summaryrefslogtreecommitdiff
path: root/drivers/power/supply/power_supply_core.c
diff options
context:
space:
mode:
authorOgnjen Galic <smclt30p@gmail.com>2018-02-07 15:58:27 +0100
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2018-02-21 23:27:13 +0100
commit285995d15d3b1725d021a8a274e55f2ce30ccfa0 (patch)
tree1aefa04c3ce461968403105edc9e7f5bada19475 /drivers/power/supply/power_supply_core.c
parentfa93854f7a7ed63d054405bf3779247d5300edd3 (diff)
power: add to_power_supply macro to the API
This patch adds the to_power_supply macro to upcast a device to a power_supply struct. This is needed because the same piece of code using container_of is used in various other places, so we abstract away such low-level operations via a macro. Suggested-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com> Signed-off-by: Ognjen Galic <smclt30p@gmail.com> Reviewed-by: Sebastian Reichel <sebastian.reichel@collabora.co.uk> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/power/supply/power_supply_core.c')
-rw-r--r--drivers/power/supply/power_supply_core.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index 82f998ab5a52..feac7b066e6c 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -668,7 +668,7 @@ EXPORT_SYMBOL_GPL(power_supply_powers);
static void power_supply_dev_release(struct device *dev)
{
- struct power_supply *psy = container_of(dev, struct power_supply, dev);
+ struct power_supply *psy = to_power_supply(dev);
dev_dbg(dev, "%s\n", __func__);
kfree(psy);
}