diff options
author | Alexander Chiang <achiang@hp.com> | 2010-02-02 14:08:40 -0500 |
---|---|---|
committer | Roland Dreier <rolandd@cisco.com> | 2010-02-24 13:23:45 -0500 |
commit | dc2ed5e3c963490a4fe934b482537d1274961ecb (patch) | |
tree | 7dd120ca45df9cd64c2ee666f5bda5538f573feb /drivers/infiniband | |
parent | d451b8df9f7e572ea77f976745f424dd1dae8aeb (diff) |
IB/umad: Use stack variable 'base' in ib_umad_init_port
This change is not useful by itself, but sets us up for a future change
that allows us to support more than IB_UMAD_MAX_PORTS in a system.
Signed-off-by: Alex Chiang <achiang@hp.com>
Signed-off-by: Roland Dreier <rolandd@cisco.com>
Diffstat (limited to 'drivers/infiniband')
-rw-r--r-- | drivers/infiniband/core/user_mad.c | 7 |
1 files changed, 5 insertions, 2 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index df403ec49d94..5a66bd062389 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
@@ -975,6 +975,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
975 | struct ib_umad_port *port) | 975 | struct ib_umad_port *port) |
976 | { | 976 | { |
977 | int devnum; | 977 | int devnum; |
978 | dev_t base; | ||
978 | 979 | ||
979 | spin_lock(&port_lock); | 980 | spin_lock(&port_lock); |
980 | devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS); | 981 | devnum = find_first_zero_bit(dev_map, IB_UMAD_MAX_PORTS); |
@@ -983,6 +984,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
983 | return -1; | 984 | return -1; |
984 | } | 985 | } |
985 | port->dev_num = devnum; | 986 | port->dev_num = devnum; |
987 | base = devnum + base_dev; | ||
986 | set_bit(devnum, dev_map); | 988 | set_bit(devnum, dev_map); |
987 | spin_unlock(&port_lock); | 989 | spin_unlock(&port_lock); |
988 | 990 | ||
@@ -995,7 +997,7 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
995 | cdev_init(&port->cdev, &umad_fops); | 997 | cdev_init(&port->cdev, &umad_fops); |
996 | port->cdev.owner = THIS_MODULE; | 998 | port->cdev.owner = THIS_MODULE; |
997 | kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num); | 999 | kobject_set_name(&port->cdev.kobj, "umad%d", port->dev_num); |
998 | if (cdev_add(&port->cdev, base_dev + devnum, 1)) | 1000 | if (cdev_add(&port->cdev, base, 1)) |
999 | goto err_cdev; | 1001 | goto err_cdev; |
1000 | 1002 | ||
1001 | port->dev = device_create(umad_class, device->dma_device, | 1003 | port->dev = device_create(umad_class, device->dma_device, |
@@ -1009,10 +1011,11 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
1009 | if (device_create_file(port->dev, &dev_attr_port)) | 1011 | if (device_create_file(port->dev, &dev_attr_port)) |
1010 | goto err_dev; | 1012 | goto err_dev; |
1011 | 1013 | ||
1014 | base += IB_UMAD_MAX_PORTS; | ||
1012 | cdev_init(&port->sm_cdev, &umad_sm_fops); | 1015 | cdev_init(&port->sm_cdev, &umad_sm_fops); |
1013 | port->sm_cdev.owner = THIS_MODULE; | 1016 | port->sm_cdev.owner = THIS_MODULE; |
1014 | kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num); | 1017 | kobject_set_name(&port->sm_cdev.kobj, "issm%d", port->dev_num); |
1015 | if (cdev_add(&port->sm_cdev, base_dev + devnum + IB_UMAD_MAX_PORTS, 1)) | 1018 | if (cdev_add(&port->sm_cdev, base, 1)) |
1016 | goto err_sm_cdev; | 1019 | goto err_sm_cdev; |
1017 | 1020 | ||
1018 | port->sm_dev = device_create(umad_class, device->dma_device, | 1021 | port->sm_dev = device_create(umad_class, device->dma_device, |