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

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

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