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>