Re: lp [2.1.65] and [2.1.63 VGER] parport_sharing patches

Andrea Arcangeli (arcangeli@mbox.queen.it)
Fri, 21 Nov 1997 20:33:04 +0100 (CET)


On Thu, 20 Nov 1997, Andrea Arcangeli wrote:

>I made two patches, one against 2.1.65 and one against lp 2.1.63 VGER.

I forget a lp_schedule() :)...

I changed the need_resched condition because ppa is tq_timer interrupt
drives, so happen a _lot_ of times that need_resched is 0 and
LP_SHOULD_RELINQUISH 1. This improve parport sharing.

The patch is against the last one (2.1.65 not VGER).

Andreas Arcangeli

--- linux/drivers/char/lp.c Thu Nov 20 21:25:31 1997
+++ /home/andrea/devel/linux/drivers/char/lp.c Fri Nov 21 20:29:47 1997
@@ -52,6 +52,7 @@

#undef LP_DEBUG
#undef LP_READ_DEBUG
+#undef LP_PARPORT_DEBUG

/* Magic numbers */
#define AUTO -3
@@ -114,7 +115,7 @@
do {
status = r_str(minor);
count++;
- if (need_resched)
+ if (need_resched || LP_F(minor) & LP_SHOULD_RELINQUISH)
lp_schedule(minor);
} while (!LP_READY(minor, status) && count < LP_CHAR(minor));

@@ -231,10 +232,20 @@
#endif
current->state = TASK_INTERRUPTIBLE;
current->timeout = jiffies + LP_TIME(minor);
+#ifdef LP_DEBUG_PARPORT
+ printk("lp: polling sleep\n");
+#endif
+ lp_schedule(minor);
} else { /* interrupt */
+#ifdef LP_DEBUG_PARPORT
+ printk("lp: interrupt way\n");
+#endif
cli();
if (LP_F(minor) & LP_SHOULD_RELINQUISH) {
sti();
+#ifdef LP_DEBUG_PARPORT
+ printk("lp: revert to polling\n");
+#endif
goto lp_polling;
}

@@ -248,6 +259,9 @@
continue;
}
current->timeout = jiffies + LP_TIMEOUT_INTERRUPT;
+#ifdef LP_DEBUG_PARPORT
+ printk("lp: wait for interrupt\n");
+#endif
interruptible_sleep_on(&lp->lp_wait_q);
w_ctr(minor, LP_PSELECP | LP_PINITP);
sti();