aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/hw/mthca/mthca_provider.c
diff options
context:
space:
mode:
authorTony Jones <tonyj@suse.de>2008-02-21 18:13:36 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2008-04-19 22:10:30 -0400
commitf4e91eb4a81559da87a3843758a641b5cc590b65 (patch)
tree534335821d076764cbc072586b19c4b061710e3d /drivers/infiniband/hw/mthca/mthca_provider.c
parentc4c66cf1787d408066fbfc69209185701f5df15f (diff)
IB: convert struct class_device to struct device
This converts the main ib_device to use struct device instead of struct class_device as class_device is going away. Signed-off-by: Tony Jones <tonyj@suse.de> Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Roland Dreier <rolandd@cisco.com> Cc: Sean Hefty <sean.hefty@intel.com> Cc: Hal Rosenstock <hal.rosenstock@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/infiniband/hw/mthca/mthca_provider.c')
-rw-r--r--drivers/infiniband/hw/mthca/mthca_provider.c48
1 files changed, 28 insertions, 20 deletions
diff --git a/drivers/infiniband/hw/mthca/mthca_provider.c b/drivers/infiniband/hw/mthca/mthca_provider.c
index 81b257e18bb6..696e1f302332 100644
--- a/drivers/infiniband/hw/mthca/mthca_provider.c
+++ b/drivers/infiniband/hw/mthca/mthca_provider.c
@@ -1170,23 +1170,29 @@ static int mthca_unmap_fmr(struct list_head *fmr_list)
1170 return 0; 1170 return 0;
1171} 1171}
1172 1172
1173static ssize_t show_rev(struct class_device *cdev, char *buf) 1173static ssize_t show_rev(struct device *device, struct device_attribute *attr,
1174 char *buf)
1174{ 1175{
1175 struct mthca_dev *dev = container_of(cdev, struct mthca_dev, ib_dev.class_dev); 1176 struct mthca_dev *dev =
1177 container_of(device, struct mthca_dev, ib_dev.dev);
1176 return sprintf(buf, "%x\n", dev->rev_id); 1178 return sprintf(buf, "%x\n", dev->rev_id);
1177} 1179}
1178 1180
1179static ssize_t show_fw_ver(struct class_device *cdev, char *buf) 1181static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr,
1182 char *buf)
1180{ 1183{
1181 struct mthca_dev *dev = container_of(cdev, struct mthca_dev, ib_dev.class_dev); 1184 struct mthca_dev *dev =
1185 container_of(device, struct mthca_dev, ib_dev.dev);
1182 return sprintf(buf, "%d.%d.%d\n", (int) (dev->fw_ver >> 32), 1186 return sprintf(buf, "%d.%d.%d\n", (int) (dev->fw_ver >> 32),
1183 (int) (dev->fw_ver >> 16) & 0xffff, 1187 (int) (dev->fw_ver >> 16) & 0xffff,
1184 (int) dev->fw_ver & 0xffff); 1188 (int) dev->fw_ver & 0xffff);
1185} 1189}
1186 1190
1187static ssize_t show_hca(struct class_device *cdev, char *buf) 1191static ssize_t show_hca(struct device *device, struct device_attribute *attr,
1192 char *buf)
1188{ 1193{
1189 struct mthca_dev *dev = container_of(cdev, struct mthca_dev, ib_dev.class_dev); 1194 struct mthca_dev *dev =
1195 container_of(device, struct mthca_dev, ib_dev.dev);
1190 switch (dev->pdev->device) { 1196 switch (dev->pdev->device) {
1191 case PCI_DEVICE_ID_MELLANOX_TAVOR: 1197 case PCI_DEVICE_ID_MELLANOX_TAVOR:
1192 return sprintf(buf, "MT23108\n"); 1198 return sprintf(buf, "MT23108\n");
@@ -1202,22 +1208,24 @@ static ssize_t show_hca(struct class_device *cdev, char *buf)
1202 } 1208 }
1203} 1209}
1204 1210
1205static ssize_t show_board(struct class_device *cdev, char *buf) 1211static ssize_t show_board(struct device *device, struct device_attribute *attr,
1212 char *buf)
1206{ 1213{
1207 struct mthca_dev *dev = container_of(cdev, struct mthca_dev, ib_dev.class_dev); 1214 struct mthca_dev *dev =
1215 container_of(device, struct mthca_dev, ib_dev.dev);
1208 return sprintf(buf, "%.*s\n", MTHCA_BOARD_ID_LEN, dev->board_id); 1216 return sprintf(buf, "%.*s\n", MTHCA_BOARD_ID_LEN, dev->board_id);
1209} 1217}
1210 1218
1211static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); 1219static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL);
1212static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); 1220static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL);
1213static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); 1221static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL);
1214static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); 1222static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL);
1215 1223
1216static struct class_device_attribute *mthca_class_attributes[] = { 1224static struct device_attribute *mthca_dev_attributes[] = {
1217 &class_device_attr_hw_rev, 1225 &dev_attr_hw_rev,
1218 &class_device_attr_fw_ver, 1226 &dev_attr_fw_ver,
1219 &class_device_attr_hca_type, 1227 &dev_attr_hca_type,
1220 &class_device_attr_board_id 1228 &dev_attr_board_id
1221}; 1229};
1222 1230
1223static int mthca_init_node_data(struct mthca_dev *dev) 1231static int mthca_init_node_data(struct mthca_dev *dev)
@@ -1379,9 +1387,9 @@ int mthca_register_device(struct mthca_dev *dev)
1379 if (ret) 1387 if (ret)
1380 return ret; 1388 return ret;
1381 1389
1382 for (i = 0; i < ARRAY_SIZE(mthca_class_attributes); ++i) { 1390 for (i = 0; i < ARRAY_SIZE(mthca_dev_attributes); ++i) {
1383 ret = class_device_create_file(&dev->ib_dev.class_dev, 1391 ret = device_create_file(&dev->ib_dev.dev,
1384 mthca_class_attributes[i]); 1392 mthca_dev_attributes[i]);
1385 if (ret) { 1393 if (ret) {
1386 ib_unregister_device(&dev->ib_dev); 1394 ib_unregister_device(&dev->ib_dev);
1387 return ret; 1395 return ret;