aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorDu, Changbin <changbin.du@gmail.com>2012-07-07 02:53:28 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2012-07-30 20:17:23 -0400
commita342daea70c4769ce7709c0f49aa17113228c1ed (patch)
tree8b2c1fc88ed078259960baad42619734a4d2ed53
parent720bb6436ff30fccad05cf5bdf961ea5b1f5686d (diff)
[media] rc: ati_remote.c: code style fixing
changes: 1. wrap some lines that are longer than 80 characters. 2. remove local function prototype declarations which do not need. 3. replace TAB character with a space character in function comments. Signed-off-by: Du, Changbin <changbin.du@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/media/rc/ati_remote.c133
1 files changed, 80 insertions, 53 deletions
diff --git a/drivers/media/rc/ati_remote.c b/drivers/media/rc/ati_remote.c
index 7be377fc1be8..8fa72e2dacb1 100644
--- a/drivers/media/rc/ati_remote.c
+++ b/drivers/media/rc/ati_remote.c
@@ -147,7 +147,8 @@ static bool mouse = true;
147module_param(mouse, bool, 0444); 147module_param(mouse, bool, 0444);
148MODULE_PARM_DESC(mouse, "Enable mouse device, default = yes"); 148MODULE_PARM_DESC(mouse, "Enable mouse device, default = yes");
149 149
150#define dbginfo(dev, format, arg...) do { if (debug) dev_info(dev , format , ## arg); } while (0) 150#define dbginfo(dev, format, arg...) \
151 do { if (debug) dev_info(dev , format , ## arg); } while (0)
151#undef err 152#undef err
152#define err(format, arg...) printk(KERN_ERR format , ## arg) 153#define err(format, arg...) printk(KERN_ERR format , ## arg)
153 154
@@ -191,17 +192,41 @@ static const char *get_medion_keymap(struct usb_interface *interface)
191 return RC_MAP_MEDION_X10; 192 return RC_MAP_MEDION_X10;
192} 193}
193 194
194static const struct ati_receiver_type type_ati = { .default_keymap = RC_MAP_ATI_X10 }; 195static const struct ati_receiver_type type_ati = {
195static const struct ati_receiver_type type_medion = { .get_default_keymap = get_medion_keymap }; 196 .default_keymap = RC_MAP_ATI_X10
196static const struct ati_receiver_type type_firefly = { .default_keymap = RC_MAP_SNAPSTREAM_FIREFLY }; 197};
198static const struct ati_receiver_type type_medion = {
199 .get_default_keymap = get_medion_keymap
200};
201static const struct ati_receiver_type type_firefly = {
202 .default_keymap = RC_MAP_SNAPSTREAM_FIREFLY
203};
197 204
198static struct usb_device_id ati_remote_table[] = { 205static struct usb_device_id ati_remote_table[] = {
199 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, 206 {
200 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, 207 USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA_REMOTE_PRODUCT_ID),
201 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, 208 .driver_info = (unsigned long)&type_ati
202 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_ati }, 209 },
203 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_medion }, 210 {
204 { USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID), .driver_info = (unsigned long)&type_firefly }, 211 USB_DEVICE(ATI_REMOTE_VENDOR_ID, LOLA2_REMOTE_PRODUCT_ID),
212 .driver_info = (unsigned long)&type_ati
213 },
214 {
215 USB_DEVICE(ATI_REMOTE_VENDOR_ID, ATI_REMOTE_PRODUCT_ID),
216 .driver_info = (unsigned long)&type_ati
217 },
218 {
219 USB_DEVICE(ATI_REMOTE_VENDOR_ID, NVIDIA_REMOTE_PRODUCT_ID),
220 .driver_info = (unsigned long)&type_ati
221 },
222 {
223 USB_DEVICE(ATI_REMOTE_VENDOR_ID, MEDION_REMOTE_PRODUCT_ID),
224 .driver_info = (unsigned long)&type_medion
225 },
226 {
227 USB_DEVICE(ATI_REMOTE_VENDOR_ID, FIREFLY_REMOTE_PRODUCT_ID),
228 .driver_info = (unsigned long)&type_firefly
229 },
205 {} /* Terminating entry */ 230 {} /* Terminating entry */
206}; 231};
207 232
@@ -296,25 +321,8 @@ static const struct {
296 {KIND_END, 0x00, EV_MAX + 1, 0, 0} 321 {KIND_END, 0x00, EV_MAX + 1, 0, 0}
297}; 322};
298 323
299/* Local function prototypes */
300static int ati_remote_sendpacket (struct ati_remote *ati_remote, u16 cmd, unsigned char *data);
301static void ati_remote_irq_out (struct urb *urb);
302static void ati_remote_irq_in (struct urb *urb);
303static void ati_remote_input_report (struct urb *urb);
304static int ati_remote_initialize (struct ati_remote *ati_remote);
305static int ati_remote_probe (struct usb_interface *interface, const struct usb_device_id *id);
306static void ati_remote_disconnect (struct usb_interface *interface);
307
308/* usb specific object to register with the usb subsystem */
309static struct usb_driver ati_remote_driver = {
310 .name = "ati_remote",
311 .probe = ati_remote_probe,
312 .disconnect = ati_remote_disconnect,
313 .id_table = ati_remote_table,
314};
315
316/* 324/*
317 * ati_remote_dump_input 325 * ati_remote_dump_input
318 */ 326 */
319static void ati_remote_dump(struct device *dev, unsigned char *data, 327static void ati_remote_dump(struct device *dev, unsigned char *data,
320 unsigned int len) 328 unsigned int len)
@@ -326,12 +334,14 @@ static void ati_remote_dump(struct device *dev, unsigned char *data,
326 dev_warn(dev, "Weird key %02x %02x %02x %02x\n", 334 dev_warn(dev, "Weird key %02x %02x %02x %02x\n",
327 data[0], data[1], data[2], data[3]); 335 data[0], data[1], data[2], data[3]);
328 else 336 else
329 dev_warn(dev, "Weird data, len=%d %02x %02x %02x %02x %02x %02x ...\n", 337 dev_warn(dev,
330 len, data[0], data[1], data[2], data[3], data[4], data[5]); 338 "Weird data, len=%d %02x %02x %02x %02x %02x %02x ...\n",
339 len, data[0], data[1], data[2], data[3], data[4],
340 data[5]);
331} 341}
332 342
333/* 343/*
334 * ati_remote_open 344 * ati_remote_open
335 */ 345 */
336static int ati_remote_open(struct ati_remote *ati_remote) 346static int ati_remote_open(struct ati_remote *ati_remote)
337{ 347{
@@ -355,7 +365,7 @@ out: mutex_unlock(&ati_remote->open_mutex);
355} 365}
356 366
357/* 367/*
358 * ati_remote_close 368 * ati_remote_close
359 */ 369 */
360static void ati_remote_close(struct ati_remote *ati_remote) 370static void ati_remote_close(struct ati_remote *ati_remote)
361{ 371{
@@ -390,7 +400,7 @@ static void ati_remote_rc_close(struct rc_dev *rdev)
390} 400}
391 401
392/* 402/*
393 * ati_remote_irq_out 403 * ati_remote_irq_out
394 */ 404 */
395static void ati_remote_irq_out(struct urb *urb) 405static void ati_remote_irq_out(struct urb *urb)
396{ 406{
@@ -408,11 +418,12 @@ static void ati_remote_irq_out(struct urb *urb)
408} 418}
409 419
410/* 420/*
411 * ati_remote_sendpacket 421 * ati_remote_sendpacket
412 * 422 *
413 * Used to send device initialization strings 423 * Used to send device initialization strings
414 */ 424 */
415static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigned char *data) 425static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd,
426 unsigned char *data)
416{ 427{
417 int retval = 0; 428 int retval = 0;
418 429
@@ -441,7 +452,7 @@ static int ati_remote_sendpacket(struct ati_remote *ati_remote, u16 cmd, unsigne
441} 452}
442 453
443/* 454/*
444 * ati_remote_compute_accel 455 * ati_remote_compute_accel
445 * 456 *
446 * Implements acceleration curve for directional control pad 457 * Implements acceleration curve for directional control pad
447 * If elapsed time since last event is > 1/4 second, user "stopped", 458 * If elapsed time since last event is > 1/4 second, user "stopped",
@@ -478,7 +489,7 @@ static int ati_remote_compute_accel(struct ati_remote *ati_remote)
478} 489}
479 490
480/* 491/*
481 * ati_remote_report_input 492 * ati_remote_report_input
482 */ 493 */
483static void ati_remote_input_report(struct urb *urb) 494static void ati_remote_input_report(struct urb *urb)
484{ 495{
@@ -518,7 +529,8 @@ static void ati_remote_input_report(struct urb *urb)
518 remote_num = (data[3] >> 4) & 0x0f; 529 remote_num = (data[3] >> 4) & 0x0f;
519 if (channel_mask & (1 << (remote_num + 1))) { 530 if (channel_mask & (1 << (remote_num + 1))) {
520 dbginfo(&ati_remote->interface->dev, 531 dbginfo(&ati_remote->interface->dev,
521 "Masked input from channel 0x%02x: data %02x,%02x, mask= 0x%02lx\n", 532 "Masked input from channel 0x%02x: data %02x,%02x, "
533 "mask= 0x%02lx\n",
522 remote_num, data[1], data[2], channel_mask); 534 remote_num, data[1], data[2], channel_mask);
523 return; 535 return;
524 } 536 }
@@ -546,7 +558,9 @@ static void ati_remote_input_report(struct urb *urb)
546 if (wheel_keycode == KEY_RESERVED) { 558 if (wheel_keycode == KEY_RESERVED) {
547 /* scrollwheel was not mapped, assume mouse */ 559 /* scrollwheel was not mapped, assume mouse */
548 560
549 /* Look up event code index in the mouse translation table. */ 561 /* Look up event code index in the mouse translation
562 * table.
563 */
550 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) { 564 for (i = 0; ati_remote_tbl[i].kind != KIND_END; i++) {
551 if (scancode == ati_remote_tbl[i].data) { 565 if (scancode == ati_remote_tbl[i].data) {
552 index = i; 566 index = i;
@@ -630,9 +644,9 @@ static void ati_remote_input_report(struct urb *urb)
630 } else { 644 } else {
631 645
632 /* 646 /*
633 * Other event kinds are from the directional control pad, and have an 647 * Other event kinds are from the directional control pad, and
634 * acceleration factor applied to them. Without this acceleration, the 648 * have an acceleration factor applied to them. Without this
635 * control pad is mostly unusable. 649 * acceleration, the control pad is mostly unusable.
636 */ 650 */
637 acc = ati_remote_compute_accel(ati_remote); 651 acc = ati_remote_compute_accel(ati_remote);
638 652
@@ -659,7 +673,8 @@ static void ati_remote_input_report(struct urb *urb)
659 input_report_rel(dev, REL_Y, acc); 673 input_report_rel(dev, REL_Y, acc);
660 break; 674 break;
661 default: 675 default:
662 dev_dbg(&ati_remote->interface->dev, "ati_remote kind=%d\n", 676 dev_dbg(&ati_remote->interface->dev,
677 "ati_remote kind=%d\n",
663 ati_remote_tbl[index].kind); 678 ati_remote_tbl[index].kind);
664 } 679 }
665 input_sync(dev); 680 input_sync(dev);
@@ -670,7 +685,7 @@ static void ati_remote_input_report(struct urb *urb)
670} 685}
671 686
672/* 687/*
673 * ati_remote_irq_in 688 * ati_remote_irq_in
674 */ 689 */
675static void ati_remote_irq_in(struct urb *urb) 690static void ati_remote_irq_in(struct urb *urb)
676{ 691{
@@ -684,22 +699,25 @@ static void ati_remote_irq_in(struct urb *urb)
684 case -ECONNRESET: /* unlink */ 699 case -ECONNRESET: /* unlink */
685 case -ENOENT: 700 case -ENOENT:
686 case -ESHUTDOWN: 701 case -ESHUTDOWN:
687 dev_dbg(&ati_remote->interface->dev, "%s: urb error status, unlink? \n", 702 dev_dbg(&ati_remote->interface->dev,
703 "%s: urb error status, unlink?\n",
688 __func__); 704 __func__);
689 return; 705 return;
690 default: /* error */ 706 default: /* error */
691 dev_dbg(&ati_remote->interface->dev, "%s: Nonzero urb status %d\n", 707 dev_dbg(&ati_remote->interface->dev,
708 "%s: Nonzero urb status %d\n",
692 __func__, urb->status); 709 __func__, urb->status);
693 } 710 }
694 711
695 retval = usb_submit_urb(urb, GFP_ATOMIC); 712 retval = usb_submit_urb(urb, GFP_ATOMIC);
696 if (retval) 713 if (retval)
697 dev_err(&ati_remote->interface->dev, "%s: usb_submit_urb()=%d\n", 714 dev_err(&ati_remote->interface->dev,
715 "%s: usb_submit_urb()=%d\n",
698 __func__, retval); 716 __func__, retval);
699} 717}
700 718
701/* 719/*
702 * ati_remote_alloc_buffers 720 * ati_remote_alloc_buffers
703 */ 721 */
704static int ati_remote_alloc_buffers(struct usb_device *udev, 722static int ati_remote_alloc_buffers(struct usb_device *udev,
705 struct ati_remote *ati_remote) 723 struct ati_remote *ati_remote)
@@ -726,7 +744,7 @@ static int ati_remote_alloc_buffers(struct usb_device *udev,
726} 744}
727 745
728/* 746/*
729 * ati_remote_free_buffers 747 * ati_remote_free_buffers
730 */ 748 */
731static void ati_remote_free_buffers(struct ati_remote *ati_remote) 749static void ati_remote_free_buffers(struct ati_remote *ati_remote)
732{ 750{
@@ -825,9 +843,10 @@ static int ati_remote_initialize(struct ati_remote *ati_remote)
825} 843}
826 844
827/* 845/*
828 * ati_remote_probe 846 * ati_remote_probe
829 */ 847 */
830static int ati_remote_probe(struct usb_interface *interface, const struct usb_device_id *id) 848static int ati_remote_probe(struct usb_interface *interface,
849 const struct usb_device_id *id)
831{ 850{
832 struct usb_device *udev = interface_to_usbdev(interface); 851 struct usb_device *udev = interface_to_usbdev(interface);
833 struct usb_host_interface *iface_host = interface->cur_altsetting; 852 struct usb_host_interface *iface_host = interface->cur_altsetting;
@@ -949,7 +968,7 @@ static int ati_remote_probe(struct usb_interface *interface, const struct usb_de
949} 968}
950 969
951/* 970/*
952 * ati_remote_disconnect 971 * ati_remote_disconnect
953 */ 972 */
954static void ati_remote_disconnect(struct usb_interface *interface) 973static void ati_remote_disconnect(struct usb_interface *interface)
955{ 974{
@@ -971,6 +990,14 @@ static void ati_remote_disconnect(struct usb_interface *interface)
971 kfree(ati_remote); 990 kfree(ati_remote);
972} 991}
973 992
993/* usb specific object to register with the usb subsystem */
994static struct usb_driver ati_remote_driver = {
995 .name = "ati_remote",
996 .probe = ati_remote_probe,
997 .disconnect = ati_remote_disconnect,
998 .id_table = ati_remote_table,
999};
1000
974module_usb_driver(ati_remote_driver); 1001module_usb_driver(ati_remote_driver);
975 1002
976MODULE_AUTHOR(DRIVER_AUTHOR); 1003MODULE_AUTHOR(DRIVER_AUTHOR);