Skip to content

Commit cd48847

Browse files
t-8chrafaeljw
authored andcommitted
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 <[email protected]> Link: https://patch.msgid.link/[email protected] [ rjw: Changelog edits ] Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent f6bae04 commit cd48847

File tree

3 files changed

+7
-3
lines changed

3 files changed

+7
-3
lines changed

drivers/acpi/device_sysfs.c

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -596,6 +596,11 @@ static const struct attribute_group acpi_group = {
596596
.is_visible = acpi_attr_is_visible,
597597
};
598598

599+
const struct attribute_group *acpi_groups[] = {
600+
&acpi_group,
601+
NULL
602+
};
603+
599604
/**
600605
* acpi_device_setup_files - Create sysfs attributes of an ACPI device.
601606
* @dev: ACPI device object.
@@ -604,8 +609,6 @@ int acpi_device_setup_files(struct acpi_device *dev)
604609
{
605610
int result = 0;
606611

607-
result = device_add_group(&dev->dev, &acpi_group);
608-
609612
acpi_expose_nondev_subnodes(&dev->dev.kobj, &dev->data);
610613

611614
return result;
@@ -618,5 +621,4 @@ int acpi_device_setup_files(struct acpi_device *dev)
618621
void acpi_device_remove_files(struct acpi_device *dev)
619622
{
620623
acpi_hide_nondev_subnodes(&dev->data);
621-
device_remove_group(&dev->dev, &acpi_group);
622624
}

drivers/acpi/internal.h

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,7 @@ int acpi_tie_acpi_dev(struct acpi_device *adev);
120120
int acpi_device_add(struct acpi_device *device);
121121
int acpi_device_setup_files(struct acpi_device *dev);
122122
void acpi_device_remove_files(struct acpi_device *dev);
123+
extern const struct attribute_group *acpi_groups[];
123124
void acpi_device_add_finalize(struct acpi_device *device);
124125
void acpi_free_pnp_ids(struct acpi_device_pnp *pnp);
125126
bool acpi_device_is_enabled(const struct acpi_device *adev);

drivers/acpi/scan.c

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1822,6 +1822,7 @@ void acpi_init_device_object(struct acpi_device *device, acpi_handle handle,
18221822
device->dev.parent = parent ? &parent->dev : NULL;
18231823
device->dev.release = release;
18241824
device->dev.bus = &acpi_bus_type;
1825+
device->dev.groups = acpi_groups;
18251826
fwnode_init(&device->fwnode, &acpi_device_fwnode_ops);
18261827
acpi_set_device_status(device, ACPI_STA_DEFAULT);
18271828
acpi_device_get_busid(device);

0 commit comments

Comments
 (0)