[PATCH v2 35/36] mfd: intel_pmc_bxt: Switch to use driver->dev_groups

From: Mika Westerberg
Date: Wed Jan 08 2020 - 06:42:40 EST


The driver core provides support for adding additional attributes for
devices via new ->dev_groups member of struct device_driver. Convert the
driver to use that instead of adding the attributes manually.

Suggested-by: Andy Shevchenko <andriy.shevchenko@xxxxxxxxxxxxxxx>
Signed-off-by: Mika Westerberg <mika.westerberg@xxxxxxxxxxxxxxx>
---
drivers/mfd/intel_pmc_bxt.c | 21 +++++++--------------
1 file changed, 7 insertions(+), 14 deletions(-)

diff --git a/drivers/mfd/intel_pmc_bxt.c b/drivers/mfd/intel_pmc_bxt.c
index 76f166c1455b..9f2eb75bdf78 100644
--- a/drivers/mfd/intel_pmc_bxt.c
+++ b/drivers/mfd/intel_pmc_bxt.c
@@ -244,6 +244,11 @@ static const struct attribute_group intel_pmc_group = {
.attrs = intel_pmc_attrs,
};

+static const struct attribute_group *intel_pmc_groups[] = {
+ &intel_pmc_group,
+ NULL,
+};
+
static int pmc_create_punit_device(void)
{
struct mfd_cell punit = {
@@ -492,27 +497,14 @@ static int intel_pmc_probe(struct platform_device *pdev)
ret = pmc_create_devices();
if (ret) {
dev_err(&pdev->dev, "Failed to create pmc devices\n");
- goto err_ipc;
- }
-
- ret = sysfs_create_group(&pdev->dev.kobj, &intel_pmc_group);
- if (ret) {
- dev_err(&pdev->dev, "Failed to create sysfs group %d\n",
- ret);
- goto err_ipc;
+ intel_scu_ipc_remove(scu);
}

- return 0;
-
-err_ipc:
- intel_scu_ipc_remove(scu);
-
return ret;
}

static int intel_pmc_remove(struct platform_device *pdev)
{
- sysfs_remove_group(&pdev->dev.kobj, &intel_pmc_group);
intel_scu_ipc_remove(platform_get_drvdata(pdev));
pmcdev.dev = NULL;
return 0;
@@ -524,6 +516,7 @@ static struct platform_driver intel_pmc_driver = {
.driver = {
.name = "intel_pmc_bxt",
.acpi_match_table = ACPI_PTR(intel_pmc_acpi_ids),
+ .dev_groups = intel_pmc_groups,
},
};

--
2.24.1