Skip to content

Commit 1934fee

Browse files
zhang-ruirafaeljw
authored andcommitted
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]> Signed-off-by: Rafael J. Wysocki <[email protected]>
1 parent 42226c9 commit 1934fee

File tree

1 file changed

+15
-16
lines changed

1 file changed

+15
-16
lines changed

drivers/acpi/acpi_video.c

Lines changed: 15 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -1707,24 +1707,23 @@ static int acpi_video_resume(struct notifier_block *nb,
17071707
int i;
17081708

17091709
switch (val) {
1710-
case PM_HIBERNATION_PREPARE:
1711-
case PM_SUSPEND_PREPARE:
1712-
case PM_RESTORE_PREPARE:
1713-
return NOTIFY_DONE;
1714-
}
1715-
1716-
video = container_of(nb, struct acpi_video_bus, pm_nb);
1717-
1718-
dev_info(&video->device->dev, "Restoring backlight state\n");
1710+
case PM_POST_HIBERNATION:
1711+
case PM_POST_SUSPEND:
1712+
case PM_POST_RESTORE:
1713+
video = container_of(nb, struct acpi_video_bus, pm_nb);
1714+
1715+
dev_info(&video->device->dev, "Restoring backlight state\n");
1716+
1717+
for (i = 0; i < video->attached_count; i++) {
1718+
video_device = video->attached_array[i].bind_info;
1719+
if (video_device && video_device->brightness)
1720+
acpi_video_device_lcd_set_level(video_device,
1721+
video_device->brightness->curr);
1722+
}
17191723

1720-
for (i = 0; i < video->attached_count; i++) {
1721-
video_device = video->attached_array[i].bind_info;
1722-
if (video_device && video_device->brightness)
1723-
acpi_video_device_lcd_set_level(video_device,
1724-
video_device->brightness->curr);
1724+
return NOTIFY_OK;
17251725
}
1726-
1727-
return NOTIFY_OK;
1726+
return NOTIFY_DONE;
17281727
}
17291728

17301729
static acpi_status

0 commit comments

Comments
 (0)