Conditionally define a new symbol DRIVER_OWNS_PSY_STRUCT, which is
set in "kernel_ver.h" based on on the kernel version. Use it to
distinguish code used for kernels that differ in whether a power
supply structure is owned by the driver, or by the power supply
core.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
When a battery connection is initialized, a gb_battery structure for
it is allocated in gb_battery_connection_init(). Currently that
function ends by calling init_and_register(); in the event an error
occurs, init_and_register() is responsible for freeing the allocated
gb_battery structure.
Make the code a bit better balanced by having the function that
allocates the structure be responsible for freeing it in case of
error.
Signed-off-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@google.com>
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>
These aren't used anymore and so can be removed.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
This gets rid of lots of duplication of code.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
Some files are still prefixed with "gb-" with the reasoning that the modules
would be named so, i.e. gb-*.ko. But this can be done by playing a bit in
Makefile instead and keep uniform naming of .c files.
Lets try it.
Signed-off-by: Viresh Kumar <viresh.kumar@linaro.org>
Reviewed-by: Alex Elder <elder@linaro.org>
Signed-off-by: Greg Kroah-Hartman <greg@kroah.com>
2015-01-22 11:27:20 +08:00
Renamed from drivers/staging/greybus/gb-battery.c (Browse further)