Skip to content

Commit dd0261b

Browse files
mwilczyrafaeljw
authored andcommitted
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 <[email protected]> Signed-off-by: Michal Wilczynski <[email protected]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 470508f commit dd0261b

File tree

1 file changed

+14
-11
lines changed

1 file changed

+14
-11
lines changed

drivers/acpi/acpi_pad.c

Lines changed: 14 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -18,6 +18,7 @@
1818
#include <linux/slab.h>
1919
#include <linux/acpi.h>
2020
#include <linux/perf_event.h>
21+
#include <linux/platform_device.h>
2122
#include <asm/mwait.h>
2223
#include <xen/xen.h>
2324

@@ -430,8 +431,9 @@ static void acpi_pad_notify(acpi_handle handle, u32 event,
430431
}
431432
}
432433

433-
static int acpi_pad_add(struct acpi_device *device)
434+
static int acpi_pad_probe(struct platform_device *pdev)
434435
{
436+
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
435437
acpi_status status;
436438

437439
strcpy(acpi_device_name(device), ACPI_PROCESSOR_AGGREGATOR_DEVICE_NAME);
@@ -450,8 +452,10 @@ static int acpi_pad_add(struct acpi_device *device)
450452
return 0;
451453
}
452454

453-
static void acpi_pad_remove(struct acpi_device *device)
455+
static void acpi_pad_remove(struct platform_device *pdev)
454456
{
457+
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
458+
455459
mutex_lock(&isolated_cpus_lock);
456460
acpi_pad_idle_cpus(0);
457461
mutex_unlock(&isolated_cpus_lock);
@@ -467,13 +471,12 @@ static const struct acpi_device_id pad_device_ids[] = {
467471
};
468472
MODULE_DEVICE_TABLE(acpi, pad_device_ids);
469473

470-
static struct acpi_driver acpi_pad_driver = {
471-
.name = "processor_aggregator",
472-
.class = ACPI_PROCESSOR_AGGREGATOR_CLASS,
473-
.ids = pad_device_ids,
474-
.ops = {
475-
.add = acpi_pad_add,
476-
.remove = acpi_pad_remove,
474+
static struct platform_driver acpi_pad_driver = {
475+
.probe = acpi_pad_probe,
476+
.remove_new = acpi_pad_remove,
477+
.driver = {
478+
.name = "processor_aggregator",
479+
.acpi_match_table = pad_device_ids,
477480
},
478481
};
479482

@@ -487,12 +490,12 @@ static int __init acpi_pad_init(void)
487490
if (power_saving_mwait_eax == 0)
488491
return -EINVAL;
489492

490-
return acpi_bus_register_driver(&acpi_pad_driver);
493+
return platform_driver_register(&acpi_pad_driver);
491494
}
492495

493496
static void __exit acpi_pad_exit(void)
494497
{
495-
acpi_bus_unregister_driver(&acpi_pad_driver);
498+
platform_driver_unregister(&acpi_pad_driver);
496499
}
497500

498501
module_init(acpi_pad_init);

0 commit comments

Comments
 (0)