]> git.karo-electronics.de Git - karo-tx-linux.git/blobdiff - drivers/extcon/extcon-class.c
Merge tag 'driver-core-3.12-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git...
[karo-tx-linux.git] / drivers / extcon / extcon-class.c
index 18ccadef43fdd80f81cff69501db3679c8e6b078..148382faded9f125940ee11ca211bcea38f36290 100644 (file)
@@ -148,6 +148,7 @@ static ssize_t state_store(struct device *dev, struct device_attribute *attr,
 
        return count;
 }
+static DEVICE_ATTR_RW(state);
 
 static ssize_t name_show(struct device *dev, struct device_attribute *attr,
                char *buf)
@@ -163,6 +164,7 @@ static ssize_t name_show(struct device *dev, struct device_attribute *attr,
 
        return sprintf(buf, "%s\n", dev_name(edev->dev));
 }
+static DEVICE_ATTR_RO(name);
 
 static ssize_t cable_name_show(struct device *dev,
                               struct device_attribute *attr, char *buf)
@@ -527,11 +529,12 @@ int extcon_unregister_notifier(struct extcon_dev *edev,
 }
 EXPORT_SYMBOL_GPL(extcon_unregister_notifier);
 
-static struct device_attribute extcon_attrs[] = {
-       __ATTR(state, S_IRUGO | S_IWUSR, state_show, state_store),
-       __ATTR_RO(name),
-       __ATTR_NULL,
+static struct attribute *extcon_attrs[] = {
+       &dev_attr_state.attr,
+       &dev_attr_name.attr,
+       NULL,
 };
+ATTRIBUTE_GROUPS(extcon);
 
 static int create_extcon_class(void)
 {
@@ -539,7 +542,7 @@ static int create_extcon_class(void)
                extcon_class = class_create(THIS_MODULE, "extcon");
                if (IS_ERR(extcon_class))
                        return PTR_ERR(extcon_class);
-               extcon_class->dev_attrs = extcon_attrs;
+               extcon_class->dev_groups = extcon_groups;
 
 #if defined(CONFIG_ANDROID)
                switch_class = class_compat_register("switch");
@@ -602,7 +605,8 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
        edev->dev->class = extcon_class;
        edev->dev->release = extcon_dev_release;
 
-       dev_set_name(edev->dev, "%s", edev->name ? edev->name : dev_name(dev));
+       edev->name = edev->name ? edev->name : dev_name(dev);
+       dev_set_name(edev->dev, "%s", edev->name);
 
        if (edev->max_supported) {
                char buf[10];