aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/staging/asus_oled/asus_oled.c
diff options
context:
space:
mode:
authorAndre Haupt <andre@bitwigglers.org>2009-01-19 06:00:18 -0500
committerGreg Kroah-Hartman <gregkh@suse.de>2009-04-03 17:53:15 -0400
commit526fd20a351cd8ab598969f38d1c38cd869cd104 (patch)
tree09cefc1396af8e5e35da9a6202a3a6ae4be07180 /drivers/staging/asus_oled/asus_oled.c
parentb0e5ca810ae532153c9a44dbaeff529ee5028383 (diff)
Staging: asus_oled: trailing statements should be on next line
fix the following error reported by checkpatch.pl ERROR: trailing statements should be on next line Signed-off-by: Andre Haupt <andre@bitwigglers.org> Cc: Jakub Schmidtke <sjakub@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging/asus_oled/asus_oled.c')
-rw-r--r--drivers/staging/asus_oled/asus_oled.c57
1 files changed, 38 insertions, 19 deletions
diff --git a/drivers/staging/asus_oled/asus_oled.c b/drivers/staging/asus_oled/asus_oled.c
index cb632a04a99..41bf409a393 100644
--- a/drivers/staging/asus_oled/asus_oled.c
+++ b/drivers/staging/asus_oled/asus_oled.c
@@ -160,8 +160,10 @@ static void enable_oled(struct asus_oled_dev *odev, uint8_t enabl)
160 160
161 SETUP_PACKET_HEADER(packet, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00); 161 SETUP_PACKET_HEADER(packet, 0x20, 0x00, 0x00, 0x00, 0x01, 0x00, 0x00);
162 162
163 if (enabl) packet->bitmap[0] = 0xaf; 163 if (enabl)
164 else packet->bitmap[0] = 0xae; 164 packet->bitmap[0] = 0xaf;
165 else
166 packet->bitmap[0] = 0xae;
165 167
166 for (a=0; a<1; a++) { 168 for (a=0; a<1; a++) {
167 retval = usb_bulk_msg(odev->udev, 169 retval = usb_bulk_msg(odev->udev,
@@ -377,7 +379,8 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz
377{ 379{
378 size_t offs = 0, max_offs; 380 size_t offs = 0, max_offs;
379 381
380 if (count < 1) return 0; 382 if (count < 1)
383 return 0;
381 384
382 if (tolower(buf[0]) == 'b'){ 385 if (tolower(buf[0]) == 'b'){
383 // binary mode, set the entire memory 386 // binary mode, set the entire memory
@@ -386,7 +389,8 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz
386 389
387 odev->buf_size = (odev->dev_width * ASUS_OLED_DISP_HEIGHT) / 8; 390 odev->buf_size = (odev->dev_width * ASUS_OLED_DISP_HEIGHT) / 8;
388 391
389 if (odev->buf) kfree(odev->buf); 392 if (odev->buf)
393 kfree(odev->buf);
390 odev->buf = kmalloc(odev->buf_size, GFP_KERNEL); 394 odev->buf = kmalloc(odev->buf_size, GFP_KERNEL);
391 395
392 memset(odev->buf, 0xff, odev->buf_size); 396 memset(odev->buf, 0xff, odev->buf_size);
@@ -432,27 +436,36 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz
432 if (buf[i] >= '0' && buf[i] <= '9') { 436 if (buf[i] >= '0' && buf[i] <= '9') {
433 w = 10*w + (buf[i] - '0'); 437 w = 10*w + (buf[i] - '0');
434 438
435 if (w > ASUS_OLED_MAX_WIDTH) goto error_width; 439 if (w > ASUS_OLED_MAX_WIDTH)
440 goto error_width;
436 } 441 }
437 else if (tolower(buf[i]) == 'x') break; 442 else if (tolower(buf[i]) == 'x')
438 else goto error_width; 443 break;
444 else
445 goto error_width;
439 } 446 }
440 447
441 for (++i; i < count; ++i) { 448 for (++i; i < count; ++i) {
442 if (buf[i] >= '0' && buf[i] <= '9') { 449 if (buf[i] >= '0' && buf[i] <= '9') {
443 h = 10*h + (buf[i] - '0'); 450 h = 10*h + (buf[i] - '0');
444 451
445 if (h > ASUS_OLED_DISP_HEIGHT) goto error_height; 452 if (h > ASUS_OLED_DISP_HEIGHT)
453 goto error_height;
446 } 454 }
447 else if (tolower(buf[i]) == '>') break; 455 else if (tolower(buf[i]) == '>')
448 else goto error_height; 456 break;
457 else
458 goto error_height;
449 } 459 }
450 460
451 if (w < 1 || w > ASUS_OLED_MAX_WIDTH) goto error_width; 461 if (w < 1 || w > ASUS_OLED_MAX_WIDTH)
462 goto error_width;
452 463
453 if (h < 1 || h > ASUS_OLED_DISP_HEIGHT) goto error_height; 464 if (h < 1 || h > ASUS_OLED_DISP_HEIGHT)
465 goto error_height;
454 466
455 if (i >= count || buf[i] != '>') goto error_header; 467 if (i >= count || buf[i] != '>')
468 goto error_header;
456 469
457 offs = i+1; 470 offs = i+1;
458 471
@@ -468,7 +481,8 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz
468 481
469 odev->buf_size = w_mem * h_mem / 8; 482 odev->buf_size = w_mem * h_mem / 8;
470 483
471 if (odev->buf) kfree(odev->buf); 484 if (odev->buf)
485 kfree(odev->buf);
472 odev->buf = kmalloc(odev->buf_size, GFP_KERNEL); 486 odev->buf = kmalloc(odev->buf_size, GFP_KERNEL);
473 487
474 if (odev->buf == NULL) { 488 if (odev->buf == NULL) {
@@ -505,23 +519,27 @@ static ssize_t odev_set_picture(struct asus_oled_dev *odev, const char *buf, siz
505 int ret; 519 int ret;
506 520
507 if (buf[offs] == '1' || buf[offs] == '#') { 521 if (buf[offs] == '1' || buf[offs] == '#') {
508 if ( (ret = append_values(odev, 1, 1)) < 0) return ret; 522 if ( (ret = append_values(odev, 1, 1)) < 0)
523 return ret;
509 } 524 }
510 else if (buf[offs] == '0' || buf[offs] == ' ') { 525 else if (buf[offs] == '0' || buf[offs] == ' ') {
511 if ( (ret = append_values(odev, 0, 1)) < 0) return ret; 526 if ( (ret = append_values(odev, 0, 1)) < 0)
527 return ret;
512 } 528 }
513 else if (buf[offs] == '\n') { 529 else if (buf[offs] == '\n') {
514 // New line detected. Lets assume, that all characters till the end of the 530 // New line detected. Lets assume, that all characters till the end of the
515 // line were equal to the last character in this line. 531 // line were equal to the last character in this line.
516 if (odev->buf_offs % odev->width != 0) 532 if (odev->buf_offs % odev->width != 0)
517 if ( (ret = append_values(odev, odev->last_val, 533 if ( (ret = append_values(odev, odev->last_val,
518 odev->width - (odev->buf_offs % odev->width))) < 0) return ret; 534 odev->width - (odev->buf_offs % odev->width))) < 0)
535 return ret;
519 } 536 }
520 537
521 offs++; 538 offs++;
522 } 539 }
523 540
524 if (odev->buf_offs >= max_offs) send_data(odev); 541 if (odev->buf_offs >= max_offs)
542 send_data(odev);
525 543
526 return count; 544 return count;
527 545
@@ -682,7 +700,8 @@ static void asus_oled_disconnect(struct usb_interface *interface)
682 700
683 usb_put_dev(odev->udev); 701 usb_put_dev(odev->udev);
684 702
685 if (odev->buf) kfree(odev->buf); 703 if (odev->buf)
704 kfree(odev->buf);
686 705
687 kfree(odev); 706 kfree(odev);
688 707