diff options
author | Aaron Lu <aaron.lu@intel.com> | 2016-05-21 03:30:46 -0400 |
---|---|---|
committer | Rafael J. Wysocki <rafael.j.wysocki@intel.com> | 2016-05-30 07:53:09 -0400 |
commit | 9f9cd7ee2c05881f151e5ee4889e667a031dd8d9 (patch) | |
tree | 55c2c3702f9675afe8756c2bb9baa5bf7e127f42 /drivers/acpi | |
parent | e4f35c1339f0cfcf38d3f63dd6fea2b070399263 (diff) |
ACPI / Thermal / video: fix max_level incorrect value
commit 059500940def (ACPI/video: export acpi_video_get_levels)
mistakenly dropped the correct value of max_level and that caused the
set_level function following failed and the acpi_video backlight interface
didn't get created. Fix this by passing back the correct max_level value.
While at it, also fix the param used in acpi_video_device_lcd_query_levels
where acpi_handle is expected but acpi_video_device is passed.
Fixes: 059500940def (ACPI/video: export acpi_video_get_levels)
Reported-and-tested-by: Valdis Kletnieks <valdis.kletnieks@vt.edu>
Signed-off-by: Aaron Lu <aaron.lu@intel.com>
Acked-by: Zhang Rui <rui.zhang@intel.com>
Signed-off-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
Diffstat (limited to 'drivers/acpi')
-rw-r--r-- | drivers/acpi/acpi_video.c | 9 |
1 files changed, 6 insertions, 3 deletions
diff --git a/drivers/acpi/acpi_video.c b/drivers/acpi/acpi_video.c index 3d5b8a099351..c1d138e128cb 100644 --- a/drivers/acpi/acpi_video.c +++ b/drivers/acpi/acpi_video.c | |||
@@ -754,7 +754,8 @@ static int acpi_video_bqc_quirk(struct acpi_video_device *device, | |||
754 | } | 754 | } |
755 | 755 | ||
756 | int acpi_video_get_levels(struct acpi_device *device, | 756 | int acpi_video_get_levels(struct acpi_device *device, |
757 | struct acpi_video_device_brightness **dev_br) | 757 | struct acpi_video_device_brightness **dev_br, |
758 | int *pmax_level) | ||
758 | { | 759 | { |
759 | union acpi_object *obj = NULL; | 760 | union acpi_object *obj = NULL; |
760 | int i, max_level = 0, count = 0, level_ac_battery = 0; | 761 | int i, max_level = 0, count = 0, level_ac_battery = 0; |
@@ -841,6 +842,8 @@ int acpi_video_get_levels(struct acpi_device *device, | |||
841 | 842 | ||
842 | br->count = count; | 843 | br->count = count; |
843 | *dev_br = br; | 844 | *dev_br = br; |
845 | if (pmax_level) | ||
846 | *pmax_level = max_level; | ||
844 | 847 | ||
845 | out: | 848 | out: |
846 | kfree(obj); | 849 | kfree(obj); |
@@ -869,7 +872,7 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
869 | struct acpi_video_device_brightness *br = NULL; | 872 | struct acpi_video_device_brightness *br = NULL; |
870 | int result = -EINVAL; | 873 | int result = -EINVAL; |
871 | 874 | ||
872 | result = acpi_video_get_levels(device->dev, &br); | 875 | result = acpi_video_get_levels(device->dev, &br, &max_level); |
873 | if (result) | 876 | if (result) |
874 | return result; | 877 | return result; |
875 | device->brightness = br; | 878 | device->brightness = br; |
@@ -1737,7 +1740,7 @@ static void acpi_video_run_bcl_for_osi(struct acpi_video_bus *video) | |||
1737 | 1740 | ||
1738 | mutex_lock(&video->device_list_lock); | 1741 | mutex_lock(&video->device_list_lock); |
1739 | list_for_each_entry(dev, &video->video_device_list, entry) { | 1742 | list_for_each_entry(dev, &video->video_device_list, entry) { |
1740 | if (!acpi_video_device_lcd_query_levels(dev, &levels)) | 1743 | if (!acpi_video_device_lcd_query_levels(dev->dev->handle, &levels)) |
1741 | kfree(levels); | 1744 | kfree(levels); |
1742 | } | 1745 | } |
1743 | mutex_unlock(&video->device_list_lock); | 1746 | mutex_unlock(&video->device_list_lock); |