aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/scsi/hpsa.c
diff options
context:
space:
mode:
authorAkinobu Mita <akinobu.mita@gmail.com>2012-01-20 10:15:27 -0500
committerJames Bottomley <JBottomley@Parallels.com>2012-02-19 09:08:57 -0500
commit263d9401a332ccec8945841dbc57707dcba1ec7d (patch)
treeef1ea13bcc764a574a6b405e750d60abfaed46a1 /drivers/scsi/hpsa.c
parentde13e9654e308db6bde49c779410512ad9659bc0 (diff)
[SCSI] hpsa: use find_first_zero_bit
Use find_first_zero_bit to find the first cleared bit in a memory region. This also includes the following minor changes. - Use bitmap_zero - Reduce unnecessary atomic bitops usage Signed-off-by: Akinobu Mita <akinobu.mita@gmail.com> Acked-by: Stephen M. Cameron <scameron@beardog.cce.hp.com> Signed-off-by: James Bottomley <JBottomley@Parallels.com>
Diffstat (limited to 'drivers/scsi/hpsa.c')
-rw-r--r--drivers/scsi/hpsa.c18
1 files changed, 8 insertions, 10 deletions
diff --git a/drivers/scsi/hpsa.c b/drivers/scsi/hpsa.c
index 13195072b234..5019bea323ce 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,
579 int i, found = 0; 579 int i, found = 0;
580 DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES); 580 DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES);
581 581
582 memset(&lun_taken[0], 0, HPSA_MAX_DEVICES >> 3); 582 bitmap_zero(lun_taken, HPSA_MAX_DEVICES);
583 583
584 for (i = 0; i < h->ndevices; i++) { 584 for (i = 0; i < h->ndevices; i++) {
585 if (h->dev[i]->bus == bus && h->dev[i]->target != -1) 585 if (h->dev[i]->bus == bus && h->dev[i]->target != -1)
586 set_bit(h->dev[i]->target, lun_taken); 586 __set_bit(h->dev[i]->target, lun_taken);
587 } 587 }
588 588
589 for (i = 0; i < HPSA_MAX_DEVICES; i++) { 589 i = find_first_zero_bit(lun_taken, HPSA_MAX_DEVICES);
590 if (!test_bit(i, lun_taken)) { 590 if (i < HPSA_MAX_DEVICES) {
591 /* *bus = 1; */ 591 /* *bus = 1; */
592 *target = i; 592 *target = i;
593 *lun = 0; 593 *lun = 0;
594 found = 1; 594 found = 1;
595 break;
596 }
597 } 595 }
598 return !found; 596 return !found;
599} 597}