summaryrefslogtreecommitdiffstats
path: root/drivers/scsi/a100u2w.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2008-03-17 13:32:02 +0100
committerJames Bottomley <James.Bottomley@HansenPartnership.com>2008-03-20 15:19:25 +0100
commit28aef2f7d9415b881c9145ab9b2c1c234064a243 (patch)
treedba23def5ed8533e337b8c147ebc9e9a6881f752 /drivers/scsi/a100u2w.c
parent[SCSI] fix media change events for polled devices (diff)
downloadlinux-28aef2f7d9415b881c9145ab9b2c1c234064a243.tar.xz
linux-28aef2f7d9415b881c9145ab9b2c1c234064a243.zip
[SCSI] a100u2w: fix bitmap lookup routine
This patch is only compile tested. It seems that bitmap lookup routine for allocation_map in a100u2w driver is simply wrong. It cannot lookup more than first 32 bits. If all first 32 bits are set, it just returns 33-th orc_scb even though the 33-th bit is not set. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Tested-by: Alan Cox <alan@redhat.com> Signed-off-by: James Bottomley <James.Bottomley@HansenPartnership.com>
Diffstat (limited to 'drivers/scsi/a100u2w.c')
-rw-r--r--drivers/scsi/a100u2w.c9
1 files changed, 5 insertions, 4 deletions
diff --git a/drivers/scsi/a100u2w.c b/drivers/scsi/a100u2w.c
index f608d4a1d6da..792b2e807bf3 100644
--- a/drivers/scsi/a100u2w.c
+++ b/drivers/scsi/a100u2w.c
@@ -674,12 +674,13 @@ static struct orc_scb *__orc_alloc_scb(struct orc_host * host)
for (index = 0; index < 32; index++) {
if ((host->allocation_map[channel][i] >> index) & 0x01) {
host->allocation_map[channel][i] &= ~(1 << index);
- break;
+ idx = index + 32 * i;
+ /*
+ * Translate the index to a structure instance
+ */
+ return host->scb_virt + idx;
}
}
- idx = index + 32 * i;
- /* Translate the index to a structure instance */
- return (struct orc_scb *) ((unsigned long) host->scb_virt + (idx * sizeof(struct orc_scb)));
}
return NULL;
}