[PARPORT] Re: More parport troubles


Andrea Arcangeli (arcangeli@mbox.queen.it)
Mon, 13 Apr 1998 19:56:30 +0200 (CEST)


On Mon, 13 Apr 1998, Andrea Arcangeli wrote:

>printing works fine (as in 2.0.3x) and if your printer don' t work using
>interrupt it should be buggy. Can you print using interrupt in other

This seems a bug in the lp interrupt printing since you are not the only
one is reporting this stall.

I can' t reproduce your problems on my hardware.

Could you try this patch (also you Philip)? It' s against plain 2.1.95.
My hardware don' t report problems.

Andrea[s] Arcangeli

--- linux/drivers/char/lp.c.orig Mon Apr 13 19:45:05 1998
+++ linux/drivers/char/lp.c Mon Apr 13 19:49:47 1998
@@ -90,7 +90,7 @@
 struct lp_struct lp_table[LP_NO] =
 {
         [0 ... LP_NO-1] = {NULL, 0, LP_INIT_CHAR, LP_INIT_TIME, LP_INIT_WAIT,
- NULL, 0, 0, 0, {0}}
+ NULL, 0, 0, 0, {0}, ATOMIC_INIT(0) }
 };
 
 /* Test if printer is ready (and optionally has no error conditions) */
@@ -160,25 +160,28 @@
 
 static inline int lp_char(char lpchar, int minor)
 {
- int status;
         unsigned int wait = 0;
         unsigned long count = 0;
         struct lp_stats *stats;
 
         for (;;) {
                 lp_yield(minor);
- status = r_str (minor);
                 if (++count == LP_CHAR(minor))
                         return 0;
                 if (LP_POLLING(minor))
                 {
- if (LP_READY(minor, status))
+ if (LP_READY(minor, r_str(minor)))
                                 break;
                 } else {
- if (!LP_READY(minor, status))
+ cli();
+ if (!LP_READY(minor, r_str(minor)))
+ {
+ atomic_set(&lp_table[minor].int_count, 0);
+ sti();
                                 return 0;
- else
- break;
+ }
+ sti();
+ break;
                 }
         }
 
@@ -225,6 +228,7 @@
 
         if (waitqueue_active (&lp_dev->dev->wait_q))
                 wake_up_interruptible(&lp_dev->dev->wait_q);
+ atomic_inc(&lp_dev->int_count);
 }
 
 static void lp_error(int minor)
@@ -302,6 +306,11 @@
                                         lp_schedule (minor);
                                 } else {
                                         cli();
+ if (atomic_read(&lp_table[minor].int_count) > 0)
+ {
+ printk("probably the lp irq problem is fixed now\n");
+ goto after_irq;
+ }
                                         if (LP_PREEMPTED(minor)) {
                                                 sti();
                                                 goto lp_polling;
@@ -319,6 +328,7 @@
                                         interruptible_sleep_on(&lp->dev->wait_q);
                                         disable_irq(lp->dev->port->irq);
                                         w_ctr(minor, LP_PSELECP | LP_PINITP);
+ after_irq:
                                         sti();
                                         if (lp_check_status(minor))
                                                 return rc ? rc : -EIO;
--- linux/include/linux/lp.h.orig Mon Apr 13 19:45:21 1998
+++ linux/include/linux/lp.h Mon Apr 13 19:49:54 1998
@@ -115,6 +115,7 @@
         unsigned int runchars;
         unsigned int waittime;
         struct lp_stats stats;
+ atomic_t int_count;
 };
 
 /*

-- 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:37 EST