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 | |
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')
-rw-r--r-- | drivers/infiniband/hw/amso1100/c2_provider.c | 48 | ||||
-rw-r--r-- | drivers/infiniband/hw/cxgb3/iwch_provider.c | 75 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_diag.c | 10 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_file_ops.c | 44 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_kernel.h | 8 | ||||
-rw-r--r-- | drivers/infiniband/hw/ipath/ipath_verbs.c | 37 | ||||
-rw-r--r-- | drivers/infiniband/hw/mlx4/main.c | 49 | ||||
-rw-r--r-- | drivers/infiniband/hw/mthca/mthca_provider.c | 48 | ||||
-rw-r--r-- | drivers/infiniband/hw/nes/nes_verbs.c | 48 |
9 files changed, 197 insertions, 170 deletions
diff --git a/drivers/infiniband/hw/amso1100/c2_provider.c b/drivers/infiniband/hw/amso1100/c2_provider.c index e10d27a6e145..6af2c0f79a67 100644 --- a/drivers/infiniband/hw/amso1100/c2_provider.c +++ b/drivers/infiniband/hw/amso1100/c2_provider.c | |||
@@ -523,45 +523,49 @@ static int c2_dereg_mr(struct ib_mr *ib_mr) | |||
523 | return err; | 523 | return err; |
524 | } | 524 | } |
525 | 525 | ||
526 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 526 | static ssize_t show_rev(struct device *dev, struct device_attribute *attr, |
527 | char *buf) | ||
527 | { | 528 | { |
528 | struct c2_dev *dev = container_of(cdev, struct c2_dev, ibdev.class_dev); | 529 | struct c2_dev *c2dev = container_of(dev, struct c2_dev, ibdev.dev); |
529 | pr_debug("%s:%u\n", __func__, __LINE__); | 530 | pr_debug("%s:%u\n", __func__, __LINE__); |
530 | return sprintf(buf, "%x\n", dev->props.hw_ver); | 531 | return sprintf(buf, "%x\n", c2dev->props.hw_ver); |
531 | } | 532 | } |
532 | 533 | ||
533 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | 534 | static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, |
535 | char *buf) | ||
534 | { | 536 | { |
535 | struct c2_dev *dev = container_of(cdev, struct c2_dev, ibdev.class_dev); | 537 | struct c2_dev *c2dev = container_of(dev, struct c2_dev, ibdev.dev); |
536 | pr_debug("%s:%u\n", __func__, __LINE__); | 538 | pr_debug("%s:%u\n", __func__, __LINE__); |
537 | return sprintf(buf, "%x.%x.%x\n", | 539 | return sprintf(buf, "%x.%x.%x\n", |
538 | (int) (dev->props.fw_ver >> 32), | 540 | (int) (c2dev->props.fw_ver >> 32), |
539 | (int) (dev->props.fw_ver >> 16) & 0xffff, | 541 | (int) (c2dev->props.fw_ver >> 16) & 0xffff, |
540 | (int) (dev->props.fw_ver & 0xffff)); | 542 | (int) (c2dev->props.fw_ver & 0xffff)); |
541 | } | 543 | } |
542 | 544 | ||
543 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 545 | static ssize_t show_hca(struct device *dev, struct device_attribute *attr, |
546 | char *buf) | ||
544 | { | 547 | { |
545 | pr_debug("%s:%u\n", __func__, __LINE__); | 548 | pr_debug("%s:%u\n", __func__, __LINE__); |
546 | return sprintf(buf, "AMSO1100\n"); | 549 | return sprintf(buf, "AMSO1100\n"); |
547 | } | 550 | } |
548 | 551 | ||
549 | static ssize_t show_board(struct class_device *cdev, char *buf) | 552 | static ssize_t show_board(struct device *dev, struct device_attribute *attr, |
553 | char *buf) | ||
550 | { | 554 | { |
551 | pr_debug("%s:%u\n", __func__, __LINE__); | 555 | pr_debug("%s:%u\n", __func__, __LINE__); |
552 | return sprintf(buf, "%.*s\n", 32, "AMSO1100 Board ID"); | 556 | return sprintf(buf, "%.*s\n", 32, "AMSO1100 Board ID"); |
553 | } | 557 | } |
554 | 558 | ||
555 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 559 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
556 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 560 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
557 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 561 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
558 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | 562 | static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); |
559 | 563 | ||
560 | static struct class_device_attribute *c2_class_attributes[] = { | 564 | static struct device_attribute *c2_dev_attributes[] = { |
561 | &class_device_attr_hw_rev, | 565 | &dev_attr_hw_rev, |
562 | &class_device_attr_fw_ver, | 566 | &dev_attr_fw_ver, |
563 | &class_device_attr_hca_type, | 567 | &dev_attr_hca_type, |
564 | &class_device_attr_board_id | 568 | &dev_attr_board_id |
565 | }; | 569 | }; |
566 | 570 | ||
567 | static int c2_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, | 571 | static int c2_modify_qp(struct ib_qp *ibqp, struct ib_qp_attr *attr, |
@@ -861,9 +865,9 @@ int c2_register_device(struct c2_dev *dev) | |||
861 | if (ret) | 865 | if (ret) |
862 | goto out1; | 866 | goto out1; |
863 | 867 | ||
864 | for (i = 0; i < ARRAY_SIZE(c2_class_attributes); ++i) { | 868 | for (i = 0; i < ARRAY_SIZE(c2_dev_attributes); ++i) { |
865 | ret = class_device_create_file(&dev->ibdev.class_dev, | 869 | ret = device_create_file(&dev->ibdev.dev, |
866 | c2_class_attributes[i]); | 870 | c2_dev_attributes[i]); |
867 | if (ret) | 871 | if (ret) |
868 | goto out0; | 872 | goto out0; |
869 | } | 873 | } |
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 | } |
diff --git a/drivers/infiniband/hw/ipath/ipath_diag.c b/drivers/infiniband/hw/ipath/ipath_diag.c index 6d49d2f18a88..d4ce8b63e19e 100644 --- a/drivers/infiniband/hw/ipath/ipath_diag.c +++ b/drivers/infiniband/hw/ipath/ipath_diag.c | |||
@@ -79,7 +79,7 @@ static const struct file_operations diagpkt_file_ops = { | |||
79 | 79 | ||
80 | static atomic_t diagpkt_count = ATOMIC_INIT(0); | 80 | static atomic_t diagpkt_count = ATOMIC_INIT(0); |
81 | static struct cdev *diagpkt_cdev; | 81 | static struct cdev *diagpkt_cdev; |
82 | static struct class_device *diagpkt_class_dev; | 82 | static struct device *diagpkt_dev; |
83 | 83 | ||
84 | int ipath_diag_add(struct ipath_devdata *dd) | 84 | int ipath_diag_add(struct ipath_devdata *dd) |
85 | { | 85 | { |
@@ -89,7 +89,7 @@ int ipath_diag_add(struct ipath_devdata *dd) | |||
89 | if (atomic_inc_return(&diagpkt_count) == 1) { | 89 | if (atomic_inc_return(&diagpkt_count) == 1) { |
90 | ret = ipath_cdev_init(IPATH_DIAGPKT_MINOR, | 90 | ret = ipath_cdev_init(IPATH_DIAGPKT_MINOR, |
91 | "ipath_diagpkt", &diagpkt_file_ops, | 91 | "ipath_diagpkt", &diagpkt_file_ops, |
92 | &diagpkt_cdev, &diagpkt_class_dev); | 92 | &diagpkt_cdev, &diagpkt_dev); |
93 | 93 | ||
94 | if (ret) { | 94 | if (ret) { |
95 | ipath_dev_err(dd, "Couldn't create ipath_diagpkt " | 95 | ipath_dev_err(dd, "Couldn't create ipath_diagpkt " |
@@ -102,7 +102,7 @@ int ipath_diag_add(struct ipath_devdata *dd) | |||
102 | 102 | ||
103 | ret = ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, | 103 | ret = ipath_cdev_init(IPATH_DIAG_MINOR_BASE + dd->ipath_unit, name, |
104 | &diag_file_ops, &dd->diag_cdev, | 104 | &diag_file_ops, &dd->diag_cdev, |
105 | &dd->diag_class_dev); | 105 | &dd->diag_dev); |
106 | if (ret) | 106 | if (ret) |
107 | ipath_dev_err(dd, "Couldn't create %s device: %d", | 107 | ipath_dev_err(dd, "Couldn't create %s device: %d", |
108 | name, ret); | 108 | name, ret); |
@@ -114,9 +114,9 @@ done: | |||
114 | void ipath_diag_remove(struct ipath_devdata *dd) | 114 | void ipath_diag_remove(struct ipath_devdata *dd) |
115 | { | 115 | { |
116 | if (atomic_dec_and_test(&diagpkt_count)) | 116 | if (atomic_dec_and_test(&diagpkt_count)) |
117 | ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_class_dev); | 117 | ipath_cdev_cleanup(&diagpkt_cdev, &diagpkt_dev); |
118 | 118 | ||
119 | ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_class_dev); | 119 | ipath_cdev_cleanup(&dd->diag_cdev, &dd->diag_dev); |
120 | } | 120 | } |
121 | 121 | ||
122 | /** | 122 | /** |
diff --git a/drivers/infiniband/hw/ipath/ipath_file_ops.c b/drivers/infiniband/hw/ipath/ipath_file_ops.c index 1e627aab18bf..8b1752202e78 100644 --- a/drivers/infiniband/hw/ipath/ipath_file_ops.c +++ b/drivers/infiniband/hw/ipath/ipath_file_ops.c | |||
@@ -2434,11 +2434,11 @@ static ssize_t ipath_writev(struct kiocb *iocb, const struct iovec *iov, | |||
2434 | static struct class *ipath_class; | 2434 | static struct class *ipath_class; |
2435 | 2435 | ||
2436 | static int init_cdev(int minor, char *name, const struct file_operations *fops, | 2436 | static int init_cdev(int minor, char *name, const struct file_operations *fops, |
2437 | struct cdev **cdevp, struct class_device **class_devp) | 2437 | struct cdev **cdevp, struct device **devp) |
2438 | { | 2438 | { |
2439 | const dev_t dev = MKDEV(IPATH_MAJOR, minor); | 2439 | const dev_t dev = MKDEV(IPATH_MAJOR, minor); |
2440 | struct cdev *cdev = NULL; | 2440 | struct cdev *cdev = NULL; |
2441 | struct class_device *class_dev = NULL; | 2441 | struct device *device = NULL; |
2442 | int ret; | 2442 | int ret; |
2443 | 2443 | ||
2444 | cdev = cdev_alloc(); | 2444 | cdev = cdev_alloc(); |
@@ -2462,12 +2462,12 @@ static int init_cdev(int minor, char *name, const struct file_operations *fops, | |||
2462 | goto err_cdev; | 2462 | goto err_cdev; |
2463 | } | 2463 | } |
2464 | 2464 | ||
2465 | class_dev = class_device_create(ipath_class, NULL, dev, NULL, name); | 2465 | device = device_create(ipath_class, NULL, dev, name); |
2466 | 2466 | ||
2467 | if (IS_ERR(class_dev)) { | 2467 | if (IS_ERR(device)) { |
2468 | ret = PTR_ERR(class_dev); | 2468 | ret = PTR_ERR(device); |
2469 | printk(KERN_ERR IPATH_DRV_NAME ": Could not create " | 2469 | printk(KERN_ERR IPATH_DRV_NAME ": Could not create " |
2470 | "class_dev for minor %d, %s (err %d)\n", | 2470 | "device for minor %d, %s (err %d)\n", |
2471 | minor, name, -ret); | 2471 | minor, name, -ret); |
2472 | goto err_cdev; | 2472 | goto err_cdev; |
2473 | } | 2473 | } |
@@ -2481,29 +2481,29 @@ err_cdev: | |||
2481 | done: | 2481 | done: |
2482 | if (ret >= 0) { | 2482 | if (ret >= 0) { |
2483 | *cdevp = cdev; | 2483 | *cdevp = cdev; |
2484 | *class_devp = class_dev; | 2484 | *devp = device; |
2485 | } else { | 2485 | } else { |
2486 | *cdevp = NULL; | 2486 | *cdevp = NULL; |
2487 | *class_devp = NULL; | 2487 | *devp = NULL; |
2488 | } | 2488 | } |
2489 | 2489 | ||
2490 | return ret; | 2490 | return ret; |
2491 | } | 2491 | } |
2492 | 2492 | ||
2493 | int ipath_cdev_init(int minor, char *name, const struct file_operations *fops, | 2493 | int ipath_cdev_init(int minor, char *name, const struct file_operations *fops, |
2494 | struct cdev **cdevp, struct class_device **class_devp) | 2494 | struct cdev **cdevp, struct device **devp) |
2495 | { | 2495 | { |
2496 | return init_cdev(minor, name, fops, cdevp, class_devp); | 2496 | return init_cdev(minor, name, fops, cdevp, devp); |
2497 | } | 2497 | } |
2498 | 2498 | ||
2499 | static void cleanup_cdev(struct cdev **cdevp, | 2499 | static void cleanup_cdev(struct cdev **cdevp, |
2500 | struct class_device **class_devp) | 2500 | struct device **devp) |
2501 | { | 2501 | { |
2502 | struct class_device *class_dev = *class_devp; | 2502 | struct device *dev = *devp; |
2503 | 2503 | ||
2504 | if (class_dev) { | 2504 | if (dev) { |
2505 | class_device_unregister(class_dev); | 2505 | device_unregister(dev); |
2506 | *class_devp = NULL; | 2506 | *devp = NULL; |
2507 | } | 2507 | } |
2508 | 2508 | ||
2509 | if (*cdevp) { | 2509 | if (*cdevp) { |
@@ -2513,13 +2513,13 @@ static void cleanup_cdev(struct cdev **cdevp, | |||
2513 | } | 2513 | } |
2514 | 2514 | ||
2515 | void ipath_cdev_cleanup(struct cdev **cdevp, | 2515 | void ipath_cdev_cleanup(struct cdev **cdevp, |
2516 | struct class_device **class_devp) | 2516 | struct device **devp) |
2517 | { | 2517 | { |
2518 | cleanup_cdev(cdevp, class_devp); | 2518 | cleanup_cdev(cdevp, devp); |
2519 | } | 2519 | } |
2520 | 2520 | ||
2521 | static struct cdev *wildcard_cdev; | 2521 | static struct cdev *wildcard_cdev; |
2522 | static struct class_device *wildcard_class_dev; | 2522 | static struct device *wildcard_dev; |
2523 | 2523 | ||
2524 | static const dev_t dev = MKDEV(IPATH_MAJOR, 0); | 2524 | static const dev_t dev = MKDEV(IPATH_MAJOR, 0); |
2525 | 2525 | ||
@@ -2576,7 +2576,7 @@ int ipath_user_add(struct ipath_devdata *dd) | |||
2576 | goto bail; | 2576 | goto bail; |
2577 | } | 2577 | } |
2578 | ret = init_cdev(0, "ipath", &ipath_file_ops, &wildcard_cdev, | 2578 | ret = init_cdev(0, "ipath", &ipath_file_ops, &wildcard_cdev, |
2579 | &wildcard_class_dev); | 2579 | &wildcard_dev); |
2580 | if (ret < 0) { | 2580 | if (ret < 0) { |
2581 | ipath_dev_err(dd, "Could not create wildcard " | 2581 | ipath_dev_err(dd, "Could not create wildcard " |
2582 | "minor: error %d\n", -ret); | 2582 | "minor: error %d\n", -ret); |
@@ -2589,7 +2589,7 @@ int ipath_user_add(struct ipath_devdata *dd) | |||
2589 | snprintf(name, sizeof(name), "ipath%d", dd->ipath_unit); | 2589 | snprintf(name, sizeof(name), "ipath%d", dd->ipath_unit); |
2590 | 2590 | ||
2591 | ret = init_cdev(dd->ipath_unit + 1, name, &ipath_file_ops, | 2591 | ret = init_cdev(dd->ipath_unit + 1, name, &ipath_file_ops, |
2592 | &dd->user_cdev, &dd->user_class_dev); | 2592 | &dd->user_cdev, &dd->user_dev); |
2593 | if (ret < 0) | 2593 | if (ret < 0) |
2594 | ipath_dev_err(dd, "Could not create user minor %d, %s\n", | 2594 | ipath_dev_err(dd, "Could not create user minor %d, %s\n", |
2595 | dd->ipath_unit + 1, name); | 2595 | dd->ipath_unit + 1, name); |
@@ -2604,13 +2604,13 @@ bail: | |||
2604 | 2604 | ||
2605 | void ipath_user_remove(struct ipath_devdata *dd) | 2605 | void ipath_user_remove(struct ipath_devdata *dd) |
2606 | { | 2606 | { |
2607 | cleanup_cdev(&dd->user_cdev, &dd->user_class_dev); | 2607 | cleanup_cdev(&dd->user_cdev, &dd->user_dev); |
2608 | 2608 | ||
2609 | if (atomic_dec_return(&user_count) == 0) { | 2609 | if (atomic_dec_return(&user_count) == 0) { |
2610 | if (atomic_read(&user_setup) == 0) | 2610 | if (atomic_read(&user_setup) == 0) |
2611 | goto bail; | 2611 | goto bail; |
2612 | 2612 | ||
2613 | cleanup_cdev(&wildcard_cdev, &wildcard_class_dev); | 2613 | cleanup_cdev(&wildcard_cdev, &wildcard_dev); |
2614 | user_cleanup(); | 2614 | user_cleanup(); |
2615 | 2615 | ||
2616 | atomic_set(&user_setup, 0); | 2616 | atomic_set(&user_setup, 0); |
diff --git a/drivers/infiniband/hw/ipath/ipath_kernel.h b/drivers/infiniband/hw/ipath/ipath_kernel.h index 5863cbe99303..202337ae90dc 100644 --- a/drivers/infiniband/hw/ipath/ipath_kernel.h +++ b/drivers/infiniband/hw/ipath/ipath_kernel.h | |||
@@ -466,8 +466,8 @@ struct ipath_devdata { | |||
466 | struct pci_dev *pcidev; | 466 | struct pci_dev *pcidev; |
467 | struct cdev *user_cdev; | 467 | struct cdev *user_cdev; |
468 | struct cdev *diag_cdev; | 468 | struct cdev *diag_cdev; |
469 | struct class_device *user_class_dev; | 469 | struct device *user_dev; |
470 | struct class_device *diag_class_dev; | 470 | struct device *diag_dev; |
471 | /* timer used to prevent stats overflow, error throttling, etc. */ | 471 | /* timer used to prevent stats overflow, error throttling, etc. */ |
472 | struct timer_list ipath_stats_timer; | 472 | struct timer_list ipath_stats_timer; |
473 | /* timer to verify interrupts work, and fallback if possible */ | 473 | /* timer to verify interrupts work, and fallback if possible */ |
@@ -854,9 +854,9 @@ void ipath_clear_freeze(struct ipath_devdata *); | |||
854 | 854 | ||
855 | struct file_operations; | 855 | struct file_operations; |
856 | int ipath_cdev_init(int minor, char *name, const struct file_operations *fops, | 856 | int ipath_cdev_init(int minor, char *name, const struct file_operations *fops, |
857 | struct cdev **cdevp, struct class_device **class_devp); | 857 | struct cdev **cdevp, struct device **devp); |
858 | void ipath_cdev_cleanup(struct cdev **cdevp, | 858 | void ipath_cdev_cleanup(struct cdev **cdevp, |
859 | struct class_device **class_devp); | 859 | struct device **devp); |
860 | 860 | ||
861 | int ipath_diag_add(struct ipath_devdata *); | 861 | int ipath_diag_add(struct ipath_devdata *); |
862 | void ipath_diag_remove(struct ipath_devdata *); | 862 | void ipath_diag_remove(struct ipath_devdata *); |
diff --git a/drivers/infiniband/hw/ipath/ipath_verbs.c b/drivers/infiniband/hw/ipath/ipath_verbs.c index 320a6d018de7..c38f9aa8be8d 100644 --- a/drivers/infiniband/hw/ipath/ipath_verbs.c +++ b/drivers/infiniband/hw/ipath/ipath_verbs.c | |||
@@ -2172,18 +2172,20 @@ void ipath_unregister_ib_device(struct ipath_ibdev *dev) | |||
2172 | ib_dealloc_device(ibdev); | 2172 | ib_dealloc_device(ibdev); |
2173 | } | 2173 | } |
2174 | 2174 | ||
2175 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 2175 | static ssize_t show_rev(struct device *device, struct device_attribute *attr, |
2176 | char *buf) | ||
2176 | { | 2177 | { |
2177 | struct ipath_ibdev *dev = | 2178 | struct ipath_ibdev *dev = |
2178 | container_of(cdev, struct ipath_ibdev, ibdev.class_dev); | 2179 | container_of(device, struct ipath_ibdev, ibdev.dev); |
2179 | 2180 | ||
2180 | return sprintf(buf, "%x\n", dev->dd->ipath_pcirev); | 2181 | return sprintf(buf, "%x\n", dev->dd->ipath_pcirev); |
2181 | } | 2182 | } |
2182 | 2183 | ||
2183 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 2184 | static ssize_t show_hca(struct device *device, struct device_attribute *attr, |
2185 | char *buf) | ||
2184 | { | 2186 | { |
2185 | struct ipath_ibdev *dev = | 2187 | struct ipath_ibdev *dev = |
2186 | container_of(cdev, struct ipath_ibdev, ibdev.class_dev); | 2188 | container_of(device, struct ipath_ibdev, ibdev.dev); |
2187 | int ret; | 2189 | int ret; |
2188 | 2190 | ||
2189 | ret = dev->dd->ipath_f_get_boardname(dev->dd, buf, 128); | 2191 | ret = dev->dd->ipath_f_get_boardname(dev->dd, buf, 128); |
@@ -2196,10 +2198,11 @@ bail: | |||
2196 | return ret; | 2198 | return ret; |
2197 | } | 2199 | } |
2198 | 2200 | ||
2199 | static ssize_t show_stats(struct class_device *cdev, char *buf) | 2201 | static ssize_t show_stats(struct device *device, struct device_attribute *attr, |
2202 | char *buf) | ||
2200 | { | 2203 | { |
2201 | struct ipath_ibdev *dev = | 2204 | struct ipath_ibdev *dev = |
2202 | container_of(cdev, struct ipath_ibdev, ibdev.class_dev); | 2205 | container_of(device, struct ipath_ibdev, ibdev.dev); |
2203 | int i; | 2206 | int i; |
2204 | int len; | 2207 | int len; |
2205 | 2208 | ||
@@ -2237,16 +2240,16 @@ static ssize_t show_stats(struct class_device *cdev, char *buf) | |||
2237 | return len; | 2240 | return len; |
2238 | } | 2241 | } |
2239 | 2242 | ||
2240 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 2243 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
2241 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 2244 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
2242 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_hca, NULL); | 2245 | static DEVICE_ATTR(board_id, S_IRUGO, show_hca, NULL); |
2243 | static CLASS_DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); | 2246 | static DEVICE_ATTR(stats, S_IRUGO, show_stats, NULL); |
2244 | 2247 | ||
2245 | static struct class_device_attribute *ipath_class_attributes[] = { | 2248 | static struct device_attribute *ipath_class_attributes[] = { |
2246 | &class_device_attr_hw_rev, | 2249 | &dev_attr_hw_rev, |
2247 | &class_device_attr_hca_type, | 2250 | &dev_attr_hca_type, |
2248 | &class_device_attr_board_id, | 2251 | &dev_attr_board_id, |
2249 | &class_device_attr_stats | 2252 | &dev_attr_stats |
2250 | }; | 2253 | }; |
2251 | 2254 | ||
2252 | static int ipath_verbs_register_sysfs(struct ib_device *dev) | 2255 | static int ipath_verbs_register_sysfs(struct ib_device *dev) |
@@ -2255,8 +2258,8 @@ static int ipath_verbs_register_sysfs(struct ib_device *dev) | |||
2255 | int ret; | 2258 | int ret; |
2256 | 2259 | ||
2257 | for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) | 2260 | for (i = 0; i < ARRAY_SIZE(ipath_class_attributes); ++i) |
2258 | if (class_device_create_file(&dev->class_dev, | 2261 | if (device_create_file(&dev->dev, |
2259 | ipath_class_attributes[i])) { | 2262 | ipath_class_attributes[i])) { |
2260 | ret = 1; | 2263 | ret = 1; |
2261 | goto bail; | 2264 | goto bail; |
2262 | } | 2265 | } |
diff --git a/drivers/infiniband/hw/mlx4/main.c b/drivers/infiniband/hw/mlx4/main.c index 136c76c7b4e7..4d9b5ac42202 100644 --- a/drivers/infiniband/hw/mlx4/main.c +++ b/drivers/infiniband/hw/mlx4/main.c | |||
@@ -481,42 +481,51 @@ out: | |||
481 | return err; | 481 | return err; |
482 | } | 482 | } |
483 | 483 | ||
484 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 484 | static ssize_t show_hca(struct device *device, struct device_attribute *attr, |
485 | char *buf) | ||
485 | { | 486 | { |
486 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | 487 | struct mlx4_ib_dev *dev = |
488 | container_of(device, struct mlx4_ib_dev, ib_dev.dev); | ||
487 | return sprintf(buf, "MT%d\n", dev->dev->pdev->device); | 489 | return sprintf(buf, "MT%d\n", dev->dev->pdev->device); |
488 | } | 490 | } |
489 | 491 | ||
490 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | 492 | static ssize_t show_fw_ver(struct device *device, struct device_attribute *attr, |
493 | char *buf) | ||
491 | { | 494 | { |
492 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | 495 | struct mlx4_ib_dev *dev = |
496 | container_of(device, struct mlx4_ib_dev, ib_dev.dev); | ||
493 | return sprintf(buf, "%d.%d.%d\n", (int) (dev->dev->caps.fw_ver >> 32), | 497 | return sprintf(buf, "%d.%d.%d\n", (int) (dev->dev->caps.fw_ver >> 32), |
494 | (int) (dev->dev->caps.fw_ver >> 16) & 0xffff, | 498 | (int) (dev->dev->caps.fw_ver >> 16) & 0xffff, |
495 | (int) dev->dev->caps.fw_ver & 0xffff); | 499 | (int) dev->dev->caps.fw_ver & 0xffff); |
496 | } | 500 | } |
497 | 501 | ||
498 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 502 | static ssize_t show_rev(struct device *device, struct device_attribute *attr, |
503 | char *buf) | ||
499 | { | 504 | { |
500 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | 505 | struct mlx4_ib_dev *dev = |
506 | container_of(device, struct mlx4_ib_dev, ib_dev.dev); | ||
501 | return sprintf(buf, "%x\n", dev->dev->rev_id); | 507 | return sprintf(buf, "%x\n", dev->dev->rev_id); |
502 | } | 508 | } |
503 | 509 | ||
504 | static ssize_t show_board(struct class_device *cdev, char *buf) | 510 | static ssize_t show_board(struct device *device, struct device_attribute *attr, |
511 | char *buf) | ||
505 | { | 512 | { |
506 | struct mlx4_ib_dev *dev = container_of(cdev, struct mlx4_ib_dev, ib_dev.class_dev); | 513 | struct mlx4_ib_dev *dev = |
507 | return sprintf(buf, "%.*s\n", MLX4_BOARD_ID_LEN, dev->dev->board_id); | 514 | container_of(device, struct mlx4_ib_dev, ib_dev.dev); |
515 | return sprintf(buf, "%.*s\n", MLX4_BOARD_ID_LEN, | ||
516 | dev->dev->board_id); | ||
508 | } | 517 | } |
509 | 518 | ||
510 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 519 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
511 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 520 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
512 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 521 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
513 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | 522 | static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); |
514 | 523 | ||
515 | static struct class_device_attribute *mlx4_class_attributes[] = { | 524 | static struct device_attribute *mlx4_class_attributes[] = { |
516 | &class_device_attr_hw_rev, | 525 | &dev_attr_hw_rev, |
517 | &class_device_attr_fw_ver, | 526 | &dev_attr_fw_ver, |
518 | &class_device_attr_hca_type, | 527 | &dev_attr_hca_type, |
519 | &class_device_attr_board_id | 528 | &dev_attr_board_id |
520 | }; | 529 | }; |
521 | 530 | ||
522 | static void *mlx4_ib_add(struct mlx4_dev *dev) | 531 | static void *mlx4_ib_add(struct mlx4_dev *dev) |
@@ -640,8 +649,8 @@ static void *mlx4_ib_add(struct mlx4_dev *dev) | |||
640 | goto err_reg; | 649 | goto err_reg; |
641 | 650 | ||
642 | for (i = 0; i < ARRAY_SIZE(mlx4_class_attributes); ++i) { | 651 | for (i = 0; i < ARRAY_SIZE(mlx4_class_attributes); ++i) { |
643 | if (class_device_create_file(&ibdev->ib_dev.class_dev, | 652 | if (device_create_file(&ibdev->ib_dev.dev, |
644 | mlx4_class_attributes[i])) | 653 | mlx4_class_attributes[i])) |
645 | goto err_reg; | 654 | goto err_reg; |
646 | } | 655 | } |
647 | 656 | ||
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 | ||
1173 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 1173 | static 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 | ||
1179 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | 1181 | static 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 | ||
1187 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 1191 | static 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 | ||
1205 | static ssize_t show_board(struct class_device *cdev, char *buf) | 1211 | static 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 | ||
1211 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 1219 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
1212 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 1220 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
1213 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 1221 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
1214 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | 1222 | static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); |
1215 | 1223 | ||
1216 | static struct class_device_attribute *mthca_class_attributes[] = { | 1224 | static 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 | ||
1223 | static int mthca_init_node_data(struct mthca_dev *dev) | 1231 | static 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; |
diff --git a/drivers/infiniband/hw/nes/nes_verbs.c b/drivers/infiniband/hw/nes/nes_verbs.c index 7c27420c2240..f9a5d4390892 100644 --- a/drivers/infiniband/hw/nes/nes_verbs.c +++ b/drivers/infiniband/hw/nes/nes_verbs.c | |||
@@ -2800,10 +2800,11 @@ static int nes_dereg_mr(struct ib_mr *ib_mr) | |||
2800 | /** | 2800 | /** |
2801 | * show_rev | 2801 | * show_rev |
2802 | */ | 2802 | */ |
2803 | static ssize_t show_rev(struct class_device *cdev, char *buf) | 2803 | static ssize_t show_rev(struct device *dev, struct device_attribute *attr, |
2804 | char *buf) | ||
2804 | { | 2805 | { |
2805 | struct nes_ib_device *nesibdev = | 2806 | struct nes_ib_device *nesibdev = |
2806 | container_of(cdev, struct nes_ib_device, ibdev.class_dev); | 2807 | container_of(dev, struct nes_ib_device, ibdev.dev); |
2807 | struct nes_vnic *nesvnic = nesibdev->nesvnic; | 2808 | struct nes_vnic *nesvnic = nesibdev->nesvnic; |
2808 | 2809 | ||
2809 | nes_debug(NES_DBG_INIT, "\n"); | 2810 | nes_debug(NES_DBG_INIT, "\n"); |
@@ -2814,10 +2815,11 @@ static ssize_t show_rev(struct class_device *cdev, char *buf) | |||
2814 | /** | 2815 | /** |
2815 | * show_fw_ver | 2816 | * show_fw_ver |
2816 | */ | 2817 | */ |
2817 | static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | 2818 | static ssize_t show_fw_ver(struct device *dev, struct device_attribute *attr, |
2819 | char *buf) | ||
2818 | { | 2820 | { |
2819 | struct nes_ib_device *nesibdev = | 2821 | struct nes_ib_device *nesibdev = |
2820 | container_of(cdev, struct nes_ib_device, ibdev.class_dev); | 2822 | container_of(dev, struct nes_ib_device, ibdev.dev); |
2821 | struct nes_vnic *nesvnic = nesibdev->nesvnic; | 2823 | struct nes_vnic *nesvnic = nesibdev->nesvnic; |
2822 | 2824 | ||
2823 | nes_debug(NES_DBG_INIT, "\n"); | 2825 | nes_debug(NES_DBG_INIT, "\n"); |
@@ -2831,7 +2833,8 @@ static ssize_t show_fw_ver(struct class_device *cdev, char *buf) | |||
2831 | /** | 2833 | /** |
2832 | * show_hca | 2834 | * show_hca |
2833 | */ | 2835 | */ |
2834 | static ssize_t show_hca(struct class_device *cdev, char *buf) | 2836 | static ssize_t show_hca(struct device *dev, struct device_attribute *attr, |
2837 | char *buf) | ||
2835 | { | 2838 | { |
2836 | nes_debug(NES_DBG_INIT, "\n"); | 2839 | nes_debug(NES_DBG_INIT, "\n"); |
2837 | return sprintf(buf, "NES020\n"); | 2840 | return sprintf(buf, "NES020\n"); |
@@ -2841,23 +2844,24 @@ static ssize_t show_hca(struct class_device *cdev, char *buf) | |||
2841 | /** | 2844 | /** |
2842 | * show_board | 2845 | * show_board |
2843 | */ | 2846 | */ |
2844 | static ssize_t show_board(struct class_device *cdev, char *buf) | 2847 | static ssize_t show_board(struct device *dev, struct device_attribute *attr, |
2848 | char *buf) | ||
2845 | { | 2849 | { |
2846 | nes_debug(NES_DBG_INIT, "\n"); | 2850 | nes_debug(NES_DBG_INIT, "\n"); |
2847 | return sprintf(buf, "%.*s\n", 32, "NES020 Board ID"); | 2851 | return sprintf(buf, "%.*s\n", 32, "NES020 Board ID"); |
2848 | } | 2852 | } |
2849 | 2853 | ||
2850 | 2854 | ||
2851 | static CLASS_DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); | 2855 | static DEVICE_ATTR(hw_rev, S_IRUGO, show_rev, NULL); |
2852 | static CLASS_DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); | 2856 | static DEVICE_ATTR(fw_ver, S_IRUGO, show_fw_ver, NULL); |
2853 | static CLASS_DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); | 2857 | static DEVICE_ATTR(hca_type, S_IRUGO, show_hca, NULL); |
2854 | static CLASS_DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); | 2858 | static DEVICE_ATTR(board_id, S_IRUGO, show_board, NULL); |
2855 | 2859 | ||
2856 | static struct class_device_attribute *nes_class_attributes[] = { | 2860 | static struct device_attribute *nes_dev_attributes[] = { |
2857 | &class_device_attr_hw_rev, | 2861 | &dev_attr_hw_rev, |
2858 | &class_device_attr_fw_ver, | 2862 | &dev_attr_fw_ver, |
2859 | &class_device_attr_hca_type, | 2863 | &dev_attr_hca_type, |
2860 | &class_device_attr_board_id | 2864 | &dev_attr_board_id |
2861 | }; | 2865 | }; |
2862 | 2866 | ||
2863 | 2867 | ||
@@ -3782,7 +3786,7 @@ struct nes_ib_device *nes_init_ofa_device(struct net_device *netdev) | |||
3782 | nesibdev->ibdev.phys_port_cnt = 1; | 3786 | nesibdev->ibdev.phys_port_cnt = 1; |
3783 | nesibdev->ibdev.num_comp_vectors = 1; | 3787 | nesibdev->ibdev.num_comp_vectors = 1; |
3784 | nesibdev->ibdev.dma_device = &nesdev->pcidev->dev; | 3788 | nesibdev->ibdev.dma_device = &nesdev->pcidev->dev; |
3785 | nesibdev->ibdev.class_dev.dev = &nesdev->pcidev->dev; | 3789 | nesibdev->ibdev.dev.parent = &nesdev->pcidev->dev; |
3786 | nesibdev->ibdev.query_device = nes_query_device; | 3790 | nesibdev->ibdev.query_device = nes_query_device; |
3787 | nesibdev->ibdev.query_port = nes_query_port; | 3791 | nesibdev->ibdev.query_port = nes_query_port; |
3788 | nesibdev->ibdev.modify_port = nes_modify_port; | 3792 | nesibdev->ibdev.modify_port = nes_modify_port; |
@@ -3877,13 +3881,13 @@ int nes_register_ofa_device(struct nes_ib_device *nesibdev) | |||
3877 | nesibdev->max_qp = (nesadapter->max_qp-NES_FIRST_QPN) / nesadapter->port_count; | 3881 | nesibdev->max_qp = (nesadapter->max_qp-NES_FIRST_QPN) / nesadapter->port_count; |
3878 | nesibdev->max_pd = nesadapter->max_pd / nesadapter->port_count; | 3882 | nesibdev->max_pd = nesadapter->max_pd / nesadapter->port_count; |
3879 | 3883 | ||
3880 | for (i = 0; i < ARRAY_SIZE(nes_class_attributes); ++i) { | 3884 | for (i = 0; i < ARRAY_SIZE(nes_dev_attributes); ++i) { |
3881 | ret = class_device_create_file(&nesibdev->ibdev.class_dev, nes_class_attributes[i]); | 3885 | ret = device_create_file(&nesibdev->ibdev.dev, nes_dev_attributes[i]); |
3882 | if (ret) { | 3886 | if (ret) { |
3883 | while (i > 0) { | 3887 | while (i > 0) { |
3884 | i--; | 3888 | i--; |
3885 | class_device_remove_file(&nesibdev->ibdev.class_dev, | 3889 | device_remove_file(&nesibdev->ibdev.dev, |
3886 | nes_class_attributes[i]); | 3890 | nes_dev_attributes[i]); |
3887 | } | 3891 | } |
3888 | ib_unregister_device(&nesibdev->ibdev); | 3892 | ib_unregister_device(&nesibdev->ibdev); |
3889 | return ret; | 3893 | return ret; |
@@ -3904,8 +3908,8 @@ static void nes_unregister_ofa_device(struct nes_ib_device *nesibdev) | |||
3904 | struct nes_vnic *nesvnic = nesibdev->nesvnic; | 3908 | struct nes_vnic *nesvnic = nesibdev->nesvnic; |
3905 | int i; | 3909 | int i; |
3906 | 3910 | ||
3907 | for (i = 0; i < ARRAY_SIZE(nes_class_attributes); ++i) { | 3911 | for (i = 0; i < ARRAY_SIZE(nes_dev_attributes); ++i) { |
3908 | class_device_remove_file(&nesibdev->ibdev.class_dev, nes_class_attributes[i]); | 3912 | device_remove_file(&nesibdev->ibdev.dev, nes_dev_attributes[i]); |
3909 | } | 3913 | } |
3910 | 3914 | ||
3911 | if (nesvnic->of_device_registered) { | 3915 | if (nesvnic->of_device_registered) { |