Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

at v6.19-rc1 94 lines 2.9 kB view raw
1/* SPDX-License-Identifier: GPL-2.0-only */ 2/* 3 * Functions private to power supply class 4 * 5 * Copyright © 2007 Anton Vorontsov <cbou@mail.ru> 6 * Copyright © 2004 Szabolcs Gyurko 7 * Copyright © 2003 Ian Molton <spyro@f2s.com> 8 * 9 * Modified: 2004, Oct Szabolcs Gyurko 10 */ 11 12#include <linux/lockdep.h> 13 14struct device; 15struct device_type; 16struct power_supply; 17 18extern int power_supply_property_is_writeable(struct power_supply *psy, 19 enum power_supply_property psp); 20extern bool power_supply_has_property(struct power_supply *psy, 21 enum power_supply_property psp); 22extern bool power_supply_ext_has_property(const struct power_supply_ext *ext, 23 enum power_supply_property psp); 24 25struct power_supply_ext_registration { 26 struct list_head list_head; 27 const struct power_supply_ext *ext; 28 struct device *dev; 29 void *data; 30}; 31 32/* Make sure that the macro is a single expression */ 33#define power_supply_for_each_extension(pos, psy) \ 34 if ( ({ lockdep_assert_held(&(psy)->extensions_sem); 0; }) ) \ 35 ; \ 36 else \ 37 list_for_each_entry(pos, &(psy)->extensions, list_head) \ 38 39#ifdef CONFIG_SYSFS 40 41extern void __init power_supply_init_attrs(void); 42extern int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env); 43extern const struct attribute_group *power_supply_attr_groups[]; 44extern int power_supply_sysfs_add_extension(struct power_supply *psy, 45 const struct power_supply_ext *ext, 46 struct device *dev); 47extern void power_supply_sysfs_remove_extension(struct power_supply *psy, 48 const struct power_supply_ext *ext); 49 50#else 51 52static inline void power_supply_init_attrs(void) {} 53#define power_supply_attr_groups NULL 54#define power_supply_uevent NULL 55static inline int power_supply_sysfs_add_extension(struct power_supply *psy, 56 const struct power_supply_ext *ext, 57 struct device *dev) 58{ return 0; } 59static inline void power_supply_sysfs_remove_extension(struct power_supply *psy, 60 const struct power_supply_ext *ext) {} 61 62#endif /* CONFIG_SYSFS */ 63 64#ifdef CONFIG_LEDS_TRIGGERS 65 66extern void power_supply_update_leds(struct power_supply *psy); 67extern int power_supply_create_triggers(struct power_supply *psy); 68extern void power_supply_remove_triggers(struct power_supply *psy); 69 70#else 71 72static inline void power_supply_update_leds(struct power_supply *psy) {} 73static inline int power_supply_create_triggers(struct power_supply *psy) 74{ return 0; } 75static inline void power_supply_remove_triggers(struct power_supply *psy) {} 76 77#endif /* CONFIG_LEDS_TRIGGERS */ 78 79#ifdef CONFIG_POWER_SUPPLY_HWMON 80 81int power_supply_add_hwmon_sysfs(struct power_supply *psy); 82void power_supply_remove_hwmon_sysfs(struct power_supply *psy); 83 84#else 85 86static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy) 87{ 88 return 0; 89} 90 91static inline 92void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {} 93 94#endif /* CONFIG_POWER_SUPPLY_HWMON */