diff options
author | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-03 17:47:08 -0400 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@suse.de> | 2009-06-19 14:00:57 -0400 |
commit | f05e0575ed334a23dad91b8f6ed0ac42a3996b8d (patch) | |
tree | 454ae5519aa8425aeb46e3d164a8280cd6c26d32 /drivers/staging | |
parent | 39e7df5d17f28889543c09b5f3ffd6d380fc7317 (diff) |
Staging: udlfb: clean up checkpatch warnings in udlfb.c
This cleans up a bunch of checkpatch.pl warnings in the udlfb.c file.
Cc: Roberto De Ioris <roberto@unbit.it>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/staging')
-rw-r--r-- | drivers/staging/udlfb/udlfb.c | 96 |
1 files changed, 38 insertions, 58 deletions
diff --git a/drivers/staging/udlfb/udlfb.c b/drivers/staging/udlfb/udlfb.c index 8341b0e904bd..45b8ae7882de 100644 --- a/drivers/staging/udlfb/udlfb.c +++ b/drivers/staging/udlfb/udlfb.c | |||
@@ -24,7 +24,7 @@ | |||
24 | 24 | ||
25 | #define DRIVER_VERSION "DLFB 0.2" | 25 | #define DRIVER_VERSION "DLFB 0.2" |
26 | 26 | ||
27 | // memory functions taken from vfb | 27 | /* memory functions taken from vfb */ |
28 | 28 | ||
29 | static void *rvmalloc(unsigned long size) | 29 | static void *rvmalloc(unsigned long size) |
30 | { | 30 | { |
@@ -72,17 +72,16 @@ static int dlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
72 | 72 | ||
73 | printk("MMAP: %lu %u\n", offset + size, info->fix.smem_len); | 73 | printk("MMAP: %lu %u\n", offset + size, info->fix.smem_len); |
74 | 74 | ||
75 | if (offset + size > info->fix.smem_len) { | 75 | if (offset + size > info->fix.smem_len) |
76 | return -EINVAL; | 76 | return -EINVAL; |
77 | } | ||
78 | 77 | ||
79 | pos = (unsigned long)info->fix.smem_start + offset; | 78 | pos = (unsigned long)info->fix.smem_start + offset; |
80 | 79 | ||
81 | while (size > 0) { | 80 | while (size > 0) { |
82 | page = vmalloc_to_pfn((void *)pos); | 81 | page = vmalloc_to_pfn((void *)pos); |
83 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) { | 82 | if (remap_pfn_range(vma, start, page, PAGE_SIZE, PAGE_SHARED)) |
84 | return -EAGAIN; | 83 | return -EAGAIN; |
85 | } | 84 | |
86 | start += PAGE_SIZE; | 85 | start += PAGE_SIZE; |
87 | pos += PAGE_SIZE; | 86 | pos += PAGE_SIZE; |
88 | if (size > PAGE_SIZE) | 87 | if (size > PAGE_SIZE) |
@@ -96,28 +95,23 @@ static int dlfb_mmap(struct fb_info *info, struct vm_area_struct *vma) | |||
96 | 95 | ||
97 | } | 96 | } |
98 | 97 | ||
99 | // | 98 | /* ioctl structure */ |
100 | |||
101 | //ioctl structure | ||
102 | struct dloarea { | 99 | struct dloarea { |
103 | int x, y; | 100 | int x, y; |
104 | int w, h; | 101 | int w, h; |
105 | }; | 102 | }; |
106 | 103 | ||
107 | /* | 104 | /* |
108 | |||
109 | static struct usb_device_id id_table [] = { | 105 | static struct usb_device_id id_table [] = { |
110 | { USB_DEVICE(0x17e9, 0x023d) }, | 106 | { USB_DEVICE(0x17e9, 0x023d) }, |
111 | { } | 107 | { } |
112 | }; | 108 | }; |
113 | |||
114 | */ | 109 | */ |
115 | 110 | ||
116 | static struct usb_device_id id_table[] = { | 111 | static struct usb_device_id id_table[] = { |
117 | {.idVendor = 0x17e9,.match_flags = USB_DEVICE_ID_MATCH_VENDOR,}, | 112 | {.idVendor = 0x17e9, .match_flags = USB_DEVICE_ID_MATCH_VENDOR,}, |
118 | {}, | 113 | {}, |
119 | }; | 114 | }; |
120 | |||
121 | MODULE_DEVICE_TABLE(usb, id_table); | 115 | MODULE_DEVICE_TABLE(usb, id_table); |
122 | 116 | ||
123 | static struct usb_driver dlfb_driver; | 117 | static struct usb_driver dlfb_driver; |
@@ -135,13 +129,11 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
135 | 129 | ||
136 | char *bufptr; | 130 | char *bufptr; |
137 | 131 | ||
138 | if (x + width > dev_info->info->var.xres) { | 132 | if (x + width > dev_info->info->var.xres) |
139 | return -EINVAL; | 133 | return -EINVAL; |
140 | } | ||
141 | 134 | ||
142 | if (y + height > dev_info->info->var.yres) { | 135 | if (y + height > dev_info->info->var.yres) |
143 | return -EINVAL; | 136 | return -EINVAL; |
144 | } | ||
145 | 137 | ||
146 | mutex_lock(&dev_info->bulk_mutex); | 138 | mutex_lock(&dev_info->bulk_mutex); |
147 | 139 | ||
@@ -149,7 +141,7 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
149 | 141 | ||
150 | data += (dev_info->info->var.xres * 2 * y) + (x * 2); | 142 | data += (dev_info->info->var.xres * 2 * y) + (x * 2); |
151 | 143 | ||
152 | //printk("IMAGE_BLIT\n"); | 144 | /* printk("IMAGE_BLIT\n"); */ |
153 | 145 | ||
154 | bufptr = dev_info->buf; | 146 | bufptr = dev_info->buf; |
155 | 147 | ||
@@ -162,7 +154,7 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
162 | 154 | ||
163 | rem = width; | 155 | rem = width; |
164 | 156 | ||
165 | //printk("WRITING LINE %d\n", i); | 157 | /* printk("WRITING LINE %d\n", i); */ |
166 | 158 | ||
167 | while (rem) { | 159 | while (rem) { |
168 | 160 | ||
@@ -193,7 +185,7 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
193 | *bufptr++ = (char)(base >> 8); | 185 | *bufptr++ = (char)(base >> 8); |
194 | *bufptr++ = (char)(base); | 186 | *bufptr++ = (char)(base); |
195 | *bufptr++ = 255; | 187 | *bufptr++ = 255; |
196 | // PUT COMPRESSION HERE | 188 | /* PUT COMPRESSION HERE */ |
197 | for (j = 0; j < 510; j += 2) { | 189 | for (j = 0; j < 510; j += 2) { |
198 | bufptr[j] = data[j + 1]; | 190 | bufptr[j] = data[j + 1]; |
199 | bufptr[j + 1] = data[j]; | 191 | bufptr[j + 1] = data[j]; |
@@ -226,7 +218,7 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
226 | *bufptr++ = (char)(base >> 8); | 218 | *bufptr++ = (char)(base >> 8); |
227 | *bufptr++ = (char)(base); | 219 | *bufptr++ = (char)(base); |
228 | *bufptr++ = rem; | 220 | *bufptr++ = rem; |
229 | // PUT COMPRESSION HERE | 221 | /* PUT COMPRESSION HERE */ |
230 | for (j = 0; j < rem * 2; j += 2) { | 222 | for (j = 0; j < rem * 2; j += 2) { |
231 | bufptr[j] = data[j + 1]; | 223 | bufptr[j] = data[j + 1]; |
232 | bufptr[j + 1] = data[j]; | 224 | bufptr[j + 1] = data[j]; |
@@ -250,9 +242,8 @@ image_blit(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
250 | 242 | ||
251 | } | 243 | } |
252 | 244 | ||
253 | if (bufptr > dev_info->buf) { | 245 | if (bufptr > dev_info->buf) |
254 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | 246 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); |
255 | } | ||
256 | 247 | ||
257 | mutex_unlock(&dev_info->bulk_mutex); | 248 | mutex_unlock(&dev_info->bulk_mutex); |
258 | 249 | ||
@@ -274,13 +265,11 @@ draw_rect(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
274 | 265 | ||
275 | char *bufptr; | 266 | char *bufptr; |
276 | 267 | ||
277 | if (x + width > dev_info->info->var.xres) { | 268 | if (x + width > dev_info->info->var.xres) |
278 | return -EINVAL; | 269 | return -EINVAL; |
279 | } | ||
280 | 270 | ||
281 | if (y + height > dev_info->info->var.yres) { | 271 | if (y + height > dev_info->info->var.yres) |
282 | return -EINVAL; | 272 | return -EINVAL; |
283 | } | ||
284 | 273 | ||
285 | mutex_lock(&dev_info->bulk_mutex); | 274 | mutex_lock(&dev_info->bulk_mutex); |
286 | 275 | ||
@@ -338,9 +327,8 @@ draw_rect(struct dlfb_data *dev_info, int x, int y, int width, int height, | |||
338 | 327 | ||
339 | } | 328 | } |
340 | 329 | ||
341 | if (bufptr > dev_info->buf) { | 330 | if (bufptr > dev_info->buf) |
342 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | 331 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); |
343 | } | ||
344 | 332 | ||
345 | mutex_unlock(&dev_info->bulk_mutex); | 333 | mutex_unlock(&dev_info->bulk_mutex); |
346 | 334 | ||
@@ -351,7 +339,6 @@ static int | |||
351 | copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, | 339 | copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, |
352 | int width, int height) | 340 | int width, int height) |
353 | { | 341 | { |
354 | |||
355 | int base; | 342 | int base; |
356 | int source; | 343 | int source; |
357 | int rem; | 344 | int rem; |
@@ -359,13 +346,11 @@ copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, | |||
359 | 346 | ||
360 | char *bufptr; | 347 | char *bufptr; |
361 | 348 | ||
362 | if (dx + width > dev_info->info->var.xres) { | 349 | if (dx + width > dev_info->info->var.xres) |
363 | return -EINVAL; | 350 | return -EINVAL; |
364 | } | ||
365 | 351 | ||
366 | if (dy + height > dev_info->info->var.yres) { | 352 | if (dy + height > dev_info->info->var.yres) |
367 | return -EINVAL; | 353 | return -EINVAL; |
368 | } | ||
369 | 354 | ||
370 | mutex_lock(&dev_info->bulk_mutex); | 355 | mutex_lock(&dev_info->bulk_mutex); |
371 | 356 | ||
@@ -423,17 +408,14 @@ copyarea(struct dlfb_data *dev_info, int dx, int dy, int sx, int sy, | |||
423 | source += rem * 2; | 408 | source += rem * 2; |
424 | rem = 0; | 409 | rem = 0; |
425 | } | 410 | } |
426 | |||
427 | } | 411 | } |
428 | 412 | ||
429 | base += (dev_info->info->var.xres * 2) - (width * 2); | 413 | base += (dev_info->info->var.xres * 2) - (width * 2); |
430 | source += (dev_info->info->var.xres * 2) - (width * 2); | 414 | source += (dev_info->info->var.xres * 2) - (width * 2); |
431 | |||
432 | } | 415 | } |
433 | 416 | ||
434 | if (bufptr > dev_info->buf) { | 417 | if (bufptr > dev_info->buf) |
435 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); | 418 | ret = dlfb_bulk_msg(dev_info, bufptr - dev_info->buf); |
436 | } | ||
437 | 419 | ||
438 | mutex_unlock(&dev_info->bulk_mutex); | 420 | mutex_unlock(&dev_info->bulk_mutex); |
439 | 421 | ||
@@ -448,7 +430,7 @@ void dlfb_copyarea(struct fb_info *info, const struct fb_copyarea *area) | |||
448 | copyarea(dev, area->dx, area->dy, area->sx, area->sy, area->width, | 430 | copyarea(dev, area->dx, area->dy, area->sx, area->sy, area->width, |
449 | area->height); | 431 | area->height); |
450 | 432 | ||
451 | //printk("COPY AREA %d %d %d %d %d %d !!!\n", area->dx, area->dy, area->sx, area->sy, area->width, area->height); | 433 | /* printk("COPY AREA %d %d %d %d %d %d !!!\n", area->dx, area->dy, area->sx, area->sy, area->width, area->height); */ |
452 | 434 | ||
453 | } | 435 | } |
454 | 436 | ||
@@ -457,12 +439,12 @@ void dlfb_imageblit(struct fb_info *info, const struct fb_image *image) | |||
457 | 439 | ||
458 | int ret; | 440 | int ret; |
459 | struct dlfb_data *dev = info->par; | 441 | struct dlfb_data *dev = info->par; |
460 | //printk("IMAGE BLIT (1) %d %d %d %d DEPTH %d {%p}!!!\n", image->dx, image->dy, image->width, image->height, image->depth, dev->udev); | 442 | /* printk("IMAGE BLIT (1) %d %d %d %d DEPTH %d {%p}!!!\n", image->dx, image->dy, image->width, image->height, image->depth, dev->udev); */ |
461 | cfb_imageblit(info, image); | 443 | cfb_imageblit(info, image); |
462 | ret = | 444 | ret = |
463 | image_blit(dev, image->dx, image->dy, image->width, image->height, | 445 | image_blit(dev, image->dx, image->dy, image->width, image->height, |
464 | info->screen_base); | 446 | info->screen_base); |
465 | //printk("IMAGE BLIT (2) %d %d %d %d DEPTH %d {%p} %d!!!\n", image->dx, image->dy, image->width, image->height, image->depth, dev->udev, ret); | 447 | /* printk("IMAGE BLIT (2) %d %d %d %d DEPTH %d {%p} %d!!!\n", image->dx, image->dy, image->width, image->height, image->depth, dev->udev, ret); */ |
466 | } | 448 | } |
467 | 449 | ||
468 | void dlfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) | 450 | void dlfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) |
@@ -476,7 +458,7 @@ void dlfb_fillrect(struct fb_info *info, const struct fb_fillrect *region) | |||
476 | memcpy(&blue, ®ion->color + 2, 1); | 458 | memcpy(&blue, ®ion->color + 2, 1); |
477 | draw_rect(dev, region->dx, region->dy, region->width, region->height, | 459 | draw_rect(dev, region->dx, region->dy, region->width, region->height, |
478 | red, green, blue); | 460 | red, green, blue); |
479 | //printk("FILL RECT %d %d !!!\n", region->dx, region->dy); | 461 | /* printk("FILL RECT %d %d !!!\n", region->dx, region->dy); */ |
480 | 462 | ||
481 | } | 463 | } |
482 | 464 | ||
@@ -508,7 +490,7 @@ static int dlfb_ioctl(struct fb_info *info, unsigned int cmd, unsigned long arg) | |||
508 | return 0; | 490 | return 0; |
509 | } | 491 | } |
510 | 492 | ||
511 | // taken from vesafb | 493 | /* taken from vesafb */ |
512 | 494 | ||
513 | static int | 495 | static int |
514 | dlfb_setcolreg(unsigned regno, unsigned red, unsigned green, | 496 | dlfb_setcolreg(unsigned regno, unsigned red, unsigned green, |
@@ -544,12 +526,12 @@ static int dlfb_release(struct fb_info *info, int user) | |||
544 | return 0; | 526 | return 0; |
545 | } | 527 | } |
546 | 528 | ||
547 | static int dlfb_blank(int blank_mode, struct fb_info *info) { | 529 | static int dlfb_blank(int blank_mode, struct fb_info *info) |
530 | { | ||
548 | return 0; | 531 | return 0; |
549 | } | 532 | } |
550 | 533 | ||
551 | static struct fb_ops dlfb_ops = { | 534 | static struct fb_ops dlfb_ops = { |
552 | |||
553 | .fb_setcolreg = dlfb_setcolreg, | 535 | .fb_setcolreg = dlfb_setcolreg, |
554 | .fb_fillrect = dlfb_fillrect, | 536 | .fb_fillrect = dlfb_fillrect, |
555 | .fb_copyarea = dlfb_copyarea, | 537 | .fb_copyarea = dlfb_copyarea, |
@@ -583,10 +565,11 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
583 | 565 | ||
584 | printk("DisplayLink device attached\n"); | 566 | printk("DisplayLink device attached\n"); |
585 | 567 | ||
586 | // add framebuffer info to usb interface | 568 | /* add framebuffer info to usb interface */ |
587 | usb_set_intfdata(interface, dev_info); | 569 | usb_set_intfdata(interface, dev_info); |
588 | 570 | ||
589 | dev_info->buf = kmalloc(BUF_SIZE, GFP_KERNEL); //usb_buffer_alloc(dev_info->udev, BUF_SIZE , GFP_KERNEL, &dev_info->tx_urb->transfer_dma); | 571 | dev_info->buf = kmalloc(BUF_SIZE, GFP_KERNEL); |
572 | /* usb_buffer_alloc(dev_info->udev, BUF_SIZE , GFP_KERNEL, &dev_info->tx_urb->transfer_dma); */ | ||
590 | 573 | ||
591 | if (dev_info->buf == NULL) { | 574 | if (dev_info->buf == NULL) { |
592 | printk("unable to allocate memory for dlfb commands\n"); | 575 | printk("unable to allocate memory for dlfb commands\n"); |
@@ -611,7 +594,7 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
611 | usb_rcvctrlpipe(dev_info->udev, 0), (0x02), | 594 | usb_rcvctrlpipe(dev_info->udev, 0), (0x02), |
612 | (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, | 595 | (0x80 | (0x02 << 5)), i << 8, 0xA1, rbuf, 2, |
613 | 0); | 596 | 0); |
614 | //printk("ret control msg edid %d: %d [%d]\n",i, ret, rbuf[1]); | 597 | /* printk("ret control msg edid %d: %d [%d]\n",i, ret, rbuf[1]); */ |
615 | dev_info->edid[i] = rbuf[1]; | 598 | dev_info->edid[i] = rbuf[1]; |
616 | } | 599 | } |
617 | 600 | ||
@@ -626,9 +609,8 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
626 | 609 | ||
627 | printk("EDID XRES %d YRES %d\n", info->var.xres, info->var.yres); | 610 | printk("EDID XRES %d YRES %d\n", info->var.xres, info->var.yres); |
628 | 611 | ||
629 | if (dlfb_set_video_mode(dev_info, info->var.xres, info->var.yres) != 0) { | 612 | if (dlfb_set_video_mode(dev_info, info->var.xres, info->var.yres) != 0) |
630 | goto out; | 613 | goto out; |
631 | } | ||
632 | 614 | ||
633 | printk("found valid mode...%d\n", info->var.pixclock); | 615 | printk("found valid mode...%d\n", info->var.pixclock); |
634 | 616 | ||
@@ -654,10 +636,10 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
654 | 636 | ||
655 | dev_info->backing_buffer = kzalloc(dev_info->screen_size, GFP_KERNEL); | 637 | dev_info->backing_buffer = kzalloc(dev_info->screen_size, GFP_KERNEL); |
656 | 638 | ||
657 | if (!dev_info->backing_buffer) { | 639 | if (!dev_info->backing_buffer) |
658 | printk("non posso allocare il backing buffer\n"); | 640 | printk("non posso allocare il backing buffer\n"); |
659 | } | 641 | |
660 | //info->var = dev_info->si; | 642 | /* info->var = dev_info->si; */ |
661 | 643 | ||
662 | info->var.bits_per_pixel = 16; | 644 | info->var.bits_per_pixel = 16; |
663 | info->var.activate = FB_ACTIVATE_TEST; | 645 | info->var.activate = FB_ACTIVATE_TEST; |
@@ -675,7 +657,7 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
675 | info->var.blue.length = 5; | 657 | info->var.blue.length = 5; |
676 | info->var.blue.msb_right = 0; | 658 | info->var.blue.msb_right = 0; |
677 | 659 | ||
678 | //info->var.pixclock = (10000000 / FB_W * 1000 / FB_H)/2 ; | 660 | /* info->var.pixclock = (10000000 / FB_W * 1000 / FB_H)/2 ; */ |
679 | 661 | ||
680 | info->fix.smem_start = (unsigned long)info->screen_base; | 662 | info->fix.smem_start = (unsigned long)info->screen_base; |
681 | info->fix.smem_len = PAGE_ALIGN(dev_info->screen_size); | 663 | info->fix.smem_len = PAGE_ALIGN(dev_info->screen_size); |
@@ -685,14 +667,12 @@ dlfb_probe(struct usb_interface *interface, const struct usb_device_id *id) | |||
685 | info->fix.accel = info->flags; | 667 | info->fix.accel = info->flags; |
686 | info->fix.line_length = dev_info->line_length; | 668 | info->fix.line_length = dev_info->line_length; |
687 | 669 | ||
688 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) { | 670 | if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) |
689 | goto out1; | 671 | goto out1; |
690 | } | ||
691 | 672 | ||
692 | printk("colormap allocated\n"); | 673 | printk("colormap allocated\n"); |
693 | if (register_framebuffer(info) < 0) { | 674 | if (register_framebuffer(info) < 0) |
694 | goto out2; | 675 | goto out2; |
695 | } | ||
696 | 676 | ||
697 | draw_rect(dev_info, 0, 0, dev_info->info->var.xres, | 677 | draw_rect(dev_info, 0, 0, dev_info->info->var.xres, |
698 | dev_info->info->var.yres, 0x30, 0xff, 0x30); | 678 | dev_info->info->var.yres, 0x30, 0xff, 0x30); |