diff options
author | Krzysztof Kozlowski <k.kozlowski@samsung.com> | 2015-03-12 07:44:01 (GMT) |
---|---|---|
committer | Sebastian Reichel <sre@kernel.org> | 2015-03-13 21:52:52 (GMT) |
commit | e44ea364394499d38a26ed4c9668fb378ae8797f (patch) | |
tree | faa70daae9bf311bcf12a2104e5a533b20a5e41d /drivers/power | |
parent | 1915a718b1872edffcb13e5436a9f7302d3d36f0 (diff) | |
download | linux-e44ea364394499d38a26ed4c9668fb378ae8797f.tar.xz |
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>
Diffstat (limited to 'drivers/power')
-rw-r--r-- | drivers/power/power_supply_core.c | 6 |
1 files changed, 6 insertions, 0 deletions
diff --git a/drivers/power/power_supply_core.c b/drivers/power/power_supply_core.c index 44c8104..1c0978f 100644 --- a/drivers/power/power_supply_core.c +++ b/drivers/power/power_supply_core.c @@ -674,6 +674,12 @@ void power_supply_unregister(struct power_supply *psy) } EXPORT_SYMBOL_GPL(power_supply_unregister); +void *power_supply_get_drvdata(struct power_supply *psy) +{ + return psy->drv_data; +} +EXPORT_SYMBOL_GPL(power_supply_get_drvdata); + static int __init power_supply_class_init(void) { power_supply_class = class_create(THIS_MODULE, "power_supply"); |