ACPI: video: improve PM notifer callback
PATCH 1/1 ACPI: video: improve PM notifer callback
PM notifier callbacks should check for supported events rather than filter out the unsupported events. So that it won't break when a new event is introduced.
No functional change in this patch.
Signed-off-by Zhang Rui <[email protected]>
--- drivers/acpi/acpi_video.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)
drivers/acpi/acpi_video.c +15 -16
@@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb,int i;switch (val) { -case PM_HIBERNATION_PREPARE : -case PM_SUSPEND_PREPARE : -case PM_RESTORE_PREPARE : -return NOTIFY_DONE ; - } - - video = container_of(nb, struct acpi_video_bus, pm_nb); - -dev_info (&video->device->dev,"Restoring backlight state\n" ); +case PM_POST_HIBERNATION : +case PM_POST_SUSPEND : +case PM_POST_RESTORE : + video = container_of(nb, struct acpi_video_bus, pm_nb); + +dev_info (&video->device->dev,"Restoring backlight state\n" ); + +for (i =0 ; i < video->attached_count; i++) { + video_device = video->attached_array[i].bind_info; +if (video_device && video_device->brightness) +acpi_video_device_lcd_set_level (video_device, + video_device->brightness->curr); + } -for (i =0 ; i < video->attached_count; i++) { - video_device = video->attached_array[i].bind_info; -if (video_device && video_device->brightness) -acpi_video_device_lcd_set_level (video_device, - video_device->brightness->curr); +return NOTIFY_OK ; } - -return NOTIFY_OK ; +return NOTIFY_DONE ; } static acpi_status
Signature · 1 line
2.17.1
Quoted 47 lines · Zhang Rui
PM notifier callbacks should check for supported events rather than filter out the unsupported events. So that it won't break when a new event is introduced.
No functional change in this patch.
Signed-off-by Zhang Rui <[email protected]>--- drivers/acpi/acpi_video.c | 31 +++++++++++++++---------------- 1 file changed, 15 insertions(+), 16 deletions(-)drivers/acpi/acpi_video.c +13
-13@@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb,int i;switch (val) { -case PM_HIBERNATION_PREPARE : -case PM_SUSPEND_PREPARE : -case PM_RESTORE_PREPARE : -return NOTIFY_DONE ; - } - - video = container_of(nb, struct acpi_video_bus, pm_nb); - -dev_info (&video->device->dev,"Restoring backlight state\n" ); +case PM_POST_HIBERNATION : +case PM_POST_SUSPEND : +case PM_POST_RESTORE : + video = container_of(nb, struct acpi_video_bus, pm_nb); + +dev_info (&video->device->dev,"Restoring backlight state\n" ); + +for (i =0 ; i < video->attached_count; i++) { + video_device = video->attached_array[i].bind_info; +if (video_device && video_device->brightness) +acpi_video_device_lcd_set_level (video_device, + video_device->brightness->curr); + } -for (i =0 ; i < video->attached_count; i++) { - video_device = video->attached_array[i].bind_info; -if (video_device && video_device->brightness) - acpi_video_device_lcd_set_level(video_device,
drivers/acpi/acpi_video.c static int acpi_video_resume(struct notifier_block *nb,
Quoted 10 lines
drivers/acpi/acpi_video.c +2
-4- video_device->brightness->curr); +return NOTIFY_OK ; } - -return NOTIFY_OK ; +return NOTIFY_DONE ; } static acpi_status --
Applied as 5.19 material, thanks!