aboutsummaryrefslogtreecommitdiff
path: root/drivers/acpi
diff options
context:
space:
mode:
authorMichal Wilczynski2023-10-18 22:09:43 +0300
committerRafael J. Wysocki2023-10-24 20:54:29 +0200
commitdd0261bb9e4435a426cd86a28516129c46929ea4 (patch)
tree3880e9ed68093d0b48b083767a661c336c7e380d /drivers/acpi
parent470508f63ad2483b1ae82ed67cd504ad408b2a35 (diff)
ACPI: acpi_pad: Replace acpi_driver with platform_driver
The acpi_pad driver uses struct acpi_driver to register itself while it would be more logically consistent to use struct platform_driver for this purpose, because the corresponding platform device is present and the role of struct acpi_device is to amend the other bus types. ACPI devices are not meant to be used as proper representation of hardware entities, but to collect information on those hardware entities provided by the platform firmware. Use struct platform_driver for registering the acpi_pad driver. Suggested-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> Signed-off-by: Michal Wilczynski <michal.wilczynski@intel.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r--drivers/acpi/acpi_pad.c25
1 files changed, 14 insertions, 11 deletions
diff --git a/drivers/acpi/acpi_pad.c b/drivers/acpi/acpi_pad.c
index 7a453c5ff303..25068f2c5b4d 100644
--- a/drivers/acpi/acpi_pad.c
+++ b/drivers/acpi/acpi_pad.c
@@ -18,6 +18,7 @@
#include <linux/slab.h>
#include <linux/acpi.h>
#include <linux/perf_event.h>
+#include <linux/platform_device.h>
#include <asm/mwait.h>
#include <xen/xen.h>
@@ -430,8 +431,9 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
}
}
-static int acpi_pad_add(struct acpi_device *device)
+static int acpi_pad_probe(struct platform_device *pdev)
{
+ struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
acpi_status status;
strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
@@ -450,8 +452,10 @@ static int acpi_pad_add(struct acpi_device *device)
return 0;
}
-static void acpi_pad_remove(struct acpi_device *device)
+static void acpi_pad_remove(struct platform_device *pdev)
{
+ struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+
mutex_lock(&isolated_cpus_lock);
acpi_pad_idle_cpus(0);
mutex_unlock(&isolated_cpus_lock);
@@ -467,13 +471,12 @@ static const struct acpi_device_id pad_device_ids[] = {
};
MODULE_DEVICE_TABLE(acpi, pad_device_ids);
-static struct acpi_driver acpi_pad_driver = {
- .name = "processor_aggregator",
- .class = ACPI_PROCESSOR_AGGREGATOR_CLASS,
- .ids = pad_device_ids,
- .ops = {
- .add = acpi_pad_add,
- .remove = acpi_pad_remove,
+static struct platform_driver acpi_pad_driver = {
+ .probe = acpi_pad_probe,
+ .remove_new = acpi_pad_remove,
+ .driver = {
+ .name = "processor_aggregator",
+ .acpi_match_table = pad_device_ids,
},
};
@@ -487,12 +490,12 @@ static int __init acpi_pad_init(void)
if (power_saving_mwait_eax == 0)
return -EINVAL;
- return acpi_bus_register_driver(&acpi_pad_driver);
+ return platform_driver_register(&acpi_pad_driver);
}
static void __exit acpi_pad_exit(void)
{
- acpi_bus_unregister_driver(&acpi_pad_driver);
+ platform_driver_unregister(&acpi_pad_driver);
}
module_init(acpi_pad_init);