This patch applies to the bitkeeper 2.5 view.
It contains three changes. The first removes some #defines that don't seem
to be needed anymore. The second fixes a problem when CONFIG_LBD is set
and sector_t is u64. The third fixes some compile warnings setting a
char * in the scsi_pointer struct to a dma_addr_t. I changed the usage
from the ptr element to the dma_handle element.
It compiles without warnings and I have run some tests on aacraid devices
on the osdl lab machines with the CONFIG_LBD option on and off.
Mark.
- - - -
aachba.c | 17 ++++++-----------
aacraid.h | 16 ++++++++++++++++
linit.c | 6 ++++--
3 files changed, 26 insertions(+), 13 deletions(-)
===== drivers/scsi/aacraid/aachba.c 1.5 vs edited =====
--- 1.5/drivers/scsi/aacraid/aachba.c Mon Nov 11 12:32:15 2002
+++ edited/drivers/scsi/aacraid/aachba.c Tue Dec 3 08:33:06 2002
@@ -33,18 +33,12 @@
#include <linux/completion.h>
#include <asm/semaphore.h>
#include <asm/uaccess.h>
-#define MAJOR_NR SCSI_DISK0_MAJOR /* For DEVICE_NR() */
#include <linux/blk.h>
#include "scsi.h"
#include "hosts.h"
#include "aacraid.h"
-#warning this is broken
-#define N_SD_MAJORS 8
-#define SD_MAJOR_MASK (N_SD_MAJORS - 1)
-#define DEVICE_NR(device) (((major(device) & SD_MAJOR_MASK) << (8 - 4)) +
(minor(device) >> 4))
-
/* SCSI Commands */
/* TODO: dmb - use the ones defined in include/scsi/scsi.h */
@@ -567,7 +561,7 @@
scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
else if(scsicmd->request_bufflen)
- pci_unmap_single(dev->pdev, (dma_addr_t)(unsigned long)scsicmd->SCp.ptr,
+ pci_unmap_single(dev->pdev, scsicmd->SCp.dma_handle,
scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
readreply = (struct aac_read_reply *)fib_data(fibptr);
@@ -611,7 +605,7 @@
scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
else if(scsicmd->request_bufflen)
- pci_unmap_single(dev->pdev, (dma_addr_t)(unsigned long)scsicmd->SCp.ptr,
+ pci_unmap_single(dev->pdev, scsicmd->SCp.dma_handle,
scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
@@ -1225,7 +1219,8 @@
scsicmd->use_sg,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
else if(scsicmd->request_bufflen)
- pci_unmap_single(dev->pdev, (ulong)scsicmd->SCp.ptr, scsicmd->request_bufflen,
+ pci_unmap_single(dev->pdev, scsicmd->SCp.dma_handle,
+ scsicmd->request_bufflen,
scsi_to_pci_dma_dir(scsicmd->sc_data_direction));
/*
@@ -1516,7 +1511,7 @@
psg->count = cpu_to_le32(1);
psg->sg[0].addr = cpu_to_le32(addr);
psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
- scsicmd->SCp.ptr = (void *)addr;
+ scsicmd->SCp.dma_handle = addr;
byte_count = scsicmd->request_bufflen;
}
return byte_count;
@@ -1577,7 +1572,7 @@
psg->sg[0].addr[1] = (u32)(le_addr>>32);
psg->sg[0].addr[0] = (u32)(le_addr & 0xffffffff);
psg->sg[0].count = cpu_to_le32(scsicmd->request_bufflen);
- scsicmd->SCp.ptr = (void *)addr;
+ scsicmd->SCp.dma_handle = addr;
byte_count = scsicmd->request_bufflen;
}
return byte_count;
===== drivers/scsi/aacraid/aacraid.h 1.2 vs edited =====
--- 1.2/drivers/scsi/aacraid/aacraid.h Fri Nov 1 04:28:15 2002
+++ edited/drivers/scsi/aacraid/aacraid.h Tue Dec 3 08:15:27 2002
@@ -1369,6 +1369,22 @@
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.6 vs edited =====
--- 1.6/drivers/scsi/aacraid/linit.c Thu Nov 21 21:34:44 2002
+++ edited/drivers/scsi/aacraid/linit.c Tue Dec 3 13:22:08 2002
@@ -443,7 +443,8 @@
param->sectors = 32;
}
- param->cylinders = capacity/(param->heads * param->sectors);
+ param->cylinders = cap_to_cyls(capacity,
+ (param->heads * param->sectors));
/*
* Read the partition table block
@@ -497,7 +498,8 @@
end_sec = first->end_sector & 0x3f;
}
- param->cylinders = capacity / (param->heads * param->sectors);
+ param->cylinders = cap_to_cyls(capacity,
+ (param->heads * param->sectors));
if(num < 4 && end_sec == param->sectors)
{
--
Mark Haverkamp <[email protected]>
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.
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 <[email protected]>
>>>>> "Mark" == Mark Haverkamp <[email protected]> writes:
Mark> 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.
Mark> Thanks for finding this. I have enclosed a change using your
Mark> suggestion.
sector_div(a, b) is just like do_div(a, b) -- it returns the
remainder, and sets a to a/b which is not reflected in your patch...
--
Dr Peter Chubb [email protected]
You are lost in a maze of BitKeeper repositories, all almost the same.
On Mon, 2002-12-09 at 14:02, Peter Chubb wrote:
> >>>>> "Mark" == Mark Haverkamp <[email protected]> writes:
>
> Mark> 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.
>
>
> Mark> Thanks for finding this. I have enclosed a change using your
> Mark> suggestion.
>
>
> sector_div(a, b) is just like do_div(a, b) -- it returns the
> remainder, and sets a to a/b which is not reflected in your patch...
>
oops, I didn't look closely enough at the sector_div code.
--
Mark Haverkamp <[email protected]>