Skip to content
  • Anton Vorontsov's avatar
    power_supply: Make the core a boolean instead of a tristate · 0d4ed4e2
    Anton Vorontsov authored
    
    
    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: default avatarBenjamin Herrenschmidt <benh@kernel.crashing.org>
    Signed-off-by: default avatarAnton Vorontsov <cbouatmailru@gmail.com>
    0d4ed4e2