Hi,
this patch checks the return value for parport_wait_peripheral
and gives warnings if something unexpected happens.
We should always make sure the peripheral works as expected
and report if not ...
Tim, please submit to the kernel if you like.
Regards, Gunther
--- linux-2399p8-orig/drivers/parport/parport_pc.c Sun May 14 10:46:15 2000
+++ linux/drivers/parport/parport_pc.c Sun May 14 11:05:01 2000
@@ -704,6 +704,7 @@
int flags)
{
size_t written;
+ int r;
/* Special case: a timeout of zero means we cannot call schedule(). */
if (!port->physport->cad->timeout)
@@ -745,9 +746,12 @@
frob_econtrol (port, 0xe0, ECR_PS2 << 5);
}
- parport_wait_peripheral (port,
+ r = parport_wait_peripheral (port,
PARPORT_STATUS_BUSY,
PARPORT_STATUS_BUSY);
+ if (r)
+ printk("%s: warning BUSY timeout (%d) in compat_write_block_pio.\n",
+ port->name, r);
port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
return written;
@@ -760,6 +764,7 @@
int flags)
{
size_t written;
+ int r;
/* Special case: a timeout of zero means we cannot call schedule(). */
if (!port->physport->cad->timeout)
@@ -772,9 +777,12 @@
parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
/* Event 40: PError goes high. */
- parport_wait_peripheral (port,
+ r = parport_wait_peripheral (port,
PARPORT_STATUS_PAPEROUT,
PARPORT_STATUS_PAPEROUT);
+ if (r)
+ printk("%s: warning PError timeout (%d) in ecp_write_block_pio\n",
+ port->name, r);
}
/* Set up ECP parallel port mode.*/
@@ -818,18 +826,28 @@
parport_pc_data_reverse (port); /* Must be in PS2 mode */
udelay (5);
parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
- parport_wait_peripheral (port, PARPORT_STATUS_PAPEROUT, 0);
+ r = parport_wait_peripheral (port, PARPORT_STATUS_PAPEROUT, 0);
+ if (r)
+ printk("%s: warning PE,1 timeout (%d)in ecp_write_block_pio\n",
+ port->name, r);
parport_frob_control (port,
PARPORT_CONTROL_INIT,
PARPORT_CONTROL_INIT);
- parport_wait_peripheral (port,
+ r = parport_wait_peripheral (port,
PARPORT_STATUS_PAPEROUT,
PARPORT_STATUS_PAPEROUT);
+ if (r)
+ printk("%s: warning PE,2 timeout (%d)in ecp_write_block_pio\n",
+ port->name, r);
+
}
- parport_wait_peripheral (port,
+ r = parport_wait_peripheral (port,
PARPORT_STATUS_BUSY,
PARPORT_STATUS_BUSY);
+ if(r)
+ printk("%s: warning BUSY timeout (%d)in ecp_write_block_pio\n",
+ port->name, r);
port->physport->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
return written;
@@ -840,6 +858,7 @@
{
size_t left = length;
size_t fifofull;
+ int r;
const int fifo = FIFO(port);
const struct parport_pc_private *priv = port->physport->private_data;
const int fifo_depth = priv->fifo_depth;
@@ -882,7 +901,11 @@
0);
/* Event 40: PError goes low */
- parport_wait_peripheral (port, PARPORT_STATUS_PAPEROUT, 0);
+ r = parport_wait_peripheral (port, PARPORT_STATUS_PAPEROUT, 0);
+ if (r)
+ printk("%s: warning PE timeout Event 40 (%d) in ecp_read_block_pio\n",
+ port->name, r);
+
}
/* Set up ECP FIFO mode.*/
@@ -961,9 +984,13 @@
/* Go to forward idle mode to shut the peripheral up. */
parport_frob_control (port, PARPORT_CONTROL_INIT, 0);
- parport_wait_peripheral (port,
+ r = parport_wait_peripheral (port,
PARPORT_STATUS_PAPEROUT,
PARPORT_STATUS_PAPEROUT);
+ if (r)
+ printk("%s: warning PE timeout fwdidle (%d)in ecp_read_block_pio\n",
+ port->name, r);
+
port->ieee1284.phase = IEEE1284_PH_FWD_IDLE;
/* Finish up. */
-- To unsubscribe, send mail to: linux-parport-request@torque.net --
-- with the single word "unsubscribe" in the body of the message. --
This archive was generated by hypermail 2b29 : Sun May 14 2000 - 09:11:43 EDT