13 #include <linux/module.h>
14 #include <linux/types.h>
16 #include <linux/slab.h>
17 #include <linux/device.h>
29 static int __power_supply_changed_work(
struct device *
dev,
void *
data)
51 __power_supply_changed_work);
66 static int __power_supply_am_i_supplied(
struct device *dev,
void *data)
90 __power_supply_am_i_supplied);
98 static int __power_supply_is_system_supplied(
struct device *dev,
void *data)
117 unsigned int count = 0;
120 __power_supply_is_system_supplied);
144 static int power_supply_match_device_by_name(
struct device *dev,
void *data)
155 power_supply_match_device_by_name);
167 static void power_supply_dev_release(
struct device *dev)
169 pr_debug(
"device: '%s': %s\n", dev_name(dev), __func__);
173 #ifdef CONFIG_THERMAL
187 *temp =
val.intval * 100;
196 static int psy_register_thermal(
struct power_supply *psy)
204 psy, &psy_tzd_ops, 0, 0);
205 if (IS_ERR(psy->tzd))
206 return PTR_ERR(psy->tzd);
213 static void psy_unregister_thermal(
struct power_supply *psy)
215 if (IS_ERR_OR_NULL(psy->tzd))
220 static int psy_register_thermal(
struct power_supply *psy)
225 static void psy_unregister_thermal(
struct power_supply *psy)
242 dev->
type = &power_supply_dev_type;
244 dev->
release = power_supply_dev_release;
252 goto kobject_set_name_failed;
256 goto device_add_failed;
258 rc = psy_register_thermal(psy);
260 goto register_thermal_failed;
264 goto create_triggers_failed;
270 create_triggers_failed:
271 psy_unregister_thermal(psy);
272 register_thermal_failed:
274 kobject_set_name_failed:
287 psy_unregister_thermal(psy);
292 static int __init power_supply_class_init(
void)
296 if (IS_ERR(power_supply_class))
297 return PTR_ERR(power_supply_class);
305 static void __exit power_supply_class_exit(
void)