hpsa.c (bd9244f7b9508a5945dcbd015db334110a9cdecf) | hpsa.c (263d9401a332ccec8945841dbc57707dcba1ec7d) |
---|---|
1/* 2 * Disk Array driver for HP Smart Array SAS controllers 3 * Copyright 2000, 2009 Hewlett-Packard Development Company, L.P. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * --- 565 unchanged lines hidden (view full) --- 574 unsigned char scsi3addr[], int bus, int *target, int *lun) 575{ 576 /* finds an unused bus, target, lun for a new physical device 577 * assumes h->devlock is held 578 */ 579 int i, found = 0; 580 DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES); 581 | 1/* 2 * Disk Array driver for HP Smart Array SAS controllers 3 * Copyright 2000, 2009 Hewlett-Packard Development Company, L.P. 4 * 5 * This program is free software; you can redistribute it and/or modify 6 * it under the terms of the GNU General Public License as published by 7 * the Free Software Foundation; version 2 of the License. 8 * --- 565 unchanged lines hidden (view full) --- 574 unsigned char scsi3addr[], int bus, int *target, int *lun) 575{ 576 /* finds an unused bus, target, lun for a new physical device 577 * assumes h->devlock is held 578 */ 579 int i, found = 0; 580 DECLARE_BITMAP(lun_taken, HPSA_MAX_DEVICES); 581 |
582 memset(&lun_taken[0], 0, HPSA_MAX_DEVICES >> 3); | 582 bitmap_zero(lun_taken, HPSA_MAX_DEVICES); |
583 584 for (i = 0; i < h->ndevices; i++) { 585 if (h->dev[i]->bus == bus && h->dev[i]->target != -1) | 583 584 for (i = 0; i < h->ndevices; i++) { 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 } 588 | 587 } 588 |
589 for (i = 0; i < HPSA_MAX_DEVICES; i++) { 590 if (!test_bit(i, lun_taken)) { 591 /* *bus = 1; */ 592 *target = i; 593 *lun = 0; 594 found = 1; 595 break; 596 } | 589 i = find_first_zero_bit(lun_taken, HPSA_MAX_DEVICES); 590 if (i < HPSA_MAX_DEVICES) { 591 /* *bus = 1; */ 592 *target = i; 593 *lun = 0; 594 found = 1; |
597 } 598 return !found; 599} 600 601/* Add an entry into h->dev[] array. */ 602static int hpsa_scsi_add_entry(struct ctlr_info *h, int hostno, 603 struct hpsa_scsi_dev_t *device, 604 struct hpsa_scsi_dev_t *added[], int *nadded) --- 4102 unchanged lines hidden --- | 595 } 596 return !found; 597} 598 599/* Add an entry into h->dev[] array. */ 600static int hpsa_scsi_add_entry(struct ctlr_info *h, int hostno, 601 struct hpsa_scsi_dev_t *device, 602 struct hpsa_scsi_dev_t *added[], int *nadded) --- 4102 unchanged lines hidden --- |