diff options
author | Anton Vorontsov <cbouatmailru@gmail.com> | 2012-05-05 00:06:19 -0400 |
---|---|---|
committer | Anton Vorontsov <anton.vorontsov@linaro.org> | 2012-05-05 00:15:52 -0400 |
commit | 0d4ed4e27a4cb180af395fa3d7aa98d79f3d3015 (patch) | |
tree | 5b034e5214020e9819c80de42bb5bb009728ea02 | |
parent | a2ebfe2fc6e088a70d06cd15a5bc9bcb621cc195 (diff) |
power_supply: Make the core a boolean instead of a tristate
On Mon, Apr 02, 2012 at 01:53:23PM +1000, Benjamin Herrenschmidt wrote:
> > drivers/built-in.o: In function `.nouveau_pm_trigger':
> > (.text+0xa56e8): undefined reference to `.power_supply_is_system_supplied'
> >
> > nouveau probably needs to depends on CONFIG_POWER_SUPPLY to force a module
> > build with the latter is =m
>
> Ok, not that trivial...
>
> The problem is more like POWER_SUPPLY should be a bool, not a tristate.
>
> If you think about it: you don't want things like nouveau to depend on a
> random subsystem like that, people will never get it. In fact,
> POWER_SUPPLY provides empty inline stubs when not enabled, so that's
> really designed to not have depends...
>
> However that -cannot- work if POWER_SUPPLY is modular and the drivers
> who use it are not.
>
> The only fixes here that make sense I can think of
> that don't also involve Kconfig horrors are:
>
> - Ugly: in power_supply.h, use the extern variant if
>
> defined(CONFIG_POWER_SUPPLY) ||
> (defined(CONFIG_POWER_SUPPLY_MODULE) && defined(MODULE))
>
> IE. use the stub if power supply is a module and what is being built is
> built-in. Of course that's not only ugly, it somewhat sucks from a user
> perspective as the subsystem now exists but can't be used by some
> drivers...
>
> - Better: Just make the bloody thing a bool :-) The power supply
> framework itself is small enough, just make it a boolean option and
> avoid the problem entirely. The actual power supply sub drivers can
> remain modular of course.
Suggested-by: Benjamin Herrenschmidt <benh@kernel.crashing.org>
Signed-off-by: Anton Vorontsov <cbouatmailru@gmail.com>
-rw-r--r-- | drivers/power/Kconfig | 2 | ||||
-rw-r--r-- | include/linux/power_supply.h | 2 |
2 files changed, 2 insertions, 2 deletions
diff --git a/drivers/power/Kconfig b/drivers/power/Kconfig index 99dc29f2f2f2..0c52a4079124 100644 --- a/drivers/power/Kconfig +++ b/drivers/power/Kconfig | |||
@@ -1,5 +1,5 @@ | |||
1 | menuconfig POWER_SUPPLY | 1 | menuconfig POWER_SUPPLY |
2 | tristate "Power supply class support" | 2 | bool "Power supply class support" |
3 | help | 3 | help |
4 | Say Y here to enable power supply class support. This allows | 4 | Say Y here to enable power supply class support. This allows |
5 | power supply (batteries, AC, USB) monitoring by userspace | 5 | power supply (batteries, AC, USB) monitoring by userspace |
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h index fd17ae0f9c20..3b912bee28d1 100644 --- a/include/linux/power_supply.h +++ b/include/linux/power_supply.h | |||
@@ -212,7 +212,7 @@ extern void power_supply_changed(struct power_supply *psy); | |||
212 | extern int power_supply_am_i_supplied(struct power_supply *psy); | 212 | extern int power_supply_am_i_supplied(struct power_supply *psy); |
213 | extern int power_supply_set_battery_charged(struct power_supply *psy); | 213 | extern int power_supply_set_battery_charged(struct power_supply *psy); |
214 | 214 | ||
215 | #if defined(CONFIG_POWER_SUPPLY) || defined(CONFIG_POWER_SUPPLY_MODULE) | 215 | #ifdef CONFIG_POWER_SUPPLY |
216 | extern int power_supply_is_system_supplied(void); | 216 | extern int power_supply_is_system_supplied(void); |
217 | #else | 217 | #else |
218 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } | 218 | static inline int power_supply_is_system_supplied(void) { return -ENOSYS; } |