aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/extcon
diff options
context:
space:
mode:
authorMark Brown <broonie@opensource.wolfsonmicro.com>2012-08-16 15:03:21 -0400
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>2012-08-16 17:05:40 -0400
commit9baf3220afe870b2526397919857b271c3affda5 (patch)
tree7f76d3be9e5c20162a68f18f5d46868ea2313aa9 /drivers/extcon
parent1508d8111f0e965ebe06c32dc4d176750eb53c3a (diff)
extcon: Ensure dynamically allocated sysfs attributes are initialised
The operation of lockdep requires that all dynamically allocated sysfs nodes are initialised using sysfs_attr_init() otherwise lots of warnings are generated. Ensure that all the dynamically allocated attributes that extcon generates have this done. Signed-off-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/extcon')
-rw-r--r--drivers/extcon/extcon-class.c4
1 files changed, 4 insertions, 0 deletions
diff --git a/drivers/extcon/extcon-class.c b/drivers/extcon/extcon-class.c
index f6419f9db76c..481cfa0f2118 100644
--- a/drivers/extcon/extcon-class.c
+++ b/drivers/extcon/extcon-class.c
@@ -30,6 +30,7 @@
30#include <linux/err.h> 30#include <linux/err.h>
31#include <linux/extcon.h> 31#include <linux/extcon.h>
32#include <linux/slab.h> 32#include <linux/slab.h>
33#include <linux/sysfs.h>
33 34
34/* 35/*
35 * extcon_cable_name suggests the standard cable names for commonly used 36 * extcon_cable_name suggests the standard cable names for commonly used
@@ -673,10 +674,12 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
673 cable->attr_g.name = str; 674 cable->attr_g.name = str;
674 cable->attr_g.attrs = cable->attrs; 675 cable->attr_g.attrs = cable->attrs;
675 676
677 sysfs_attr_init(&cable->attr_name.attr);
676 cable->attr_name.attr.name = "name"; 678 cable->attr_name.attr.name = "name";
677 cable->attr_name.attr.mode = 0444; 679 cable->attr_name.attr.mode = 0444;
678 cable->attr_name.show = cable_name_show; 680 cable->attr_name.show = cable_name_show;
679 681
682 sysfs_attr_init(&cable->attr_state.attr);
680 cable->attr_state.attr.name = "state"; 683 cable->attr_state.attr.name = "state";
681 cable->attr_state.attr.mode = 0644; 684 cable->attr_state.attr.mode = 0644;
682 cable->attr_state.show = cable_state_show; 685 cable->attr_state.show = cable_state_show;
@@ -722,6 +725,7 @@ int extcon_dev_register(struct extcon_dev *edev, struct device *dev)
722 goto err_muex; 725 goto err_muex;
723 } 726 }
724 strcpy(name, buf); 727 strcpy(name, buf);
728 sysfs_attr_init(&edev->d_attrs_muex[index].attr);
725 edev->d_attrs_muex[index].attr.name = name; 729 edev->d_attrs_muex[index].attr.name = name;
726 edev->d_attrs_muex[index].attr.mode = 0000; 730 edev->d_attrs_muex[index].attr.mode = 0000;
727 edev->attrs_muex[index] = &edev->d_attrs_muex[index] 731 edev->attrs_muex[index] = &edev->d_attrs_muex[index]