diff options
Diffstat (limited to 'drivers')
-rw-r--r-- | drivers/power/power_supply_core.c | 28 |
1 files changed, 28 insertions, 0 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 12cd6e36ff1d..cce75b40b435 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c | |||
@@ -116,6 +116,34 @@ int power_supply_is_system_supplied(void) | |||
116 | } | 116 | } |
117 | EXPORT_SYMBOL_GPL(power_supply_is_system_supplied); | 117 | EXPORT_SYMBOL_GPL(power_supply_is_system_supplied); |
118 | 118 | ||
119 | int power_supply_set_battery_charged(struct power_supply *psy) | ||
120 | { | ||
121 | if (psy->type == POWER_SUPPLY_TYPE_BATTERY && psy->set_charged) { | ||
122 | psy->set_charged(psy); | ||
123 | return 0; | ||
124 | } | ||
125 | |||
126 | return -EINVAL; | ||
127 | } | ||
128 | EXPORT_SYMBOL_GPL(power_supply_set_battery_charged); | ||
129 | |||
130 | static int power_supply_match_device_by_name(struct device *dev, void *data) | ||
131 | { | ||
132 | const char *name = data; | ||
133 | struct power_supply *psy = dev_get_drvdata(dev); | ||
134 | |||
135 | return strcmp(psy->name, name) == 0; | ||
136 | } | ||
137 | |||
138 | struct power_supply *power_supply_get_by_name(char *name) | ||
139 | { | ||
140 | struct device *dev = class_find_device(power_supply_class, NULL, name, | ||
141 | power_supply_match_device_by_name); | ||
142 | |||
143 | return dev ? dev_get_drvdata(dev) : NULL; | ||
144 | } | ||
145 | EXPORT_SYMBOL_GPL(power_supply_get_by_name); | ||
146 | |||
119 | int power_supply_register(struct device *parent, struct power_supply *psy) | 147 | int power_supply_register(struct device *parent, struct power_supply *psy) |
120 | { | 148 | { |
121 | int rc = 0; | 149 | int rc = 0; |