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

On Wed, Sep 27, 2006 at 04:28:26PM -0700, David Brownell wrote:
> 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.

Me too, tbh.  But the function looks right.

static inline clock_t jiffies_to_clock_t(long x)
{
#if (TICK_NSEC % (NSEC_PER_SEC / USER_HZ)) == 0
        return x / (HZ / USER_HZ);
#else
        u64 tmp = (u64)x * TICK_NSEC;
        do_div(tmp, (NSEC_PER_SEC / USER_HZ));
        return (long)tmp;
#endif
}


      reply	other threads:[~2006-09-28  2:40 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
2006-09-28  2:40     ` Matthew Wilcox [this message]

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