drivers/power/supply/power_supply.h
Source file repositories/reference/linux-study-clean/drivers/power/supply/power_supply.h
File Facts
- System
- Linux kernel
- Corpus path
drivers/power/supply/power_supply.h- Extension
.h- Size
- 2945 bytes
- Lines
- 95
- Domain
- Driver Families
- Bucket
- drivers/power
- Inferred role
- Driver Families: implementation source
- Status
- source implementation candidate
Why This File Exists
Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Repeatable hardware-adapter layer. Deep compatibility for every driver is out of scope; this atlas records patterns, probe lifecycles, bus glue, IRQ/DMA usage, and links back to core abstractions.
- Defines or uses C structs; map object ownership, embedded links, reference counts, and lock ownership.
Dependency Surface
linux/lockdep.h
Detected Declarations
struct devicestruct device_typestruct power_supplystruct power_supply_ext_registrationfunction power_supply_init_attrsfunction power_supply_sysfs_remove_extensionfunction power_supply_update_ledsfunction power_supply_remove_triggersfunction power_supply_add_hwmon_sysfsfunction power_supply_remove_hwmon_sysfs
Annotated Snippet
struct power_supply_ext_registration {
struct list_head list_head;
const struct power_supply_ext *ext;
struct device *dev;
void *data;
};
/* Make sure that the macro is a single expression */
#define power_supply_for_each_extension(pos, psy) \
if ( ({ lockdep_assert_held(&(psy)->extensions_sem); 0; }) ) \
; \
else \
list_for_each_entry(pos, &(psy)->extensions, list_head) \
#ifdef CONFIG_SYSFS
extern void __init power_supply_init_attrs(void);
extern int power_supply_uevent(const struct device *dev, struct kobj_uevent_env *env);
extern const struct attribute_group *power_supply_attr_groups[];
extern int power_supply_sysfs_add_extension(struct power_supply *psy,
const struct power_supply_ext *ext,
struct device *dev);
extern void power_supply_sysfs_remove_extension(struct power_supply *psy,
const struct power_supply_ext *ext);
#else
static inline void power_supply_init_attrs(void) {}
#define power_supply_attr_groups NULL
#define power_supply_uevent NULL
static inline int power_supply_sysfs_add_extension(struct power_supply *psy,
const struct power_supply_ext *ext,
struct device *dev)
{ return 0; }
static inline void power_supply_sysfs_remove_extension(struct power_supply *psy,
const struct power_supply_ext *ext) {}
#endif /* CONFIG_SYSFS */
#ifdef CONFIG_LEDS_TRIGGERS
extern void power_supply_update_leds(struct power_supply *psy);
extern int power_supply_create_triggers(struct power_supply *psy);
extern void power_supply_remove_triggers(struct power_supply *psy);
#else
static inline void power_supply_update_leds(struct power_supply *psy) {}
static inline int power_supply_create_triggers(struct power_supply *psy)
{ return 0; }
static inline void power_supply_remove_triggers(struct power_supply *psy) {}
#endif /* CONFIG_LEDS_TRIGGERS */
#ifdef CONFIG_POWER_SUPPLY_HWMON
int power_supply_add_hwmon_sysfs(struct power_supply *psy);
void power_supply_remove_hwmon_sysfs(struct power_supply *psy);
#else
static inline int power_supply_add_hwmon_sysfs(struct power_supply *psy)
{
return 0;
}
static inline
void power_supply_remove_hwmon_sysfs(struct power_supply *psy) {}
#endif /* CONFIG_POWER_SUPPLY_HWMON */
Annotation
- Immediate include surface: `linux/lockdep.h`.
- Detected declarations: `struct device`, `struct device_type`, `struct power_supply`, `struct power_supply_ext_registration`, `function power_supply_init_attrs`, `function power_supply_sysfs_remove_extension`, `function power_supply_update_leds`, `function power_supply_remove_triggers`, `function power_supply_add_hwmon_sysfs`, `function power_supply_remove_hwmon_sysfs`.
- Atlas domain: Driver Families / drivers/power.
- Implementation status: source implementation candidate.
Implementation Notes
- This generated page is the file-by-file coverage layer; curated subsystem chapters should link here when they synthesize a multi-file control flow.
- Core OS pages should be promoted from atlas-only to deep-reviewed when they explain data structures, invariants, locking, lifecycle, and C implementation snippets.
- Driver-family pages are intentionally pattern-oriented unless they are part of the selected PCIe/NVMe representative device path.