mirror of
https://github.com/torvalds/linux.git
synced 2026-06-03 20:14:06 +02:00
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>
This commit is contained in:
parent
beb2b0a26c
commit
b8303880b6
|
|
@ -14,6 +14,7 @@
|
||||||
#include <linux/input.h>
|
#include <linux/input.h>
|
||||||
#include <linux/types.h>
|
#include <linux/types.h>
|
||||||
#include <linux/acpi.h>
|
#include <linux/acpi.h>
|
||||||
|
#include <linux/platform_device.h>
|
||||||
#include <linux/uaccess.h>
|
#include <linux/uaccess.h>
|
||||||
|
|
||||||
#define ACPI_ATLAS_NAME "Atlas ACPI"
|
#define ACPI_ATLAS_NAME "Atlas ACPI"
|
||||||
|
|
@ -57,8 +58,9 @@ static acpi_status acpi_atlas_button_handler(u32 function,
|
||||||
return status;
|
return status;
|
||||||
}
|
}
|
||||||
|
|
||||||
static int atlas_acpi_button_add(struct acpi_device *device)
|
static int atlas_acpi_button_probe(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
int i;
|
int i;
|
||||||
int err;
|
int err;
|
||||||
|
|
@ -106,8 +108,9 @@ static int atlas_acpi_button_add(struct acpi_device *device)
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
static void atlas_acpi_button_remove(struct acpi_device *device)
|
static void atlas_acpi_button_remove(struct platform_device *pdev)
|
||||||
{
|
{
|
||||||
|
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||||
acpi_status status;
|
acpi_status status;
|
||||||
|
|
||||||
status = acpi_remove_address_space_handler(device->handle,
|
status = acpi_remove_address_space_handler(device->handle,
|
||||||
|
|
@ -124,16 +127,15 @@ static const struct acpi_device_id atlas_device_ids[] = {
|
||||||
};
|
};
|
||||||
MODULE_DEVICE_TABLE(acpi, atlas_device_ids);
|
MODULE_DEVICE_TABLE(acpi, atlas_device_ids);
|
||||||
|
|
||||||
static struct acpi_driver atlas_acpi_driver = {
|
static struct platform_driver atlas_acpi_driver = {
|
||||||
.name = ACPI_ATLAS_NAME,
|
.probe = atlas_acpi_button_probe,
|
||||||
.class = ACPI_ATLAS_CLASS,
|
.remove = atlas_acpi_button_remove,
|
||||||
.ids = atlas_device_ids,
|
.driver = {
|
||||||
.ops = {
|
.name = ACPI_ATLAS_NAME,
|
||||||
.add = atlas_acpi_button_add,
|
.acpi_match_table = atlas_device_ids,
|
||||||
.remove = atlas_acpi_button_remove,
|
|
||||||
},
|
},
|
||||||
};
|
};
|
||||||
module_acpi_driver(atlas_acpi_driver);
|
module_platform_driver(atlas_acpi_driver);
|
||||||
|
|
||||||
MODULE_AUTHOR("Jaya Kumar");
|
MODULE_AUTHOR("Jaya Kumar");
|
||||||
MODULE_LICENSE("GPL");
|
MODULE_LICENSE("GPL");
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue
Block a user