Skip to content

Commit c04c697

Browse files
Matthew Garrettrafaeljw
authored andcommitted
ACPI / video: Always call acpi_video_init_brightness() on init
We have to call acpi_video_init_brightness() even if we're not going to initialise the backlight - Thinkpads seem to use this as the trigger for enabling ACPI notifications rather than handling it in firmware. [rjw: Drop the brightness object created by acpi_video_init_brightness() if we are not going to use it.] Signed-off-by: Matthew Garrett <matthew.garrett@nebula.com> Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
1 parent 242b228 commit c04c697

File tree

1 file changed

+8
-3
lines changed

1 file changed

+8
-3
lines changed

drivers/acpi/video.c

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -898,6 +898,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
898898
device->cap._DDC = 1;
899899
}
900900

901+
if (acpi_video_init_brightness(device))
902+
return;
903+
901904
if (acpi_video_backlight_support()) {
902905
struct backlight_properties props;
903906
struct pci_dev *pdev;
@@ -907,9 +910,6 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
907910
static int count = 0;
908911
char *name;
909912

910-
result = acpi_video_init_brightness(device);
911-
if (result)
912-
return;
913913
name = kasprintf(GFP_KERNEL, "acpi_video%d", count);
914914
if (!name)
915915
return;
@@ -969,6 +969,11 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
969969
if (result)
970970
printk(KERN_ERR PREFIX "Create sysfs link\n");
971971

972+
} else {
973+
/* Remove the brightness object. */
974+
kfree(device->brightness->levels);
975+
kfree(device->brightness);
976+
device->brightness = NULL;
972977
}
973978
}
974979

0 commit comments

Comments
 (0)