power_supply: Add driver private data
authorKrzysztof Kozlowski <k.kozlowski@samsung.com>
Thu, 12 Mar 2015 07:44:01 +0000 (08:44 +0100)
committerSebastian Reichel <sre@kernel.org>
Fri, 13 Mar 2015 21:52:52 +0000 (22:52 +0100)
commite44ea364394499d38a26ed4c9668fb378ae8797f
treefaa70daae9bf311bcf12a2104e5a533b20a5e41d
parent1915a718b1872edffcb13e5436a9f7302d3d36f0
power_supply: Add driver private data

Allow drivers to store private data inside power_supply structure for
later usage in power supply operations.

Usage of driver private data is necessary to access driver's state
container object from power supply calls (like get_property()) if struct
'power_supply' is a stored there as a pointer, for example:

struct some_driver_info {
struct i2c_client       *client;
struct power_supply     *power_supply;
...
}

In such case one cannot use container_of() and must store pointer to
state container as private data.

Signed-off-by: Krzysztof Kozlowski <k.kozlowski@samsung.com>
Reviewed-by: Bartlomiej Zolnierkiewicz <b.zolnierkie@samsung.com>
Reviewed-by: Sebastian Reichel <sre@kernel.org>
Acked-by: Pavel Machek <pavel@ucw.cz>
Signed-off-by: Sebastian Reichel <sre@kernel.org>
drivers/power/power_supply_core.c
include/linux/power_supply.h