aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--drivers/power/power_supply_core.c7
-rw-r--r--include/linux/power_supply.h1
2 files changed, 8 insertions, 0 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c
index 329b46b2327d..b10c121244e5 100644
--- a/drivers/power/power_supply_core.c
+++ b/drivers/power/power_supply_core.c
@@ -147,6 +147,12 @@ struct power_supply *power_supply_get_by_name(char *name)
147} 147}
148EXPORT_SYMBOL_GPL(power_supply_get_by_name); 148EXPORT_SYMBOL_GPL(power_supply_get_by_name);
149 149
150int power_supply_powers(struct power_supply *psy, struct device *dev)
151{
152 return sysfs_create_link_nowarn(&psy->dev->kobj, &dev->kobj, "powers");
153}
154EXPORT_SYMBOL_GPL(power_supply_powers);
155
150static void power_supply_dev_release(struct device *dev) 156static void power_supply_dev_release(struct device *dev)
151{ 157{
152 pr_debug("device: '%s': %s\n", dev_name(dev), __func__); 158 pr_debug("device: '%s': %s\n", dev_name(dev), __func__);
@@ -202,6 +208,7 @@ EXPORT_SYMBOL_GPL(power_supply_register);
202void power_supply_unregister(struct power_supply *psy) 208void power_supply_unregister(struct power_supply *psy)
203{ 209{
204 cancel_work_sync(&psy->changed_work); 210 cancel_work_sync(&psy->changed_work);
211 sysfs_remove_link(&psy->dev->kobj, "powers");
205 power_supply_remove_triggers(psy); 212 power_supply_remove_triggers(psy);
206 device_unregister(psy->dev); 213 device_unregister(psy->dev);
207} 214}
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index 040a7b08e7c7..2e3c8279b3b0 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -218,6 +218,7 @@ static inline int power_supply_is_system_supplied(void) { return -ENOSYS; }
218extern int power_supply_register(struct device *parent, 218extern int power_supply_register(struct device *parent,
219 struct power_supply *psy); 219 struct power_supply *psy);
220extern void power_supply_unregister(struct power_supply *psy); 220extern void power_supply_unregister(struct power_supply *psy);
221extern int power_supply_powers(struct power_supply *psy, struct device *dev);
221 222
222/* For APM emulation, think legacy userspace. */ 223/* For APM emulation, think legacy userspace. */
223extern struct class *power_supply_class; 224extern struct class *power_supply_class;