All of lore.kernel.org
 help / color / mirror / Atom feed
From: Christoph Hellwig <hch@lst.de>
To: James Bottomley <James.Bottomley@steeleye.com>
Cc: Christoph Hellwig <hch@lst.de>, linux-scsi@vger.kernel.org
Subject: Re: [PATCH] sanitize ->bios_param prototype
Date: Fri, 25 Oct 2002 19:53:28 +0200	[thread overview]
Message-ID: <20021025195328.A3124@lst.de> (raw)
In-Reply-To: <200210251718.g9PHIpP03406@localhost.localdomain>; from James.Bottomley@steeleye.com on Fri, Oct 25, 2002 at 12:18:51PM -0500

On Fri, Oct 25, 2002 at 12:18:51PM -0500, James Bottomley wrote:
> hch@lst.de said:
> > (aka Scsi_Disk or Disk) to each and every lowlevel driver, although
> > this structure should be privated to the sd driver.
> 
> > All bios_param implementation do only use two fields:  .device and
> > .capacity.  This patch passes down those two directly and gets rid of
> > 99% of the sd.h inclusions (*).
> 
> > I've tried to not break any driver with this patch, but given the
> > number of compiler errors in the current tree I might have missed one
> > or two. 
> 
> I'm getting:
> 
> Loading scsi_mod module
> /lib/scsi_mod.o: unresolved symbol __udivdi3
> 
> The problem seems to be the definition of sector_t for the division.  If I 
> make this fix:

Ooops - I tested without CONFIG_LBD defined where it's 32bit so I
couldn't trap this bug.  I think the right fix would be
to use sector_div (warning, hand-edit patch):

--- 1.10/drivers/scsi/scsicam.c Thu Oct 24 19:29:22 2002
+++ edited/drivers/scsi/scsicam.c       Fri Oct 25 12:10:40 2002
@@ -80,11 +80,12 @@
        if (ret || ip[0] > 255 || ip[1] > 63) {
                ip[0] = 64;
                ip[1] = 32;
-               if ((capacity / (ip[0] * ip[1])) > 65534) {
+               if (((unsigned long)capacity / (ip[0] * ip[1])) > 65534) {
                        ip[0] = 255;
                        ip[1] = 63;
                }
-               ip[2] = capacity / (ip[0] * ip[1]);
+         	sector_div(capacity, (ip[0] * ip[1]));      
+		ip[2] = capacity;
        }
 
        return 0;


  reply	other threads:[~2002-10-25 17:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <20021025041735.A28857@lst.de>
2002-10-25 17:18 ` [PATCH] sanitize ->bios_param prototype James Bottomley
2002-10-25 17:53   ` Christoph Hellwig [this message]
2002-10-25 22:50   ` Andries Brouwer

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=20021025195328.A3124@lst.de \
    --to=hch@lst.de \
    --cc=James.Bottomley@steeleye.com \
    --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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.