From nobody Thu Dec 18 03:56:17 2025 Received: from smtp.kernel.org (aws-us-west-2-korg-mail-1.web.codeaurora.org [10.30.226.201]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id D8E5433556C; Mon, 15 Dec 2025 14:04:20 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=10.30.226.201 ARC-Seal: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765807461; cv=none; b=jkoSj9Q6vSYWiLR0cj80eS+2weKURYH2+TJnhIXTs6ghiDi5LB2g6NmsWqo/wIJPwU3ngWLqufkdOBFZX6uuQgkWfy3ttKT9N29NPMVyeCdh8vpCx0u/0JLv4mkYMZg83NitoxmlvIXvKBXYuceZ2M07XxDKzH3682plvVBrwRo= ARC-Message-Signature: i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1765807461; c=relaxed/simple; bh=6vvbtUhyx+Vh39xk3H6F4iiMvieFsent7KLa+qxDcY4=; h=From:To:Cc:Subject:Date:Message-ID:In-Reply-To:References: MIME-Version:Content-Type; b=opC1fu6cNZjl+fRVtFgxZapTsLugZ3b1N9mj2NZWOGHSxqE0IvwG7SfGDkoQQ5ToOw+y0X+YoyuwtZJTIKVr1MqW/suyJGKc5sTfn24j17OkKfG7wkdJd8/Xq/ob7sbNKG9AASwkrvgRYvmKlaGnO9iiNzv8hucaMiJm/sIQ3s0= ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b=vE6Dlzif; arc=none smtp.client-ip=10.30.226.201 Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=kernel.org header.i=@kernel.org header.b="vE6Dlzif" Received: by smtp.kernel.org (Postfix) with ESMTPSA id 68AD6C16AAE; Mon, 15 Dec 2025 14:04:19 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=kernel.org; s=k20201202; t=1765807460; bh=6vvbtUhyx+Vh39xk3H6F4iiMvieFsent7KLa+qxDcY4=; h=From:To:Cc:Subject:Date:In-Reply-To:References:From; b=vE6DlzifwZmzMb4xs9dw0ykAxqiRL+2H/di8enVz7Geo+HPKjJVJFGUiFRbq2vJhG xc6a/koJaNrULcnYSMU9k3TxJExkIBjL0XbPL3zX8lYIrU3Ef3+aB1++j3HiYimmNd jpYcoerCEH9YvHfbb9lZkTVhEQB9AyIiqS/0oHukMa2cOoXIExsChc59MlISDDtU7h nvsX8m1THb3QniwEPqw6IRKoR483UM1NjaZx//DmItEZKbJicBJCuKq66TLwn9Vnd1 sxz3dSuYMB7qGR4OsJjhbHiRrxunBfRMA4QhP5qJWK+VKJ+niGWcQ1k+jnYBn/jU0r 33IQpcKEI/N3Q== From: "Rafael J. Wysocki" To: Linux ACPI Cc: Hans de Goede , LKML , Linux PM , Thomas =?ISO-8859-1?Q?Wei=DFschuh?= , Armin Wolf Subject: [PATCH v2 05/10] ACPI: tiny-power-button: Convert the driver to a platform one Date: Mon, 15 Dec 2025 14:59:00 +0100 Message-ID: <5629403.Sb9uPGUboI@rafael.j.wysocki> Organization: Linux Kernel Development In-Reply-To: <2685338.Lt9SDvczpP@rafael.j.wysocki> References: <2685338.Lt9SDvczpP@rafael.j.wysocki> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Transfer-Encoding: quoted-printable Content-Type: text/plain; charset="utf-8" From: Rafael J. Wysocki 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 --- v1 -> v2: No changes --- drivers/acpi/tiny-power-button.c | 27 +++++++++++++++------------ 1 file changed, 15 insertions(+), 12 deletions(-) --- a/drivers/acpi/tiny-power-button.c +++ b/drivers/acpi/tiny-power-button.c @@ -1,7 +1,8 @@ // SPDX-License-Identifier: GPL-2.0-or-later +#include #include +#include #include -#include #include =20 MODULE_AUTHOR("Josh Triplett"); @@ -35,8 +36,9 @@ static u32 acpi_tiny_power_button_event( return ACPI_INTERRUPT_HANDLED; } =20 -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 =3D ACPI_COMPANION(&pdev->dev); acpi_status status; =20 if (device->device_type =3D=3D ACPI_BUS_TYPE_POWER_BUTTON) { @@ -55,8 +57,10 @@ static int acpi_tiny_power_button_add(st return 0; } =20 -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 =3D ACPI_COMPANION(&pdev->dev); + if (device->device_type =3D=3D 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_remov acpi_os_wait_events_complete(); } =20 -static struct acpi_driver acpi_tiny_power_button_driver =3D { - .name =3D "tiny-power-button", - .class =3D "tiny-power-button", - .ids =3D tiny_power_button_device_ids, - .ops =3D { - .add =3D acpi_tiny_power_button_add, - .remove =3D acpi_tiny_power_button_remove, - }, +static struct platform_driver acpi_tiny_power_button_driver =3D { + .probe =3D acpi_tiny_power_button_probe, + .remove =3D acpi_tiny_power_button_remove, + .driver =3D { + .name =3D "acpi-tiny-power-button", + .acpi_match_table =3D tiny_power_button_device_ids, + }, }; =20 -module_acpi_driver(acpi_tiny_power_button_driver); +module_platform_driver(acpi_tiny_power_button_driver);