aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-11-28 06:34:15 -0500
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2014-12-04 11:13:14 -0500
commitfdf1bc9fa2cf08f82b0c1747d9dd16da192d7d2a (patch)
tree971722a8d9f3ec290ec0999d57e10d28644a9e38
parent1b97dc98b58dad98f13fa0a4cdc819b60f3f3bff (diff)
[media] em28xx: checkpatch cleanup: whitespaces/new lines cleanups
This patch is basically produced while testing a tool that Joe Perches sent upstream sometime ago: https://lkml.org/lkml/2014/7/11/794 I used it with those arguments: $ reformat_with_checkpatch.sh drivers/media/usb/em28xx/em28xx*.[ch] It actually produced 24 patches, with is too much, and showed interesting things: gcc produced different codes on most of the patches, even with just linespace changes. The total code data remained the same on all cases I checked though. Anyway, provided that we fold the resulting patches, this tool seems useful. Signed-off-by: Mauro Carvalho Chehab <mchehab@osg.samsung.com>
-rw-r--r--drivers/media/usb/em28xx/em28xx-audio.c19
-rw-r--r--drivers/media/usb/em28xx/em28xx-camera.c5
-rw-r--r--drivers/media/usb/em28xx/em28xx-cards.c28
-rw-r--r--drivers/media/usb/em28xx/em28xx-core.c41
-rw-r--r--drivers/media/usb/em28xx/em28xx-dvb.c30
-rw-r--r--drivers/media/usb/em28xx/em28xx-i2c.c5
-rw-r--r--drivers/media/usb/em28xx/em28xx-input.c14
-rw-r--r--drivers/media/usb/em28xx/em28xx-reg.h3
-rw-r--r--drivers/media/usb/em28xx/em28xx-v4l.h1
-rw-r--r--drivers/media/usb/em28xx/em28xx-vbi.c1
-rw-r--r--drivers/media/usb/em28xx/em28xx-video.c98
-rw-r--r--drivers/media/usb/em28xx/em28xx.h25
12 files changed, 134 insertions, 136 deletions
diff --git a/drivers/media/usb/em28xx/em28xx-audio.c b/drivers/media/usb/em28xx/em28xx-audio.c
index 957c7ae30efe..44ae1e0661e6 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -56,7 +56,7 @@ MODULE_PARM_DESC(debug, "activates debug info");
56#define dprintk(fmt, arg...) do { \ 56#define dprintk(fmt, arg...) do { \
57 if (debug) \ 57 if (debug) \
58 printk(KERN_INFO "em28xx-audio %s: " fmt, \ 58 printk(KERN_INFO "em28xx-audio %s: " fmt, \
59 __func__, ##arg); \ 59 __func__, ##arg); \
60 } while (0) 60 } while (0)
61 61
62static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 62static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
@@ -232,7 +232,6 @@ static struct snd_pcm_hardware snd_em28xx_hw_capture = {
232 .channels_max = 2, 232 .channels_max = 2,
233 .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */ 233 .buffer_bytes_max = 62720 * 8, /* just about the value in usbaudio.c */
234 234
235
236 /* 235 /*
237 * The period is 12.288 bytes. Allow a 10% of variation along its 236 * The period is 12.288 bytes. Allow a 10% of variation along its
238 * value, in order to avoid overruns/underruns due to some clock 237 * value, in order to avoid overruns/underruns due to some clock
@@ -361,7 +360,7 @@ static int snd_em28xx_hw_capture_params(struct snd_pcm_substream *substream,
361 dprintk("Setting capture parameters\n"); 360 dprintk("Setting capture parameters\n");
362 361
363 ret = snd_pcm_alloc_vmalloc_buffer(substream, 362 ret = snd_pcm_alloc_vmalloc_buffer(substream,
364 params_buffer_bytes(hw_params)); 363 params_buffer_bytes(hw_params));
365 if (ret < 0) 364 if (ret < 0)
366 return ret; 365 return ret;
367#if 0 366#if 0
@@ -478,7 +477,7 @@ static struct page *snd_pcm_get_vmalloc_page(struct snd_pcm_substream *subs,
478 * AC97 volume control support 477 * AC97 volume control support
479 */ 478 */
480static int em28xx_vol_info(struct snd_kcontrol *kcontrol, 479static int em28xx_vol_info(struct snd_kcontrol *kcontrol,
481 struct snd_ctl_elem_info *info) 480 struct snd_ctl_elem_info *info)
482{ 481{
483 struct em28xx *dev = snd_kcontrol_chip(kcontrol); 482 struct em28xx *dev = snd_kcontrol_chip(kcontrol);
484 483
@@ -494,7 +493,7 @@ static int em28xx_vol_info(struct snd_kcontrol *kcontrol,
494} 493}
495 494
496static int em28xx_vol_put(struct snd_kcontrol *kcontrol, 495static int em28xx_vol_put(struct snd_kcontrol *kcontrol,
497 struct snd_ctl_elem_value *value) 496 struct snd_ctl_elem_value *value)
498{ 497{
499 struct em28xx *dev = snd_kcontrol_chip(kcontrol); 498 struct em28xx *dev = snd_kcontrol_chip(kcontrol);
500 struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream; 499 struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream;
@@ -534,7 +533,7 @@ err:
534} 533}
535 534
536static int em28xx_vol_get(struct snd_kcontrol *kcontrol, 535static int em28xx_vol_get(struct snd_kcontrol *kcontrol,
537 struct snd_ctl_elem_value *value) 536 struct snd_ctl_elem_value *value)
538{ 537{
539 struct em28xx *dev = snd_kcontrol_chip(kcontrol); 538 struct em28xx *dev = snd_kcontrol_chip(kcontrol);
540 struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream; 539 struct snd_pcm_substream *substream = dev->adev.capture_pcm_substream;
@@ -655,7 +654,7 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev,
655 struct snd_kcontrol *kctl; 654 struct snd_kcontrol *kctl;
656 struct snd_kcontrol_new tmp; 655 struct snd_kcontrol_new tmp;
657 656
658 memset (&tmp, 0, sizeof(tmp)); 657 memset(&tmp, 0, sizeof(tmp));
659 tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 658 tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
660 tmp.private_value = id, 659 tmp.private_value = id,
661 tmp.name = ctl_name, 660 tmp.name = ctl_name,
@@ -672,7 +671,7 @@ static int em28xx_cvol_new(struct snd_card *card, struct em28xx *dev,
672 dprintk("Added control %s for ac97 volume control 0x%04x\n", 671 dprintk("Added control %s for ac97 volume control 0x%04x\n",
673 ctl_name, id); 672 ctl_name, id);
674 673
675 memset (&tmp, 0, sizeof(tmp)); 674 memset(&tmp, 0, sizeof(tmp));
676 tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER, 675 tmp.iface = SNDRV_CTL_ELEM_IFACE_MIXER,
677 tmp.private_value = id, 676 tmp.private_value = id,
678 tmp.name = ctl_name, 677 tmp.name = ctl_name,
@@ -731,7 +730,7 @@ static void em28xx_audio_free_urb(struct em28xx *dev)
731 730
732/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */ 731/* high bandwidth multiplier, as encoded in highspeed endpoint descriptors */
733static int em28xx_audio_ep_packet_size(struct usb_device *udev, 732static int em28xx_audio_ep_packet_size(struct usb_device *udev,
734 struct usb_endpoint_descriptor *e) 733 struct usb_endpoint_descriptor *e)
735{ 734{
736 int size = le16_to_cpu(e->wMaxPacketSize); 735 int size = le16_to_cpu(e->wMaxPacketSize);
737 736
@@ -781,7 +780,7 @@ static int em28xx_audio_urb_init(struct em28xx *dev)
781 interval = 1 << (ep->bInterval - 1); 780 interval = 1 << (ep->bInterval - 1);
782 781
783 em28xx_info("Endpoint 0x%02x %s on intf %d alt %d interval = %d, size %d\n", 782 em28xx_info("Endpoint 0x%02x %s on intf %d alt %d interval = %d, size %d\n",
784 EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed), 783 EM28XX_EP_AUDIO, usb_speed_string(dev->udev->speed),
785 dev->ifnum, alt, 784 dev->ifnum, alt,
786 interval, 785 interval,
787 ep_size); 786 ep_size);
diff --git a/drivers/media/usb/em28xx/em28xx-camera.c b/drivers/media/usb/em28xx/em28xx-camera.c
index 38cf6c8491a4..7be661f73930 100644
--- a/drivers/media/usb/em28xx/em28xx-camera.c
+++ b/drivers/media/usb/em28xx/em28xx-camera.c
@@ -27,7 +27,6 @@
27 27
28#include "em28xx.h" 28#include "em28xx.h"
29 29
30
31/* Possible i2c addresses of Micron sensors */ 30/* Possible i2c addresses of Micron sensors */
32static unsigned short micron_sensor_addrs[] = { 31static unsigned short micron_sensor_addrs[] = {
33 0xb8 >> 1, /* MT9V111, MT9V403 */ 32 0xb8 >> 1, /* MT9V111, MT9V403 */
@@ -43,7 +42,6 @@ static unsigned short omnivision_sensor_addrs[] = {
43 I2C_CLIENT_END 42 I2C_CLIENT_END
44}; 43};
45 44
46
47static struct soc_camera_link camlink = { 45static struct soc_camera_link camlink = {
48 .bus_id = 0, 46 .bus_id = 0,
49 .flags = 0, 47 .flags = 0,
@@ -51,7 +49,6 @@ static struct soc_camera_link camlink = {
51 .unbalanced_power = true, 49 .unbalanced_power = true,
52}; 50};
53 51
54
55/* FIXME: Should be replaced by a proper mt9m111 driver */ 52/* FIXME: Should be replaced by a proper mt9m111 driver */
56static int em28xx_initialize_mt9m111(struct em28xx *dev) 53static int em28xx_initialize_mt9m111(struct em28xx *dev)
57{ 54{
@@ -70,7 +67,6 @@ static int em28xx_initialize_mt9m111(struct em28xx *dev)
70 return 0; 67 return 0;
71} 68}
72 69
73
74/* FIXME: Should be replaced by a proper mt9m001 driver */ 70/* FIXME: Should be replaced by a proper mt9m001 driver */
75static int em28xx_initialize_mt9m001(struct em28xx *dev) 71static int em28xx_initialize_mt9m001(struct em28xx *dev)
76{ 72{
@@ -98,7 +94,6 @@ static int em28xx_initialize_mt9m001(struct em28xx *dev)
98 return 0; 94 return 0;
99} 95}
100 96
101
102/* 97/*
103 * Probes Micron sensors with 8 bit address and 16 bit register width 98 * Probes Micron sensors with 8 bit address and 16 bit register width
104 */ 99 */
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c
index 5f747a5e2463..d9704e66b8c9 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -64,7 +64,6 @@ module_param(usb_xfer_mode, int, 0444);
64MODULE_PARM_DESC(usb_xfer_mode, 64MODULE_PARM_DESC(usb_xfer_mode,
65 "USB transfer mode for frame data (-1 = auto, 0 = prefer isoc, 1 = prefer bulk)"); 65 "USB transfer mode for frame data (-1 = auto, 0 = prefer isoc, 1 = prefer bulk)");
66 66
67
68/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS - 1 */ 67/* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS - 1 */
69static DECLARE_BITMAP(em28xx_devused, EM28XX_MAXBOARDS); 68static DECLARE_BITMAP(em28xx_devused, EM28XX_MAXBOARDS);
70 69
@@ -190,8 +189,8 @@ static struct em28xx_reg_seq kworld_a340_digital[] = {
190}; 189};
191 190
192static struct em28xx_reg_seq kworld_ub435q_v3_digital[] = { 191static struct em28xx_reg_seq kworld_ub435q_v3_digital[] = {
193 {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 100}, 192 {EM2874_R80_GPIO_P0_CTRL, 0xff, 0xff, 100},
194 {EM2874_R80_GPIO_P0_CTRL, 0xfe, 0xff, 100}, 193 {EM2874_R80_GPIO_P0_CTRL, 0xfe, 0xff, 100},
195 {EM2874_R80_GPIO_P0_CTRL, 0xbe, 0xff, 100}, 194 {EM2874_R80_GPIO_P0_CTRL, 0xbe, 0xff, 100},
196 {EM2874_R80_GPIO_P0_CTRL, 0xfe, 0xff, 100}, 195 {EM2874_R80_GPIO_P0_CTRL, 0xfe, 0xff, 100},
197 { -1, -1, -1, -1}, 196 { -1, -1, -1, -1},
@@ -301,7 +300,6 @@ static struct em28xx_reg_seq dikom_dk300_digital[] = {
301 { -1, -1, -1, -1}, 300 { -1, -1, -1, -1},
302}; 301};
303 302
304
305/* Reset for the most [digital] boards */ 303/* Reset for the most [digital] boards */
306static struct em28xx_reg_seq leadership_digital[] = { 304static struct em28xx_reg_seq leadership_digital[] = {
307 {EM2874_R80_GPIO_P0_CTRL, 0x70, 0xff, 10}, 305 {EM2874_R80_GPIO_P0_CTRL, 0x70, 0xff, 10},
@@ -562,7 +560,6 @@ static struct em28xx_led pctv_80e_leds[] = {
562 {-1, 0, 0, 0}, 560 {-1, 0, 0, 0},
563}; 561};
564 562
565
566/* 563/*
567 * Board definitions 564 * Board definitions
568 */ 565 */
@@ -1528,7 +1525,7 @@ struct em28xx_board em28xx_boards[] = {
1528 .type = EM28XX_VMUX_TELEVISION, 1525 .type = EM28XX_VMUX_TELEVISION,
1529 .vmux = SAA7115_COMPOSITE2, 1526 .vmux = SAA7115_COMPOSITE2,
1530 .amux = EM28XX_AMUX_VIDEO, 1527 .amux = EM28XX_AMUX_VIDEO,
1531 .aout = EM28XX_AOUT_MONO | /* I2S */ 1528 .aout = EM28XX_AOUT_MONO | /* I2S */
1532 EM28XX_AOUT_MASTER, /* Line out pin */ 1529 EM28XX_AOUT_MASTER, /* Line out pin */
1533 }, { 1530 }, {
1534 .type = EM28XX_VMUX_COMPOSITE1, 1531 .type = EM28XX_VMUX_COMPOSITE1,
@@ -1550,7 +1547,7 @@ struct em28xx_board em28xx_boards[] = {
1550 .type = EM28XX_VMUX_TELEVISION, 1547 .type = EM28XX_VMUX_TELEVISION,
1551 .vmux = SAA7115_COMPOSITE2, 1548 .vmux = SAA7115_COMPOSITE2,
1552 .amux = EM28XX_AMUX_VIDEO, 1549 .amux = EM28XX_AMUX_VIDEO,
1553 .aout = EM28XX_AOUT_MONO | /* I2S */ 1550 .aout = EM28XX_AOUT_MONO | /* I2S */
1554 EM28XX_AOUT_MASTER, /* Line out pin */ 1551 EM28XX_AOUT_MASTER, /* Line out pin */
1555 }, { 1552 }, {
1556 .type = EM28XX_VMUX_COMPOSITE1, 1553 .type = EM28XX_VMUX_COMPOSITE1,
@@ -2496,6 +2493,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = {
2496 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF}, 2493 {0x4ba50080, EM2861_BOARD_GADMEI_UTV330PLUS, TUNER_TNF_5335MF},
2497 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT}, 2494 {0x6b800080, EM2874_BOARD_LEADERSHIP_ISDBT, TUNER_ABSENT},
2498}; 2495};
2496
2499/* NOTE: introduce a separate hash table for devices with 16 bit eeproms */ 2497/* NOTE: introduce a separate hash table for devices with 16 bit eeproms */
2500 2498
2501int em28xx_tuner_callback(void *ptr, int component, int command, int arg) 2499int em28xx_tuner_callback(void *ptr, int component, int command, int arg)
@@ -2738,7 +2736,7 @@ static int em28xx_hint_board(struct em28xx *dev)
2738 " insmod option:\n"); 2736 " insmod option:\n");
2739 for (i = 0; i < em28xx_bcount; i++) { 2737 for (i = 0; i < em28xx_bcount; i++) {
2740 em28xx_errdev(" card=%d -> %s\n", 2738 em28xx_errdev(" card=%d -> %s\n",
2741 i, em28xx_boards[i].name); 2739 i, em28xx_boards[i].name);
2742 } 2740 }
2743 return -1; 2741 return -1;
2744} 2742}
@@ -3094,6 +3092,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
3094 if (le16_to_cpu(dev->udev->descriptor.idVendor) 3092 if (le16_to_cpu(dev->udev->descriptor.idVendor)
3095 == 0xeb1a) { 3093 == 0xeb1a) {
3096 __le16 idProd = dev->udev->descriptor.idProduct; 3094 __le16 idProd = dev->udev->descriptor.idProduct;
3095
3097 if (le16_to_cpu(idProd) == 0x2710) 3096 if (le16_to_cpu(idProd) == 0x2710)
3098 chip_name = "em2710"; 3097 chip_name = "em2710";
3099 else if (le16_to_cpu(idProd) == 0x2820) 3098 else if (le16_to_cpu(idProd) == 0x2820)
@@ -3182,7 +3181,7 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
3182 retval = em28xx_i2c_register(dev, 0, EM28XX_I2C_ALGO_EM28XX); 3181 retval = em28xx_i2c_register(dev, 0, EM28XX_I2C_ALGO_EM28XX);
3183 if (retval < 0) { 3182 if (retval < 0) {
3184 em28xx_errdev("%s: em28xx_i2c_register bus 0 - error [%d]!\n", 3183 em28xx_errdev("%s: em28xx_i2c_register bus 0 - error [%d]!\n",
3185 __func__, retval); 3184 __func__, retval);
3186 return retval; 3185 return retval;
3187 } 3186 }
3188 3187
@@ -3190,13 +3189,13 @@ static int em28xx_init_dev(struct em28xx *dev, struct usb_device *udev,
3190 if (dev->def_i2c_bus) { 3189 if (dev->def_i2c_bus) {
3191 if (dev->is_em25xx) 3190 if (dev->is_em25xx)
3192 retval = em28xx_i2c_register(dev, 1, 3191 retval = em28xx_i2c_register(dev, 1,
3193 EM28XX_I2C_ALGO_EM25XX_BUS_B); 3192 EM28XX_I2C_ALGO_EM25XX_BUS_B);
3194 else 3193 else
3195 retval = em28xx_i2c_register(dev, 1, 3194 retval = em28xx_i2c_register(dev, 1,
3196 EM28XX_I2C_ALGO_EM28XX); 3195 EM28XX_I2C_ALGO_EM28XX);
3197 if (retval < 0) { 3196 if (retval < 0) {
3198 em28xx_errdev("%s: em28xx_i2c_register bus 1 - error [%d]!\n", 3197 em28xx_errdev("%s: em28xx_i2c_register bus 1 - error [%d]!\n",
3199 __func__, retval); 3198 __func__, retval);
3200 3199
3201 em28xx_i2c_unregister(dev, 0); 3200 em28xx_i2c_unregister(dev, 0);
3202 3201
@@ -3236,7 +3235,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
3236 if (nr >= EM28XX_MAXBOARDS) { 3235 if (nr >= EM28XX_MAXBOARDS) {
3237 /* No free device slots */ 3236 /* No free device slots */
3238 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n", 3237 printk(DRIVER_NAME ": Supports only %i em28xx boards.\n",
3239 EM28XX_MAXBOARDS); 3238 EM28XX_MAXBOARDS);
3240 retval = -ENOMEM; 3239 retval = -ENOMEM;
3241 goto err_no_slot; 3240 goto err_no_slot;
3242 } 3241 }
@@ -3420,6 +3419,7 @@ static int em28xx_usb_probe(struct usb_interface *interface,
3420 /* Checks if audio is provided by a USB Audio Class interface */ 3419 /* Checks if audio is provided by a USB Audio Class interface */
3421 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) { 3420 for (i = 0; i < udev->config->desc.bNumInterfaces; i++) {
3422 struct usb_interface *uif = udev->config->interface[i]; 3421 struct usb_interface *uif = udev->config->interface[i];
3422
3423 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) { 3423 if (uif->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
3424 if (has_vendor_audio) 3424 if (has_vendor_audio)
3425 em28xx_err("em28xx: device seems to have vendor AND usb audio class interfaces !\n" 3425 em28xx_err("em28xx: device seems to have vendor AND usb audio class interfaces !\n"
@@ -3530,7 +3530,7 @@ static void em28xx_usb_disconnect(struct usb_interface *interface)
3530} 3530}
3531 3531
3532static int em28xx_usb_suspend(struct usb_interface *interface, 3532static int em28xx_usb_suspend(struct usb_interface *interface,
3533 pm_message_t message) 3533 pm_message_t message)
3534{ 3534{
3535 struct em28xx *dev; 3535 struct em28xx *dev;
3536 3536
diff --git a/drivers/media/usb/em28xx/em28xx-core.c b/drivers/media/usb/em28xx/em28xx-core.c
index 901cf2b952d7..86461a708abe 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -75,7 +75,7 @@ MODULE_PARM_DESC(reg_debug, "enable debug messages [URB reg]");
75 * reads data from the usb device specifying bRequest 75 * reads data from the usb device specifying bRequest
76 */ 76 */
77int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg, 77int em28xx_read_reg_req_len(struct em28xx *dev, u8 req, u16 reg,
78 char *buf, int len) 78 char *buf, int len)
79{ 79{
80 int ret; 80 int ret;
81 int pipe = usb_rcvctrlpipe(dev->udev, 0); 81 int pipe = usb_rcvctrlpipe(dev->udev, 0);
@@ -151,7 +151,7 @@ EXPORT_SYMBOL_GPL(em28xx_read_reg);
151 * sends data to the usb device, specifying bRequest 151 * sends data to the usb device, specifying bRequest
152 */ 152 */
153int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf, 153int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
154 int len) 154 int len)
155{ 155{
156 int ret; 156 int ret;
157 int pipe = usb_sndctrlpipe(dev->udev, 0); 157 int pipe = usb_sndctrlpipe(dev->udev, 0);
@@ -213,7 +213,7 @@ EXPORT_SYMBOL_GPL(em28xx_write_reg);
213 * the actual value 213 * the actual value
214 */ 214 */
215int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, 215int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
216 u8 bitmask) 216 u8 bitmask)
217{ 217{
218 int oldval; 218 int oldval;
219 u8 newval; 219 u8 newval;
@@ -222,7 +222,7 @@ int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
222 if (oldval < 0) 222 if (oldval < 0)
223 return oldval; 223 return oldval;
224 224
225 newval = (((u8) oldval) & ~bitmask) | (val & bitmask); 225 newval = (((u8)oldval) & ~bitmask) | (val & bitmask);
226 226
227 return em28xx_write_regs(dev, reg, &newval, 1); 227 return em28xx_write_regs(dev, reg, &newval, 1);
228} 228}
@@ -314,7 +314,7 @@ int em28xx_write_ac97(struct em28xx *dev, u8 reg, u16 val)
314 if (ret < 0) 314 if (ret < 0)
315 return ret; 315 return ret;
316 316
317 ret = em28xx_write_regs(dev, EM28XX_R40_AC97LSB, (u8 *) &value, 2); 317 ret = em28xx_write_regs(dev, EM28XX_R40_AC97LSB, (u8 *)&value, 2);
318 if (ret < 0) 318 if (ret < 0)
319 return ret; 319 return ret;
320 320
@@ -361,7 +361,7 @@ static int set_ac97_input(struct em28xx *dev)
361 361
362 if (ret < 0) 362 if (ret < 0)
363 em28xx_warn("couldn't setup AC97 register %d\n", 363 em28xx_warn("couldn't setup AC97 register %d\n",
364 inputs[i].reg); 364 inputs[i].reg);
365 } 365 }
366 return 0; 366 return 0;
367} 367}
@@ -445,7 +445,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
445 ret = em28xx_write_ac97(dev, outputs[i].reg, 0x8000); 445 ret = em28xx_write_ac97(dev, outputs[i].reg, 0x8000);
446 if (ret < 0) 446 if (ret < 0)
447 em28xx_warn("couldn't setup AC97 register %d\n", 447 em28xx_warn("couldn't setup AC97 register %d\n",
448 outputs[i].reg); 448 outputs[i].reg);
449 } 449 }
450 } 450 }
451 451
@@ -483,7 +483,7 @@ int em28xx_audio_analog_set(struct em28xx *dev)
483 vol); 483 vol);
484 if (ret < 0) 484 if (ret < 0)
485 em28xx_warn("couldn't setup AC97 register %d\n", 485 em28xx_warn("couldn't setup AC97 register %d\n",
486 outputs[i].reg); 486 outputs[i].reg);
487 } 487 }
488 488
489 if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) { 489 if (dev->ctl_aoutput & EM28XX_AOUT_PCM_IN) {
@@ -531,7 +531,7 @@ int em28xx_audio_setup(struct em28xx *dev)
531 } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) != EM28XX_CHIPCFG_AC97) { 531 } else if ((cfg & EM28XX_CHIPCFG_AUDIOMASK) != EM28XX_CHIPCFG_AC97) {
532 dev->int_audio_type = EM28XX_INT_AUDIO_I2S; 532 dev->int_audio_type = EM28XX_INT_AUDIO_I2S;
533 if (dev->chip_id < CHIP_ID_EM2860 && 533 if (dev->chip_id < CHIP_ID_EM2860 &&
534 (cfg & EM28XX_CHIPCFG_AUDIOMASK) == 534 (cfg & EM28XX_CHIPCFG_AUDIOMASK) ==
535 EM2820_CHIPCFG_I2S_1_SAMPRATE) 535 EM2820_CHIPCFG_I2S_1_SAMPRATE)
536 i2s_samplerates = 1; 536 i2s_samplerates = 1;
537 else if (dev->chip_id >= CHIP_ID_EM2860 && 537 else if (dev->chip_id >= CHIP_ID_EM2860 &&
@@ -541,7 +541,7 @@ int em28xx_audio_setup(struct em28xx *dev)
541 else 541 else
542 i2s_samplerates = 3; 542 i2s_samplerates = 3;
543 em28xx_info("I2S Audio (%d sample rate(s))\n", 543 em28xx_info("I2S Audio (%d sample rate(s))\n",
544 i2s_samplerates); 544 i2s_samplerates);
545 /* Skip the code that does AC97 vendor detection */ 545 /* Skip the code that does AC97 vendor detection */
546 dev->audio_mode.ac97 = EM28XX_NO_AC97; 546 dev->audio_mode.ac97 = EM28XX_NO_AC97;
547 goto init_audio; 547 goto init_audio;
@@ -614,8 +614,9 @@ const struct em28xx_led *em28xx_find_led(struct em28xx *dev,
614{ 614{
615 if (dev->board.leds) { 615 if (dev->board.leds) {
616 u8 k = 0; 616 u8 k = 0;
617
617 while (dev->board.leds[k].role >= 0 && 618 while (dev->board.leds[k].role >= 0 &&
618 dev->board.leds[k].role < EM28XX_NUM_LED_ROLES) { 619 dev->board.leds[k].role < EM28XX_NUM_LED_ROLES) {
619 if (dev->board.leds[k].role == role) 620 if (dev->board.leds[k].role == role)
620 return &dev->board.leds[k]; 621 return &dev->board.leds[k];
621 k++; 622 k++;
@@ -658,10 +659,12 @@ int em28xx_capture_start(struct em28xx *dev, int start)
658 659
659 if (dev->mode == EM28XX_ANALOG_MODE) 660 if (dev->mode == EM28XX_ANALOG_MODE)
660 rc = em28xx_write_reg(dev, 661 rc = em28xx_write_reg(dev,
661 EM28XX_R12_VINENABLE, 0x67); 662 EM28XX_R12_VINENABLE,
663 0x67);
662 else 664 else
663 rc = em28xx_write_reg(dev, 665 rc = em28xx_write_reg(dev,
664 EM28XX_R12_VINENABLE, 0x37); 666 EM28XX_R12_VINENABLE,
667 0x37);
665 if (rc < 0) 668 if (rc < 0)
666 return rc; 669 return rc;
667 670
@@ -815,9 +818,9 @@ void em28xx_uninit_usb_xfer(struct em28xx *dev, enum em28xx_mode mode)
815 818
816 if (usb_bufs->transfer_buffer[i]) { 819 if (usb_bufs->transfer_buffer[i]) {
817 usb_free_coherent(dev->udev, 820 usb_free_coherent(dev->udev,
818 urb->transfer_buffer_length, 821 urb->transfer_buffer_length,
819 usb_bufs->transfer_buffer[i], 822 usb_bufs->transfer_buffer[i],
820 urb->transfer_dma); 823 urb->transfer_dma);
821 } 824 }
822 usb_free_urb(urb); 825 usb_free_urb(urb);
823 usb_bufs->urb[i] = NULL; 826 usb_bufs->urb[i] = NULL;
@@ -889,7 +892,7 @@ int em28xx_alloc_urbs(struct em28xx *dev, enum em28xx_mode mode, int xfer_bulk,
889 if ((xfer_bulk && !dev->analog_ep_bulk) || 892 if ((xfer_bulk && !dev->analog_ep_bulk) ||
890 (!xfer_bulk && !dev->analog_ep_isoc)) { 893 (!xfer_bulk && !dev->analog_ep_isoc)) {
891 em28xx_errdev("no endpoint for analog mode and transfer type %d\n", 894 em28xx_errdev("no endpoint for analog mode and transfer type %d\n",
892 xfer_bulk > 0); 895 xfer_bulk > 0);
893 return -EINVAL; 896 return -EINVAL;
894 } 897 }
895 usb_bufs = &dev->usb_ctl.analog_bufs; 898 usb_bufs = &dev->usb_ctl.analog_bufs;
@@ -988,9 +991,9 @@ EXPORT_SYMBOL_GPL(em28xx_alloc_urbs);
988 * Allocate URBs and start IRQ 991 * Allocate URBs and start IRQ
989 */ 992 */
990int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode, 993int em28xx_init_usb_xfer(struct em28xx *dev, enum em28xx_mode mode,
991 int xfer_bulk, int num_bufs, int max_pkt_size, 994 int xfer_bulk, int num_bufs, int max_pkt_size,
992 int packet_multiplier, 995 int packet_multiplier,
993 int (*urb_data_copy) (struct em28xx *dev, struct urb *urb)) 996 int (*urb_data_copy)(struct em28xx *dev, struct urb *urb))
994{ 997{
995 struct em28xx_dmaqueue *dma_q = &dev->vidq; 998 struct em28xx_dmaqueue *dma_q = &dev->vidq;
996 struct em28xx_dmaqueue *vbi_dma_q = &dev->vbiq; 999 struct em28xx_dmaqueue *vbi_dma_q = &dev->vbiq;
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c b/drivers/media/usb/em28xx/em28xx-dvb.c
index 0b8823d7f7ec..9877b699c6bc 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -63,7 +63,6 @@ MODULE_LICENSE("GPL");
63MODULE_DESCRIPTION(DRIVER_DESC " - digital TV interface"); 63MODULE_DESCRIPTION(DRIVER_DESC " - digital TV interface");
64MODULE_VERSION(EM28XX_VERSION); 64MODULE_VERSION(EM28XX_VERSION);
65 65
66
67static unsigned int debug; 66static unsigned int debug;
68module_param(debug, int, 0644); 67module_param(debug, int, 0644);
69MODULE_PARM_DESC(debug, "enable debug messages [dvb]"); 68MODULE_PARM_DESC(debug, "enable debug messages [dvb]");
@@ -71,7 +70,7 @@ MODULE_PARM_DESC(debug, "enable debug messages [dvb]");
71DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr); 70DVB_DEFINE_MOD_OPT_ADAPTER_NR(adapter_nr);
72 71
73#define dprintk(level, fmt, arg...) do { \ 72#define dprintk(level, fmt, arg...) do { \
74if (debug >= level) \ 73if (debug >= level) \
75 printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \ 74 printk(KERN_DEBUG "%s/2-dvb: " fmt, dev->name, ## arg); \
76} while (0) 75} while (0)
77 76
@@ -99,9 +98,8 @@ struct em28xx_dvb {
99 struct i2c_client *i2c_client_tuner; 98 struct i2c_client *i2c_client_tuner;
100}; 99};
101 100
102
103static inline void print_err_status(struct em28xx *dev, 101static inline void print_err_status(struct em28xx *dev,
104 int packet, int status) 102 int packet, int status)
105{ 103{
106 char *errmsg = "Unknown"; 104 char *errmsg = "Unknown";
107 105
@@ -169,7 +167,7 @@ static inline int em28xx_dvb_urb_data_copy(struct em28xx *dev, struct urb *urb)
169 if (!urb->actual_length) 167 if (!urb->actual_length)
170 continue; 168 continue;
171 dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer, 169 dvb_dmx_swfilter(&dev->dvb->demux, urb->transfer_buffer,
172 urb->actual_length); 170 urb->actual_length);
173 } else { 171 } else {
174 if (urb->iso_frame_desc[i].status < 0) { 172 if (urb->iso_frame_desc[i].status < 0) {
175 print_err_status(dev, i, 173 print_err_status(dev, i,
@@ -280,7 +278,6 @@ static int em28xx_stop_feed(struct dvb_demux_feed *feed)
280} 278}
281 279
282 280
283
284/* ------------------------------------------------------------------ */ 281/* ------------------------------------------------------------------ */
285static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire) 282static int em28xx_dvb_bus_ctrl(struct dvb_frontend *fe, int acquire)
286{ 283{
@@ -740,7 +737,7 @@ static int em28xx_pctv_290e_set_lna(struct dvb_frontend *fe)
740 return ret; 737 return ret;
741#else 738#else
742 dev_warn(&dev->udev->dev, "%s: LNA control is disabled (lna=%u)\n", 739 dev_warn(&dev->udev->dev, "%s: LNA control is disabled (lna=%u)\n",
743 KBUILD_MODNAME, c->lna); 740 KBUILD_MODNAME, c->lna);
744 return 0; 741 return 0;
745#endif 742#endif
746} 743}
@@ -830,6 +827,7 @@ static struct zl10353_config em28xx_zl10353_no_i2c_gate_dev = {
830 .no_tuner = 1, 827 .no_tuner = 1,
831 .parallel_ts = 1, 828 .parallel_ts = 1,
832}; 829};
830
833static struct qt1010_config em28xx_qt1010_config = { 831static struct qt1010_config em28xx_qt1010_config = {
834 .i2c_address = 0x62 832 .i2c_address = 0x62
835}; 833};
@@ -861,7 +859,6 @@ static const struct m88ds3103_config pctv_461e_m88ds3103_config = {
861 .agc = 0x99, 859 .agc = 0x99,
862}; 860};
863 861
864
865static struct tda18271_std_map drx_j_std_map = { 862static struct tda18271_std_map drx_j_std_map = {
866 .atsc_6 = { .if_freq = 5000, .agc_mode = 3, .std = 0, .if_lvl = 1, 863 .atsc_6 = { .if_freq = 5000, .agc_mode = 3, .std = 0, .if_lvl = 1,
867 .rfagc_top = 0x37, }, 864 .rfagc_top = 0x37, },
@@ -948,7 +945,7 @@ static int em28xx_register_dvb(struct em28xx_dvb *dvb, struct module *module,
948 result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]); 945 result = dvb_register_frontend(&dvb->adapter, dvb->fe[1]);
949 if (result < 0) { 946 if (result < 0) {
950 printk(KERN_WARNING "%s: 2nd dvb_register_frontend failed (errno = %d)\n", 947 printk(KERN_WARNING "%s: 2nd dvb_register_frontend failed (errno = %d)\n",
951 dev->name, result); 948 dev->name, result);
952 goto fail_frontend1; 949 goto fail_frontend1;
953 } 950 }
954 } 951 }
@@ -1182,7 +1179,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
1182 &dev->i2c_adap[dev->def_i2c_bus]); 1179 &dev->i2c_adap[dev->def_i2c_bus]);
1183 if (dvb->fe[0] != NULL) { 1180 if (dvb->fe[0] != NULL) {
1184 if (!dvb_attach(simple_tuner_attach, dvb->fe[0], 1181 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1185 &dev->i2c_adap[dev->def_i2c_bus], 0x61, TUNER_THOMSON_DTT761X)) { 1182 &dev->i2c_adap[dev->def_i2c_bus],
1183 0x61, TUNER_THOMSON_DTT761X)) {
1186 result = -EINVAL; 1184 result = -EINVAL;
1187 goto out_free; 1185 goto out_free;
1188 } 1186 }
@@ -1204,7 +1202,8 @@ static int em28xx_dvb_init(struct em28xx *dev)
1204 &dev->i2c_adap[dev->def_i2c_bus], 0x48); 1202 &dev->i2c_adap[dev->def_i2c_bus], 0x48);
1205 if (dvb->fe[0]) { 1203 if (dvb->fe[0]) {
1206 if (!dvb_attach(simple_tuner_attach, dvb->fe[0], 1204 if (!dvb_attach(simple_tuner_attach, dvb->fe[0],
1207 &dev->i2c_adap[dev->def_i2c_bus], 0x60, TUNER_PHILIPS_CU1216L)) { 1205 &dev->i2c_adap[dev->def_i2c_bus],
1206 0x60, TUNER_PHILIPS_CU1216L)) {
1208 result = -EINVAL; 1207 result = -EINVAL;
1209 goto out_free; 1208 goto out_free;
1210 } 1209 }
@@ -1219,7 +1218,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
1219 goto out_free; 1218 goto out_free;
1220 } 1219 }
1221 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60, 1220 if (!dvb_attach(tda18271_attach, dvb->fe[0], 0x60,
1222 &dev->i2c_adap[dev->def_i2c_bus], 1221 &dev->i2c_adap[dev->def_i2c_bus],
1223 &kworld_a340_config)) { 1222 &kworld_a340_config)) {
1224 dvb_frontend_detach(dvb->fe[0]); 1223 dvb_frontend_detach(dvb->fe[0]);
1225 result = -EINVAL; 1224 result = -EINVAL;
@@ -1250,10 +1249,10 @@ static int em28xx_dvb_init(struct em28xx *dev)
1250#ifdef CONFIG_GPIOLIB 1249#ifdef CONFIG_GPIOLIB
1251 /* enable LNA for DVB-T, DVB-T2 and DVB-C */ 1250 /* enable LNA for DVB-T, DVB-T2 and DVB-C */
1252 result = gpio_request_one(dvb->lna_gpio, 1251 result = gpio_request_one(dvb->lna_gpio,
1253 GPIOF_OUT_INIT_LOW, NULL); 1252 GPIOF_OUT_INIT_LOW, NULL);
1254 if (result) 1253 if (result)
1255 em28xx_errdev("gpio request failed %d\n", 1254 em28xx_errdev("gpio request failed %d\n",
1256 result); 1255 result);
1257 else 1256 else
1258 gpio_free(dvb->lna_gpio); 1257 gpio_free(dvb->lna_gpio);
1259 1258
@@ -1266,6 +1265,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
1266 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C: 1265 case EM2884_BOARD_HAUPPAUGE_WINTV_HVR_930C:
1267 { 1266 {
1268 struct xc5000_config cfg; 1267 struct xc5000_config cfg;
1268
1269 hauppauge_hvr930c_init(dev); 1269 hauppauge_hvr930c_init(dev);
1270 1270
1271 dvb->fe[0] = dvb_attach(drxk_attach, 1271 dvb->fe[0] = dvb_attach(drxk_attach,
@@ -1339,7 +1339,7 @@ static int em28xx_dvb_init(struct em28xx *dev)
1339 /* attach SEC */ 1339 /* attach SEC */
1340 if (dvb->fe[0]) 1340 if (dvb->fe[0])
1341 dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus], 1341 dvb_attach(a8293_attach, dvb->fe[0], &dev->i2c_adap[dev->def_i2c_bus],
1342 &em28xx_a8293_config); 1342 &em28xx_a8293_config);
1343 break; 1343 break;
1344 case EM2874_BOARD_DELOCK_61959: 1344 case EM2874_BOARD_DELOCK_61959:
1345 case EM2874_BOARD_MAXMEDIA_UB425_TC: 1345 case EM2874_BOARD_MAXMEDIA_UB425_TC:
diff --git a/drivers/media/usb/em28xx/em28xx-i2c.c b/drivers/media/usb/em28xx/em28xx-i2c.c
index d22986dcd865..a19b5c8b56ff 100644
--- a/drivers/media/usb/em28xx/em28xx-i2c.c
+++ b/drivers/media/usb/em28xx/em28xx-i2c.c
@@ -593,6 +593,7 @@ static inline unsigned long em28xx_hash_mem(char *buf, int length, int bits)
593 unsigned long l = 0; 593 unsigned long l = 0;
594 int len = 0; 594 int len = 0;
595 unsigned char c; 595 unsigned char c;
596
596 do { 597 do {
597 if (len == length) { 598 if (len == length) {
598 c = (char)len; 599 c = (char)len;
@@ -950,7 +951,7 @@ int em28xx_i2c_register(struct em28xx *dev, unsigned bus,
950 retval = i2c_add_adapter(&dev->i2c_adap[bus]); 951 retval = i2c_add_adapter(&dev->i2c_adap[bus]);
951 if (retval < 0) { 952 if (retval < 0) {
952 em28xx_errdev("%s: i2c_add_adapter failed! retval [%d]\n", 953 em28xx_errdev("%s: i2c_add_adapter failed! retval [%d]\n",
953 __func__, retval); 954 __func__, retval);
954 return retval; 955 return retval;
955 } 956 }
956 957
@@ -962,7 +963,7 @@ int em28xx_i2c_register(struct em28xx *dev, unsigned bus,
962 retval = em28xx_i2c_eeprom(dev, bus, &dev->eedata, &dev->eedata_len); 963 retval = em28xx_i2c_eeprom(dev, bus, &dev->eedata, &dev->eedata_len);
963 if ((retval < 0) && (retval != -ENODEV)) { 964 if ((retval < 0) && (retval != -ENODEV)) {
964 em28xx_errdev("%s: em28xx_i2_eeprom failed! retval [%d]\n", 965 em28xx_errdev("%s: em28xx_i2_eeprom failed! retval [%d]\n",
965 __func__, retval); 966 __func__, retval);
966 967
967 return retval; 968 return retval;
968 } 969 }
diff --git a/drivers/media/usb/em28xx/em28xx-input.c b/drivers/media/usb/em28xx/em28xx-input.c
index 85ac7dd15700..d8dc03aadfbd 100644
--- a/drivers/media/usb/em28xx/em28xx-input.c
+++ b/drivers/media/usb/em28xx/em28xx-input.c
@@ -459,7 +459,7 @@ static int em28xx_ir_change_protocol(struct rc_dev *rc_dev, u64 *rc_type)
459 return em2874_ir_change_protocol(rc_dev, rc_type); 459 return em2874_ir_change_protocol(rc_dev, rc_type);
460 default: 460 default:
461 printk("Unrecognized em28xx chip id 0x%02x: IR not supported\n", 461 printk("Unrecognized em28xx chip id 0x%02x: IR not supported\n",
462 dev->chip_id); 462 dev->chip_id);
463 return -EINVAL; 463 return -EINVAL;
464 } 464 }
465} 465}
@@ -505,7 +505,7 @@ static void em28xx_query_buttons(struct work_struct *work)
505 /* Check states of the buttons and act */ 505 /* Check states of the buttons and act */
506 j = 0; 506 j = 0;
507 while (dev->board.buttons[j].role >= 0 && 507 while (dev->board.buttons[j].role >= 0 &&
508 dev->board.buttons[j].role < EM28XX_NUM_BUTTON_ROLES) { 508 dev->board.buttons[j].role < EM28XX_NUM_BUTTON_ROLES) {
509 struct em28xx_button *button = &dev->board.buttons[j]; 509 struct em28xx_button *button = &dev->board.buttons[j];
510 /* Check if button uses the current address */ 510 /* Check if button uses the current address */
511 if (button->reg_r != dev->button_polling_addresses[i]) { 511 if (button->reg_r != dev->button_polling_addresses[i]) {
@@ -607,7 +607,7 @@ static void em28xx_init_buttons(struct em28xx *dev)
607 607
608 dev->button_polling_interval = EM28XX_BUTTONS_DEBOUNCED_QUERY_INTERVAL; 608 dev->button_polling_interval = EM28XX_BUTTONS_DEBOUNCED_QUERY_INTERVAL;
609 while (dev->board.buttons[i].role >= 0 && 609 while (dev->board.buttons[i].role >= 0 &&
610 dev->board.buttons[i].role < EM28XX_NUM_BUTTON_ROLES) { 610 dev->board.buttons[i].role < EM28XX_NUM_BUTTON_ROLES) {
611 struct em28xx_button *button = &dev->board.buttons[i]; 611 struct em28xx_button *button = &dev->board.buttons[i];
612 /* Check if polling address is already on the list */ 612 /* Check if polling address is already on the list */
613 addr_new = true; 613 addr_new = true;
@@ -653,11 +653,11 @@ next_button:
653 /* Start polling */ 653 /* Start polling */
654 if (dev->num_button_polling_addresses) { 654 if (dev->num_button_polling_addresses) {
655 memset(dev->button_polling_last_values, 0, 655 memset(dev->button_polling_last_values, 0,
656 EM28XX_NUM_BUTTON_ADDRESSES_MAX); 656 EM28XX_NUM_BUTTON_ADDRESSES_MAX);
657 INIT_DELAYED_WORK(&dev->buttons_query_work, 657 INIT_DELAYED_WORK(&dev->buttons_query_work,
658 em28xx_query_buttons); 658 em28xx_query_buttons);
659 schedule_delayed_work(&dev->buttons_query_work, 659 schedule_delayed_work(&dev->buttons_query_work,
660 msecs_to_jiffies(dev->button_polling_interval)); 660 msecs_to_jiffies(dev->button_polling_interval));
661 } 661 }
662} 662}
663 663
@@ -886,7 +886,7 @@ static int em28xx_ir_resume(struct em28xx *dev)
886 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling)); 886 schedule_delayed_work(&ir->work, msecs_to_jiffies(ir->polling));
887 if (dev->num_button_polling_addresses) 887 if (dev->num_button_polling_addresses)
888 schedule_delayed_work(&dev->buttons_query_work, 888 schedule_delayed_work(&dev->buttons_query_work,
889 msecs_to_jiffies(dev->button_polling_interval)); 889 msecs_to_jiffies(dev->button_polling_interval));
890 return 0; 890 return 0;
891} 891}
892 892
diff --git a/drivers/media/usb/em28xx/em28xx-reg.h b/drivers/media/usb/em28xx/em28xx-reg.h
index 311fb349dafa..13cbb7f3ea10 100644
--- a/drivers/media/usb/em28xx/em28xx-reg.h
+++ b/drivers/media/usb/em28xx/em28xx-reg.h
@@ -49,7 +49,6 @@
49#define EM28XX_CHIPCFG2_TS_PACKETSIZE_564 0x02 49#define EM28XX_CHIPCFG2_TS_PACKETSIZE_564 0x02
50#define EM28XX_CHIPCFG2_TS_PACKETSIZE_752 0x03 50#define EM28XX_CHIPCFG2_TS_PACKETSIZE_752 0x03
51 51
52
53/* GPIO/GPO registers */ 52/* GPIO/GPO registers */
54#define EM2880_R04_GPO 0x04 /* em2880-em2883 only */ 53#define EM2880_R04_GPO 0x04 /* em2880-em2883 only */
55#define EM2820_R08_GPIO_CTRL 0x08 /* em2820-em2873/83 only */ 54#define EM2820_R08_GPIO_CTRL 0x08 /* em2820-em2873/83 only */
@@ -68,7 +67,6 @@
68#define EM28XX_I2C_FREQ_400_KHZ 0x01 67#define EM28XX_I2C_FREQ_400_KHZ 0x01
69#define EM28XX_I2C_FREQ_100_KHZ 0x00 68#define EM28XX_I2C_FREQ_100_KHZ 0x00
70 69
71
72#define EM28XX_R0A_CHIPID 0x0a 70#define EM28XX_R0A_CHIPID 0x0a
73#define EM28XX_R0C_USBSUSP 0x0c 71#define EM28XX_R0C_USBSUSP 0x0c
74#define EM28XX_R0C_USBSUSP_SNAPSHOT 0x20 /* 1=button pressed, needs reset */ 72#define EM28XX_R0C_USBSUSP_SNAPSHOT 0x20 /* 1=button pressed, needs reset */
@@ -157,7 +155,6 @@
157#define EM28XX_OUTFMT_YUV422_Y1UY0V 0x15 155#define EM28XX_OUTFMT_YUV422_Y1UY0V 0x15
158#define EM28XX_OUTFMT_YUV411 0x18 156#define EM28XX_OUTFMT_YUV411 0x18
159 157
160
161#define EM28XX_R28_XMIN 0x28 158#define EM28XX_R28_XMIN 0x28
162#define EM28XX_R29_XMAX 0x29 159#define EM28XX_R29_XMAX 0x29
163#define EM28XX_R2A_YMIN 0x2a 160#define EM28XX_R2A_YMIN 0x2a
diff --git a/drivers/media/usb/em28xx/em28xx-v4l.h b/drivers/media/usb/em28xx/em28xx-v4l.h
index 432862c20bbf..8dfcb56bf4b3 100644
--- a/drivers/media/usb/em28xx/em28xx-v4l.h
+++ b/drivers/media/usb/em28xx/em28xx-v4l.h
@@ -14,7 +14,6 @@
14 GNU General Public License for more details. 14 GNU General Public License for more details.
15 */ 15 */
16 16
17
18int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count); 17int em28xx_start_analog_streaming(struct vb2_queue *vq, unsigned int count);
19void em28xx_stop_vbi_streaming(struct vb2_queue *vq); 18void em28xx_stop_vbi_streaming(struct vb2_queue *vq);
20extern struct vb2_ops em28xx_vbi_qops; 19extern struct vb2_ops em28xx_vbi_qops;
diff --git a/drivers/media/usb/em28xx/em28xx-vbi.c b/drivers/media/usb/em28xx/em28xx-vbi.c
index 34ee1e03a732..744e7ed743e1 100644
--- a/drivers/media/usb/em28xx/em28xx-vbi.c
+++ b/drivers/media/usb/em28xx/em28xx-vbi.c
@@ -92,7 +92,6 @@ vbi_buffer_queue(struct vb2_buffer *vb)
92 spin_unlock_irqrestore(&dev->slock, flags); 92 spin_unlock_irqrestore(&dev->slock, flags);
93} 93}
94 94
95
96struct vb2_ops em28xx_vbi_qops = { 95struct vb2_ops em28xx_vbi_qops = {
97 .queue_setup = vbi_queue_setup, 96 .queue_setup = vbi_queue_setup,
98 .buf_prepare = vbi_buffer_prepare, 97 .buf_prepare = vbi_buffer_prepare,
diff --git a/drivers/media/usb/em28xx/em28xx-video.c b/drivers/media/usb/em28xx/em28xx-video.c
index 03d5ece0319c..cf7f58b76292 100644
--- a/drivers/media/usb/em28xx/em28xx-video.c
+++ b/drivers/media/usb/em28xx/em28xx-video.c
@@ -81,7 +81,6 @@ MODULE_DESCRIPTION(DRIVER_DESC " - v4l2 interface");
81MODULE_LICENSE("GPL"); 81MODULE_LICENSE("GPL");
82MODULE_VERSION(EM28XX_VERSION); 82MODULE_VERSION(EM28XX_VERSION);
83 83
84
85#define EM25XX_FRMDATAHDR_BYTE1 0x02 84#define EM25XX_FRMDATAHDR_BYTE1 0x02
86#define EM25XX_FRMDATAHDR_BYTE2_STILL_IMAGE 0x20 85#define EM25XX_FRMDATAHDR_BYTE2_STILL_IMAGE 0x20
87#define EM25XX_FRMDATAHDR_BYTE2_FRAME_END 0x02 86#define EM25XX_FRMDATAHDR_BYTE2_FRAME_END 0x02
@@ -90,7 +89,6 @@ MODULE_VERSION(EM28XX_VERSION);
90 EM25XX_FRMDATAHDR_BYTE2_FRAME_END | \ 89 EM25XX_FRMDATAHDR_BYTE2_FRAME_END | \
91 EM25XX_FRMDATAHDR_BYTE2_FRAME_ID) 90 EM25XX_FRMDATAHDR_BYTE2_FRAME_ID)
92 91
93
94static unsigned int video_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U }; 92static unsigned int video_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U };
95static unsigned int vbi_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U }; 93static unsigned int vbi_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U };
96static unsigned int radio_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U }; 94static unsigned int radio_nr[] = {[0 ... (EM28XX_MAXBOARDS - 1)] = -1U };
@@ -194,9 +192,10 @@ static int em28xx_vbi_supported(struct em28xx *dev)
194static void em28xx_wake_i2c(struct em28xx *dev) 192static void em28xx_wake_i2c(struct em28xx *dev)
195{ 193{
196 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; 194 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev;
195
197 v4l2_device_call_all(v4l2_dev, 0, core, reset, 0); 196 v4l2_device_call_all(v4l2_dev, 0, core, reset, 0);
198 v4l2_device_call_all(v4l2_dev, 0, video, s_routing, 197 v4l2_device_call_all(v4l2_dev, 0, video, s_routing,
199 INPUT(dev->ctl_input)->vmux, 0, 0); 198 INPUT(dev->ctl_input)->vmux, 0, 0);
200 v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0); 199 v4l2_device_call_all(v4l2_dev, 0, video, s_stream, 0);
201} 200}
202 201
@@ -275,7 +274,7 @@ static int em28xx_accumulator_set(struct em28xx *dev, u8 xmin, u8 xmax,
275} 274}
276 275
277static void em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart, 276static void em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
278 u16 width, u16 height) 277 u16 width, u16 height)
279{ 278{
280 u8 cwidth = width >> 2; 279 u8 cwidth = width >> 2;
281 u8 cheight = height >> 2; 280 u8 cheight = height >> 2;
@@ -283,7 +282,7 @@ static void em28xx_capture_area_set(struct em28xx *dev, u8 hstart, u8 vstart,
283 /* NOTE: size limit: 2047x1023 = 2MPix */ 282 /* NOTE: size limit: 2047x1023 = 2MPix */
284 283
285 em28xx_videodbg("capture area set to (%d,%d): %dx%d\n", 284 em28xx_videodbg("capture area set to (%d,%d): %dx%d\n",
286 hstart, vstart, 285 hstart, vstart,
287 ((overflow & 2) << 9 | cwidth << 2), 286 ((overflow & 2) << 9 | cwidth << 2),
288 ((overflow & 1) << 10 | cheight << 2)); 287 ((overflow & 1) << 10 | cheight << 2));
289 288
@@ -406,13 +405,13 @@ set_alt:
406 dev->packet_multiplier = EM28XX_BULK_PACKET_MULTIPLIER; 405 dev->packet_multiplier = EM28XX_BULK_PACKET_MULTIPLIER;
407 } else { /* isoc */ 406 } else { /* isoc */
408 em28xx_videodbg("minimum isoc packet size: %u (alt=%d)\n", 407 em28xx_videodbg("minimum isoc packet size: %u (alt=%d)\n",
409 min_pkt_size, dev->alt); 408 min_pkt_size, dev->alt);
410 dev->max_pkt_size = 409 dev->max_pkt_size =
411 dev->alt_max_pkt_size_isoc[dev->alt]; 410 dev->alt_max_pkt_size_isoc[dev->alt];
412 dev->packet_multiplier = EM28XX_NUM_ISOC_PACKETS; 411 dev->packet_multiplier = EM28XX_NUM_ISOC_PACKETS;
413 } 412 }
414 em28xx_videodbg("setting alternate %d with wMaxPacketSize=%u\n", 413 em28xx_videodbg("setting alternate %d with wMaxPacketSize=%u\n",
415 dev->alt, dev->max_pkt_size); 414 dev->alt, dev->max_pkt_size);
416 errCode = usb_set_interface(dev->udev, dev->ifnum, dev->alt); 415 errCode = usb_set_interface(dev->udev, dev->ifnum, dev->alt);
417 if (errCode < 0) { 416 if (errCode < 0) {
418 em28xx_errdev("cannot change alternate number to %d (error=%i)\n", 417 em28xx_errdev("cannot change alternate number to %d (error=%i)\n",
@@ -482,7 +481,7 @@ static void em28xx_copy_video(struct em28xx *dev,
482 481
483 if ((char *)startwrite + lencopy > (char *)buf->vb_buf + buf->length) { 482 if ((char *)startwrite + lencopy > (char *)buf->vb_buf + buf->length) {
484 em28xx_isocdbg("Overflow of %zu bytes past buffer end (1)\n", 483 em28xx_isocdbg("Overflow of %zu bytes past buffer end (1)\n",
485 ((char *)startwrite + lencopy) - 484 ((char *)startwrite + lencopy) -
486 ((char *)buf->vb_buf + buf->length)); 485 ((char *)buf->vb_buf + buf->length));
487 remain = (char *)buf->vb_buf + buf->length - 486 remain = (char *)buf->vb_buf + buf->length -
488 (char *)startwrite; 487 (char *)startwrite;
@@ -548,7 +547,7 @@ static void em28xx_copy_vbi(struct em28xx *dev,
548} 547}
549 548
550static inline void print_err_status(struct em28xx *dev, 549static inline void print_err_status(struct em28xx *dev,
551 int packet, int status) 550 int packet, int status)
552{ 551{
553 char *errmsg = "Unknown"; 552 char *errmsg = "Unknown";
554 553
@@ -831,7 +830,6 @@ static inline int em28xx_urb_data_copy(struct em28xx *dev, struct urb *urb)
831 return 1; 830 return 1;
832} 831}
833 832
834
835static int get_ressource(enum v4l2_buf_type f_type) 833static int get_ressource(enum v4l2_buf_type f_type)
836{ 834{
837 switch (f_type) { 835 switch (f_type) {
@@ -1003,6 +1001,7 @@ static void em28xx_stop_streaming(struct vb2_queue *vq)
1003 } 1001 }
1004 while (!list_empty(&vidq->active)) { 1002 while (!list_empty(&vidq->active)) {
1005 struct em28xx_buffer *buf; 1003 struct em28xx_buffer *buf;
1004
1006 buf = list_entry(vidq->active.next, struct em28xx_buffer, list); 1005 buf = list_entry(vidq->active.next, struct em28xx_buffer, list);
1007 list_del(&buf->list); 1006 list_del(&buf->list);
1008 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); 1007 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
@@ -1033,6 +1032,7 @@ void em28xx_stop_vbi_streaming(struct vb2_queue *vq)
1033 } 1032 }
1034 while (!list_empty(&vbiq->active)) { 1033 while (!list_empty(&vbiq->active)) {
1035 struct em28xx_buffer *buf; 1034 struct em28xx_buffer *buf;
1035
1036 buf = list_entry(vbiq->active.next, struct em28xx_buffer, list); 1036 buf = list_entry(vbiq->active.next, struct em28xx_buffer, list);
1037 list_del(&buf->list); 1037 list_del(&buf->list);
1038 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR); 1038 vb2_buffer_done(&buf->vb, VB2_BUF_STATE_ERROR);
@@ -1109,6 +1109,7 @@ static int em28xx_vb2_setup(struct em28xx *dev)
1109static void video_mux(struct em28xx *dev, int index) 1109static void video_mux(struct em28xx *dev, int index)
1110{ 1110{
1111 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev; 1111 struct v4l2_device *v4l2_dev = &dev->v4l2->v4l2_dev;
1112
1112 dev->ctl_input = index; 1113 dev->ctl_input = index;
1113 dev->ctl_ainput = INPUT(index)->amux; 1114 dev->ctl_ainput = INPUT(index)->amux;
1114 dev->ctl_aoutput = INPUT(index)->aout; 1115 dev->ctl_aoutput = INPUT(index)->aout;
@@ -1117,21 +1118,22 @@ static void video_mux(struct em28xx *dev, int index)
1117 dev->ctl_aoutput = EM28XX_AOUT_MASTER; 1118 dev->ctl_aoutput = EM28XX_AOUT_MASTER;
1118 1119
1119 v4l2_device_call_all(v4l2_dev, 0, video, s_routing, 1120 v4l2_device_call_all(v4l2_dev, 0, video, s_routing,
1120 INPUT(index)->vmux, 0, 0); 1121 INPUT(index)->vmux, 0, 0);
1121 1122
1122 if (dev->board.has_msp34xx) { 1123 if (dev->board.has_msp34xx) {
1123 if (dev->i2s_speed) { 1124 if (dev->i2s_speed) {
1124 v4l2_device_call_all(v4l2_dev, 0, audio, 1125 v4l2_device_call_all(v4l2_dev, 0, audio,
1125 s_i2s_clock_freq, dev->i2s_speed); 1126 s_i2s_clock_freq, dev->i2s_speed);
1126 } 1127 }
1127 /* Note: this is msp3400 specific */ 1128 /* Note: this is msp3400 specific */
1128 v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, 1129 v4l2_device_call_all(v4l2_dev, 0, audio, s_routing,
1129 dev->ctl_ainput, MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0); 1130 dev->ctl_ainput,
1131 MSP_OUTPUT(MSP_SC_IN_DSP_SCART1), 0);
1130 } 1132 }
1131 1133
1132 if (dev->board.adecoder != EM28XX_NOADECODER) { 1134 if (dev->board.adecoder != EM28XX_NOADECODER) {
1133 v4l2_device_call_all(v4l2_dev, 0, audio, s_routing, 1135 v4l2_device_call_all(v4l2_dev, 0, audio, s_routing,
1134 dev->ctl_ainput, dev->ctl_aoutput, 0); 1136 dev->ctl_ainput, dev->ctl_aoutput, 0);
1135 } 1137 }
1136 1138
1137 em28xx_audio_analog_set(dev); 1139 em28xx_audio_analog_set(dev);
@@ -1203,7 +1205,7 @@ static const struct v4l2_ctrl_ops em28xx_ctrl_ops = {
1203}; 1205};
1204 1206
1205static void size_to_scale(struct em28xx *dev, 1207static void size_to_scale(struct em28xx *dev,
1206 unsigned int width, unsigned int height, 1208 unsigned int width, unsigned int height,
1207 unsigned int *hscale, unsigned int *vscale) 1209 unsigned int *hscale, unsigned int *vscale)
1208{ 1210{
1209 unsigned int maxw = norm_maxw(dev); 1211 unsigned int maxw = norm_maxw(dev);
@@ -1234,7 +1236,7 @@ static void scale_to_size(struct em28xx *dev,
1234 ------------------------------------------------------------------*/ 1236 ------------------------------------------------------------------*/
1235 1237
1236static int vidioc_g_fmt_vid_cap(struct file *file, void *priv, 1238static int vidioc_g_fmt_vid_cap(struct file *file, void *priv,
1237 struct v4l2_format *f) 1239 struct v4l2_format *f)
1238{ 1240{
1239 struct em28xx *dev = video_drvdata(file); 1241 struct em28xx *dev = video_drvdata(file);
1240 struct em28xx_v4l2 *v4l2 = dev->v4l2; 1242 struct em28xx_v4l2 *v4l2 = dev->v4l2;
@@ -1267,7 +1269,7 @@ static struct em28xx_fmt *format_by_fourcc(unsigned int fourcc)
1267} 1269}
1268 1270
1269static int vidioc_try_fmt_vid_cap(struct file *file, void *priv, 1271static int vidioc_try_fmt_vid_cap(struct file *file, void *priv,
1270 struct v4l2_format *f) 1272 struct v4l2_format *f)
1271{ 1273{
1272 struct em28xx *dev = video_drvdata(file); 1274 struct em28xx *dev = video_drvdata(file);
1273 struct em28xx_v4l2 *v4l2 = dev->v4l2; 1275 struct em28xx_v4l2 *v4l2 = dev->v4l2;
@@ -1338,7 +1340,7 @@ static int em28xx_set_video_format(struct em28xx *dev, unsigned int fourcc,
1338 1340
1339 /* set new image size */ 1341 /* set new image size */
1340 size_to_scale(dev, v4l2->width, v4l2->height, 1342 size_to_scale(dev, v4l2->width, v4l2->height,
1341 &v4l2->hscale, &v4l2->vscale); 1343 &v4l2->hscale, &v4l2->vscale);
1342 1344
1343 em28xx_resolution_set(dev); 1345 em28xx_resolution_set(dev);
1344 1346
@@ -1346,7 +1348,7 @@ static int em28xx_set_video_format(struct em28xx *dev, unsigned int fourcc,
1346} 1348}
1347 1349
1348static int vidioc_s_fmt_vid_cap(struct file *file, void *priv, 1350static int vidioc_s_fmt_vid_cap(struct file *file, void *priv,
1349 struct v4l2_format *f) 1351 struct v4l2_format *f)
1350{ 1352{
1351 struct em28xx *dev = video_drvdata(file); 1353 struct em28xx *dev = video_drvdata(file);
1352 struct em28xx_v4l2 *v4l2 = dev->v4l2; 1354 struct em28xx_v4l2 *v4l2 = dev->v4l2;
@@ -1401,7 +1403,7 @@ static int vidioc_s_std(struct file *file, void *priv, v4l2_std_id norm)
1401 v4l2->width = f.fmt.pix.width; 1403 v4l2->width = f.fmt.pix.width;
1402 v4l2->height = f.fmt.pix.height; 1404 v4l2->height = f.fmt.pix.height;
1403 size_to_scale(dev, v4l2->width, v4l2->height, 1405 size_to_scale(dev, v4l2->width, v4l2->height,
1404 &v4l2->hscale, &v4l2->vscale); 1406 &v4l2->hscale, &v4l2->vscale);
1405 1407
1406 em28xx_resolution_set(dev); 1408 em28xx_resolution_set(dev);
1407 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm); 1409 v4l2_device_call_all(&v4l2->v4l2_dev, 0, video, s_std, v4l2->norm);
@@ -1422,7 +1424,7 @@ static int vidioc_g_parm(struct file *file, void *priv,
1422 video, g_parm, p); 1424 video, g_parm, p);
1423 else 1425 else
1424 v4l2_video_std_frame_period(v4l2->norm, 1426 v4l2_video_std_frame_period(v4l2->norm,
1425 &p->parm.capture.timeperframe); 1427 &p->parm.capture.timeperframe);
1426 1428
1427 return rc; 1429 return rc;
1428} 1430}
@@ -1450,7 +1452,7 @@ static const char *iname[] = {
1450}; 1452};
1451 1453
1452static int vidioc_enum_input(struct file *file, void *priv, 1454static int vidioc_enum_input(struct file *file, void *priv,
1453 struct v4l2_input *i) 1455 struct v4l2_input *i)
1454{ 1456{
1455 struct em28xx *dev = video_drvdata(file); 1457 struct em28xx *dev = video_drvdata(file);
1456 unsigned int n; 1458 unsigned int n;
@@ -1467,7 +1469,7 @@ static int vidioc_enum_input(struct file *file, void *priv,
1467 strcpy(i->name, iname[INPUT(n)->type]); 1469 strcpy(i->name, iname[INPUT(n)->type]);
1468 1470
1469 if ((EM28XX_VMUX_TELEVISION == INPUT(n)->type) || 1471 if ((EM28XX_VMUX_TELEVISION == INPUT(n)->type) ||
1470 (EM28XX_VMUX_CABLE == INPUT(n)->type)) 1472 (EM28XX_VMUX_CABLE == INPUT(n)->type))
1471 i->type = V4L2_INPUT_TYPE_TUNER; 1473 i->type = V4L2_INPUT_TYPE_TUNER;
1472 1474
1473 i->std = dev->v4l2->vdev->tvnorms; 1475 i->std = dev->v4l2->vdev->tvnorms;
@@ -1558,7 +1560,7 @@ static int vidioc_s_audio(struct file *file, void *priv, const struct v4l2_audio
1558} 1560}
1559 1561
1560static int vidioc_g_tuner(struct file *file, void *priv, 1562static int vidioc_g_tuner(struct file *file, void *priv,
1561 struct v4l2_tuner *t) 1563 struct v4l2_tuner *t)
1562{ 1564{
1563 struct em28xx *dev = video_drvdata(file); 1565 struct em28xx *dev = video_drvdata(file);
1564 1566
@@ -1572,7 +1574,7 @@ static int vidioc_g_tuner(struct file *file, void *priv,
1572} 1574}
1573 1575
1574static int vidioc_s_tuner(struct file *file, void *priv, 1576static int vidioc_s_tuner(struct file *file, void *priv,
1575 const struct v4l2_tuner *t) 1577 const struct v4l2_tuner *t)
1576{ 1578{
1577 struct em28xx *dev = video_drvdata(file); 1579 struct em28xx *dev = video_drvdata(file);
1578 1580
@@ -1584,7 +1586,7 @@ static int vidioc_s_tuner(struct file *file, void *priv,
1584} 1586}
1585 1587
1586static int vidioc_g_frequency(struct file *file, void *priv, 1588static int vidioc_g_frequency(struct file *file, void *priv,
1587 struct v4l2_frequency *f) 1589 struct v4l2_frequency *f)
1588{ 1590{
1589 struct em28xx *dev = video_drvdata(file); 1591 struct em28xx *dev = video_drvdata(file);
1590 struct em28xx_v4l2 *v4l2 = dev->v4l2; 1592 struct em28xx_v4l2 *v4l2 = dev->v4l2;
@@ -1597,7 +1599,7 @@ static int vidioc_g_frequency(struct file *file, void *priv,
1597} 1599}
1598 1600
1599static int vidioc_s_frequency(struct file *file, void *priv, 1601static int vidioc_s_frequency(struct file *file, void *priv,
1600 const struct v4l2_frequency *f) 1602 const struct v4l2_frequency *f)
1601{ 1603{
1602 struct v4l2_frequency new_freq = *f; 1604 struct v4l2_frequency new_freq = *f;
1603 struct em28xx *dev = video_drvdata(file); 1605 struct em28xx *dev = video_drvdata(file);
@@ -1615,7 +1617,7 @@ static int vidioc_s_frequency(struct file *file, void *priv,
1615 1617
1616#ifdef CONFIG_VIDEO_ADV_DEBUG 1618#ifdef CONFIG_VIDEO_ADV_DEBUG
1617static int vidioc_g_chip_info(struct file *file, void *priv, 1619static int vidioc_g_chip_info(struct file *file, void *priv,
1618 struct v4l2_dbg_chip_info *chip) 1620 struct v4l2_dbg_chip_info *chip)
1619{ 1621{
1620 struct em28xx *dev = video_drvdata(file); 1622 struct em28xx *dev = video_drvdata(file);
1621 1623
@@ -1670,6 +1672,7 @@ static int vidioc_g_register(struct file *file, void *priv,
1670 reg->val = ret; 1672 reg->val = ret;
1671 } else { 1673 } else {
1672 __le16 val = 0; 1674 __le16 val = 0;
1675
1673 ret = dev->em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS, 1676 ret = dev->em28xx_read_reg_req_len(dev, USB_REQ_GET_STATUS,
1674 reg->reg, (char *)&val, 2); 1677 reg->reg, (char *)&val, 2);
1675 if (ret < 0) 1678 if (ret < 0)
@@ -1700,9 +1703,8 @@ static int vidioc_s_register(struct file *file, void *priv,
1700} 1703}
1701#endif 1704#endif
1702 1705
1703
1704static int vidioc_querycap(struct file *file, void *priv, 1706static int vidioc_querycap(struct file *file, void *priv,
1705 struct v4l2_capability *cap) 1707 struct v4l2_capability *cap)
1706{ 1708{
1707 struct video_device *vdev = video_devdata(file); 1709 struct video_device *vdev = video_devdata(file);
1708 struct em28xx *dev = video_drvdata(file); 1710 struct em28xx *dev = video_drvdata(file);
@@ -1736,7 +1738,7 @@ static int vidioc_querycap(struct file *file, void *priv,
1736} 1738}
1737 1739
1738static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv, 1740static int vidioc_enum_fmt_vid_cap(struct file *file, void *priv,
1739 struct v4l2_fmtdesc *f) 1741 struct v4l2_fmtdesc *f)
1740{ 1742{
1741 if (unlikely(f->index >= ARRAY_SIZE(format))) 1743 if (unlikely(f->index >= ARRAY_SIZE(format)))
1742 return -EINVAL; 1744 return -EINVAL;
@@ -2177,9 +2179,10 @@ static unsigned short msp3400_addrs[] = {
2177 2179
2178/******************************** usb interface ******************************/ 2180/******************************** usb interface ******************************/
2179 2181
2180static struct video_device *em28xx_vdev_init(struct em28xx *dev, 2182static struct video_device
2181 const struct video_device *template, 2183*em28xx_vdev_init(struct em28xx *dev,
2182 const char *type_name) 2184 const struct video_device *template,
2185 const char *type_name)
2183{ 2186{
2184 struct video_device *vfd; 2187 struct video_device *vfd;
2185 2188
@@ -2344,21 +2347,24 @@ static int em28xx_v4l2_init(struct em28xx *dev)
2344 2347
2345 if (dev->board.radio.type) 2348 if (dev->board.radio.type)
2346 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, 2349 v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2347 &dev->i2c_adap[dev->def_i2c_bus], 2350 &dev->i2c_adap[dev->def_i2c_bus],
2348 "tuner", dev->board.radio_addr, NULL); 2351 "tuner", dev->board.radio_addr,
2352 NULL);
2349 2353
2350 if (has_demod) 2354 if (has_demod)
2351 v4l2_i2c_new_subdev(&v4l2->v4l2_dev, 2355 v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2352 &dev->i2c_adap[dev->def_i2c_bus], "tuner", 2356 &dev->i2c_adap[dev->def_i2c_bus],
2353 0, v4l2_i2c_tuner_addrs(ADDRS_DEMOD)); 2357 "tuner", 0,
2358 v4l2_i2c_tuner_addrs(ADDRS_DEMOD));
2354 if (tuner_addr == 0) { 2359 if (tuner_addr == 0) {
2355 enum v4l2_i2c_tuner_type type = 2360 enum v4l2_i2c_tuner_type type =
2356 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV; 2361 has_demod ? ADDRS_TV_WITH_DEMOD : ADDRS_TV;
2357 struct v4l2_subdev *sd; 2362 struct v4l2_subdev *sd;
2358 2363
2359 sd = v4l2_i2c_new_subdev(&v4l2->v4l2_dev, 2364 sd = v4l2_i2c_new_subdev(&v4l2->v4l2_dev,
2360 &dev->i2c_adap[dev->def_i2c_bus], "tuner", 2365 &dev->i2c_adap[dev->def_i2c_bus],
2361 0, v4l2_i2c_tuner_addrs(type)); 2366 "tuner", 0,
2367 v4l2_i2c_tuner_addrs(type));
2362 2368
2363 if (sd) 2369 if (sd)
2364 tuner_addr = v4l2_i2c_subdev_addr(sd); 2370 tuner_addr = v4l2_i2c_subdev_addr(sd);
@@ -2378,20 +2384,20 @@ static int em28xx_v4l2_init(struct em28xx *dev)
2378 ret = em28xx_audio_setup(dev); 2384 ret = em28xx_audio_setup(dev);
2379 if (ret < 0) { 2385 if (ret < 0) {
2380 em28xx_errdev("%s: Error while setting audio - error [%d]!\n", 2386 em28xx_errdev("%s: Error while setting audio - error [%d]!\n",
2381 __func__, ret); 2387 __func__, ret);
2382 goto unregister_dev; 2388 goto unregister_dev;
2383 } 2389 }
2384 if (dev->audio_mode.ac97 != EM28XX_NO_AC97) { 2390 if (dev->audio_mode.ac97 != EM28XX_NO_AC97) {
2385 v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops, 2391 v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2386 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1); 2392 V4L2_CID_AUDIO_MUTE, 0, 1, 1, 1);
2387 v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops, 2393 v4l2_ctrl_new_std(hdl, &em28xx_ctrl_ops,
2388 V4L2_CID_AUDIO_VOLUME, 0, 0x1f, 1, 0x1f); 2394 V4L2_CID_AUDIO_VOLUME, 0, 0x1f, 1, 0x1f);
2389 } else { 2395 } else {
2390 /* install the em28xx notify callback */ 2396 /* install the em28xx notify callback */
2391 v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_MUTE), 2397 v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_MUTE),
2392 em28xx_ctrl_notify, dev); 2398 em28xx_ctrl_notify, dev);
2393 v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_VOLUME), 2399 v4l2_ctrl_notify(v4l2_ctrl_find(hdl, V4L2_CID_AUDIO_VOLUME),
2394 em28xx_ctrl_notify, dev); 2400 em28xx_ctrl_notify, dev);
2395 } 2401 }
2396 2402
2397 /* wake i2c devices */ 2403 /* wake i2c devices */
@@ -2518,7 +2524,7 @@ static int em28xx_v4l2_init(struct em28xx *dev)
2518 2524
2519 /* register v4l2 video video_device */ 2525 /* register v4l2 video video_device */
2520 ret = video_register_device(v4l2->vdev, VFL_TYPE_GRABBER, 2526 ret = video_register_device(v4l2->vdev, VFL_TYPE_GRABBER,
2521 video_nr[dev->devno]); 2527 video_nr[dev->devno]);
2522 if (ret) { 2528 if (ret) {
2523 em28xx_errdev("unable to register video device (error=%i).\n", 2529 em28xx_errdev("unable to register video device (error=%i).\n",
2524 ret); 2530 ret);
diff --git a/drivers/media/usb/em28xx/em28xx.h b/drivers/media/usb/em28xx/em28xx.h
index 8c970be8ad33..9c7075344109 100644
--- a/drivers/media/usb/em28xx/em28xx.h
+++ b/drivers/media/usb/em28xx/em28xx.h
@@ -217,7 +217,6 @@ enum em28xx_mode {
217 EM28XX_DIGITAL_MODE, 217 EM28XX_DIGITAL_MODE,
218}; 218};
219 219
220
221struct em28xx; 220struct em28xx;
222 221
223struct em28xx_usb_bufs { 222struct em28xx_usb_bufs {
@@ -245,11 +244,11 @@ struct em28xx_usb_ctl {
245 struct em28xx_usb_bufs digital_bufs; 244 struct em28xx_usb_bufs digital_bufs;
246 245
247 /* Stores already requested buffers */ 246 /* Stores already requested buffers */
248 struct em28xx_buffer *vid_buf; 247 struct em28xx_buffer *vid_buf;
249 struct em28xx_buffer *vbi_buf; 248 struct em28xx_buffer *vbi_buf;
250 249
251 /* copy data from URB */ 250 /* copy data from URB */
252 int (*urb_data_copy) (struct em28xx *dev, struct urb *urb); 251 int (*urb_data_copy)(struct em28xx *dev, struct urb *urb);
253 252
254}; 253};
255 254
@@ -697,14 +696,14 @@ struct em28xx {
697 char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */ 696 char urb_buf[URB_MAX_CTRL_SIZE]; /* urb control msg buffer */
698 697
699 /* helper funcs that call usb_control_msg */ 698 /* helper funcs that call usb_control_msg */
700 int (*em28xx_write_regs) (struct em28xx *dev, u16 reg, 699 int (*em28xx_write_regs)(struct em28xx *dev, u16 reg,
701 char *buf, int len); 700 char *buf, int len);
702 int (*em28xx_read_reg) (struct em28xx *dev, u16 reg); 701 int (*em28xx_read_reg)(struct em28xx *dev, u16 reg);
703 int (*em28xx_read_reg_req_len) (struct em28xx *dev, u8 req, u16 reg, 702 int (*em28xx_read_reg_req_len)(struct em28xx *dev, u8 req, u16 reg,
704 char *buf, int len); 703 char *buf, int len);
705 int (*em28xx_write_regs_req) (struct em28xx *dev, u8 req, u16 reg, 704 int (*em28xx_write_regs_req)(struct em28xx *dev, u8 req, u16 reg,
706 char *buf, int len); 705 char *buf, int len);
707 int (*em28xx_read_reg_req) (struct em28xx *dev, u8 req, u16 reg); 706 int (*em28xx_read_reg_req)(struct em28xx *dev, u8 req, u16 reg);
708 707
709 enum em28xx_mode mode; 708 enum em28xx_mode mode;
710 709
@@ -747,7 +746,7 @@ int em28xx_write_regs_req(struct em28xx *dev, u8 req, u16 reg, char *buf,
747int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len); 746int em28xx_write_regs(struct em28xx *dev, u16 reg, char *buf, int len);
748int em28xx_write_reg(struct em28xx *dev, u16 reg, u8 val); 747int em28xx_write_reg(struct em28xx *dev, u16 reg, u8 val);
749int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val, 748int em28xx_write_reg_bits(struct em28xx *dev, u16 reg, u8 val,
750 u8 bitmask); 749 u8 bitmask);
751int em28xx_toggle_reg_bits(struct em28xx *dev, u16 reg, u8 bitmask); 750int em28xx_toggle_reg_bits(struct em28xx *dev, u16 reg, u8 bitmask);
752 751
753int em28xx_read_ac97(struct em28xx *dev, u8 reg); 752int em28xx_read_ac97(struct em28xx *dev, u8 reg);