2023-10-25 11:19:21

by Wilczynski, Michal

[permalink] [raw]
Subject: [PATCH v1 0/6] Replace acpi_driver with platform_driver

This patchset is a continuation of efforts from [1] aiming to replace
acpi_driver with platform_driver. To ease up review effort I'm sending
miniseries per driver, with a replacement patch + various improvements
that were noticed by me, or during internal review.

This mini-series takes care of acpi_video driver.

[1] - https://lore.kernel.org/linux-acpi/[email protected]/T/#t

Michal Wilczynski (6):
ACPI: acpi_video: Remove unnecessary checks
ACPI: acpi_video: Use yes_or_no helper instead of ternary operator
ACPI: acpi_video: Remove unnecessary driver_data clear
ACPI: acpi_video: Replace acpi_driver with platform_driver
ACPI: acpi_video: Rename ACPI device instances from device to adev
ACPI: acpi_video: Fix holes in acpi_video_bus

drivers/acpi/acpi_video.c | 101 +++++++++++++++++---------------------
1 file changed, 46 insertions(+), 55 deletions(-)

--
2.41.0


2023-10-25 11:19:23

by Wilczynski, Michal

[permalink] [raw]
Subject: [PATCH v1 5/6] ACPI: acpi_video: Rename ACPI device instances from device to adev

Since transformation from ACPI driver to platform driver there are
two devices on which the driver operates - ACPI device and platform
device. For the sake of reader this calls for the distinction in
their naming, to avoid confusion. Rename relevant ACPI devices to adev,
as corresponding platform devices are called pdev.

Signed-off-by: Michal Wilczynski <[email protected]>
---
drivers/acpi/acpi_video.c | 36 ++++++++++++++++++------------------
1 file changed, 18 insertions(+), 18 deletions(-)

diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c
index 5b9fb3374a2e..bfc7f51a527d 100644
--- a/drivers/acpi/acpi_video.c
+++ b/drivers/acpi/acpi_video.c
@@ -1526,7 +1526,7 @@ static int acpi_video_bus_stop_devices(struct acpi_video_bus *video)
static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
{
struct acpi_video_bus *video = data;
- struct acpi_device *device = video->device;
+ struct acpi_device *adev = video->device;
struct input_dev *input;
int keycode = 0;

@@ -1559,12 +1559,12 @@ static void acpi_video_bus_notify(acpi_handle handle, u32 event, void *data)
break;

default:
- acpi_handle_debug(device->handle, "Unsupported event [0x%x]\n",
+ acpi_handle_debug(adev->handle, "Unsupported event [0x%x]\n",
event);
break;
}

- if (acpi_notifier_call_chain(device, event, 0))
+ if (acpi_notifier_call_chain(adev, event, 0))
/* Something vetoed the keypress. */
keycode = 0;

@@ -1971,16 +1971,16 @@ static int instance;

static int acpi_video_bus_probe(struct platform_device *pdev)
{
- struct acpi_device *device = ACPI_COMPANION(&pdev->dev);
+ struct acpi_device *adev = ACPI_COMPANION(&pdev->dev);
struct acpi_video_bus *video;
bool auto_detect;
int error;
acpi_status status;

status = acpi_walk_namespace(ACPI_TYPE_DEVICE,
- acpi_dev_parent(device)->handle, 1,
- acpi_video_bus_match, NULL,
- device, NULL);
+ acpi_dev_parent(adev)->handle, 1,
+ acpi_video_bus_match, NULL,
+ adev, NULL);
if (status == AE_ALREADY_EXISTS) {
pr_info(FW_BUG
"Duplicate ACPI video bus devices for the"
@@ -1996,21 +1996,21 @@ static int acpi_video_bus_probe(struct platform_device *pdev)
return -ENOMEM;

/* a hack to fix the duplicate name "VID" problem on T61 */
- if (!strcmp(device->pnp.bus_id, "VID")) {
+ if (!strcmp(adev->pnp.bus_id, "VID")) {
if (instance)
- device->pnp.bus_id[3] = '0' + instance;
+ adev->pnp.bus_id[3] = '0' + instance;
instance++;
}
/* a hack to fix the duplicate name "VGA" problem on Pa 3553 */
- if (!strcmp(device->pnp.bus_id, "VGA")) {
+ if (!strcmp(adev->pnp.bus_id, "VGA")) {
if (instance)
- device->pnp.bus_id[3] = '0' + instance;
+ adev->pnp.bus_id[3] = '0' + instance;
instance++;
}

- video->device = device;
- strcpy(acpi_device_name(device), ACPI_VIDEO_BUS_NAME);
- strcpy(acpi_device_class(device), ACPI_VIDEO_CLASS);
+ video->device = adev;
+ strcpy(acpi_device_name(adev), ACPI_VIDEO_BUS_NAME);
+ strcpy(acpi_device_class(adev), ACPI_VIDEO_CLASS);
platform_set_drvdata(pdev, video);

acpi_video_bus_find_cap(video);
@@ -2021,7 +2021,7 @@ static int acpi_video_bus_probe(struct platform_device *pdev)
mutex_init(&video->device_list_lock);
INIT_LIST_HEAD(&video->video_device_list);

- error = acpi_video_bus_get_devices(video, device);
+ error = acpi_video_bus_get_devices(video, adev);
if (error)
goto err_put_video;

@@ -2029,10 +2029,10 @@ static int acpi_video_bus_probe(struct platform_device *pdev)
* HP ZBook Fury 16 G10 requires ACPI video's child devices have _PS0
* evaluated to have functional panel brightness control.
*/
- acpi_device_fix_up_power_extended(device);
+ acpi_device_fix_up_power_extended(adev);

pr_info("%s [%s] (multi-head: %s rom: %s post: %s)\n",
- ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(device),
+ ACPI_VIDEO_DEVICE_NAME, acpi_device_bid(adev),
str_yes_no(video->flags.multihead),
str_yes_no(video->flags.rom),
str_yes_no(video->flags.post));
@@ -2059,7 +2059,7 @@ static int acpi_video_bus_probe(struct platform_device *pdev)
if (error)
goto err_del;

- error = acpi_dev_install_notify_handler(device, ACPI_DEVICE_NOTIFY,
+ error = acpi_dev_install_notify_handler(adev, ACPI_DEVICE_NOTIFY,
acpi_video_bus_notify, video);
if (error)
goto err_remove;
--
2.41.0

2023-10-25 12:57:19

by Rafael J. Wysocki

[permalink] [raw]
Subject: Re: [PATCH v1 0/6] Replace acpi_driver with platform_driver

On Wed, Oct 25, 2023 at 2:34 PM Michal Wilczynski
<[email protected]> wrote:
>
> This patchset is a continuation of efforts from [1] aiming to replace
> acpi_driver with platform_driver. To ease up review effort I'm sending
> miniseries per driver, with a replacement patch + various improvements
> that were noticed by me, or during internal review.
>
> This mini-series takes care of acpi_video driver.
>
> [1] - https://lore.kernel.org/linux-acpi/[email protected]/T/#t
>
> Michal Wilczynski (6):
> ACPI: acpi_video: Remove unnecessary checks
> ACPI: acpi_video: Use yes_or_no helper instead of ternary operator
> ACPI: acpi_video: Remove unnecessary driver_data clear
> ACPI: acpi_video: Replace acpi_driver with platform_driver
> ACPI: acpi_video: Rename ACPI device instances from device to adev
> ACPI: acpi_video: Fix holes in acpi_video_bus
>
> drivers/acpi/acpi_video.c | 101 +++++++++++++++++---------------------
> 1 file changed, 46 insertions(+), 55 deletions(-)
>
> --

Because this is not going to get into 6.7 anyway, I'm deferring the
review of it until 6.7-rc1 is out.

Thanks!