mirror of
https://github.com/BobTheBlinker/android_kernel_motorola_sm6375.git
synced 2026-10-30 11:41:38 -04:00
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 <[email protected]>
Reviewed-by: Bartlomiej Zolnierkiewicz <[email protected]>
Reviewed-by: Sebastian Reichel <[email protected]>
Acked-by: Pavel Machek <[email protected]>
Signed-off-by: Sebastian Reichel <[email protected]>
This commit is contained in:
parent
1915a718b1
commit
e44ea36439
2 changed files with 10 additions and 0 deletions
|
|
@ -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");
|
||||
|
|
|
|||
Loading…
Reference in a new issue