aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorRoel Van Nyen <roel.vannyen@gmail.com>2010-04-27 17:57:00 -0400
committerMauro Carvalho Chehab <mchehab@redhat.com>2010-05-19 11:58:21 -0400
commit9d5164da8d8dd63bfb4e3070a5e27d79af0f1654 (patch)
treed51e7ba9d34b23e4e6ebf6831b3a4b7d689581cd
parente18f58c6262f1504dbf6c95e8a5e3cd9f32b6c5c (diff)
V4L/DVB: tm6000: fix coding style issues of tm6000-cards.c
fix coding style issues [mchehab@redhat.com: Fix conflicts with other patches] Signed-off-by: Roel Van Nyen <roel.vannyen@gmail.com> Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
-rw-r--r--drivers/staging/tm6000/tm6000-cards.c120
1 files changed, 58 insertions, 62 deletions
diff --git a/drivers/staging/tm6000/tm6000-cards.c b/drivers/staging/tm6000/tm6000-cards.c
index 56b878f8d49a..00d46ab185a1 100644
--- a/drivers/staging/tm6000/tm6000-cards.c
+++ b/drivers/staging/tm6000/tm6000-cards.c
@@ -299,7 +299,7 @@ struct tm6000_board tm6000_boards[] = {
299}; 299};
300 300
301/* table of devices that work with this driver */ 301/* table of devices that work with this driver */
302struct usb_device_id tm6000_id_table [] = { 302struct usb_device_id tm6000_id_table[] = {
303 { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 }, 303 { USB_DEVICE(0x6000, 0x0001), .driver_info = TM5600_BOARD_10MOONS_UT821 },
304 { USB_DEVICE(0x6000, 0x0002), .driver_info = TM6010_BOARD_GENERIC }, 304 { USB_DEVICE(0x6000, 0x0002), .driver_info = TM6010_BOARD_GENERIC },
305 { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV }, 305 { USB_DEVICE(0x06e1, 0xf332), .driver_info = TM6000_BOARD_ADSTECH_DUAL_TV },
@@ -324,23 +324,23 @@ struct usb_device_id tm6000_id_table [] = {
324 324
325int tm6000_tuner_callback(void *ptr, int component, int command, int arg) 325int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
326{ 326{
327 int rc=0; 327 int rc = 0;
328 struct tm6000_core *dev = ptr; 328 struct tm6000_core *dev = ptr;
329 329
330 if (dev->tuner_type!=TUNER_XC2028) 330 if (dev->tuner_type != TUNER_XC2028)
331 return 0; 331 return 0;
332 332
333 switch (command) { 333 switch (command) {
334 case XC2028_RESET_CLK: 334 case XC2028_RESET_CLK:
335 tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 335 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
336 0x02, arg); 336 0x02, arg);
337 msleep(10); 337 msleep(10);
338 rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, 338 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
339 TM6000_GPIO_CLK, 0); 339 TM6000_GPIO_CLK, 0);
340 if (rc<0) 340 if (rc < 0)
341 return rc; 341 return rc;
342 msleep(10); 342 msleep(10);
343 rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, 343 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
344 TM6000_GPIO_CLK, 1); 344 TM6000_GPIO_CLK, 1);
345 break; 345 break;
346 case XC2028_TUNER_RESET: 346 case XC2028_TUNER_RESET:
@@ -389,24 +389,24 @@ int tm6000_tuner_callback(void *ptr, int component, int command, int arg)
389 } 389 }
390 break; 390 break;
391 case 1: 391 case 1:
392 tm6000_set_reg (dev, REQ_04_EN_DISABLE_MCU_INT, 392 tm6000_set_reg(dev, REQ_04_EN_DISABLE_MCU_INT,
393 0x02, 0x01); 393 0x02, 0x01);
394 msleep(10); 394 msleep(10);
395 break; 395 break;
396 396
397 case 2: 397 case 2:
398 rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, 398 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
399 TM6000_GPIO_CLK, 0); 399 TM6000_GPIO_CLK, 0);
400 if (rc<0) 400 if (rc < 0)
401 return rc; 401 return rc;
402 msleep(100); 402 msleep(100);
403 rc=tm6000_set_reg (dev, REQ_03_SET_GET_MCU_PIN, 403 rc = tm6000_set_reg(dev, REQ_03_SET_GET_MCU_PIN,
404 TM6000_GPIO_CLK, 1); 404 TM6000_GPIO_CLK, 1);
405 msleep(100); 405 msleep(100);
406 break; 406 break;
407 } 407 }
408 } 408 }
409 return (rc); 409 return rc;
410} 410}
411 411
412int tm6000_cards_setup(struct tm6000_core *dev) 412int tm6000_cards_setup(struct tm6000_core *dev)
@@ -507,28 +507,28 @@ int tm6000_cards_setup(struct tm6000_core *dev)
507 return 0; 507 return 0;
508}; 508};
509 509
510static void tm6000_config_tuner (struct tm6000_core *dev) 510static void tm6000_config_tuner(struct tm6000_core *dev)
511{ 511{
512 struct tuner_setup tun_setup; 512 struct tuner_setup tun_setup;
513 513
514 /* Load tuner module */ 514 /* Load tuner module */
515 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap, 515 v4l2_i2c_new_subdev(&dev->v4l2_dev, &dev->i2c_adap,
516 "tuner", "tuner",dev->tuner_addr, NULL); 516 "tuner", "tuner", dev->tuner_addr, NULL);
517 517
518 memset(&tun_setup, 0, sizeof(tun_setup)); 518 memset(&tun_setup, 0, sizeof(tun_setup));
519 tun_setup.type = dev->tuner_type; 519 tun_setup.type = dev->tuner_type;
520 tun_setup.addr = dev->tuner_addr; 520 tun_setup.addr = dev->tuner_addr;
521 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO | T_DIGITAL_TV; 521 tun_setup.mode_mask = T_ANALOG_TV | T_RADIO | T_DIGITAL_TV;
522 tun_setup.tuner_callback = tm6000_tuner_callback; 522 tun_setup.tuner_callback = tm6000_tuner_callback;
523 523
524 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup); 524 v4l2_device_call_all(&dev->v4l2_dev, 0, tuner, s_type_addr, &tun_setup);
525 525
526 if (dev->tuner_type == TUNER_XC2028) { 526 if (dev->tuner_type == TUNER_XC2028) {
527 struct v4l2_priv_tun_config xc2028_cfg; 527 struct v4l2_priv_tun_config xc2028_cfg;
528 struct xc2028_ctrl ctl; 528 struct xc2028_ctrl ctl;
529 529
530 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg)); 530 memset(&xc2028_cfg, 0, sizeof(xc2028_cfg));
531 memset (&ctl,0,sizeof(ctl)); 531 memset(&ctl, 0, sizeof(ctl));
532 532
533 ctl.input1 = 1; 533 ctl.input1 = 1;
534 ctl.read_not_reliable = 0; 534 ctl.read_not_reliable = 0;
@@ -539,7 +539,7 @@ static void tm6000_config_tuner (struct tm6000_core *dev)
539 xc2028_cfg.tuner = TUNER_XC2028; 539 xc2028_cfg.tuner = TUNER_XC2028;
540 xc2028_cfg.priv = &ctl; 540 xc2028_cfg.priv = &ctl;
541 541
542 switch(dev->model) { 542 switch (dev->model) {
543 case TM6010_BOARD_HAUPPAUGE_900H: 543 case TM6010_BOARD_HAUPPAUGE_900H:
544 case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE: 544 case TM6010_BOARD_TERRATEC_CINERGY_HYBRID_XE:
545 case TM6010_BOARD_TWINHAN_TU501: 545 case TM6010_BOARD_TWINHAN_TU501:
@@ -580,8 +580,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
580 dev->caps = tm6000_boards[dev->model].caps; 580 dev->caps = tm6000_boards[dev->model].caps;
581 581
582 /* initialize hardware */ 582 /* initialize hardware */
583 rc=tm6000_init (dev); 583 rc = tm6000_init(dev);
584 if (rc<0) 584 if (rc < 0)
585 goto err; 585 goto err;
586 586
587 rc = v4l2_device_register(&dev->udev->dev, &dev->v4l2_dev); 587 rc = v4l2_device_register(&dev->udev->dev, &dev->v4l2_dev);
@@ -589,8 +589,8 @@ static int tm6000_init_dev(struct tm6000_core *dev)
589 goto err; 589 goto err;
590 590
591 /* register i2c bus */ 591 /* register i2c bus */
592 rc=tm6000_i2c_register(dev); 592 rc = tm6000_i2c_register(dev);
593 if (rc<0) 593 if (rc < 0)
594 goto err; 594 goto err;
595 595
596 /* Default values for STD and resolutions */ 596 /* Default values for STD and resolutions */
@@ -599,7 +599,7 @@ static int tm6000_init_dev(struct tm6000_core *dev)
599 dev->norm = V4L2_STD_PAL_M; 599 dev->norm = V4L2_STD_PAL_M;
600 600
601 /* Configure tuner */ 601 /* Configure tuner */
602 tm6000_config_tuner (dev); 602 tm6000_config_tuner(dev);
603 603
604 /* Set video standard */ 604 /* Set video standard */
605 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm); 605 v4l2_device_call_all(&dev->v4l2_dev, 0, core, s_std, dev->norm);
@@ -616,20 +616,20 @@ static int tm6000_init_dev(struct tm6000_core *dev)
616 "tvaudio", "tvaudio", I2C_ADDR_TDA9874, NULL); 616 "tvaudio", "tvaudio", I2C_ADDR_TDA9874, NULL);
617 617
618 /* register and initialize V4L2 */ 618 /* register and initialize V4L2 */
619 rc=tm6000_v4l2_register(dev); 619 rc = tm6000_v4l2_register(dev);
620 if (rc<0) 620 if (rc < 0)
621 goto err; 621 goto err;
622 622
623 if(dev->caps.has_dvb) { 623 if (dev->caps.has_dvb) {
624 dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL); 624 dev->dvb = kzalloc(sizeof(*(dev->dvb)), GFP_KERNEL);
625 if(!dev->dvb) { 625 if (!dev->dvb) {
626 rc = -ENOMEM; 626 rc = -ENOMEM;
627 goto err2; 627 goto err2;
628 } 628 }
629 629
630#ifdef CONFIG_VIDEO_TM6000_DVB 630#ifdef CONFIG_VIDEO_TM6000_DVB
631 rc = tm6000_dvb_register(dev); 631 rc = tm6000_dvb_register(dev);
632 if(rc < 0) { 632 if (rc < 0) {
633 kfree(dev->dvb); 633 kfree(dev->dvb);
634 dev->dvb = NULL; 634 dev->dvb = NULL;
635 goto err2; 635 goto err2;
@@ -668,7 +668,7 @@ static void get_max_endpoint(struct usb_device *udev,
668 tm_ep->bInterfaceNumber = alt->desc.bInterfaceNumber; 668 tm_ep->bInterfaceNumber = alt->desc.bInterfaceNumber;
669 tm_ep->bAlternateSetting = alt->desc.bAlternateSetting; 669 tm_ep->bAlternateSetting = alt->desc.bAlternateSetting;
670 670
671 printk("tm6000: %s endpoint: 0x%02x (max size=%u bytes)\n", 671 printk(KERN_INFO "tm6000: %s endpoint: 0x%02x (max size=%u bytes)\n",
672 msgtype, curr_e->desc.bEndpointAddress, 672 msgtype, curr_e->desc.bEndpointAddress,
673 size); 673 size);
674 } 674 }
@@ -683,22 +683,21 @@ static int tm6000_usb_probe(struct usb_interface *interface,
683{ 683{
684 struct usb_device *usbdev; 684 struct usb_device *usbdev;
685 struct tm6000_core *dev = NULL; 685 struct tm6000_core *dev = NULL;
686 int i,rc=0; 686 int i, rc = 0;
687 int nr=0; 687 int nr = 0;
688 char *speed; 688 char *speed;
689 689
690 690 usbdev = usb_get_dev(interface_to_usbdev(interface));
691 usbdev=usb_get_dev(interface_to_usbdev(interface));
692 691
693 /* Selects the proper interface */ 692 /* Selects the proper interface */
694 rc=usb_set_interface(usbdev,0,1); 693 rc = usb_set_interface(usbdev, 0, 1);
695 if (rc<0) 694 if (rc < 0)
696 goto err; 695 goto err;
697 696
698 /* Check to see next free device and mark as used */ 697 /* Check to see next free device and mark as used */
699 nr=find_first_zero_bit(&tm6000_devused,TM6000_MAXBOARDS); 698 nr = find_first_zero_bit(&tm6000_devused, TM6000_MAXBOARDS);
700 if (nr >= TM6000_MAXBOARDS) { 699 if (nr >= TM6000_MAXBOARDS) {
701 printk ("tm6000: Supports only %i tm60xx boards.\n",TM6000_MAXBOARDS); 700 printk(KERN_ERR "tm6000: Supports only %i tm60xx boards.\n", TM6000_MAXBOARDS);
702 usb_put_dev(usbdev); 701 usb_put_dev(usbdev);
703 return -ENOMEM; 702 return -ENOMEM;
704 } 703 }
@@ -706,24 +705,23 @@ static int tm6000_usb_probe(struct usb_interface *interface,
706 /* Create and initialize dev struct */ 705 /* Create and initialize dev struct */
707 dev = kzalloc(sizeof(*dev), GFP_KERNEL); 706 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
708 if (dev == NULL) { 707 if (dev == NULL) {
709 printk ("tm6000" ": out of memory!\n"); 708 printk(KERN_ERR "tm6000" ": out of memory!\n");
710 usb_put_dev(usbdev); 709 usb_put_dev(usbdev);
711 return -ENOMEM; 710 return -ENOMEM;
712 } 711 }
713 spin_lock_init(&dev->slock); 712 spin_lock_init(&dev->slock);
714 713
715 /* Increment usage count */ 714 /* Increment usage count */
716 tm6000_devused|=1<<nr; 715 tm6000_devused |= 1<<nr;
717 snprintf(dev->name, 29, "tm6000 #%d", nr); 716 snprintf(dev->name, 29, "tm6000 #%d", nr);
718 717
719 dev->model=id->driver_info; 718 dev->model = id->driver_info;
720 if ((card[nr]>=0) && (card[nr]<ARRAY_SIZE(tm6000_boards))) { 719 if ((card[nr] >= 0) && (card[nr] < ARRAY_SIZE(tm6000_boards)))
721 dev->model=card[nr]; 720 dev->model = card[nr];
722 }
723 721
724 INIT_LIST_HEAD(&dev->tm6000_corelist); 722 INIT_LIST_HEAD(&dev->tm6000_corelist);
725 dev->udev= usbdev; 723 dev->udev = usbdev;
726 dev->devno=nr; 724 dev->devno = nr;
727 725
728 switch (usbdev->speed) { 726 switch (usbdev->speed) {
729 case USB_SPEED_LOW: 727 case USB_SPEED_LOW:
@@ -755,7 +753,7 @@ static int tm6000_usb_probe(struct usb_interface *interface,
755 dir_out = ((e->desc.bEndpointAddress & 753 dir_out = ((e->desc.bEndpointAddress &
756 USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT); 754 USB_ENDPOINT_DIR_MASK) == USB_DIR_OUT);
757 755
758 printk("tm6000: alt %d, interface %i, class %i\n", 756 printk(KERN_INFO "tm6000: alt %d, interface %i, class %i\n",
759 i, 757 i,
760 interface->altsetting[i].desc.bInterfaceNumber, 758 interface->altsetting[i].desc.bInterfaceNumber,
761 interface->altsetting[i].desc.bInterfaceClass); 759 interface->altsetting[i].desc.bInterfaceClass);
@@ -792,7 +790,7 @@ static int tm6000_usb_probe(struct usb_interface *interface,
792 } 790 }
793 791
794 792
795 printk("tm6000: New video device @ %s Mbps (%04x:%04x, ifnum %d)\n", 793 printk(KERN_INFO "tm6000: New video device @ %s Mbps (%04x:%04x, ifnum %d)\n",
796 speed, 794 speed,
797 le16_to_cpu(dev->udev->descriptor.idVendor), 795 le16_to_cpu(dev->udev->descriptor.idVendor),
798 le16_to_cpu(dev->udev->descriptor.idProduct), 796 le16_to_cpu(dev->udev->descriptor.idProduct),
@@ -800,8 +798,8 @@ static int tm6000_usb_probe(struct usb_interface *interface,
800 798
801/* check if the the device has the iso in endpoint at the correct place */ 799/* check if the the device has the iso in endpoint at the correct place */
802 if (!dev->isoc_in.endp) { 800 if (!dev->isoc_in.endp) {
803 printk("tm6000: probing error: no IN ISOC endpoint!\n"); 801 printk(KERN_ERR "tm6000: probing error: no IN ISOC endpoint!\n");
804 rc= -ENODEV; 802 rc = -ENODEV;
805 803
806 goto err; 804 goto err;
807 } 805 }
@@ -809,19 +807,19 @@ static int tm6000_usb_probe(struct usb_interface *interface,
809 /* save our data pointer in this interface device */ 807 /* save our data pointer in this interface device */
810 usb_set_intfdata(interface, dev); 808 usb_set_intfdata(interface, dev);
811 809
812 printk("tm6000: Found %s\n", tm6000_boards[dev->model].name); 810 printk(KERN_INFO "tm6000: Found %s\n", tm6000_boards[dev->model].name);
813 811
814 rc=tm6000_init_dev(dev); 812 rc = tm6000_init_dev(dev);
815 813
816 if (rc<0) 814 if (rc < 0)
817 goto err; 815 goto err;
818 816
819 return 0; 817 return 0;
820 818
821err: 819err:
822 printk("tm6000: Error %d while registering\n", rc); 820 printk(KERN_ERR "tm6000: Error %d while registering\n", rc);
823 821
824 tm6000_devused&=~(1<<nr); 822 tm6000_devused &= ~(1<<nr);
825 usb_put_dev(usbdev); 823 usb_put_dev(usbdev);
826 824
827 kfree(dev); 825 kfree(dev);
@@ -841,12 +839,12 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
841 if (!dev) 839 if (!dev)
842 return; 840 return;
843 841
844 printk("tm6000: disconnecting %s\n", dev->name); 842 printk(KERN_INFO "tm6000: disconnecting %s\n", dev->name);
845 843
846 mutex_lock(&dev->lock); 844 mutex_lock(&dev->lock);
847 845
848#ifdef CONFIG_VIDEO_TM6000_DVB 846#ifdef CONFIG_VIDEO_TM6000_DVB
849 if(dev->dvb) { 847 if (dev->dvb) {
850 tm6000_dvb_unregister(dev); 848 tm6000_dvb_unregister(dev);
851 kfree(dev->dvb); 849 kfree(dev->dvb);
852 } 850 }
@@ -858,8 +856,6 @@ static void tm6000_usb_disconnect(struct usb_interface *interface)
858 856
859 v4l2_device_unregister(&dev->v4l2_dev); 857 v4l2_device_unregister(&dev->v4l2_dev);
860 858
861// wake_up_interruptible_all(&dev->open);
862
863 dev->state |= DEV_DISCONNECTED; 859 dev->state |= DEV_DISCONNECTED;
864 860
865 usb_put_dev(dev->udev); 861 usb_put_dev(dev->udev);
@@ -886,7 +882,7 @@ static int __init tm6000_module_init(void)
886 /* register this driver with the USB subsystem */ 882 /* register this driver with the USB subsystem */
887 result = usb_register(&tm6000_usb_driver); 883 result = usb_register(&tm6000_usb_driver);
888 if (result) 884 if (result)
889 printk("tm6000" 885 printk(KERN_ERR "tm6000"
890 " usb_register failed. Error number %d.\n", result); 886 " usb_register failed. Error number %d.\n", result);
891 887
892 return result; 888 return result;