public inbox for linux-scsi@vger.kernel.org
 help / color / mirror / Atom feed
From: David Brownell <david-b@pacbell.net>
To: Matthew Wilcox <matthew@wil.cx>
Cc: linux-scsi@vger.kernel.org
Subject: Re: fix compile-time divide-by-zero in scsi_ioctl
Date: Wed, 27 Sep 2006 16:28:26 -0700	[thread overview]
Message-ID: <200609271628.27120.david-b@pacbell.net> (raw)
In-Reply-To: <20060927202710.GV5017@parisc-linux.org>

On Wednesday 27 September 2006 1:27 pm, Matthew Wilcox wrote:
> On Tue, Sep 26, 2006 at 08:48:48AM -0700, David Brownell wrote:
> > This fixes a compiler-reported divide-by-zero when HZ < 100.
> 
> Shouldn't we instead be using jiffies_to_clock_t?  Thus:

Could be ... the units in that function unclear to me though.

What I care about is not needing to carry a patch around in my tree ...
I got no response when I posted a fix to LKML several months back,
your suggestion could well be better!

FWIW HZ=64 can be convenient for various embedded platforms with
32768/sec system clocks; HZ=100 can be impractical.

- Dave



> Index: at91/block/scsi_ioctl.c
> ===================================================================
> --- at91.orig/block/scsi_ioctl.c	2006-07-30 01:17:34.000000000 -0700
> +++ at91/block/scsi_ioctl.c	2006-07-30 01:44:17.000000000 -0700
> @@ -63,7 +63,7 @@ static int scsi_get_bus(request_queue_t 
>  
>  static int sg_get_timeout(request_queue_t *q)
>  {
> -	return q->sg_timeout / (HZ / USER_HZ);
> +	return jiffies_to_clock_t(q->sg_timeout);
>  }
>  
>  static int sg_set_timeout(request_queue_t *q, int __user *p)
> 

  reply	other threads:[~2006-09-27 23:28 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2006-09-26 15:48 fix compile-time divide-by-zero in scsi_ioctl David Brownell
2006-09-27 20:27 ` Matthew Wilcox
2006-09-27 23:28   ` David Brownell [this message]
2006-09-28  2:40     ` Matthew Wilcox

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=200609271628.27120.david-b@pacbell.net \
    --to=david-b@pacbell.net \
    --cc=linux-scsi@vger.kernel.org \
    --cc=matthew@wil.cx \
    /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