OSDN Git Service

greybus: battery: update for 4.1 power supply api changes
authorGreg Kroah-Hartman <gregkh@google.com>
Fri, 1 May 2015 18:41:00 +0000 (20:41 +0200)
committerGreg Kroah-Hartman <gregkh@google.com>
Tue, 5 May 2015 09:09:56 +0000 (11:09 +0200)
commita549be518623e0948213bdacd338183bba033229
tree74d862bc5039923b46f3244b9c449999442d79b3
parentf03eec87720d3427443b64f2d1b237b85d5c68b4
greybus: battery: update for 4.1 power supply api changes

The 4.1-rc1 kernel changed the power supply apis such that the
structures are now owned by the power supply core, and not the
individual drivers.  This broke the greybus battery driver, so update it
to support both the old and the new apis.

The API changes were such that I can't "hide" them in kernel_ver.h, but
rather the driver itself needs to have ugly #ifdefs in it.  I tried to
keep it to a minimum, making a sub-function for initializing the power
supply device that is implemented differently for different kernel
versions.

When this is submitted upstream, or if we ever move our AP development
to 4.1 or greater, the support for older kernels can be removed.

Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
Reviewed-by: Viresh Kumar <viresh.kumar@linaro.org>
drivers/staging/greybus/battery.c