diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index 81a55e974feb..6e776be5bfa0 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h @@ -381,8 +381,14 @@ struct power_supply_battery_info { extern struct atomic_notifier_head power_supply_notifier; extern int power_supply_reg_notifier(struct notifier_block *nb); extern void power_supply_unreg_notifier(struct notifier_block *nb); +#if IS_ENABLED(CONFIG_POWER_SUPPLY) extern struct power_supply *power_supply_get_by_name(const char *name); extern void power_supply_put(struct power_supply *psy); +#else +static inline void power_supply_put(struct power_supply *psy) {} +static inline struct power_supply *power_supply_get_by_name(const char *name) +{ return NULL; } +#endif #ifdef CONFIG_OF extern struct power_supply *power_supply_get_by_phandle(struct device_node *np, const char *property);