Re: [PARPORT] Fast polling


Andrea Arcangeli (andrea@e-mind.com)
Thu, 17 Dec 1998 23:30:51 +0100 (CET)


On Thu, 17 Dec 1998, Andrea Arcangeli wrote:

>Ah right ;) I' ll remove it now... Tim do you want to fix the parport
>sharing playing with the preempt of the pardevice as I done with
>lp_error()? Philip? Hints?

Index: linux/drivers/misc/parport_ieee1284_ops.c
diff -u linux/drivers/misc/parport_ieee1284_ops.c:1.1.4.2 linux/drivers/misc/parport_ieee1284_ops.c:1.1.2.13
--- linux/drivers/misc/parport_ieee1284_ops.c:1.1.4.2 Thu Dec 17 19:06:59 1998
+++ linux/drivers/misc/parport_ieee1284_ops.c Thu Dec 17 23:28:40 1998
@@ -73,12 +73,6 @@
  * Host-to-peripheral data transfer functions *
  * ***/
 
-static inline
-int polling (struct pardevice *dev)
-{
- return !(dev->flags & PARPORT_DEV_IEEE1284IRQ);
-}
-
 /* Compatibility mode. */
 int parport_ieee1284_write_compat (struct parport *port,
                                    const void *buffer, size_t len,
@@ -89,13 +83,11 @@
         ssize_t count = 0;
         const unsigned char *byte = buffer;
         struct pardevice *dev = port->cad;
- struct timer_list timer;
         typedef void (*tm_func) (unsigned long);
         unsigned char ctl = (PARPORT_CONTROL_SELECT
                              | PARPORT_CONTROL_INIT
                              | PARPORT_CONTROL_INTEN);
 
- init_timer (&timer);
         port->ieee1284.phase = IEEE1284_PH_FWD_DATA;
         while (count < len) {
                 long expire = jiffies + port->ieee1284.timeout;
@@ -128,19 +120,15 @@
                                 PARPORT_STATUS_ERROR))
                                 goto stop;
 
- /* Yield the port for a while. */
- if (count && polling (dev))
- parport_release (dev);
- timer.expires = jiffies + wait;
- timer.data = (unsigned long) port;
- timer.function = (tm_func) parport_ieee1284_wakeup;
- add_timer (&timer);
- down_interruptible (&port->ieee1284.sem);
- del_timer (&timer);
- if (count && polling (dev))
- parport_claim_or_block (dev);
+ /*
+ * Yield the port for a while to allow other pardevice
+ * to use the port in the meantime.
+ */
+ parport_release (dev);
+ schedule_timeout(wait);
+ parport_claim_or_block (dev);
 
- /* Is there a signal pending? */
+ /* We unblocked due a signal? */
                         if (signal_pending (current))
                                 goto stop;
 

Andrea Arcangeli

-- 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 2.0b3 on Wed 30 Dec 1998 - 10:18:58 EST