diff options
author | Tony Jones <tonyj@suse.de> | 2008-02-21 18:13:36 -0500 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2008-04-19 22:10:30 -0400 |
commit | f4e91eb4a81559da87a3843758a641b5cc590b65 (patch) | |
tree | 534335821d076764cbc072586b19c4b061710e3d /drivers/infiniband/hw/cxgb3 | |
parent | c4c66cf1787d408066fbfc69209185701f5df15f (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/cxgb3')
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_provider.c | 75 |
1 files changed, 37 insertions, 38 deletions
diff --git a/drivers/infiniband/hw/cxgb3/iwch_provider.c b/drivers/infiniband/hw/cxgb3/iwch_provider.c index ca7265443c05..ab4695c1dd56 100644 --- a/drivers/infiniband/hw/cxgb3/iwch_provider.c +++ b/drivers/infiniband/hw/cxgb3/iwch_provider.c | |||
@@ -1041,61 +1041,60 @@ static int iwch_query_port(struct ib_device *ibdev, | |||
1041 | return 0; | 1041 | return 0; |
1042 | } | 1042 | } |
1043 | 1043 | ||
1044 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 1044 | static ssize_t show_rev(struct device *dev, struct device_attribute *attr, |
1045 | char *buf) | ||
1045 | { | 1046 | { |
1046 | struct iwch_dev *dev = container_of(cdev, struct iwch_dev, | 1047 | struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev, |
1047 | ibdev.class_dev); | 1048 | ibdev.dev); |
1048 | PDBG("%s class dev 0x%p\n", __func__, cdev); | 1049 | PDBG("%s dev 0x%p\n", __func__, dev); |
1049 | return sprintf(buf, "%d\n", dev->rdev.t3cdev_p->type); | 1050 | return sprintf(buf, "%d\n", iwch_dev->rdev.t3cdev_p->type); |
1050 | } | 1051 | } |
1051 | 1052 | ||
1052 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | 1053 | static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, char *buf) |
1053 | { | 1054 | { |
1054 | struct iwch_dev *dev = container_of(cdev, struct iwch_dev, | 1055 | struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev, |
1055 | ibdev.class_dev); | 1056 | ibdev.dev); |
1056 | struct ethtool_drvinfo info; | 1057 | struct ethtool_drvinfo info; |
1057 | struct net_device *lldev = dev->rdev.t3cdev_p->lldev; | 1058 | struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; |
1058 | 1059 | ||
1059 | PDBG("%s class dev 0x%p\n", __func__, cdev); | 1060 | PDBG("%s dev 0x%p\n", __func__, dev); |
1060 | rtnl_lock(); | ||
1061 | lldev->ethtool_ops->get_drvinfo(lldev, &info); | 1061 | lldev->ethtool_ops->get_drvinfo(lldev, &info); |
1062 | rtnl_unlock(); | ||
1063 | return sprintf(buf, "%s\n", info.fw_version); | 1062 | return sprintf(buf, "%s\n", info.fw_version); |
1064 | } | 1063 | } |
1065 | 1064 | ||
1066 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 1065 | static ssize_t show_hca(struct device *dev, struct device_attribute *attr, |
1066 | char *buf) | ||
1067 | { | 1067 | { |
1068 | struct iwch_dev *dev = container_of(cdev, struct iwch_dev, | 1068 | struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev, |
1069 | ibdev.class_dev); | 1069 | ibdev.dev); |
1070 | struct ethtool_drvinfo info; | 1070 | struct ethtool_drvinfo info; |
1071 | struct net_device *lldev = dev->rdev.t3cdev_p->lldev; | 1071 | struct net_device *lldev = iwch_dev->rdev.t3cdev_p->lldev; |
1072 | 1072 | ||
1073 | PDBG("%s class dev 0x%p\n", __func__, cdev); | 1073 | PDBG("%s dev 0x%p\n", __func__, dev); |
1074 | rtnl_lock(); | ||
1075 | lldev->ethtool_ops->get_drvinfo(lldev, &info); | 1074 | lldev->ethtool_ops->get_drvinfo(lldev, &info); |
1076 | rtnl_unlock(); | ||
1077 | return sprintf(buf, "%s\n", info.driver); | 1075 | return sprintf(buf, "%s\n", info.driver); |
1078 | } | 1076 | } |
1079 | 1077 | ||
1080 | static ssize_t show_board(struct class_device *cdev, char *buf) | 1078 | static ssize_t show_board(struct device *dev, struct device_attribute *attr, |
1079 | char *buf) | ||
1081 | { | 1080 | { |
1082 | struct iwch_dev *dev = container_of(cdev, struct iwch_dev, | 1081 | struct iwch_dev *iwch_dev = container_of(dev, struct iwch_dev, |
1083 | ibdev.class_dev); | 1082 | ibdev.dev); |
1084 | PDBG("%s class dev 0x%p\n", __func__, dev); | 1083 | PDBG("%s dev 0x%p\n", __func__, dev); |
1085 | return sprintf(buf, "%x.%x\n", dev->rdev.rnic_info.pdev->vendor, | 1084 | return sprintf(buf, "%x.%x\n", iwch_dev->rdev.rnic_info.pdev->vendor, |
1086 | dev->rdev.rnic_info.pdev->device); | 1085 | iwch_dev->rdev.rnic_info.pdev->device); |
1087 | } | 1086 | } |
1088 | 1087 | ||
1089 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 1088 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
1090 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 1089 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
1091 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 1090 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
1092 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | 1091 | static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); |
1093 | 1092 | ||
1094 | static struct class_device_attribute *iwch_class_attributes[] = { | 1093 | static struct device_attribute *iwch_class_attributes[] = { |
1095 | &class_device_attr_hw_rev, | 1094 | &dev_attr_hw_rev, |
1096 | &class_device_attr_fw_ver, | 1095 | &dev_attr_fw_ver, |
1097 | &class_device_attr_hca_type, | 1096 | &dev_attr_hca_type, |
1098 | &class_device_attr_board_id | 1097 | &dev_attr_board_id |
1099 | }; | 1098 | }; |
1100 | 1099 | ||
1101 | int iwch_register_device(struct iwch_dev *dev) | 1100 | int iwch_register_device(struct iwch_dev *dev) |
@@ -1189,8 +1188,8 @@ int iwch_register_device(struct iwch_dev *dev) | |||
1189 | goto bail1; | 1188 | goto bail1; |
1190 | 1189 | ||
1191 | for (i = 0; i < ARRAY_SIZE(iwch_class_attributes); ++i) { | 1190 | for (i = 0; i < ARRAY_SIZE(iwch_class_attributes); ++i) { |
1192 | ret = class_device_create_file(&dev->ibdev.class_dev, | 1191 | ret = device_create_file(&dev->ibdev.dev, |
1193 | iwch_class_attributes[i]); | 1192 | iwch_class_attributes[i]); |
1194 | if (ret) { | 1193 | if (ret) { |
1195 | goto bail2; | 1194 | goto bail2; |
1196 | } | 1195 | } |
@@ -1208,8 +1207,8 @@ void iwch_unregister_device(struct iwch_dev *dev) | |||
1208 | 1207 | ||
1209 | PDBG("%s iwch_dev %p\n", __func__, dev); | 1208 | PDBG("%s iwch_dev %p\n", __func__, dev); |
1210 | for (i = 0; i < ARRAY_SIZE(iwch_class_attributes); ++i) | 1209 | for (i = 0; i < ARRAY_SIZE(iwch_class_attributes); ++i) |
1211 | class_device_remove_file(&dev->ibdev.class_dev, | 1210 | device_remove_file(&dev->ibdev.dev, |
1212 | iwch_class_attributes[i]); | 1211 | iwch_class_attributes[i]); |
1213 | ib_unregister_device(&dev->ibdev); | 1212 | ib_unregister_device(&dev->ibdev); |
1214 | return; | 1213 | return; |
1215 | } | 1214 | } |