patch-2.1.126 linux/drivers/scsi/ppa.c

Next file: linux/drivers/scsi/scsi.c
Previous file: linux/drivers/scsi/imm.c
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.1.125/linux/drivers/scsi/ppa.c linux/drivers/scsi/ppa.c
@@ -133,14 +133,29 @@
 
 	ppa_hosts[i].dev =
 	    parport_register_device(pb, "ppa", NULL, ppa_wakeup,
-			 NULL, PARPORT_DEV_TRAN, (void *) &ppa_hosts[i]);
+			 NULL, 0, (void *) &ppa_hosts[i]);
+
+	if (!ppa_hosts[i].dev)
+		continue;
 
 	/* Claim the bus so it remembers what we do to the control
 	 * registers. [ CTR and ECP ]
 	 */
 	if (ppa_pb_claim(i))
+	{
+	    unsigned long now = jiffies;
 	    while (ppa_hosts[i].p_busy)
+	    {
 		schedule();	/* We are safe to schedule here */
+		if (jiffies > now + 3*HZ)
+		{
+		    printk(KERN_ERR "ppa%d: failed to claim parport because a "
+			   "pardevice is owning the port for too longtime!\n",
+			   i);
+		    return 0;
+		}
+	    }
+	}
 
 	ppb = PPA_BASE(i) = ppa_hosts[i].dev->port->base;
 	w_ctr(ppb, 0x0c);

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov