diff options
| -rw-r--r-- | drivers/infiniband/core/user_mad.c | 28 |
1 files changed, 12 insertions, 16 deletions
diff --git a/drivers/infiniband/core/user_mad.c b/drivers/infiniband/core/user_mad.c index 7c95a35910f4..de8d31ab8945 100644 --- a/drivers/infiniband/core/user_mad.c +++ b/drivers/infiniband/core/user_mad.c | |||
| @@ -1123,7 +1123,7 @@ static struct ib_client umad_client = { | |||
| 1123 | .remove = ib_umad_remove_one | 1123 | .remove = ib_umad_remove_one |
| 1124 | }; | 1124 | }; |
| 1125 | 1125 | ||
| 1126 | static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr, | 1126 | static ssize_t ibdev_show(struct device *dev, struct device_attribute *attr, |
| 1127 | char *buf) | 1127 | char *buf) |
| 1128 | { | 1128 | { |
| 1129 | struct ib_umad_port *port = dev_get_drvdata(dev); | 1129 | struct ib_umad_port *port = dev_get_drvdata(dev); |
| @@ -1133,9 +1133,9 @@ static ssize_t show_ibdev(struct device *dev, struct device_attribute *attr, | |||
| 1133 | 1133 | ||
| 1134 | return sprintf(buf, "%s\n", dev_name(&port->ib_dev->dev)); | 1134 | return sprintf(buf, "%s\n", dev_name(&port->ib_dev->dev)); |
| 1135 | } | 1135 | } |
| 1136 | static DEVICE_ATTR(ibdev, S_IRUGO, show_ibdev, NULL); | 1136 | static DEVICE_ATTR_RO(ibdev); |
| 1137 | 1137 | ||
| 1138 | static ssize_t show_port(struct device *dev, struct device_attribute *attr, | 1138 | static ssize_t port_show(struct device *dev, struct device_attribute *attr, |
| 1139 | char *buf) | 1139 | char *buf) |
| 1140 | { | 1140 | { |
| 1141 | struct ib_umad_port *port = dev_get_drvdata(dev); | 1141 | struct ib_umad_port *port = dev_get_drvdata(dev); |
| @@ -1145,7 +1145,14 @@ static ssize_t show_port(struct device *dev, struct device_attribute *attr, | |||
| 1145 | 1145 | ||
| 1146 | return sprintf(buf, "%d\n", port->port_num); | 1146 | return sprintf(buf, "%d\n", port->port_num); |
| 1147 | } | 1147 | } |
| 1148 | static DEVICE_ATTR(port, S_IRUGO, show_port, NULL); | 1148 | static DEVICE_ATTR_RO(port); |
| 1149 | |||
| 1150 | static struct attribute *umad_class_dev_attrs[] = { | ||
| 1151 | &dev_attr_ibdev.attr, | ||
| 1152 | &dev_attr_port.attr, | ||
| 1153 | NULL, | ||
| 1154 | }; | ||
| 1155 | ATTRIBUTE_GROUPS(umad_class_dev); | ||
| 1149 | 1156 | ||
| 1150 | static char *umad_devnode(struct device *dev, umode_t *mode) | 1157 | static char *umad_devnode(struct device *dev, umode_t *mode) |
| 1151 | { | 1158 | { |
| @@ -1169,6 +1176,7 @@ static struct class umad_class = { | |||
| 1169 | .name = "infiniband_mad", | 1176 | .name = "infiniband_mad", |
| 1170 | .devnode = umad_devnode, | 1177 | .devnode = umad_devnode, |
| 1171 | .class_groups = umad_class_groups, | 1178 | .class_groups = umad_class_groups, |
| 1179 | .dev_groups = umad_class_dev_groups, | ||
| 1172 | }; | 1180 | }; |
| 1173 | 1181 | ||
| 1174 | static void ib_umad_release_port(struct device *device) | 1182 | static void ib_umad_release_port(struct device *device) |
| @@ -1229,11 +1237,6 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
| 1229 | if (ret) | 1237 | if (ret) |
| 1230 | goto err_cdev; | 1238 | goto err_cdev; |
| 1231 | 1239 | ||
| 1232 | if (device_create_file(&port->dev, &dev_attr_ibdev)) | ||
| 1233 | goto err_dev; | ||
| 1234 | if (device_create_file(&port->dev, &dev_attr_port)) | ||
| 1235 | goto err_dev; | ||
| 1236 | |||
| 1237 | ib_umad_init_port_dev(&port->sm_dev, port, device); | 1240 | ib_umad_init_port_dev(&port->sm_dev, port, device); |
| 1238 | port->sm_dev.devt = base_issm; | 1241 | port->sm_dev.devt = base_issm; |
| 1239 | dev_set_name(&port->sm_dev, "issm%d", port->dev_num); | 1242 | dev_set_name(&port->sm_dev, "issm%d", port->dev_num); |
| @@ -1244,15 +1247,8 @@ static int ib_umad_init_port(struct ib_device *device, int port_num, | |||
| 1244 | if (ret) | 1247 | if (ret) |
| 1245 | goto err_dev; | 1248 | goto err_dev; |
| 1246 | 1249 | ||
| 1247 | if (device_create_file(&port->sm_dev, &dev_attr_ibdev)) | ||
| 1248 | goto err_sm_dev; | ||
| 1249 | if (device_create_file(&port->sm_dev, &dev_attr_port)) | ||
| 1250 | goto err_sm_dev; | ||
| 1251 | |||
| 1252 | return 0; | 1250 | return 0; |
| 1253 | 1251 | ||
| 1254 | err_sm_dev: | ||
| 1255 | cdev_device_del(&port->sm_cdev, &port->sm_dev); | ||
| 1256 | err_dev: | 1252 | err_dev: |
| 1257 | put_device(&port->sm_dev); | 1253 | put_device(&port->sm_dev); |
| 1258 | cdev_device_del(&port->cdev, &port->dev); | 1254 | cdev_device_del(&port->cdev, &port->dev); |
