mirror of
https://github.com/torvalds/linux.git
synced 2024-11-13 23:51:39 +00:00
7eff2e7a8b
This changes the uevent buffer functions to use a struct instead of a long list of parameters. It does no longer require the caller to do the proper buffer termination and size accounting, which is currently wrong in some places. It fixes a known bug where parts of the uevent environment are overwritten because of wrong index calculations. Many thanks to Mathieu Desnoyers for finding bugs and improving the error handling. Signed-off-by: Kay Sievers <kay.sievers@vrfy.org> Cc: Mathieu Desnoyers <mathieu.desnoyers@polymtl.ca> Cc: Cornelia Huck <cornelia.huck@de.ibm.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
42 lines
1.2 KiB
C
42 lines
1.2 KiB
C
/*
|
|
* Functions private to power supply class
|
|
*
|
|
* Copyright © 2007 Anton Vorontsov <cbou@mail.ru>
|
|
* Copyright © 2004 Szabolcs Gyurko
|
|
* Copyright © 2003 Ian Molton <spyro@f2s.com>
|
|
*
|
|
* Modified: 2004, Oct Szabolcs Gyurko
|
|
*
|
|
* You may use this code as per GPL version 2
|
|
*/
|
|
|
|
#ifdef CONFIG_SYSFS
|
|
|
|
extern int power_supply_create_attrs(struct power_supply *psy);
|
|
extern void power_supply_remove_attrs(struct power_supply *psy);
|
|
extern int power_supply_uevent(struct device *dev, struct kobj_uevent_env *env);
|
|
|
|
#else
|
|
|
|
static inline int power_supply_create_attrs(struct power_supply *psy)
|
|
{ return 0; }
|
|
static inline void power_supply_remove_attrs(struct power_supply *psy) {}
|
|
#define power_supply_uevent NULL
|
|
|
|
#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 */
|