diff options
Diffstat (limited to 'drivers/acpi/video.c')
-rw-r--r-- | drivers/acpi/video.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/acpi/video.c b/drivers/acpi/video.c index 66a610d0e2f5..f261737636da 100644 --- a/drivers/acpi/video.c +++ b/drivers/acpi/video.c | |||
@@ -36,6 +36,7 @@ | |||
36 | #include <linux/backlight.h> | 36 | #include <linux/backlight.h> |
37 | #include <linux/thermal.h> | 37 | #include <linux/thermal.h> |
38 | #include <linux/video_output.h> | 38 | #include <linux/video_output.h> |
39 | #include <linux/sort.h> | ||
39 | #include <asm/uaccess.h> | 40 | #include <asm/uaccess.h> |
40 | 41 | ||
41 | #include <acpi/acpi_bus.h> | 42 | #include <acpi/acpi_bus.h> |
@@ -631,6 +632,16 @@ acpi_video_bus_DOS(struct acpi_video_bus *video, int bios_flag, int lcd_flag) | |||
631 | } | 632 | } |
632 | 633 | ||
633 | /* | 634 | /* |
635 | * Simple comparison function used to sort backlight levels. | ||
636 | */ | ||
637 | |||
638 | static int | ||
639 | acpi_video_cmp_level(const void *a, const void *b) | ||
640 | { | ||
641 | return *(int *)a - *(int *)b; | ||
642 | } | ||
643 | |||
644 | /* | ||
634 | * Arg: | 645 | * Arg: |
635 | * device : video output device (LCD, CRT, ..) | 646 | * device : video output device (LCD, CRT, ..) |
636 | * | 647 | * |
@@ -681,6 +692,10 @@ acpi_video_init_brightness(struct acpi_video_device *device) | |||
681 | count++; | 692 | count++; |
682 | } | 693 | } |
683 | 694 | ||
695 | /* don't sort the first two brightness levels */ | ||
696 | sort(&br->levels[2], count - 2, sizeof(br->levels[2]), | ||
697 | acpi_video_cmp_level, NULL); | ||
698 | |||
684 | if (count < 2) | 699 | if (count < 2) |
685 | goto out_free_levels; | 700 | goto out_free_levels; |
686 | 701 | ||