Skip to content

Commit

Permalink
Staging: asus_oled: fix image processing
Browse files Browse the repository at this point in the history
Programming an image was broken, because odev->buf_offs was not advanced
for val == 0 in append_values(). This regression was introduced in:

 commit 1ff12a4
 Author: Kevin A. Granade <[email protected]>
 Date:   Sat Sep 5 01:03:39 2009 -0500

     Staging: asus_oled: Cleaned up checkpatch issues.

Fix the image processing by special-casing val == 0.

I have tested this change on an Asus G50V laptop only.

Cc: Jakub Schmidtke <[email protected]>
Cc: Kevin A. Granade <[email protected]>
Signed-off-by: Pekka Paalanen <[email protected]>
Cc: stable <[email protected]>
Signed-off-by: Greg Kroah-Hartman <[email protected]>
  • Loading branch information
ppaalanen authored and gregkh committed Feb 8, 2012
1 parent 3c1b86f commit 635032c
Showing 1 changed file with 8 additions and 2 deletions.
10 changes: 8 additions & 2 deletions drivers/staging/asus_oled/asus_oled.c
Original file line number Diff line number Diff line change
Expand Up @@ -355,7 +355,14 @@ static void send_data(struct asus_oled_dev *odev)

static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count)
{
while (count-- > 0 && val) {
odev->last_val = val;

if (val == 0) {
odev->buf_offs += count;
return 0;
}

while (count-- > 0) {
size_t x = odev->buf_offs % odev->width;
size_t y = odev->buf_offs / odev->width;
size_t i;
Expand Down Expand Up @@ -406,7 +413,6 @@ static int append_values(struct asus_oled_dev *odev, uint8_t val, size_t count)
;
}

odev->last_val = val;
odev->buf_offs++;
}

Expand Down

0 comments on commit 635032c

Please sign in to comment.