Skip to content

Commit

Permalink
ACPI: video: Simplify acpi_video_unregister_backlight()
Browse files Browse the repository at this point in the history
When acpi_video_register() has not run yet the video_bus_head will be
empty, so there is no need to check the register_count flag first.

Acked-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Signed-off-by: Hans de Goede <hdegoede@redhat.com>
  • Loading branch information
Hans de Goede committed Sep 2, 2022
1 parent c1af8be commit 038a819
Showing 1 changed file with 4 additions and 8 deletions.
12 changes: 4 additions & 8 deletions drivers/acpi/acpi_video.c
Original file line number Diff line number Diff line change
Expand Up @@ -2257,14 +2257,10 @@ void acpi_video_unregister_backlight(void)
{
struct acpi_video_bus *video;

mutex_lock(&register_count_mutex);
if (register_count) {
mutex_lock(&video_list_lock);
list_for_each_entry(video, &video_bus_head, entry)
acpi_video_bus_unregister_backlight(video);
mutex_unlock(&video_list_lock);
}
mutex_unlock(&register_count_mutex);
mutex_lock(&video_list_lock);
list_for_each_entry(video, &video_bus_head, entry)
acpi_video_bus_unregister_backlight(video);
mutex_unlock(&video_list_lock);
}

bool acpi_video_handles_brightness_key_presses(void)
Expand Down

0 comments on commit 038a819

Please sign in to comment.