public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andreas Dilger <adilger@turbolabs.com>
To: Tim Schmielau <tim@physik3.uni-rostock.de>
Cc: Philip.Blundell@pobox.com, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] lp.c, eexpress.c jiffies cleanup
Date: Tue, 6 Nov 2001 14:15:21 -0700	[thread overview]
Message-ID: <20011106141521.R3957@lynx.no> (raw)
In-Reply-To: <Pine.LNX.4.30.0111062039440.23693-100000@gans.physik3.uni-rostock.de>
In-Reply-To: <Pine.LNX.4.30.0111062039440.23693-100000@gans.physik3.uni-rostock.de>; from tim@physik3.uni-rostock.de on Tue, Nov 06, 2001 at 09:04:51PM +0100

On Nov 06, 2001  21:04 +0100, Tim Schmielau wrote:
> In eexpress.c I also turned absolute jiffies number into multiples of HZ,
> yet the resulting timeout values still do not always seem reasonable to
> me.

I agree.  It seems very ugly.  I looked at a few drivers which loop 1 or 2
jiffies, but to busy-loop for 1/10th of a second, or even 20 seconds
is terribly bad.  I took a look at the functions scb_rdcmd() and
scb_status() and they are only reading from an I/O port, so no chance
of sleeping/blocking, just busy waiting.

> -	unsigned long int oldtime = jiffies;
> -	while (scb_rdcmd(dev) && ((jiffies-oldtime)<10));
> +	unsigned long timeout = jiffies + HZ/10;
> +	while (scb_rdcmd(dev) && (time_before(jiffies, timeout)));
>  	if (scb_rdcmd(dev)) {
>  		printk("%s: command didn't clear\n", dev->name);
>  	}
> @@ -1598,16 +1598,16 @@
>  #endif
> -                oj = jiffies;
> +                timeout = jiffies + 20*HZ;
>                  while ((SCB_CUstat(scb_status(dev)) == 2) &&
> -                       ((jiffies-oj) < 2000));
> +                       time_before(jiffies, timeout));
>  		if (SCB_CUstat(scb_status(dev)) == 2)
>  			printk("%s: warning, CU didn't stop\n", dev->name);
>                  lp->started &= ~(STARTED_CU);

Cheers, Andreas
--
Andreas Dilger
http://sourceforge.net/projects/ext2resize/
http://www-mddsp.enel.ucalgary.ca/People/adilger/


  reply	other threads:[~2001-11-06 21:16 UTC|newest]

Thread overview: 35+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <adilger@turbolabs.com>
2001-11-06 20:04 ` [PATCH] lp.c, eexpress.c jiffies cleanup Tim Schmielau
2001-11-06 21:15   ` Andreas Dilger [this message]
2001-11-06 21:37     ` Philip Blundell
2001-11-07  0:10       ` Andreas Dilger
2001-11-06 23:58         ` Tim Hockin
2001-11-21 23:32 [PATCH] Remove needless BKL from release functions David C. Hansen
2001-11-22 10:12 ` Oliver Neukum
2001-11-22 12:11   ` Christoph Hellwig
2001-11-22 12:30     ` Horst von Brand
2001-11-22 13:05       ` Christoph Hellwig
2001-11-23  9:44       ` Rick Lindsley
2001-11-23 10:10         ` Oliver.Neukum
2001-11-23 10:47           ` Christoph Hellwig
2001-11-23 11:24             ` Oliver Neukum
2001-11-26 17:46             ` David C. Hansen
2001-11-26 19:41               ` Flavio Stanchina
2001-11-26 19:53                 ` David C. Hansen
2001-11-23 12:08           ` Rick Lindsley
  -- strict thread matches above, loose matches on Subject: below --
2001-09-20 20:07 XFS to main kernel source Gonyou, Austin
2001-09-20 20:14 ` Alan Cox
2001-09-20 20:16   ` Steve Lord
2001-09-20 20:25     ` Alan Cox
2001-09-20 20:26     ` Christoph Hellwig
2001-09-20 21:31       ` Steve Lord
2001-09-21  3:12         ` Andreas Dilger
2001-09-21  3:25           ` Steve Lord
2001-09-21  4:42             ` Nathan Scott
2001-09-21  5:58         ` Christoph Hellwig
2001-09-21  8:40           ` Narancs v1
2001-09-21 14:19         ` Alexander Viro
2001-09-21 14:45           ` Steve Lord
2001-09-20 20:40     ` Alexander Viro
2001-09-21 18:03       ` Steve Lord
2001-09-20 20:29 ` Horst von Brand
2001-09-20 20:50   ` Alan Cox

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20011106141521.R3957@lynx.no \
    --to=adilger@turbolabs.com \
    --cc=Philip.Blundell@pobox.com \
    --cc=linux-kernel@vger.kernel.org \
    --cc=tim@physik3.uni-rostock.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox