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.

Input: atlas - 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 ACPI Atlas button 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/3429591.aeNJFYEL58@rafael.j.wysocki
Signed-off-by: Dmitry Torokhov <dmitry.torokhov@gmail.com>

authored by

Rafael J. Wysocki and committed by
Dmitry Torokhov
b8303880 beb2b0a2

+12 -10
+12 -10
drivers/input/misc/atlas_btns.c
··· 14 14 #include <linux/input.h> 15 15 #include <linux/types.h> 16 16 #include <linux/acpi.h> 17 + #include <linux/platform_device.h> 17 18 #include <linux/uaccess.h> 18 19 19 20 #define ACPI_ATLAS_NAME "Atlas ACPI" ··· 58 57 return status; 59 58 } 60 59 61 - static int atlas_acpi_button_add(struct acpi_device *device) 60 + static int atlas_acpi_button_probe(struct platform_device *pdev) 62 61 { 62 + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); 63 63 acpi_status status; 64 64 int i; 65 65 int err; ··· 108 106 return err; 109 107 } 110 108 111 - static void atlas_acpi_button_remove(struct acpi_device *device) 109 + static void atlas_acpi_button_remove(struct platform_device *pdev) 112 110 { 111 + struct acpi_device *device = ACPI_COMPANION(&pdev->dev); 113 112 acpi_status status; 114 113 115 114 status = acpi_remove_address_space_handler(device->handle, ··· 127 124 }; 128 125 MODULE_DEVICE_TABLE(acpi, atlas_device_ids); 129 126 130 - static struct acpi_driver atlas_acpi_driver = { 131 - .name = ACPI_ATLAS_NAME, 132 - .class = ACPI_ATLAS_CLASS, 133 - .ids = atlas_device_ids, 134 - .ops = { 135 - .add = atlas_acpi_button_add, 136 - .remove = atlas_acpi_button_remove, 127 + static struct platform_driver atlas_acpi_driver = { 128 + .probe = atlas_acpi_button_probe, 129 + .remove = atlas_acpi_button_remove, 130 + .driver = { 131 + .name = ACPI_ATLAS_NAME, 132 + .acpi_match_table = atlas_device_ids, 137 133 }, 138 134 }; 139 - module_acpi_driver(atlas_acpi_driver); 135 + module_platform_driver(atlas_acpi_driver); 140 136 141 137 MODULE_AUTHOR("Jaya Kumar"); 142 138 MODULE_LICENSE("GPL");