diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c index 13195072b234b5cf64236c2737701e6f0d85047e..5019bea323ce15c34acfdbf50cd4c8a10e6d2f3d 100644 --- a/drivers/scsi/hpsa.c +++ b/drivers/scsi/hpsa.c @@ -579,21 +579,19 @@ static int hpsa_find_target_lun(struct ctlr_info *h, int i, found = 0; DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES); - memset(&lun_taken[0], 0, HPSA_MAX_DEVICES >> 3); + bitmap_zero(lun_taken, HPSA_MAX_DEVICES); for (i = 0; i < h->ndevices; i++) { if (h->dev[i]->bus == bus && h->dev[i]->target != -1) - set_bit(h->dev[i]->target, lun_taken); + __set_bit(h->dev[i]->target, lun_taken); } - for (i = 0; i < HPSA_MAX_DEVICES; i++) { - if (!test_bit(i, lun_taken)) { - /* *bus = 1; */ - *target = i; - *lun = 0; - found = 1; - break; - } + i = find_first_zero_bit(lun_taken, HPSA_MAX_DEVICES); + if (i < HPSA_MAX_DEVICES) { + /* *bus = 1; */ + *target = i; + *lun = 0; + found = 1; } return !found; }