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 | |
| 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>
| -rw-r--r-- | drivers/acpi/acpi_video.c | 9 | ||||
| -rw-r--r-- | drivers/thermal/int340x_thermal/int3406_thermal.c | 2 | ||||
| -rw-r--r-- | include/acpi/video.h | 6 |
3 files changed, 11 insertions, 6 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); |
diff --git a/drivers/thermal/int340x_thermal/int3406_thermal.c b/drivers/thermal/int340x_thermal/int3406_thermal.c index 13d431cbd29e..a578cd257db4 100644 --- a/drivers/thermal/int340x_thermal/int3406_thermal.c +++ b/drivers/thermal/int340x_thermal/int3406_thermal.c | |||
| @@ -177,7 +177,7 @@ static int int3406_thermal_probe(struct platform_device *pdev) | |||
| 177 | return -ENODEV; | 177 | return -ENODEV; |
| 178 | d->raw_bd = bd; | 178 | d->raw_bd = bd; |
| 179 | 179 | ||
| 180 | ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br); | 180 | ret = acpi_video_get_levels(ACPI_COMPANION(&pdev->dev), &d->br, NULL); |
| 181 | if (ret) | 181 | if (ret) |
| 182 | return ret; | 182 | return ret; |
| 183 | 183 | ||
diff --git a/include/acpi/video.h b/include/acpi/video.h index 70a41f742037..5731ccb42585 100644 --- a/include/acpi/video.h +++ b/include/acpi/video.h | |||
| @@ -51,7 +51,8 @@ extern void acpi_video_set_dmi_backlight_type(enum acpi_backlight_type type); | |||
| 51 | */ | 51 | */ |
| 52 | extern bool acpi_video_handles_brightness_key_presses(void); | 52 | extern bool acpi_video_handles_brightness_key_presses(void); |
| 53 | extern int acpi_video_get_levels(struct acpi_device *device, | 53 | extern int acpi_video_get_levels(struct acpi_device *device, |
| 54 | struct acpi_video_device_brightness **dev_br); | 54 | struct acpi_video_device_brightness **dev_br, |
| 55 | int *pmax_level); | ||
| 55 | #else | 56 | #else |
| 56 | static inline int acpi_video_register(void) { return 0; } | 57 | static inline int acpi_video_register(void) { return 0; } |
| 57 | static inline void acpi_video_unregister(void) { return; } | 58 | static inline void acpi_video_unregister(void) { return; } |
| @@ -72,7 +73,8 @@ static inline bool acpi_video_handles_brightness_key_presses(void) | |||
| 72 | return false; | 73 | return false; |
| 73 | } | 74 | } |
| 74 | static inline int acpi_video_get_levels(struct acpi_device *device, | 75 | static inline int acpi_video_get_levels(struct acpi_device *device, |
| 75 | struct acpi_video_device_brightness **dev_br) | 76 | struct acpi_video_device_brightness **dev_br, |
| 77 | int *pmax_level) | ||
| 76 | { | 78 | { |
| 77 | return -ENODEV; | 79 | return -ENODEV; |
| 78 | } | 80 | } |
