@@ -4697,8 +4697,7 @@ static struct CommandList *cmd_alloc(struct ctlr_info *h)
offset = (i + 1) % h->nr_cmds;
continue;
}
- set_bit(i & (BITS_PER_LONG - 1),
- h->cmd_pool_bits + (i / BITS_PER_LONG));
+ set_bit(i, h->cmd_pool_bits);
break; /* it's ours now. */
}
h->last_allocation = i; /* benignly racy */
@@ -4729,8 +4728,7 @@ static void cmd_free(struct ctlr_info *h, struct CommandList *c)
int i;
i = c - h->cmd_pool;
- clear_bit(i & (BITS_PER_LONG - 1),
- h->cmd_pool_bits + (i / BITS_PER_LONG));
+ clear_bit(i, h->cmd_pool_bits);
}
}
@@ -6410,8 +6408,7 @@ out_disable:
static int hpsa_allocate_cmd_pool(struct ctlr_info *h)
{
- h->cmd_pool_bits = kzalloc(
- DIV_ROUND_UP(h->nr_cmds, BITS_PER_LONG) *
+ h->cmd_pool_bits = kcalloc(BITS_TO_LONGS(h->nr_cmds),
sizeof(unsigned long), GFP_KERNEL);
h->cmd_pool = pci_alloc_consistent(h->pdev,
h->nr_cmds * sizeof(*h->cmd_pool),
Remove unnecessary adjustment for bit number and address of bitmask, and use BITS_TO_LONGS macro to calculate bitmap size. This change just simplifies the code a bit. Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Cc: Don Brace <don.brace@pmcs.com> Cc: iss_storagedev@hp.com Cc: storagedev@pmcs.com Cc: "James E.J. Bottomley" <JBottomley@parallels.com> Cc: linux-scsi@vger.kernel.org --- drivers/scsi/hpsa.c | 9 +++------ 1 file changed, 3 insertions(+), 6 deletions(-)