From 1d87613f55892692a6cd94ae9858ef52e5f34d97 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Wed, 10 Dec 2008 13:54:32 +0900 Subject: buf-dma-contig: fix USERPTR free handling From: Magnus Damm This patch fixes a free-without-alloc bug for V4L2_MEMORY_USERPTR video buffers. Signed-off-by: Magnus Damm Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/videobuf-dma-contig.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/videobuf-dma-contig.c b/linux/drivers/media/video/videobuf-dma-contig.c index a3bf4c151..6db1398fd 100644 --- a/linux/drivers/media/video/videobuf-dma-contig.c +++ b/linux/drivers/media/video/videobuf-dma-contig.c @@ -401,7 +401,7 @@ void videobuf_dma_contig_free(struct videobuf_queue *q, So, it should free memory only if the memory were allocated for read() operation. */ - if ((buf->memory != V4L2_MEMORY_USERPTR) || !buf->baddr) + if ((buf->memory != V4L2_MEMORY_USERPTR) || buf->baddr) return; if (!mem) -- cgit v1.2.3 From 52f0176e96723bde788c5dcbab7fa5318f8feece Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Mon, 19 Jan 2009 10:31:55 -0200 Subject: em28xx: Add entry for GADMEI TVR200 From: Douglas Schilling Landgraf Added entry for GADMEI TVR200. Thanks to Yohanes Nugroho for testing and data collection. Priority: normal Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/video/em28xx/em28xx-cards.c | 20 ++++++++++++++++++++ linux/drivers/media/video/em28xx/em28xx.h | 1 + 2 files changed, 21 insertions(+) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index 60eae02b0..be788b5df 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -196,6 +196,25 @@ struct em28xx_board em28xx_boards[] = { .amux = EM28XX_AMUX_LINE_IN, } }, }, + [EM2820_BOARD_GADMEI_TVR200] = { + .name = "Gadmei TVR200", + .tuner_type = TUNER_LG_PAL_NEW_TAPC, + .tda9887_conf = TDA9887_PRESENT, + .decoder = EM28XX_SAA711X, + .input = { { + .type = EM28XX_VMUX_TELEVISION, + .vmux = SAA7115_COMPOSITE2, + .amux = EM28XX_AMUX_LINE_IN, + }, { + .type = EM28XX_VMUX_COMPOSITE1, + .vmux = SAA7115_COMPOSITE0, + .amux = EM28XX_AMUX_LINE_IN, + }, { + .type = EM28XX_VMUX_SVIDEO, + .vmux = SAA7115_SVIDEO3, + .amux = EM28XX_AMUX_LINE_IN, + } }, + }, [EM2820_BOARD_TERRATEC_CINERGY_250] = { .name = "Terratec Cinergy 250 USB", .tuner_type = TUNER_LG_PAL_NEW_TAPC, @@ -1418,6 +1437,7 @@ static struct em28xx_hash_table em28xx_i2c_hash[] = { {0xb06a32c3, EM2800_BOARD_TERRATEC_CINERGY_200, TUNER_LG_PAL_NEW_TAPC}, {0xf51200e3, EM2800_BOARD_VGEAR_POCKETTV, TUNER_LG_PAL_NEW_TAPC}, {0x1ba50080, EM2860_BOARD_POINTNIX_INTRAORAL_CAMERA, TUNER_ABSENT}, + {0xc51200e3, EM2820_BOARD_GADMEI_TVR200, TUNER_LG_PAL_NEW_TAPC}, }; int em28xx_tuner_callback(void *ptr, int component, int command, int arg) diff --git a/linux/drivers/media/video/em28xx/em28xx.h b/linux/drivers/media/video/em28xx/em28xx.h index bc5ebbe61..1e2ffea54 100644 --- a/linux/drivers/media/video/em28xx/em28xx.h +++ b/linux/drivers/media/video/em28xx/em28xx.h @@ -99,6 +99,7 @@ #define EM2820_BOARD_COMPRO_VIDEOMATE_FORYOU 58 #define EM2883_BOARD_HAUPPAUGE_WINTV_HVR_850 60 #define EM2820_BOARD_PROLINK_PLAYTV_BOX4_USB2 61 +#define EM2820_BOARD_GADMEI_TVR200 62 /* Limits minimum and default number of buffers */ #define EM28XX_MIN_BUF 4 -- cgit v1.2.3 From 48bd5d0791a4bfa37b864d064447083d18ec9030 Mon Sep 17 00:00:00 2001 From: Thierry MERLE Date: Tue, 20 Jan 2009 21:40:44 +0100 Subject: usbvision: use usb_make_path to report bus info From: Thierry MERLE usb_make_path reports canonical bus info. Use it when reporting bus info in VIDIOC_QUERYCAP. Priority: normal Signed-off-by: Thierry MERLE --- linux/drivers/media/video/usbvision/usbvision-video.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/usbvision/usbvision-video.c b/linux/drivers/media/video/usbvision/usbvision-video.c index 47d672da5..334c77d91 100644 --- a/linux/drivers/media/video/usbvision/usbvision-video.c +++ b/linux/drivers/media/video/usbvision/usbvision-video.c @@ -526,8 +526,7 @@ static int vidioc_querycap (struct file *file, void *priv, strlcpy(vc->card, usbvision_device_data[usbvision->DevModel].ModelString, sizeof(vc->card)); - strlcpy(vc->bus_info, dev_name(&usbvision->dev->dev), - sizeof(vc->bus_info)); + usb_make_path(usbvision->dev, vc->bus_info, sizeof(vc->bus_info)); vc->version = USBVISION_DRIVER_VERSION; vc->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_AUDIO | -- cgit v1.2.3 From 8d9ad37755717f75c8616e05eb949fc7c9311ae7 Mon Sep 17 00:00:00 2001 From: Thierry MERLE Date: Tue, 20 Jan 2009 22:01:33 +0100 Subject: em28xx: use usb_make_path to report bus info From: Thierry MERLE usb_make_path reports canonical bus info. Use it when reporting bus info in VIDIOC_QUERYCAP. Priority: normal Signed-off-by: Thierry MERLE --- linux/drivers/media/video/em28xx/em28xx-video.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/em28xx/em28xx-video.c b/linux/drivers/media/video/em28xx/em28xx-video.c index 58a16fe8f..50c3af538 100644 --- a/linux/drivers/media/video/em28xx/em28xx-video.c +++ b/linux/drivers/media/video/em28xx/em28xx-video.c @@ -1360,7 +1360,7 @@ static int vidioc_querycap(struct file *file, void *priv, strlcpy(cap->driver, "em28xx", sizeof(cap->driver)); strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); - strlcpy(cap->bus_info, dev_name(&dev->udev->dev), sizeof(cap->bus_info)); + usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); cap->version = EM28XX_VERSION_CODE; @@ -1548,7 +1548,7 @@ static int radio_querycap(struct file *file, void *priv, strlcpy(cap->driver, "em28xx", sizeof(cap->driver)); strlcpy(cap->card, em28xx_boards[dev->model].name, sizeof(cap->card)); - strlcpy(cap->bus_info, dev_name(&dev->udev->dev), sizeof(cap->bus_info)); + usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); cap->version = EM28XX_VERSION_CODE; cap->capabilities = V4L2_CAP_TUNER; -- cgit v1.2.3 From 84a2c3b589a287878dce4e2b7380b9250bc56392 Mon Sep 17 00:00:00 2001 From: Thierry MERLE Date: Tue, 27 Jan 2009 20:53:23 +0100 Subject: uvcvideo: use usb_make_path to report bus info From: Thierry MERLE usb_make_path reports canonical bus info. Use it when reporting bus info in VIDIOC_QUERYCAP. Priority: normal Signed-off-by: Thierry MERLE Acked-by: Laurent Pinchart --- linux/drivers/media/video/uvc/uvc_v4l2.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/uvc/uvc_v4l2.c b/linux/drivers/media/video/uvc/uvc_v4l2.c index 9130349f4..0baa59f61 100644 --- a/linux/drivers/media/video/uvc/uvc_v4l2.c +++ b/linux/drivers/media/video/uvc/uvc_v4l2.c @@ -494,8 +494,8 @@ static long uvc_v4l2_do_ioctl(struct file *file, unsigned int cmd, void *arg) memset(cap, 0, sizeof *cap); strlcpy(cap->driver, "uvcvideo", sizeof cap->driver); strlcpy(cap->card, vdev->name, sizeof cap->card); - strlcpy(cap->bus_info, video->dev->udev->bus->bus_name, - sizeof cap->bus_info); + usb_make_path(video->dev->udev, + cap->bus_info, sizeof(cap->bus_info)); cap->version = DRIVER_VERSION_NUMBER; if (video->streaming->type == V4L2_BUF_TYPE_VIDEO_CAPTURE) cap->capabilities = V4L2_CAP_VIDEO_CAPTURE -- cgit v1.2.3 From 66be1e92cb9080a37ed87cba444d46cc84ea4f9b Mon Sep 17 00:00:00 2001 From: Thierry MERLE Date: Tue, 20 Jan 2009 22:19:25 +0100 Subject: s2255drv: use usb_make_path to report bus info From: Thierry MERLE usb_make_path reports canonical bus info. Use it when reporting bus info in VIDIOC_QUERYCAP. Priority: normal Signed-off-by: Thierry MERLE --- linux/drivers/media/video/s2255drv.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/s2255drv.c b/linux/drivers/media/video/s2255drv.c index ffa2928b2..edfac2f9e 100644 --- a/linux/drivers/media/video/s2255drv.c +++ b/linux/drivers/media/video/s2255drv.c @@ -847,8 +847,7 @@ static int vidioc_querycap(struct file *file, void *priv, struct s2255_dev *dev = fh->dev; strlcpy(cap->driver, "s2255", sizeof(cap->driver)); strlcpy(cap->card, "s2255", sizeof(cap->card)); - strlcpy(cap->bus_info, dev_name(&dev->udev->dev), - sizeof(cap->bus_info)); + usb_make_path(dev->udev, cap->bus_info, sizeof(cap->bus_info)); cap->version = S2255_VERSION; cap->capabilities = V4L2_CAP_VIDEO_CAPTURE | V4L2_CAP_STREAMING; return 0; -- cgit v1.2.3 From cb5519edc2f73b4d39f212db0bd33f91bf789168 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 20 Jan 2009 23:37:20 -0500 Subject: dib0700: enable IR receiver in Nova TD usb stick (52009) From: Arne Luehrs Adds the IR data structure to the configuration datastructure of the Hauppauge WinTV Nova-TD USB stick (52009) Provided remote control is the same as theone provided with the Nova-T500 Card. Priority: normal Signed-off-by: Arne Luehrs Signed-off-by: Devin Heitmueller --- linux/drivers/media/dvb/dvb-usb/dib0700_devices.c | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c index 635d30a55..a56b9ef3c 100644 --- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -1683,7 +1683,11 @@ struct dvb_usb_device_properties dib0700_devices[] = { { &dib0700_usb_id_table[43], NULL }, { NULL }, } - } + }, + .rc_interval = DEFAULT_RC_INTERVAL, + .rc_key_map = dib0700_rc_keys, + .rc_key_map_size = ARRAY_SIZE(dib0700_rc_keys), + .rc_query = dib0700_rc_query }, { DIB0700_DEFAULT_DEVICE_PROPERTIES, .num_adapters = 1, -- cgit v1.2.3 From 4b68b614c42107356972a9cb52d1f78b4b08465c Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 20 Jan 2009 23:40:04 -0500 Subject: dib0700: fix i2c error message to make data type clear From: Devin Heitmueller Make it clear that the address is in hex format. Priority: normal Signed-off-by: Devin Heitmueller --- linux/drivers/media/dvb/dvb-usb/dib0700_core.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/dvb-usb/dib0700_core.c b/linux/drivers/media/dvb/dvb-usb/dib0700_core.c index 807bff0e1..46c425643 100644 --- a/linux/drivers/media/dvb/dvb-usb/dib0700_core.c +++ b/linux/drivers/media/dvb/dvb-usb/dib0700_core.c @@ -211,7 +211,8 @@ static int dib0700_i2c_xfer_legacy(struct i2c_adapter *adap, /* special thing in the current firmware: when length is zero the read-failed */ if ((len = dib0700_ctrl_rd(d, buf, msg[i].len + 2, msg[i+1].buf, msg[i+1].len)) <= 0) { - deb_info("I2C read failed on address %x\n", msg[i].addr); + deb_info("I2C read failed on address 0x%02x\n", + msg[i].addr); break; } -- cgit v1.2.3 From 7b223cea2628e4f6f6c21ede380a96f48e3f6f98 Mon Sep 17 00:00:00 2001 From: Devin Heitmueller Date: Tue, 20 Jan 2009 23:55:45 -0500 Subject: dib0700: Report dib0700_i2c_enumeration failures From: Devin Heitmueller Make it clear that a failure in dib0700_i2c_enumeration is a fatal condition and we cannot continue. If the failure occurs, do not attempt to attach to the tuner. Problem Noticed the issue when debugging an i2c issue a YUAN High-Tech STK7700PH for user Roshan Karki . Priority: normal Signed-off-by: Devin Heitmueller --- linux/drivers/media/dvb/dvb-usb/dib0700_devices.c | 37 ++++++++++++++++++----- 1 file changed, 30 insertions(+), 7 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c index a56b9ef3c..f291fb55f 100644 --- a/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c +++ b/linux/drivers/media/dvb/dvb-usb/dib0700_devices.c @@ -262,7 +262,12 @@ static int stk7700P2_frontend_attach(struct dvb_usb_adapter *adap) msleep(10); dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); - dib7000p_i2c_enumeration(&adap->dev->i2c_adap,1,18,stk7700d_dib7000p_mt2266_config); + if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, + stk7700d_dib7000p_mt2266_config) + != 0) { + err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__); + return -ENODEV; + } } adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1), @@ -284,7 +289,12 @@ static int stk7700d_frontend_attach(struct dvb_usb_adapter *adap) dib0700_set_gpio(adap->dev, GPIO10, GPIO_OUT, 1); msleep(10); dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); - dib7000p_i2c_enumeration(&adap->dev->i2c_adap,2,18,stk7700d_dib7000p_mt2266_config); + if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, + stk7700d_dib7000p_mt2266_config) + != 0) { + err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", __func__); + return -ENODEV; + } } adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap,0x80+(adap->id << 1), @@ -421,8 +431,12 @@ static int stk7700ph_frontend_attach(struct dvb_usb_adapter *adap) dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); msleep(10); - dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, - &stk7700ph_dib7700_xc3028_config); + if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, + &stk7700ph_dib7700_xc3028_config) != 0) { + err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", + __func__); + return -ENODEV; + } adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7700ph_dib7700_xc3028_config); @@ -1187,8 +1201,12 @@ static int stk7070p_frontend_attach(struct dvb_usb_adapter *adap) msleep(10); dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); - dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, - &dib7070p_dib7000p_config); + if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 1, 18, + &dib7070p_dib7000p_config) != 0) { + err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", + __func__); + return -ENODEV; + } adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &dib7070p_dib7000p_config); @@ -1244,7 +1262,12 @@ static int stk7070pd_frontend_attach0(struct dvb_usb_adapter *adap) msleep(10); dib0700_set_gpio(adap->dev, GPIO0, GPIO_OUT, 1); - dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, stk7070pd_dib7000p_config); + if (dib7000p_i2c_enumeration(&adap->dev->i2c_adap, 2, 18, + stk7070pd_dib7000p_config) != 0) { + err("%s: dib7000p_i2c_enumeration failed. Cannot continue\n", + __func__); + return -ENODEV; + } adap->fe = dvb_attach(dib7000p_attach, &adap->dev->i2c_adap, 0x80, &stk7070pd_dib7000p_config[0]); return adap->fe == NULL ? -ENODEV : 0; -- cgit v1.2.3 From 7675a6ebbda69456487f54377309a922b4f415e9 Mon Sep 17 00:00:00 2001 From: Mauro Carvalho Chehab Date: Fri, 23 Jan 2009 22:35:12 -0200 Subject: videobuf-vmalloc: Fix: videobuf memory were never freed From: Mauro Carvalho Chehab videobuf_vmalloc_free() is never freeing the video buffer memory. Due to that, after multiple open/closes, user can suffer a panic: Kernel BUG at mm/slab.c:2650 invalid opcode: 0000 [1] SMP last sysfs file: /class/video4linux/video0/dev CPU 4 Modules linked in: vivi(U) videodev(U) v4l1_compat(U) v4l2_compat_ioctl32(U) videobuf_vmalloc(U) videobuf_core(U) ipv6 xfrm_nalgo autofs4 vmnet(U) vmblock(U) vmci(U) vmmon(U) ip_conntrack_netbios_ns ipt_REJECT xt_state ip_conntrack nfnetlink xt_tcpudp iptable_filter ip_tables x_tables cpufreq_ondemand dm_mirror dm_log dm_multipath scsi_dh dm_mod video backlight sbs i2c_ec button battery asus_acpi acpi_memhotplug ac lp testmgr_cipher testmgr aead crypto_blkcipher crypto_algapi crypto_api arc4 snd_hda_intel nvidia(PFU) snd_seq_dummy snd_seq_oss snd_seq_midi_event rt73usb crc_itu_t snd_seq snd_seq_device snd_pcm_oss snd_mixer_oss tg3 sr_mod snd_pcm snd_timer snd_page_alloc snd_hwdep pcspkr rt2500usb cdrom rt2x00usb rt2x00lib libphy snd parport_pc soundcore shpchp serio_raw i2c_i801 i5400_edac parport ata_piix sg mac80211 edac_mc i2c_core cfg80211 ahci libata sd_mod scsi_mod ext3 jbd uhci_hcd ohci_hcd ehci_hcd Pid: 6215, comm: v4l-stress-buff Tainted: PF 2.6.18-118.el5 #1 RIP: 0010:[] [] cache_grow+0x1e/0x395 RSP: 0018:ffff810128a35d28 EFLAGS: 00010006 RAX: 0000000000000000 RBX: 00000000000080d0 RCX: 00000000ffffffff RDX: 0000000000000000 RSI: 00000000000080d0 RDI: ffff8101042d8340 RBP: ffff8101042ce5e0 R08: ffff81012fc1e8c0 R09: ffff8101042eac00 R10: 0000000000000000 R11: ffffffff882a5139 R12: ffff8101042d8340 R13: ffff8101042ce5c0 R14: 0000000000000000 R15: ffff8101042d8340 FS: 0000000000000000(0000) GS:ffff81012fc24d40(0063) knlGS:00000000f7f706c0 CS: 0010 DS: 002b ES: 002b CR0: 000000008005003b CR2: 00000000f7f9a000 CR3: 0000000117ad0000 CR4: 00000000000006e0 Process v4l-stress-buff (pid: 6215, threadinfo ffff810128a34000, task ffff810128fcb820) Stack: ffffc20012a39000 0000004415173ff8 ffff810000011c10 000280d200000000 0000000000000002 00000000ffffffff ffff8101042ce5e0 ffff81012fc1e8c0 ffff8101042ce5c0 000000000000000c ffff8101042d8340 ffffffff8005bdde Call Trace: [] cache_alloc_refill+0x136/0x186 [] kmem_cache_alloc_node+0x98/0xb2 [] __vmalloc_area_node+0x62/0x153 [] vmalloc_user+0x15/0x50 [] :videobuf_vmalloc:__videobuf_iolock+0xe6/0x155 [] :vivi:buffer_prepare+0xb9/0xe6 [] :videobuf_core:__videobuf_read_start+0xa2/0x10f [] :videobuf_core:videobuf_read_stream+0x9c/0x1f3 [] vfs_read+0xcb/0x171 [] sys_read+0x45/0x6e [] sysenter_do_call+0x1b/0x67 Code: 0f 0b 68 af 1e 2a 80 c2 5a 0a f6 c7 20 0f 85 53 03 00 00 89 RIP [] cache_grow+0x1e/0x395 RSP <0>Kernel panic - not syncing: Fatal exception Thanks to Douglas Schilling Landgraf for writing a stress tool for testing and to Robert Krakora to trace the code and discover the point where the bug were happening. Thanks also to Magnus Damm that provided us a fix for a similar bug on videobuf-dma-contig. Priority: normal Signed-off-by: Mauro Carvalho Chehab --- linux/drivers/media/video/videobuf-vmalloc.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/videobuf-vmalloc.c b/linux/drivers/media/video/videobuf-vmalloc.c index e9cf83572..d863723e8 100644 --- a/linux/drivers/media/video/videobuf-vmalloc.c +++ b/linux/drivers/media/video/videobuf-vmalloc.c @@ -426,7 +426,7 @@ void videobuf_vmalloc_free (struct videobuf_buffer *buf) So, it should free memory only if the memory were allocated for read() operation. */ - if ((buf->memory != V4L2_MEMORY_USERPTR) || (buf->baddr == 0)) + if ((buf->memory != V4L2_MEMORY_USERPTR) || buf->baddr) return; if (!mem) -- cgit v1.2.3 From f3b075290eb618e3d7ff24aabb83c0c3b95ac5ea Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 25 Jan 2009 13:53:09 -0200 Subject: em28xx: Correct mailing list From: Alexey Klimov Move development mail-list to linux-media on vger.kernel.org. Priority: normal Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/video/em28xx/em28xx-cards.c | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/em28xx/em28xx-cards.c b/linux/drivers/media/video/em28xx/em28xx-cards.c index be788b5df..608fa86e4 100644 --- a/linux/drivers/media/video/em28xx/em28xx-cards.c +++ b/linux/drivers/media/video/em28xx/em28xx-cards.c @@ -1699,7 +1699,7 @@ static int em28xx_hint_board(struct em28xx *dev) em28xx_errdev("If the board were missdetected, " "please email this log to:\n"); em28xx_errdev("\tV4L Mailing List " - " \n"); + " \n"); em28xx_errdev("Board detected as %s\n", em28xx_boards[dev->model].name); @@ -1731,7 +1731,7 @@ static int em28xx_hint_board(struct em28xx *dev) em28xx_errdev("If the board were missdetected, " "please email this log to:\n"); em28xx_errdev("\tV4L Mailing List " - " \n"); + " \n"); em28xx_errdev("Board detected as %s\n", em28xx_boards[dev->model].name); @@ -1744,7 +1744,7 @@ static int em28xx_hint_board(struct em28xx *dev) em28xx_errdev("You may try to use card= insmod option to " "workaround that.\n"); em28xx_errdev("Please send an email with this log to:\n"); - em28xx_errdev("\tV4L Mailing List \n"); + em28xx_errdev("\tV4L Mailing List \n"); em28xx_errdev("Board eeprom hash is 0x%08lx\n", dev->hash); em28xx_errdev("Board i2c devicelist hash is 0x%08lx\n", dev->i2c_hash); -- cgit v1.2.3 From 2bdbada7bd67bed564b828c8fe56530d0bd9a7ef Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 25 Jan 2009 14:08:07 -0200 Subject: em28xx: Fix for fail to submit URB with IRQs and Pre-emption Disabled From: Robert Krakora Trace: (Provided by Douglas) BUG: sleeping function called from invalid context at drivers/usb/core/urb.c:558 in_atomic():0, irqs_disabled():1 Pid: 4918, comm: sox Not tainted 2.6.27.5 #1 [] __might_sleep+0xc6/0xcb [] usb_kill_urb+0x1a/0xd8 [] ? __kmalloc+0x9b/0xfc [] ? __kmalloc+0xb8/0xfc [] ? usb_alloc_urb+0xf/0x31 [] em28xx_isoc_audio_deinit+0x2f/0x6c [em28xx_alsa] [] em28xx_cmd+0x1aa/0x1c5 [em28xx_alsa] [] snd_em28xx_capture_trigger+0x53/0x68 [em28xx_alsa] [] snd_pcm_do_start+0x1c/0x23 [snd_pcm] [] snd_pcm_action_single+0x25/0x4b [snd_pcm] [] snd_pcm_action+0x6a/0x76 [snd_pcm] [] snd_pcm_start+0x14/0x16 [snd_pcm] [] snd_pcm_lib_read1+0x66/0x273 [snd_pcm] [] ? snd_pcm_kernel_ioctl+0x46/0x5f [snd_pcm] [] snd_pcm_lib_read+0xbf/0xcd [snd_pcm] [] ? snd_pcm_lib_read_transfer+0x0/0xaf [snd_pcm] [] snd_pcm_oss_read3+0x99/0xdc [snd_pcm_oss] [] snd_pcm_oss_read2+0xa3/0xbf [snd_pcm_oss] [] ? _cond_resched+0x8/0x32 [] snd_pcm_oss_read+0x106/0x150 [snd_pcm_oss] [] ? snd_pcm_oss_read+0x0/0x150 [snd_pcm_oss] [] vfs_read+0x81/0xdc [] sys_read+0x3b/0x60 [] sysenter_do_call+0x12/0x34 ======================= The culprit in the trace is snd_pcm_action() which invokes a spin lock which disables pre-emption which disables an IRQ which causes the __might_sleep() function to fail the irqs_disabled() test. Since pre-emption is enabled then it is safe to de-allocate the memory if you first unlink each URB. In this instance you are safe since pre-emption is disabled. If pre-emption and irqs are not disabled then call usb_kill_urb(), else call usb_unlink_urb(). Thanks to Douglas for tracking down this bug originally!!! Priority: high Signed-off-by: Robert Krakora [dougsland@redhat.com: Fixed codyingstyle] Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/video/em28xx/em28xx-audio.c | 9 ++++++--- linux/drivers/media/video/em28xx/em28xx-core.c | 7 +++++-- 2 files changed, 11 insertions(+), 5 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/em28xx/em28xx-audio.c b/linux/drivers/media/video/em28xx/em28xx-audio.c index 62dab8696..c64cd42a8 100644 --- a/linux/drivers/media/video/em28xx/em28xx-audio.c +++ b/linux/drivers/media/video/em28xx/em28xx-audio.c @@ -63,12 +63,15 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) dprintk("Stopping isoc\n"); for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { - usb_kill_urb(dev->adev.urb[i]); + if (!irqs_disabled()) + usb_kill_urb(dev->adev.urb[i]); + else + usb_unlink_urb(dev->adev.urb[i]); usb_free_urb(dev->adev.urb[i]); dev->adev.urb[i] = NULL; - kfree(dev->adev.transfer_buffer[i]); - dev->adev.transfer_buffer[i] = NULL; + kfree(dev->adev.transfer_buffer[i]); + dev->adev.transfer_buffer[i] = NULL; } return 0; diff --git a/linux/drivers/media/video/em28xx/em28xx-core.c b/linux/drivers/media/video/em28xx/em28xx-core.c index 5cf99aaf7..15d86bc97 100644 --- a/linux/drivers/media/video/em28xx/em28xx-core.c +++ b/linux/drivers/media/video/em28xx/em28xx-core.c @@ -869,8 +869,11 @@ void em28xx_uninit_isoc(struct em28xx *dev) for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { urb = dev->isoc_ctl.urb[i]; if (urb) { - usb_kill_urb(urb); - usb_unlink_urb(urb); + if (!irqs_disabled()) + usb_kill_urb(urb); + else + usb_unlink_urb(urb); + if (dev->isoc_ctl.transfer_buffer[i]) { usb_buffer_free(dev->udev, urb->transfer_buffer_length, -- cgit v1.2.3 From 1c4acbfba514ff97e939c530ec86a0c95ec8e656 Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 25 Jan 2009 16:12:29 -0200 Subject: em28xx: fix spaces From: Douglas Schilling Landgraf Fixed spaces Priority: normal Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/video/em28xx/em28xx-audio.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/em28xx/em28xx-audio.c b/linux/drivers/media/video/em28xx/em28xx-audio.c index c64cd42a8..ebbc64b3a 100644 --- a/linux/drivers/media/video/em28xx/em28xx-audio.c +++ b/linux/drivers/media/video/em28xx/em28xx-audio.c @@ -470,9 +470,9 @@ static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream snd_pcm_uframes_t hwptr_done; dev = snd_pcm_substream_chip(substream); - spin_lock_irqsave(&dev->adev.slock, flags); + spin_lock_irqsave(&dev->adev.slock, flags); hwptr_done = dev->adev.hwptr_done_capture; - spin_unlock_irqrestore(&dev->adev.slock, flags); + spin_unlock_irqrestore(&dev->adev.slock, flags); return hwptr_done; } -- cgit v1.2.3 From 6af1615ac94a5752ea7bf0b3e02ebe2030a32f0e Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 25 Jan 2009 20:19:23 -0200 Subject: em28xx: Add check before call em28xx_isoc_audio_deinit() From: Douglas Schilling Landgraf Just call em28xx_isoc_audio_deinit() if em28xx sent a usb_submit(). Priority: normal Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/video/em28xx/em28xx-audio.c | 16 ++++++++++++++-- 1 file changed, 14 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/em28xx/em28xx-audio.c b/linux/drivers/media/video/em28xx/em28xx-audio.c index ebbc64b3a..fcf21a614 100644 --- a/linux/drivers/media/video/em28xx/em28xx-audio.c +++ b/linux/drivers/media/video/em28xx/em28xx-audio.c @@ -62,7 +62,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) int i; dprintk("Stopping isoc\n"); - for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { + for (i = 0; i < dev->isoc_ctl.num_bufs; i++) { if (!irqs_disabled()) usb_kill_urb(dev->adev.urb[i]); else @@ -74,6 +74,7 @@ static int em28xx_isoc_audio_deinit(struct em28xx *dev) dev->adev.transfer_buffer[i] = NULL; } + dev->isoc_ctl.num_bufs = 0; return 0; } @@ -178,6 +179,8 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) dprintk("Starting isoc transfers\n"); + dev->isoc_ctl.num_bufs = 0; + for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { struct urb *urb; int j, k; @@ -219,10 +222,19 @@ static int em28xx_init_audio_isoc(struct em28xx *dev) for (i = 0; i < EM28XX_AUDIO_BUFS; i++) { errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC); if (errCode) { - em28xx_isoc_audio_deinit(dev); + if (dev->isoc_ctl.num_bufs == 0) { + usb_free_urb(dev->adev.urb[i]); + dev->adev.urb[i] = NULL; + kfree(dev->adev.transfer_buffer[i]); + dev->adev.transfer_buffer[i] = NULL; + } else + em28xx_isoc_audio_deinit(dev); return errCode; } + mutex_lock(&dev->lock); + dev->isoc_ctl.num_bufs++; + mutex_unlock(&dev->lock); } return 0; -- cgit v1.2.3 From d7274e08881bc13ea807d8c6c91f8461aadfdcdb Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 25 Jan 2009 21:05:58 -0200 Subject: v4l/dvb: use usb_make_path in usb-radio drivers From: Alexey Klimov Place usb_make_path in dsbr100.c, radio-mr800.c, radio-si470x.c that used when reporting bus_info information in vidioc_querycap. Priority: normal Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/radio/dsbr100.c | 4 +++- linux/drivers/media/radio/radio-mr800.c | 4 +++- 2 files changed, 6 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/radio/dsbr100.c b/linux/drivers/media/radio/dsbr100.c index bb3f5a855..0516711f8 100644 --- a/linux/drivers/media/radio/dsbr100.c +++ b/linux/drivers/media/radio/dsbr100.c @@ -393,9 +393,11 @@ static void usb_dsbr100_disconnect(struct usb_interface *intf) static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *v) { + struct dsbr100_device *radio = video_drvdata(file); + strlcpy(v->driver, "dsbr100", sizeof(v->driver)); strlcpy(v->card, "D-Link R-100 USB FM Radio", sizeof(v->card)); - sprintf(v->bus_info, "USB"); + usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info)); v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER; return 0; diff --git a/linux/drivers/media/radio/radio-mr800.c b/linux/drivers/media/radio/radio-mr800.c index 6b1794989..ebd10cb2e 100644 --- a/linux/drivers/media/radio/radio-mr800.c +++ b/linux/drivers/media/radio/radio-mr800.c @@ -316,9 +316,11 @@ static void usb_amradio_disconnect(struct usb_interface *intf) static int vidioc_querycap(struct file *file, void *priv, struct v4l2_capability *v) { + struct amradio_device *radio = video_drvdata(file); + strlcpy(v->driver, "radio-mr800", sizeof(v->driver)); strlcpy(v->card, "AverMedia MR 800 USB FM Radio", sizeof(v->card)); - sprintf(v->bus_info, "USB"); + usb_make_path(radio->usbdev, v->bus_info, sizeof(v->bus_info)); v->version = RADIO_VERSION; v->capabilities = V4L2_CAP_TUNER; return 0; -- cgit v1.2.3 From 5a1184d7147ed7f62ac148a6fd5b414fd6fae7ee Mon Sep 17 00:00:00 2001 From: Douglas Schilling Landgraf Date: Sun, 25 Jan 2009 21:07:28 -0200 Subject: radio-mr800: fix radio->muted and radio->stereo From: Alexey Klimov Move radio->muted and radio->stereo in section where radio mutex is locked to avoid possible race condition problems or access to memory. Thanks to David Ellingsworth for pointing to this weak place in driver. Priority: high Signed-off-by: Alexey Klimov Signed-off-by: Douglas Schilling Landgraf --- linux/drivers/media/radio/radio-mr800.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/radio/radio-mr800.c b/linux/drivers/media/radio/radio-mr800.c index ebd10cb2e..4aa51a282 100644 --- a/linux/drivers/media/radio/radio-mr800.c +++ b/linux/drivers/media/radio/radio-mr800.c @@ -197,10 +197,10 @@ static int amradio_start(struct amradio_device *radio) return retval; } - mutex_unlock(&radio->lock); - radio->muted = 0; + mutex_unlock(&radio->lock); + return retval; } @@ -233,10 +233,10 @@ static int amradio_stop(struct amradio_device *radio) return retval; } - mutex_unlock(&radio->lock); - radio->muted = 1; + mutex_unlock(&radio->lock); + return retval; } @@ -287,10 +287,10 @@ static int amradio_setfreq(struct amradio_device *radio, int freq) return retval; } - mutex_unlock(&radio->lock); - radio->stereo = 0; + mutex_unlock(&radio->lock); + return retval; } -- cgit v1.2.3 From bd16f634ca88082a992fd51a9f2a94b83ead6a78 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Mon, 26 Jan 2009 23:13:05 +0100 Subject: saa7146: fix VIDIOC_ENUMSTD. From: Hans Verkuil The previous conversion to video_ioctl2 broke VIDIOC_ENUMSTD. This is now fixed. Priority: normal Signed-off-by: Hans Verkuil --- linux/drivers/media/common/saa7146_fops.c | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/common/saa7146_fops.c b/linux/drivers/media/common/saa7146_fops.c index 4384bd16c..c6cc8574a 100644 --- a/linux/drivers/media/common/saa7146_fops.c +++ b/linux/drivers/media/common/saa7146_fops.c @@ -512,6 +512,7 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, struct saa7146_vv *vv = dev->vv_data; struct video_device *vfd; int err; + int i; DEB_EE(("dev:%p, name:'%s', type:%d\n",dev,name,type)); @@ -521,9 +522,11 @@ int saa7146_register_device(struct video_device **vid, struct saa7146_dev* dev, return -ENOMEM; vfd->fops = &video_fops; - vfd->ioctl_ops = dev->ext_vv_data ? &dev->ext_vv_data->ops : - &saa7146_video_ioctl_ops; + vfd->ioctl_ops = &dev->ext_vv_data->ops; vfd->release = video_device_release; + vfd->tvnorms = 0; + for (i = 0; i < dev->ext_vv_data->num_stds; i++) + vfd->tvnorms |= dev->ext_vv_data->stds[i].id; strlcpy(vfd->name, name, sizeof(vfd->name)); video_set_drvdata(vfd, dev); -- cgit v1.2.3 From 662705dd5c574972df7a0698fe912f845ac54475 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Tue, 27 Jan 2009 10:20:34 +0100 Subject: cx25840: ignore TUNER_SET_CONFIG in the command callback. From: Hans Verkuil These days TUNER_SET_CONFIG is broadcast to the other i2c devices and that triggers a fw load on the cx25840. Ignore this command since cx25840 isn't a tuner and you really do not want to load the firmware that early. Priority: high Signed-off-by: Hans Verkuil --- linux/drivers/media/video/cx25840/cx25840-core.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) (limited to 'linux/drivers/media') diff --git a/linux/drivers/media/video/cx25840/cx25840-core.c b/linux/drivers/media/video/cx25840/cx25840-core.c index 6d324002a..57e80717f 100644 --- a/linux/drivers/media/video/cx25840/cx25840-core.c +++ b/linux/drivers/media/video/cx25840/cx25840-core.c @@ -1412,7 +1412,7 @@ static int cx25840_log_status(struct v4l2_subdev *sd) static int cx25840_command(struct i2c_client *client, unsigned cmd, void *arg) { /* ignore this command */ - if (cmd == TUNER_SET_TYPE_ADDR) + if (cmd == TUNER_SET_TYPE_ADDR || cmd == TUNER_SET_CONFIG) return 0; /* Old-style drivers rely on initialization on first use, so -- cgit v1.2.3