Commit dd0261bb authored by Michal Wilczynski's avatar Michal Wilczynski Committed by Rafael J. Wysocki

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: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: default avatarMichal Wilczynski <michal.wilczynski@intel.com>
Signed-off-by: default avatarRafael J. Wysocki <rafael.j.wysocki@intel.com>
parent 470508f6
......@@ -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);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment