aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/power/power_supply_core.c
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/power/power_supply_core.c')
-rw-r--r--drivers/power/power_supply_core.c10
1 files changed, 4 insertions, 6 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 138dd76ee347..cb1ccb472921 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -41,7 +41,7 @@ static void power_supply_changed_work(struct work_struct *work)
41 41
42 dev_dbg(psy->dev, "%s\n", __func__); 42 dev_dbg(psy->dev, "%s\n", __func__);
43 43
44 class_for_each_device(power_supply_class, psy, 44 class_for_each_device(power_supply_class, NULL, psy,
45 __power_supply_changed_work); 45 __power_supply_changed_work);
46 46
47 power_supply_update_leds(psy); 47 power_supply_update_leds(psy);
@@ -79,7 +79,7 @@ int power_supply_am_i_supplied(struct power_supply *psy)
79{ 79{
80 int error; 80 int error;
81 81
82 error = class_for_each_device(power_supply_class, psy, 82 error = class_for_each_device(power_supply_class, NULL, psy,
83 __power_supply_am_i_supplied); 83 __power_supply_am_i_supplied);
84 84
85 dev_dbg(psy->dev, "%s %d\n", __func__, error); 85 dev_dbg(psy->dev, "%s %d\n", __func__, error);
@@ -91,15 +91,13 @@ int power_supply_register(struct device *parent, struct power_supply *psy)
91{ 91{
92 int rc = 0; 92 int rc = 0;
93 93
94 psy->dev = device_create(power_supply_class, parent, 0, 94 psy->dev = device_create_drvdata(power_supply_class, parent, 0,
95 "%s", psy->name); 95 psy, "%s", psy->name);
96 if (IS_ERR(psy->dev)) { 96 if (IS_ERR(psy->dev)) {
97 rc = PTR_ERR(psy->dev); 97 rc = PTR_ERR(psy->dev);
98 goto dev_create_failed; 98 goto dev_create_failed;
99 } 99 }
100 100
101 dev_set_drvdata(psy->dev, psy);
102
103 INIT_WORK(&psy->changed_work, power_supply_changed_work); 101 INIT_WORK(&psy->changed_work, power_supply_changed_work);
104 102
105 rc = power_supply_create_attrs(psy); 103 rc = power_supply_create_attrs(psy);