Skip to content

Commit

Permalink
platform/x86: intel_pmc_ipc: Switch to use driver->dev_groups
Browse files Browse the repository at this point in the history
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@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
  • Loading branch information
Mika Westerberg authored and Andy Shevchenko committed Jan 22, 2020
1 parent fc07ac6 commit cf85e7c
Showing 1 changed file with 7 additions and 10 deletions.
17 changes: 7 additions & 10 deletions drivers/platform/x86/intel_pmc_ipc.c
Original file line number Diff line number Diff line change
Expand Up @@ -539,6 +539,11 @@ static const struct attribute_group intel_ipc_group = {
.attrs = intel_ipc_attrs,
};

static const struct attribute_group *intel_ipc_groups[] = {
&intel_ipc_group,
NULL
};

static struct resource punit_res_array[] = {
/* Punit BIOS */
{
Expand Down Expand Up @@ -879,18 +884,10 @@ static int ipc_plat_probe(struct platform_device *pdev)
goto err_irq;
}

ret = sysfs_create_group(&pdev->dev.kobj, &intel_ipc_group);
if (ret) {
dev_err(&pdev->dev, "Failed to create sysfs group %d\n",
ret);
goto err_sys;
}

ipcdev.has_gcr_regs = true;

return 0;
err_sys:
devm_free_irq(&pdev->dev, ipcdev.irq, &ipcdev);

err_irq:
platform_device_unregister(ipcdev.tco_dev);
platform_device_unregister(ipcdev.punit_dev);
Expand All @@ -901,7 +898,6 @@ static int ipc_plat_probe(struct platform_device *pdev)

static int ipc_plat_remove(struct platform_device *pdev)
{
sysfs_remove_group(&pdev->dev.kobj, &intel_ipc_group);
devm_free_irq(&pdev->dev, ipcdev.irq, &ipcdev);
platform_device_unregister(ipcdev.tco_dev);
platform_device_unregister(ipcdev.punit_dev);
Expand All @@ -916,6 +912,7 @@ static struct platform_driver ipc_plat_driver = {
.driver = {
.name = "pmc-ipc-plat",
.acpi_match_table = ACPI_PTR(ipc_acpi_ids),
.dev_groups = intel_ipc_groups,
},
};

Expand Down

0 comments on commit cf85e7c

Please sign in to comment.