diff options
Diffstat (limited to 'drivers/infiniband/ulp/ipoib')
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_main.c | 33 | ||||
-rw-r--r-- | drivers/infiniband/ulp/ipoib/ipoib_vlan.c | 11 |
2 files changed, 20 insertions, 24 deletions
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_main.c b/drivers/infiniband/ulp/ipoib/ipoib_main.c index 705eb1d0e554..af5ee2ec4499 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_main.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_main.c | |||
@@ -958,16 +958,17 @@ struct ipoib_dev_priv *ipoib_intf_alloc(const char *name) | |||
958 | return netdev_priv(dev); | 958 | return netdev_priv(dev); |
959 | } | 959 | } |
960 | 960 | ||
961 | static ssize_t show_pkey(struct class_device *cdev, char *buf) | 961 | static ssize_t show_pkey(struct device *dev, |
962 | struct device_attribute *attr, char *buf) | ||
962 | { | 963 | { |
963 | struct ipoib_dev_priv *priv = | 964 | struct ipoib_dev_priv *priv = netdev_priv(to_net_dev(dev)); |
964 | netdev_priv(container_of(cdev, struct net_device, class_dev)); | ||
965 | 965 | ||
966 | return sprintf(buf, "0x%04x\n", priv->pkey); | 966 | return sprintf(buf, "0x%04x\n", priv->pkey); |
967 | } | 967 | } |
968 | static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); | 968 | static DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); |
969 | 969 | ||
970 | static ssize_t create_child(struct class_device *cdev, | 970 | static ssize_t create_child(struct device *dev, |
971 | struct device_attribute *attr, | ||
971 | const char *buf, size_t count) | 972 | const char *buf, size_t count) |
972 | { | 973 | { |
973 | int pkey; | 974 | int pkey; |
@@ -985,14 +986,14 @@ static ssize_t create_child(struct class_device *cdev, | |||
985 | */ | 986 | */ |
986 | pkey |= 0x8000; | 987 | pkey |= 0x8000; |
987 | 988 | ||
988 | ret = ipoib_vlan_add(container_of(cdev, struct net_device, class_dev), | 989 | ret = ipoib_vlan_add(to_net_dev(dev), pkey); |
989 | pkey); | ||
990 | 990 | ||
991 | return ret ? ret : count; | 991 | return ret ? ret : count; |
992 | } | 992 | } |
993 | static CLASS_DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child); | 993 | static DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child); |
994 | 994 | ||
995 | static ssize_t delete_child(struct class_device *cdev, | 995 | static ssize_t delete_child(struct device *dev, |
996 | struct device_attribute *attr, | ||
996 | const char *buf, size_t count) | 997 | const char *buf, size_t count) |
997 | { | 998 | { |
998 | int pkey; | 999 | int pkey; |
@@ -1004,18 +1005,16 @@ static ssize_t delete_child(struct class_device *cdev, | |||
1004 | if (pkey < 0 || pkey > 0xffff) | 1005 | if (pkey < 0 || pkey > 0xffff) |
1005 | return -EINVAL; | 1006 | return -EINVAL; |
1006 | 1007 | ||
1007 | ret = ipoib_vlan_delete(container_of(cdev, struct net_device, class_dev), | 1008 | ret = ipoib_vlan_delete(to_net_dev(dev), pkey); |
1008 | pkey); | ||
1009 | 1009 | ||
1010 | return ret ? ret : count; | 1010 | return ret ? ret : count; |
1011 | 1011 | ||
1012 | } | 1012 | } |
1013 | static CLASS_DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child); | 1013 | static DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child); |
1014 | 1014 | ||
1015 | int ipoib_add_pkey_attr(struct net_device *dev) | 1015 | int ipoib_add_pkey_attr(struct net_device *dev) |
1016 | { | 1016 | { |
1017 | return class_device_create_file(&dev->class_dev, | 1017 | return device_create_file(&dev->dev, &dev_attr_pkey); |
1018 | &class_device_attr_pkey); | ||
1019 | } | 1018 | } |
1020 | 1019 | ||
1021 | static struct net_device *ipoib_add_port(const char *format, | 1020 | static struct net_device *ipoib_add_port(const char *format, |
@@ -1083,11 +1082,9 @@ static struct net_device *ipoib_add_port(const char *format, | |||
1083 | 1082 | ||
1084 | if (ipoib_add_pkey_attr(priv->dev)) | 1083 | if (ipoib_add_pkey_attr(priv->dev)) |
1085 | goto sysfs_failed; | 1084 | goto sysfs_failed; |
1086 | if (class_device_create_file(&priv->dev->class_dev, | 1085 | if (device_create_file(&priv->dev->dev, &dev_attr_create_child)) |
1087 | &class_device_attr_create_child)) | ||
1088 | goto sysfs_failed; | 1086 | goto sysfs_failed; |
1089 | if (class_device_create_file(&priv->dev->class_dev, | 1087 | if (device_create_file(&priv->dev->dev, &dev_attr_delete_child)) |
1090 | &class_device_attr_delete_child)) | ||
1091 | goto sysfs_failed; | 1088 | goto sysfs_failed; |
1092 | 1089 | ||
1093 | return priv->dev; | 1090 | return priv->dev; |
diff --git a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c index f887780e8093..085eafe6667c 100644 --- a/drivers/infiniband/ulp/ipoib/ipoib_vlan.c +++ b/drivers/infiniband/ulp/ipoib/ipoib_vlan.c | |||
@@ -42,15 +42,15 @@ | |||
42 | 42 | ||
43 | #include "ipoib.h" | 43 | #include "ipoib.h" |
44 | 44 | ||
45 | static ssize_t show_parent(struct class_device *class_dev, char *buf) | 45 | static ssize_t show_parent(struct device *d, struct device_attribute *attr, |
46 | char *buf) | ||
46 | { | 47 | { |
47 | struct net_device *dev = | 48 | struct net_device *dev = to_net_dev(d); |
48 | container_of(class_dev, struct net_device, class_dev); | ||
49 | struct ipoib_dev_priv *priv = netdev_priv(dev); | 49 | struct ipoib_dev_priv *priv = netdev_priv(dev); |
50 | 50 | ||
51 | return sprintf(buf, "%s\n", priv->parent->name); | 51 | return sprintf(buf, "%s\n", priv->parent->name); |
52 | } | 52 | } |
53 | static CLASS_DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL); | 53 | static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL); |
54 | 54 | ||
55 | int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | 55 | int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) |
56 | { | 56 | { |
@@ -118,8 +118,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey) | |||
118 | if (ipoib_add_pkey_attr(priv->dev)) | 118 | if (ipoib_add_pkey_attr(priv->dev)) |
119 | goto sysfs_failed; | 119 | goto sysfs_failed; |
120 | 120 | ||
121 | if (class_device_create_file(&priv->dev->class_dev, | 121 | if (device_create_file(&priv->dev->dev, &dev_attr_parent)) |
122 | &class_device_attr_parent)) | ||
123 | goto sysfs_failed; | 122 | goto sysfs_failed; |
124 | 123 | ||
125 | list_add_tail(&priv->list, &ppriv->child_intfs); | 124 | list_add_tail(&priv->list, &ppriv->child_intfs); |