mirror of
https://github.com/torvalds/linux.git
synced 2026-03-08 01:04:41 +01:00
ACPI: tiny-power-button: Convert the driver to a platform one
While binding drivers directly to struct acpi_device objects allows basic functionality to be provided, at least in the majority of cases, there are some problems with it, related to general consistency, sysfs layout, power management operation ordering, and code cleanliness. Overall, it is better to bind drivers to platform devices than to their ACPI companions, so convert the ACPI tiny-power-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. Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com> [ rjw: White space fixup ] Link: https://patch.msgid.link/5629403.Sb9uPGUboI@rafael.j.wysocki Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
This commit is contained in:
parent
52d8640196
commit
f4203ec64e
1 changed files with 15 additions and 12 deletions
|
|
@ -1,7 +1,8 @@
|
|||
// SPDX-License-Identifier: GPL-2.0-or-later
|
||||
#include <linux/module.h>
|
||||
#include <linux/sched/signal.h>
|
||||
#include <linux/acpi.h>
|
||||
#include <linux/module.h>
|
||||
#include <linux/platform_device.h>
|
||||
#include <linux/sched/signal.h>
|
||||
#include <acpi/button.h>
|
||||
|
||||
MODULE_AUTHOR("Josh Triplett");
|
||||
|
|
@ -35,8 +36,9 @@ static u32 acpi_tiny_power_button_event(void *not_used)
|
|||
return ACPI_INTERRUPT_HANDLED;
|
||||
}
|
||||
|
||||
static int acpi_tiny_power_button_add(struct acpi_device *device)
|
||||
static int acpi_tiny_power_button_probe(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
acpi_status status;
|
||||
|
||||
if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) {
|
||||
|
|
@ -55,8 +57,10 @@ static int acpi_tiny_power_button_add(struct acpi_device *device)
|
|||
return 0;
|
||||
}
|
||||
|
||||
static void acpi_tiny_power_button_remove(struct acpi_device *device)
|
||||
static void acpi_tiny_power_button_remove(struct platform_device *pdev)
|
||||
{
|
||||
struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
|
||||
|
||||
if (device->device_type == ACPI_BUS_TYPE_POWER_BUTTON) {
|
||||
acpi_remove_fixed_event_handler(ACPI_EVENT_POWER_BUTTON,
|
||||
acpi_tiny_power_button_event);
|
||||
|
|
@ -67,14 +71,13 @@ static void acpi_tiny_power_button_remove(struct acpi_device *device)
|
|||
acpi_os_wait_events_complete();
|
||||
}
|
||||
|
||||
static struct acpi_driver acpi_tiny_power_button_driver = {
|
||||
.name = "tiny-power-button",
|
||||
.class = "tiny-power-button",
|
||||
.ids = tiny_power_button_device_ids,
|
||||
.ops = {
|
||||
.add = acpi_tiny_power_button_add,
|
||||
.remove = acpi_tiny_power_button_remove,
|
||||
static struct platform_driver acpi_tiny_power_button_driver = {
|
||||
.probe = acpi_tiny_power_button_probe,
|
||||
.remove = acpi_tiny_power_button_remove,
|
||||
.driver = {
|
||||
.name = "acpi-tiny-power-button",
|
||||
.acpi_match_table = tiny_power_button_device_ids,
|
||||
},
|
||||
};
|
||||
|
||||
module_acpi_driver(acpi_tiny_power_button_driver);
|
||||
module_platform_driver(acpi_tiny_power_button_driver);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue