md: Protect access to mddev->disks list using RCU
[linux-2.6] / drivers / infiniband / core / device.c
index b448e0b..5ac5ffe 100644 (file)
@@ -40,6 +40,7 @@
 #include <linux/slab.h>
 #include <linux/init.h>
 #include <linux/mutex.h>
+#include <linux/workqueue.h>
 
 #include "core_priv.h"
 
@@ -119,12 +120,12 @@ static struct ib_device *__ib_device_get_by_name(const char *name)
 
 static int alloc_name(char *name)
 {
-       long *inuse;
+       unsigned long *inuse;
        char buf[IB_DEVICE_NAME_MAX];
        struct ib_device *device;
        int i;
 
-       inuse = (long *) get_zeroed_page(GFP_KERNEL);
+       inuse = (unsigned long *) get_zeroed_page(GFP_KERNEL);
        if (!inuse)
                return -ENOMEM;
 
@@ -569,10 +570,7 @@ int ib_query_port(struct ib_device *device,
                  u8 port_num,
                  struct ib_port_attr *port_attr)
 {
-       if (device->node_type == RDMA_NODE_IB_SWITCH) {
-               if (port_num)
-                       return -EINVAL;
-       } else if (port_num < 1 || port_num > device->phys_port_cnt)
+       if (port_num < start_port(device) || port_num > end_port(device))
                return -EINVAL;
 
        return device->query_port(device, port_num, port_attr);
@@ -644,10 +642,7 @@ int ib_modify_port(struct ib_device *device,
                   u8 port_num, int port_modify_mask,
                   struct ib_port_modify *port_modify)
 {
-       if (device->node_type == RDMA_NODE_IB_SWITCH) {
-               if (port_num)
-                       return -EINVAL;
-       } else if (port_num < 1 || port_num > device->phys_port_cnt)
+       if (port_num < start_port(device) || port_num > end_port(device))
                return -EINVAL;
 
        return device->modify_port(device, port_num, port_modify_mask,
@@ -707,7 +702,7 @@ int ib_find_pkey(struct ib_device *device,
                if (ret)
                        return ret;
 
-               if (pkey == tmp_pkey) {
+               if ((pkey & 0x7fff) == (tmp_pkey & 0x7fff)) {
                        *index = i;
                        return 0;
                }