aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/cx231xx
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@redhat.com>2011-01-29 20:10:56 -0500
committerMauro Carvalho Chehab <mchehab@redhat.com>2011-03-21 19:31:59 -0400
commit8bb84227d1ba41d6c1ec9350a4424ece5fe00e33 (patch)
treefd48ac9b2cd6fb974f1b9a66ec4ba01c9c362cec /drivers/media/video/cx231xx
parentb8bc77db1e23c6e141734511db873902c66bec8c (diff)
[media] cx231xx: Simplify interface checking logic at probe
Just a cleanup patch. Removes one indent level by moving the return -ENODEV to happen before the device register logic, if the interface is not the audio/video (int 1). Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
Diffstat (limited to 'drivers/media/video/cx231xx')
-rw-r--r--drivers/media/video/cx231xx/cx231xx-cards.c192
1 files changed, 96 insertions, 96 deletions
diff --git a/drivers/media/video/cx231xx/cx231xx-cards.c b/drivers/media/video/cx231xx/cx231xx-cards.c
index 588f3e8f028b..ca2b24b0b166 100644
--- a/drivers/media/video/cx231xx/cx231xx-cards.c
+++ b/drivers/media/video/cx231xx/cx231xx-cards.c
@@ -844,110 +844,110 @@ static int cx231xx_usb_probe(struct usb_interface *interface,
844 udev = usb_get_dev(interface_to_usbdev(interface)); 844 udev = usb_get_dev(interface_to_usbdev(interface));
845 ifnum = interface->altsetting[0].desc.bInterfaceNumber; 845 ifnum = interface->altsetting[0].desc.bInterfaceNumber;
846 846
847 if (ifnum == 1) { 847 /*
848 /* 848 * Interface number 0 - IR interface (handled by mceusb driver)
849 * Interface number 0 - IR interface 849 * Interface number 1 - AV interface (handled by this driver)
850 */ 850 */
851 /* Check to see next free device and mark as used */ 851 if (ifnum != 1)
852 nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS); 852 return -ENODEV;
853 cx231xx_devused |= 1 << nr;
854
855 if (nr >= CX231XX_MAXBOARDS) {
856 cx231xx_err(DRIVER_NAME
857 ": Supports only %i cx231xx boards.\n", CX231XX_MAXBOARDS);
858 cx231xx_devused &= ~(1 << nr);
859 return -ENOMEM;
860 }
861
862 /* allocate memory for our device state and initialize it */
863 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
864 if (dev == NULL) {
865 cx231xx_err(DRIVER_NAME ": out of memory!\n");
866 cx231xx_devused &= ~(1 << nr);
867 return -ENOMEM;
868 }
869
870 snprintf(dev->name, 29, "cx231xx #%d", nr);
871 dev->devno = nr;
872 dev->model = id->driver_info;
873 dev->video_mode.alt = -1;
874 dev->interface_count++;
875
876 /* reset gpio dir and value */
877 dev->gpio_dir = 0;
878 dev->gpio_val = 0;
879 dev->xc_fw_load_done = 0;
880 dev->has_alsa_audio = 1;
881 dev->power_mode = -1;
882 atomic_set(&dev->devlist_count, 0);
883
884 /* 0 - vbi ; 1 -sliced cc mode */
885 dev->vbi_or_sliced_cc_mode = 0;
886
887 /* get maximum no.of IAD interfaces */
888 assoc_desc = udev->actconfig->intf_assoc[0];
889 dev->max_iad_interface_count = assoc_desc->bInterfaceCount;
890
891 /* init CIR module TBD */
892 853
893 /* store the current interface */ 854 /* Check to see next free device and mark as used */
894 lif = interface; 855 nr = find_first_zero_bit(&cx231xx_devused, CX231XX_MAXBOARDS);
856 cx231xx_devused |= 1 << nr;
895 857
896 /*mode_tv: digital=1 or analog=0*/ 858 if (nr >= CX231XX_MAXBOARDS) {
897 dev->mode_tv = 0; 859 cx231xx_err(DRIVER_NAME
860 ": Supports only %i cx231xx boards.\n", CX231XX_MAXBOARDS);
861 cx231xx_devused &= ~(1 << nr);
862 return -ENOMEM;
863 }
898 864
899 dev->USE_ISO = transfer_mode; 865 /* allocate memory for our device state and initialize it */
866 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
867 if (dev == NULL) {
868 cx231xx_err(DRIVER_NAME ": out of memory!\n");
869 cx231xx_devused &= ~(1 << nr);
870 return -ENOMEM;
871 }
900 872
901 switch (udev->speed) { 873 snprintf(dev->name, 29, "cx231xx #%d", nr);
902 case USB_SPEED_LOW: 874 dev->devno = nr;
903 speed = "1.5"; 875 dev->model = id->driver_info;
904 break; 876 dev->video_mode.alt = -1;
905 case USB_SPEED_UNKNOWN: 877
906 case USB_SPEED_FULL: 878 dev->interface_count++;
907 speed = "12"; 879 /* reset gpio dir and value */
908 break; 880 dev->gpio_dir = 0;
909 case USB_SPEED_HIGH: 881 dev->gpio_val = 0;
910 speed = "480"; 882 dev->xc_fw_load_done = 0;
911 break; 883 dev->has_alsa_audio = 1;
912 default: 884 dev->power_mode = -1;
913 speed = "unknown"; 885 atomic_set(&dev->devlist_count, 0);
914 } 886
887 /* 0 - vbi ; 1 -sliced cc mode */
888 dev->vbi_or_sliced_cc_mode = 0;
889
890 /* get maximum no.of IAD interfaces */
891 assoc_desc = udev->actconfig->intf_assoc[0];
892 dev->max_iad_interface_count = assoc_desc->bInterfaceCount;
893
894 /* init CIR module TBD */
895
896 /* store the current interface */
897 lif = interface;
898
899 /*mode_tv: digital=1 or analog=0*/
900 dev->mode_tv = 0;
901
902 dev->USE_ISO = transfer_mode;
903
904 switch (udev->speed) {
905 case USB_SPEED_LOW:
906 speed = "1.5";
907 break;
908 case USB_SPEED_UNKNOWN:
909 case USB_SPEED_FULL:
910 speed = "12";
911 break;
912 case USB_SPEED_HIGH:
913 speed = "480";
914 break;
915 default:
916 speed = "unknown";
917 }
915 918
916 if (udev->manufacturer) 919 if (udev->manufacturer)
917 strlcpy(descr, udev->manufacturer, sizeof(descr)); 920 strlcpy(descr, udev->manufacturer, sizeof(descr));
918 921
919 if (udev->product) { 922 if (udev->product) {
920 if (*descr)
921 strlcat(descr, " ", sizeof(descr));
922 strlcat(descr, udev->product, sizeof(descr));
923 }
924 if (*descr) 923 if (*descr)
925 strlcat(descr, " ", sizeof(descr)); 924 strlcat(descr, " ", sizeof(descr));
926 925 strlcat(descr, udev->product, sizeof(descr));
927 cx231xx_info("New device %s@ %s Mbps " 926 }
928 "(%04x:%04x) with %d interfaces\n", 927 if (*descr)
929 descr, 928 strlcat(descr, " ", sizeof(descr));
930 speed, 929
931 le16_to_cpu(udev->descriptor.idVendor), 930 cx231xx_info("New device %s@ %s Mbps "
932 le16_to_cpu(udev->descriptor.idProduct), 931 "(%04x:%04x) with %d interfaces\n",
933 dev->max_iad_interface_count); 932 descr,
934 933 speed,
935 /* store the interface 0 back */ 934 le16_to_cpu(udev->descriptor.idVendor),
936 lif = udev->actconfig->interface[0]; 935 le16_to_cpu(udev->descriptor.idProduct),
937 936 dev->max_iad_interface_count);
938 /* increment interface count */ 937
939 dev->interface_count++; 938 /* store the interface 0 back */
940 939 lif = udev->actconfig->interface[0];
941 /* get device number */ 940
942 nr = dev->devno; 941 /* increment interface count */
943 942 dev->interface_count++;
944 assoc_desc = udev->actconfig->intf_assoc[0]; 943
945 if (assoc_desc->bFirstInterface != ifnum) { 944 /* get device number */
946 cx231xx_err(DRIVER_NAME ": Not found " 945 nr = dev->devno;
947 "matching IAD interface\n"); 946
948 return -ENODEV; 947 assoc_desc = udev->actconfig->intf_assoc[0];
949 } 948 if (assoc_desc->bFirstInterface != ifnum) {
950 } else { 949 cx231xx_err(DRIVER_NAME ": Not found "
950 "matching IAD interface\n");
951 return -ENODEV; 951 return -ENODEV;
952 } 952 }
953 953