Skip to content

Commit 6e35ab5

Browse files
committed
ACPI: HED: Convert the driver to a platform one
While binding drivers directly to struct acpi_device objects allows basic functionality to be provided, at least in the majority of cases, there are some problems with it, related to general consistency, sysfs layout, power management operation ordering, and code cleanliness. Overall, it is better to bind drivers to platform devices than to their ACPI companions, so convert the ACPI hardware error device (HED) driver to a platform one. While this is not expected to alter functionality, it changes sysfs layout and so it will be visible to user space. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Link: https://patch.msgid.link/8620378.T7Z3S40VBb@rafael.j.wysocki
1 parent 6cba603 commit 6e35ab5

1 file changed

Lines changed: 13 additions & 10 deletions

File tree

drivers/acpi/hed.c

Lines changed: 13 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,7 @@
1313
#include <linux/module.h>
1414
#include <linux/init.h>
1515
#include <linux/acpi.h>
16+
#include <linux/platform_device.h>
1617
#include <acpi/hed.h>
1718

1819
static const struct acpi_device_id acpi_hed_ids[] = {
@@ -47,8 +48,9 @@ static void acpi_hed_notify(acpi_handle handle, u32 event, void *data)
4748
blocking_notifier_call_chain(&acpi_hed_notify_list, 0, NULL);
4849
}
4950

50-
static int acpi_hed_add(struct acpi_device *device)
51+
static int acpi_hed_probe(struct platform_device *pdev)
5152
{
53+
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
5254
int err;
5355

5456
/* Only one hardware error device */
@@ -64,26 +66,27 @@ static int acpi_hed_add(struct acpi_device *device)
6466
return err;
6567
}
6668

67-
static void acpi_hed_remove(struct acpi_device *device)
69+
static void acpi_hed_remove(struct platform_device *pdev)
6870
{
71+
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
72+
6973
acpi_dev_remove_notify_handler(device, ACPI_DEVICE_NOTIFY,
7074
acpi_hed_notify);
7175
hed_handle = NULL;
7276
}
7377

74-
static struct acpi_driver acpi_hed_driver = {
75-
.name = "hardware_error_device",
76-
.class = "hardware_error",
77-
.ids = acpi_hed_ids,
78-
.ops = {
79-
.add = acpi_hed_add,
80-
.remove = acpi_hed_remove,
78+
static struct platform_driver acpi_hed_driver = {
79+
.probe = acpi_hed_probe,
80+
.remove = acpi_hed_remove,
81+
.driver = {
82+
.name = "acpi-hardware-error-device",
83+
.acpi_match_table = acpi_hed_ids,
8184
},
8285
};
8386

8487
static int __init acpi_hed_driver_init(void)
8588
{
86-
return acpi_bus_register_driver(&acpi_hed_driver);
89+
return platform_driver_register(&acpi_hed_driver);
8790
}
8891
subsys_initcall(acpi_hed_driver_init);
8992

0 commit comments

Comments
 (0)