return power_supply_get_drvdata(psy);
}
-static inline struct power_supply *to_power_supply(struct device *dev)
-{
- return dev_get_drvdata(dev);
-}
-
static inline int ds2780_battery_io(struct ds2780_device_info *dev_info,
char *buf, int addr, size_t count, int io)
{
return power_supply_get_drvdata(psy);
}
-static inline struct power_supply *to_power_supply(struct device *dev)
-{
- return dev_get_drvdata(dev);
-}
-
static inline int ds2781_battery_io(struct ds2781_device_info *dev_info,
char *buf, int addr, size_t count, int io)
{
static void power_supply_dev_release(struct device *dev)
{
- struct power_supply *psy = container_of(dev, struct power_supply, dev);
+ struct power_supply *psy = to_power_supply(dev);
dev_dbg(dev, "%s\n", __func__);
kfree(psy);
}
extern void power_supply_unregister(struct power_supply *psy);
extern int power_supply_powers(struct power_supply *psy, struct device *dev);
+#define to_power_supply(device) container_of(device, struct power_supply, dev)
+
extern void *power_supply_get_drvdata(struct power_supply *psy);
/* For APM emulation, think legacy userspace. */
extern struct class *power_supply_class;