[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-Id: <20180930220349.10515-2-sebastian.reichel@collabora.com>
Date: Mon, 1 Oct 2018 00:03:36 +0200
From: Sebastian Reichel <sebastian.reichel@...labora.com>
To: Sebastian Reichel <sre@...nel.org>
Cc: Greg Kroah-Hartman <gregkh@...uxfoundation.org>,
Pali Rohár <pali.rohar@...il.com>,
Milo Kim <milo.kim@...com>,
Andreas Dannenberg <dannenberg@...com>,
Krzysztof Kozlowski <k.kozlowski@...sung.com>,
Hans de Goede <hdegoede@...hat.com>,
Liam Breck <kernel@...workimprov.net>,
linux-kernel@...r.kernel.org, linux-pm@...r.kernel.org,
Sebastian Reichel <sebastian.reichel@...labora.com>
Subject: [PATCHv1 01/14] power: supply: core: add support for custom sysfs attributes
Add functionality to setup device specific sysfs attributes
in a race condition free manner
Signed-off-by: Sebastian Reichel <sebastian.reichel@...labora.com>
---
drivers/power/supply/power_supply_core.c | 1 +
include/linux/power_supply.h | 3 +++
2 files changed, 4 insertions(+)
diff --git a/drivers/power/supply/power_supply_core.c b/drivers/power/supply/power_supply_core.c
index e85361878450..cb7ddced85ed 100644
--- a/drivers/power/supply/power_supply_core.c
+++ b/drivers/power/supply/power_supply_core.c
@@ -880,6 +880,7 @@ __power_supply_register(struct device *parent,
dev_set_drvdata(dev, psy);
psy->desc = desc;
if (cfg) {
+ dev->groups = cfg->attr_grp;
psy->drv_data = cfg->drv_data;
psy->of_node =
cfg->fwnode ? to_of_node(cfg->fwnode) : cfg->of_node;
diff --git a/include/linux/power_supply.h b/include/linux/power_supply.h
index f80769175c56..410466946890 100644
--- a/include/linux/power_supply.h
+++ b/include/linux/power_supply.h
@@ -204,6 +204,9 @@ struct power_supply_config {
/* Driver private data */
void *drv_data;
+ /* Device specific sysfs attributes */
+ const struct attribute_group **attr_grp;
+
char **supplied_to;
size_t num_supplicants;
};
--
2.19.0
Powered by blists - more mailing lists