Busy loop in lp.c

Brad Pepers (pepersb@cuug.ab.ca)
Sat, 17 May 1997 14:02:22 -0600 (MDT)


Here is a patch to remove the busy loop in lp.c and replace it with
a small udelay() call. I left in the ioctl for setting the wait time
but it is now a nop.

BTW: this fixes problems I had with a printer that needed the delay
(the specs require it anyways!) and I had to guess the wait count
which was of course different from my 486/33 to my Pentium Pro 200!

This is against 2.1.38:

--- lp.c.orig Mon May 12 11:35:40 1997
+++ lp.c Sat May 17 13:51:47 1997
@@ -93,12 +93,10 @@
stats->chars++;
/* must wait before taking strobe high, and after taking strobe
low, according spec. Some printers need it, others don't. */
- while (wait != LP_WAIT(minor))
- wait++;
+ udelay(2);
/* control port takes strobe high */
w_ctr(minor, LP_PSELECP | LP_PINITP | LP_PSTROBE);
- while (wait)
- wait--;
+ udelay(2);
/* take strobe low */
w_ctr(minor, LP_PSELECP | LP_PINITP);
/* update waittime statistics */
@@ -135,13 +133,10 @@
stats->chars++;
/* must wait before taking strobe high, and after taking
strobe
low, according spec. Some printers need it, others d
on't. */
- wait = 0;
- while (wait != LP_WAIT(minor))
- wait++;
+ udelay(2);
/* control port takes strobe high */
w_ctr(minor, LP_PSELECP | LP_PINITP | LP_PSTROBE);
- while (wait)
- wait--;
+ udelay(2);
/* take strobe low */
w_ctr(minor, LP_PSELECP | LP_PINITP);
/* update waittime statistics */

-- 
Brad Pepers                             Proud supporter of Linux and
Ramparts Management Group Ltd.          Caldera in Canada!
ramparts@agt.net
http://www.agt.net/public/ramparts      Linux rules!