Skip to content

Commit 93afe8b

Browse files
committed
ACPI: TAD: Use dev_groups in struct device_driver
Instead of creating and removing the device sysfs attributes directly during probe and remove of the driver, respectively, use dev_groups in struct device_driver to point to the attribute definitions and let the core take care of creating and removing them. No intentional functional impact. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/2836803.mvXUDI8C0e@rafael.j.wysocki
1 parent 6db176e commit 93afe8b

1 file changed

Lines changed: 6 additions & 9 deletions

File tree

drivers/acpi/acpi_tad.c

Lines changed: 6 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -586,6 +586,11 @@ static const struct attribute_group acpi_tad_attr_group = {
586586
.is_visible = acpi_tad_attr_is_visible,
587587
};
588588

589+
static const struct attribute_group *acpi_tad_attr_groups[] = {
590+
&acpi_tad_attr_group,
591+
NULL,
592+
};
593+
589594
#ifdef CONFIG_RTC_CLASS
590595
/* RTC class device interface */
591596

@@ -663,8 +668,6 @@ static void acpi_tad_remove(struct platform_device *pdev)
663668

664669
device_init_wakeup(dev, false);
665670

666-
sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group);
667-
668671
scoped_guard(pm_runtime_noresume, dev) {
669672
if (dd->capabilities & ACPI_TAD_AC_WAKE) {
670673
acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
@@ -687,7 +690,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
687690
struct acpi_tad_driver_data *dd;
688691
acpi_status status;
689692
unsigned long long caps;
690-
int ret;
691693

692694
/*
693695
* Initialization failure messages are mostly about firmware issues, so
@@ -731,12 +733,6 @@ static int acpi_tad_probe(struct platform_device *pdev)
731733
pm_runtime_enable(dev);
732734
pm_runtime_suspend(dev);
733735

734-
ret = sysfs_create_group(&dev->kobj, &acpi_tad_attr_group);
735-
if (ret) {
736-
acpi_tad_remove(pdev);
737-
return ret;
738-
}
739-
740736
if (caps & ACPI_TAD_RT)
741737
acpi_tad_register_rtc(dev);
742738

@@ -752,6 +748,7 @@ static struct platform_driver acpi_tad_driver = {
752748
.driver = {
753749
.name = "acpi-tad",
754750
.acpi_match_table = acpi_tad_ids,
751+
.dev_groups = acpi_tad_attr_groups,
755752
},
756753
.probe = acpi_tad_probe,
757754
.remove = acpi_tad_remove,

0 commit comments

Comments
 (0)