[PARPORT] lp patch to handle right interrutps


Andrea Arcangeli (arcangeli@mbox.queen.it)
Wed, 1 Apr 1998 15:38:33 +0200 (CEST)


I was searching for a possible bug in lp.c (after I read the patch to
BUGS-parport) when I discovered another bug!! added by me when I joined
lp_char_interrupt() and lp_char_polled(). It' s not really a bug and
should not be the cause of the reported missing character, it' s only a
stupid handling of interrupts (practically there was no difference between
interrupt and polling printing except when the printer was offline).

You can see the CPU load difference during an interrupt printing, after
applying the patch.

It' s against the _right_ patch-2.1.91pre2-parport980327.

Andrea[s] Arcangeli

--- drivers/char/lp.c 1998/04/01 13:25:12 1.1
+++ drivers/char/lp.c 1998/04/01 13:24:05
@@ -169,14 +169,23 @@
         unsigned long count = 0;
         struct lp_stats *stats;
 
- do {
+ for (;;) {
+ lp_yield(minor);
                 status = r_str (minor);
                 count++;
- lp_yield(minor);
- } while (!LP_READY(minor, status) && count < LP_CHAR(minor));
-
- if (count == LP_CHAR(minor))
- return 0;
+ if (count == LP_CHAR(minor))
+ return 0;
+ if (LP_POLLING(minor))
+ {
+ if (LP_READY(minor, status))
+ break;
+ } else {
+ if (!LP_READY(minor, status))
+ return 0;
+ else
+ break;
+ }
+ }
 
         w_dtr(minor, lpchar);
         stats = &LP_STAT(minor);

-- 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:17:34 EST