aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/infiniband/ulp/ipoib/ipoib_main.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/infiniband/ulp/ipoib/ipoib_main.c')
-rw-r--r--drivers/infiniband/ulp/ipoib/ipoib_main.c33
1 files changed, 15 insertions, 18 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
961static ssize_t show_pkey(struct class_device *cdev, char *buf) 961static 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}
968static CLASS_DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL); 968static DEVICE_ATTR(pkey, S_IRUGO, show_pkey, NULL);
969 969
970static ssize_t create_child(struct class_device *cdev, 970static 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}
993static CLASS_DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child); 993static DEVICE_ATTR(create_child, S_IWUGO, NULL, create_child);
994 994
995static ssize_t delete_child(struct class_device *cdev, 995static 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}
1013static CLASS_DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child); 1013static DEVICE_ATTR(delete_child, S_IWUGO, NULL, delete_child);
1014 1014
1015int ipoib_add_pkey_attr(struct net_device *dev) 1015int 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
1021static struct net_device *ipoib_add_port(const char *format, 1020static 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;