summaryrefslogtreecommitdiffstats
path: root/drivers/acpi
diff options
context:
space:
mode:
authorThomas Weißschuh <linux@weissschuh.net>2024-07-09 22:37:27 +0200
committerRafael J. Wysocki <rafael.j.wysocki@intel.com>2024-08-02 16:44:22 +0200
commitcd4884724500232480cf79d8762f3cd716ba4c1b (patch)
tree0a19108ebb592c84d8e8a958e63b1589ac010202 /drivers/acpi
parentACPI: sysfs: manage attributes as attribute_group (diff)
downloadlinux-cd4884724500232480cf79d8762f3cd716ba4c1b.tar.xz
linux-cd4884724500232480cf79d8762f3cd716ba4c1b.zip
ACPI: sysfs: manage sysfs attributes through device core
Now that the ACPI sysfs attributes are organized around an attribute_group, the device core can manage them. Signed-off-by: Thomas Weißschuh <linux@weissschuh.net> Link: https://patch.msgid.link/20240709-acpi-sysfs-groups-v2-4-058ab0667fa8@weissschuh.net [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/device_sysfs.c8
-rw-r--r--drivers/acpi/internal.h1
-rw-r--r--drivers/acpi/scan.c1
3 files changed, 7 insertions, 3 deletions
diff --git a/drivers/acpi/device_sysfs.c b/drivers/acpi/device_sysfs.c
index 4afc773383ad..0bff4a1654ed 100644
--- a/drivers/acpi/device_sysfs.c
+++ b/drivers/acpi/device_sysfs.c
@@ -596,6 +596,11 @@ static const struct attribute_group acpi_group = {
.is_visible = acpi_attr_is_visible,
};
+const struct attribute_group *acpi_groups[] = {
+ &acpi_group,
+ NULL
+};
+
/**
* acpi_device_setup_files - Create sysfs attributes of an ACPI device.
* @dev: ACPI device object.
@@ -604,8 +609,6 @@ int acpi_device_setup_files(struct acpi_device *dev)
{
int result = 0;
- result = device_add_group(&dev->dev, &acpi_group);
-
acpi_expose_nondev_subnodes(&dev->dev.kobj, &dev->data);
return result;
@@ -618,5 +621,4 @@ int acpi_device_setup_files(struct acpi_device *dev)
void acpi_device_remove_files(struct acpi_device *dev)
{
acpi_hide_nondev_subnodes(&dev->data);
- device_remove_group(&dev->dev, &acpi_group);
}
diff --git a/drivers/acpi/internal.h b/drivers/acpi/internal.h
index 601b670356e5..8e1c21e45d0e 100644
--- a/drivers/acpi/internal.h
+++ b/drivers/acpi/internal.h
@@ -120,6 +120,7 @@ int acpi_tie_acpi_dev(struct acpi_device *adev);
int acpi_device_add(struct acpi_device *device);
int acpi_device_setup_files(struct acpi_device *dev);
void acpi_device_remove_files(struct acpi_device *dev);
+extern const struct attribute_group *acpi_groups[];
void acpi_device_add_finalize(struct acpi_device *device);
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
bool acpi_device_is_enabled(const struct acpi_device *adev);
diff --git a/drivers/acpi/scan.c b/drivers/acpi/scan.c
index 59771412686b..14dba8f6faff 100644
--- a/drivers/acpi/scan.c
+++ b/drivers/acpi/scan.c
@@ -1822,6 +1822,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
device->dev.parent = parent ? &parent->dev : NULL;
device->dev.release = release;
device->dev.bus = &acpi_bus_type;
+ device->dev.groups = acpi_groups;
fwnode_init(&device->fwnode, &acpi_device_fwnode_ops);
acpi_set_device_status(device, ACPI_STA_DEFAULT);
acpi_device_get_busid(device);