Re: [PATCH] aacraid 2.5

Mark Haverkamp (markh@osdl.org)
09 Dec 2002 10:55:29 -0800


On Fri, 2002-12-06 at 16:30, Christoph Hellwig wrote:
> On Fri, Dec 06, 2002 at 07:45:42AM -0800, Mark Haverkamp wrote:
> > +/**
> > + * Convert capacity to cylinders
> > + * accounting for the fact capacity could be a 64 bit value
> > + *
> > + */
> > +static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
> > +{
> > +#ifdef CONFIG_LBD
> > + do_div(capacity, divisor);
> > +#else
> > + capacity /= divisor;
> > +#endif
> > + return (u32) capacity;
> > +}
>
> Please use sector_div() instead. It exists for a reason.

Thanks for finding this. I have enclosed a change using your
suggestion.

Mark.

===== drivers/scsi/aacraid/aacraid.h 1.3 vs edited =====
--- 1.3/drivers/scsi/aacraid/aacraid.h Fri Dec 6 00:30:25 2002
+++ edited/drivers/scsi/aacraid/aacraid.h Mon Dec 9 08:57:06 2002
@@ -1369,21 +1369,6 @@
return (struct hw_fib *)addr;
}

-/**
- * Convert capacity to cylinders
- * accounting for the fact capacity could be a 64 bit value
- *
- */
-static inline u32 cap_to_cyls(sector_t capacity, u32 divisor)
-{
-#ifdef CONFIG_LBD
- do_div(capacity, divisor);
-#else
- capacity /= divisor;
-#endif
- return (u32) capacity;
-}
-
const char *aac_driverinfo(struct Scsi_Host *);
struct fib *fib_alloc(struct aac_dev *dev);
int fib_setup(struct aac_dev *dev);
===== drivers/scsi/aacraid/linit.c 1.7 vs edited =====
--- 1.7/drivers/scsi/aacraid/linit.c Fri Dec 6 00:26:58 2002
+++ edited/drivers/scsi/aacraid/linit.c Mon Dec 9 08:56:43 2002
@@ -443,7 +443,7 @@
param->sectors = 32;
}

- param->cylinders = cap_to_cyls(capacity,
+ param->cylinders = sector_div(capacity,
(param->heads * param->sectors));

/*
@@ -498,7 +498,7 @@
end_sec = first->end_sector & 0x3f;
}

- param->cylinders = cap_to_cyls(capacity,
+ param->cylinders = sector_div(capacity,
(param->heads * param->sectors));

if(num < 4 && end_sec == param->sectors)

-- 
Mark Haverkamp <markh@osdl.org>

- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/