mirror of
https://git.kernel.org/pub/scm/linux/kernel/git/next/linux-next.git
synced 2025-01-15 21:23:23 +00:00
ACPI video: Don't export sysfs backlight interface if query _BCL fail
Currently the acpi video module export the backlight interface to sysfs also if acpi_video_device_lcd_query_levels() fails to read _BLC method (e.g. because the method is not available). In this case the userspace don't know which brightness level are supported and can't set a brightness level (echo return with: "write error: Invalid Argument"). This happend e.g. on a ASUS RF1 (correct supported by the asus-laptop module). The video module should not export the backlight interface if query _BLC fail, because you can't set anything from userspace and this make it useless. http://bugzilla.kernel.org/show_bug.cgi?id=8375 Signed-off-by: Danny Kukawka <dkukawka@suse.de> Acked-by: Luming Yu <luming.yu@intel.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Len Brown <len.brown@intel.com>
This commit is contained in:
parent
23b0f015bf
commit
f70ac0e965
@ -559,7 +559,6 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag)
|
||||
|
||||
static void acpi_video_device_find_cap(struct acpi_video_device *device)
|
||||
{
|
||||
acpi_integer status;
|
||||
acpi_handle h_dummy1;
|
||||
int i;
|
||||
u32 max_level = 0;
|
||||
@ -593,9 +592,9 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
|
||||
device->cap._DSS = 1;
|
||||
}
|
||||
|
||||
status = acpi_video_device_lcd_query_levels(device, &obj);
|
||||
if (ACPI_SUCCESS(acpi_video_device_lcd_query_levels(device, &obj))) {
|
||||
|
||||
if (obj && obj->type == ACPI_TYPE_PACKAGE && obj->package.count >= 2) {
|
||||
if (obj->package.count >= 2) {
|
||||
int count = 0;
|
||||
union acpi_object *o;
|
||||
|
||||
@ -616,6 +615,7 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
|
||||
continue;
|
||||
}
|
||||
br->levels[count] = (u32) o->integer.value;
|
||||
|
||||
if (br->levels[count] > max_level)
|
||||
max_level = br->levels[count];
|
||||
count++;
|
||||
@ -634,9 +634,13 @@ static void acpi_video_device_find_cap(struct acpi_video_device *device)
|
||||
}
|
||||
}
|
||||
|
||||
} else {
|
||||
ACPI_DEBUG_PRINT((ACPI_DB_INFO, "Could not query available LCD brightness level\n"));
|
||||
}
|
||||
|
||||
kfree(obj);
|
||||
|
||||
if (device->cap._BCL && device->cap._BCM && device->cap._BQC){
|
||||
if (device->cap._BCL && device->cap._BCM && device->cap._BQC && max_level > 0){
|
||||
unsigned long tmp;
|
||||
static int count = 0;
|
||||
char *name;
|
||||
|
Loading…
x
Reference in New Issue
Block a user