qib: Convert qib_unit_table to XArray
Also remove qib_devs_list. Signed-off-by: Matthew Wilcox <willy@infradead.org> Reviewed-by: Dennis Dalessandro <dennis.dalessandro@intel.com> Signed-off-by: Jason Gunthorpe <jgg@mellanox.com>
This commit is contained in:

committed by
Jason Gunthorpe

parent
03b92789e5
commit
059d48fbf6
@@ -49,8 +49,6 @@
|
||||
*/
|
||||
const char ib_qib_version[] = QIB_DRIVER_VERSION "\n";
|
||||
|
||||
DEFINE_SPINLOCK(qib_devs_lock);
|
||||
LIST_HEAD(qib_dev_list);
|
||||
DEFINE_MUTEX(qib_mutex); /* general driver use */
|
||||
|
||||
unsigned qib_ibmtu;
|
||||
@@ -96,11 +94,11 @@ int qib_count_active_units(void)
|
||||
{
|
||||
struct qib_devdata *dd;
|
||||
struct qib_pportdata *ppd;
|
||||
unsigned long flags;
|
||||
unsigned long index, flags;
|
||||
int pidx, nunits_active = 0;
|
||||
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
list_for_each_entry(dd, &qib_dev_list, list) {
|
||||
xa_lock_irqsave(&qib_dev_table, flags);
|
||||
xa_for_each(&qib_dev_table, index, dd) {
|
||||
if (!(dd->flags & QIB_PRESENT) || !dd->kregbase)
|
||||
continue;
|
||||
for (pidx = 0; pidx < dd->num_pports; ++pidx) {
|
||||
@@ -112,7 +110,7 @@ int qib_count_active_units(void)
|
||||
}
|
||||
}
|
||||
}
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
xa_unlock_irqrestore(&qib_dev_table, flags);
|
||||
return nunits_active;
|
||||
}
|
||||
|
||||
@@ -125,13 +123,12 @@ int qib_count_units(int *npresentp, int *nupp)
|
||||
{
|
||||
int nunits = 0, npresent = 0, nup = 0;
|
||||
struct qib_devdata *dd;
|
||||
unsigned long flags;
|
||||
unsigned long index, flags;
|
||||
int pidx;
|
||||
struct qib_pportdata *ppd;
|
||||
|
||||
spin_lock_irqsave(&qib_devs_lock, flags);
|
||||
|
||||
list_for_each_entry(dd, &qib_dev_list, list) {
|
||||
xa_lock_irqsave(&qib_dev_table, flags);
|
||||
xa_for_each(&qib_dev_table, index, dd) {
|
||||
nunits++;
|
||||
if ((dd->flags & QIB_PRESENT) && dd->kregbase)
|
||||
npresent++;
|
||||
@@ -142,8 +139,7 @@ int qib_count_units(int *npresentp, int *nupp)
|
||||
nup++;
|
||||
}
|
||||
}
|
||||
|
||||
spin_unlock_irqrestore(&qib_devs_lock, flags);
|
||||
xa_unlock_irqrestore(&qib_dev_table, flags);
|
||||
|
||||
if (npresentp)
|
||||
*npresentp = npresent;
|
||||
|
Reference in New Issue
Block a user