lkml.org 
[lkml]   [2007]   [Nov]   [20]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    Patch in this message
    /
    Date
    From
    Subject[patch 14/29] ACPI: VIDEO: Adjust current level to closest available one.
    2.6.23-stable review patch.  If anyone has any objections, please let us
    know.

    ------------------
    From: Alexey Starikovskiy <astarikovskiy@suse.de>

    patch 63f0edfc0b7f8058f9d3f9b572615ec97ae011ba in mainline.

    ACPI: VIDEO: Adjust current level to closest available one.


    Signed-off-by: Alexey Starikovskiy <astarikovskiy@suse.de>
    Signed-off-by: Len Brown <len.brown@intel.com>
    Cc: Tobias Powalowski <t.powa@gmx.de>
    Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>

    ---
    drivers/acpi/video.c | 13 ++++++++++++-
    1 file changed, 12 insertions(+), 1 deletion(-)

    --- a/drivers/acpi/video.c
    +++ b/drivers/acpi/video.c
    @@ -1633,9 +1633,20 @@ static int
    acpi_video_get_next_level(struct acpi_video_device *device,
    u32 level_current, u32 event)
    {
    - int min, max, min_above, max_below, i, l;
    + int min, max, min_above, max_below, i, l, delta = 255;
    max = max_below = 0;
    min = min_above = 255;
    + /* Find closest level to level_current */
    + for (i = 0; i < device->brightness->count; i++) {
    + l = device->brightness->levels[i];
    + if (abs(l - level_current) < abs(delta)) {
    + delta = l - level_current;
    + if (!delta)
    + break;
    + }
    + }
    + /* Ajust level_current to closest available level */
    + level_current += delta;
    for (i = 0; i < device->brightness->count; i++) {
    l = device->brightness->levels[i];
    if (l < min)
    --
    -
    To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
    the body of a message to majordomo@vger.kernel.org
    More majordomo info at http://vger.kernel.org/majordomo-info.html
    Please read the FAQ at http://www.tux.org/lkml/

    \
     
     \ /
      Last update: 2007-11-20 19:36    [W:0.022 / U:58.108 seconds]
    ©2003-2016 Jasper Spaans. hosted at Digital OceanAdvertise on this site