Skip to contentSkip to conversation

ACPI: TAD: Use dev_groups in struct device_driver

PATCH New Rafael J. Wysocki 1 participant 1 message Mar 10 ACPI

lore
Share & tools
lore

Rafael J. Wysocki

author maintainer
#0 lore raw

PATCH 1/1 ACPI: TAD: Use dev_groups in struct device_driver

From: Rafael J. Wysocki <[email protected]>

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.

---

This is on top of linux-next.

---
 drivers/acpi/acpi_tad.c |   15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)
drivers/acpi/acpi_tad.c +6 -9
@@ -586,6 +586,11 @@ static const struct attribute_group acpi
 	.is_visible = acpi_tad_attr_is_visible,
 };
 
+static const struct attribute_group *acpi_tad_attr_groups[] = {
+	&acpi_tad_attr_group,
+	NULL,
+};
+
 #ifdef CONFIG_RTC_CLASS
 /* RTC class device interface */
 
@@ -663,8 +668,6 @@ static void acpi_tad_remove(struct platf
 
 	device_init_wakeup(dev, false);
 
-	sysfs_remove_group(&dev->kobj, &acpi_tad_attr_group);
-
 	scoped_guard(pm_runtime_noresume, dev) {
 		if (dd->capabilities & ACPI_TAD_AC_WAKE) {
 			acpi_tad_disable_timer(dev, ACPI_TAD_AC_TIMER);
@@ -687,7 +690,6 @@ static int acpi_tad_probe(struct platfor
 	struct acpi_tad_driver_data *dd;
 	acpi_status status;
 	unsigned long long caps;
-	int ret;
 
 	/*
 	 * Initialization failure messages are mostly about firmware issues, so
@@ -731,12 +733,6 @@ static int acpi_tad_probe(struct platfor
 	pm_runtime_enable(dev);
 	pm_runtime_suspend(dev);
 
-	ret = sysfs_create_group(&dev->kobj, &acpi_tad_attr_group);
-	if (ret) {
-		acpi_tad_remove(pdev);
-		return ret;
-	}
-
 	if (caps & ACPI_TAD_RT)
 		acpi_tad_register_rtc(dev);
 
@@ -752,6 +748,7 @@ static struct platform_driver acpi_tad_d
 	.driver = {
 		.name = "acpi-tad",
 		.acpi_match_table = acpi_tad_ids,
+		.dev_groups = acpi_tad_attr_groups,
 	},
 	.probe = acpi_tad_probe,
 	.remove = acpi_tad_remove,