]> pilppa.org Git - linux-2.6-omap-h63xx.git/blobdiff - drivers/infiniband/ulp/ipoib/ipoib_vlan.c
Merge master.kernel.org:/pub/scm/linux/kernel/git/davej/agpgart
[linux-2.6-omap-h63xx.git] / drivers / infiniband / ulp / ipoib / ipoib_vlan.c
index 332d730e60c23a81e3576ad9e27c00fd43f1cd7e..6762988439d1f6fcd96b82aad8a25f51e7bf5a86 100644 (file)
 
 #include "ipoib.h"
 
-static ssize_t show_parent(struct class_device *class_dev, char *buf)
+static ssize_t show_parent(struct device *d, struct device_attribute *attr,
+                          char *buf)
 {
-       struct net_device *dev =
-               container_of(class_dev, struct net_device, class_dev);
+       struct net_device *dev = to_net_dev(d);
        struct ipoib_dev_priv *priv = netdev_priv(dev);
 
        return sprintf(buf, "%s\n", priv->parent->name);
 }
-static CLASS_DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
+static DEVICE_ATTR(parent, S_IRUGO, show_parent, NULL);
 
 int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 {
@@ -63,7 +63,7 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 
        ppriv = netdev_priv(pdev);
 
-       down(&ppriv->vlan_mutex);
+       mutex_lock(&ppriv->vlan_mutex);
 
        /*
         * First ensure this isn't a duplicate. We check the parent device and
@@ -113,26 +113,24 @@ int ipoib_vlan_add(struct net_device *pdev, unsigned short pkey)
 
        priv->parent = ppriv->dev;
 
-       if (ipoib_create_debug_file(priv->dev))
-               goto debug_failed;
+       ipoib_create_debug_files(priv->dev);
 
+       if (ipoib_cm_add_mode_attr(priv->dev))
+               goto sysfs_failed;
        if (ipoib_add_pkey_attr(priv->dev))
                goto sysfs_failed;
 
-       if (class_device_create_file(&priv->dev->class_dev,
-                                    &class_device_attr_parent))
+       if (device_create_file(&priv->dev->dev, &dev_attr_parent))
                goto sysfs_failed;
 
        list_add_tail(&priv->list, &ppriv->child_intfs);
 
-       up(&ppriv->vlan_mutex);
+       mutex_unlock(&ppriv->vlan_mutex);
 
        return 0;
 
 sysfs_failed:
-       ipoib_delete_debug_file(priv->dev);
-
-debug_failed:
+       ipoib_delete_debug_files(priv->dev);
        unregister_netdev(priv->dev);
 
 register_failed:
@@ -142,7 +140,7 @@ device_init_failed:
        free_netdev(priv->dev);
 
 err:
-       up(&ppriv->vlan_mutex);
+       mutex_unlock(&ppriv->vlan_mutex);
        return result;
 }
 
@@ -156,21 +154,19 @@ int ipoib_vlan_delete(struct net_device *pdev, unsigned short pkey)
 
        ppriv = netdev_priv(pdev);
 
-       down(&ppriv->vlan_mutex);
+       mutex_lock(&ppriv->vlan_mutex);
        list_for_each_entry_safe(priv, tpriv, &ppriv->child_intfs, list) {
                if (priv->pkey == pkey) {
                        unregister_netdev(priv->dev);
                        ipoib_dev_cleanup(priv->dev);
-
                        list_del(&priv->list);
-
-                       kfree(priv);
+                       free_netdev(priv->dev);
 
                        ret = 0;
                        break;
                }
        }
-       up(&ppriv->vlan_mutex);
+       mutex_unlock(&ppriv->vlan_mutex);
 
        return ret;
 }