IB/qib: Convert old cpumask api into new one
authorMotohiro KOSAKI <kosaki.motohiro@jp.fujitsu.com>
Thu, 19 May 2011 01:07:05 +0000 (01:07 +0000)
committerRoland Dreier <roland@purestorage.com>
Mon, 18 Jul 2011 18:56:03 +0000 (11:56 -0700)
Adapt to use new APIs.  We plan to remove old one later and plan to
change current->cpus_allowed implementation.

No functional change.

Signed-off-by: KOSAKI Motohiro <kosaki.motohiro@jp.fujitsu.com>
Acked-by: Mike Marciniszyn <mike.marciniszyn@qlogic.com>
Signed-off-by: Roland Dreier <roland@purestorage.com>
drivers/infiniband/hw/qib/qib_file_ops.c

index 406fca50d036f0f261fed384b9a207a5d8428cc6..a94a46001745894943f4b43a1d0c7f2ee94e8859 100644 (file)
@@ -1527,6 +1527,7 @@ done_chk_sdma:
                struct qib_filedata *fd = fp->private_data;
                const struct qib_ctxtdata *rcd = fd->rcd;
                const struct qib_devdata *dd = rcd->dd;
+               unsigned int weight;
 
                if (dd->flags & QIB_HAS_SEND_DMA) {
                        fd->pq = qib_user_sdma_queue_create(&dd->pcidev->dev,
@@ -1545,8 +1546,8 @@ done_chk_sdma:
                 * it just means that sooner or later we don't recommend
                 * a cpu, and let the scheduler do it's best.
                 */
-               if (!ret && cpus_weight(current->cpus_allowed) >=
-                   qib_cpulist_count) {
+               weight = cpumask_weight(tsk_cpus_allowed(current));
+               if (!ret && weight >= qib_cpulist_count) {
                        int cpu;
                        cpu = find_first_zero_bit(qib_cpulist,
                                                  qib_cpulist_count);
@@ -1554,13 +1555,13 @@ done_chk_sdma:
                                __set_bit(cpu, qib_cpulist);
                                fd->rec_cpu_num = cpu;
                        }
-               } else if (cpus_weight(current->cpus_allowed) == 1 &&
-                       test_bit(first_cpu(current->cpus_allowed),
+               } else if (weight == 1 &&
+                       test_bit(cpumask_first(tsk_cpus_allowed(current)),
                                 qib_cpulist))
                        qib_devinfo(dd->pcidev, "%s PID %u affinity "
                                    "set to cpu %d; already allocated\n",
                                    current->comm, current->pid,
-                                   first_cpu(current->cpus_allowed));
+                                   cpumask_first(tsk_cpus_allowed(current)));
        }
 
        mutex_unlock(&qib_mutex);