Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux
1
fork

Configure Feed

Select the types of activity you want to include in your feed.

hpet: Convert ACPI driver to a platform one

In all cases in which a struct acpi_driver is used for binding a driver
to an ACPI device object, a corresponding platform device is created by
the ACPI core and that device is regarded as a proper representation of
underlying hardware. Accordingly, a struct platform_driver should be
used by driver code to bind to that device. There are multiple reasons
why drivers should not bind directly to ACPI device objects [1].

Overall, it is better to bind drivers to platform devices than to their
ACPI companions, so convert the HPET ACPI 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.

Link: https://lore.kernel.org/all/2396510.ElGaqSPkdT@rafael.j.wysocki/ [1]
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Link: https://patch.msgid.link/3611505.QJadu78ljV@rafael.j.wysocki
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>

authored by

Rafael J. Wysocki and committed by
Greg Kroah-Hartman
71f0a267 b1c7f7aa

+10 -8
+10 -8
drivers/char/hpet.c
··· 34 34 #include <linux/io.h> 35 35 #include <linux/acpi.h> 36 36 #include <linux/hpet.h> 37 + #include <linux/platform_device.h> 37 38 #include <asm/current.h> 38 39 #include <asm/irq.h> 39 40 #include <asm/div64.h> ··· 972 971 return AE_OK; 973 972 } 974 973 975 - static int hpet_acpi_add(struct acpi_device *device) 974 + static int hpet_acpi_probe(struct platform_device *pdev) 976 975 { 976 + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); 977 977 acpi_status result; 978 978 struct hpet_data data; 979 979 ··· 1002 1000 {"", 0}, 1003 1001 }; 1004 1002 1005 - static struct acpi_driver hpet_acpi_driver = { 1006 - .name = "hpet", 1007 - .ids = hpet_device_ids, 1008 - .ops = { 1009 - .add = hpet_acpi_add, 1010 - }, 1003 + static struct platform_driver hpet_acpi_driver = { 1004 + .probe = hpet_acpi_probe, 1005 + .driver = { 1006 + .name = "hpet_acpi", 1007 + .acpi_match_table = hpet_device_ids, 1008 + }, 1011 1009 }; 1012 1010 1013 1011 static struct miscdevice hpet_misc = { HPET_MINOR, "hpet", &hpet_fops }; ··· 1022 1020 1023 1021 sysctl_header = register_sysctl("dev/hpet", hpet_table); 1024 1022 1025 - result = acpi_bus_register_driver(&hpet_acpi_driver); 1023 + result = platform_driver_register(&hpet_acpi_driver); 1026 1024 if (result < 0) { 1027 1025 unregister_sysctl_table(sysctl_header); 1028 1026 misc_deregister(&hpet_misc);