power: supply: core: add power_supply_for_each_device()
Introduce power_supply_for_each_device(), which is a wrapper for class_for_each_device() using the power_supply_class and going through all devices. This allows making the power_supply_class itself a local variable, so that drivers cannot mess with it and simplifies the code slightly. Reviewed-by: Ricardo B. Marliere <ricardo@marliere.net> Link: https://lore.kernel.org/r/20240301-psy-class-cleanup-v1-1-aebe8c4b6b08@collabora.com Signed-off-by: Sebastian Reichel <sebastian.reichel@collabora.com>
This commit is contained in:
@@ -894,8 +894,7 @@ 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 const struct class power_supply_class;
|
||||
extern int power_supply_for_each_device(void *data, int (*fn)(struct device *dev, void *data));
|
||||
|
||||
static inline bool power_supply_is_amp_property(enum power_supply_property psp)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user