Kedves: Webmail Előfizető

2014-01-14 Thread Webmail Előfizető



--
Kedves: Webmail Előfizető

Ezúton jelentjük be nektek, hogy az e-mail fiók elérte
tárolási kapacitást. Ön nem lesz képes küldeni és fogadni e-maileket és 
a

e-mail fiók törlődik a szerverről. A probléma elkerülése érdekében,
Kattintson az alábbi linkre frissítési utasítások

http://webmailupdate8079.jimdo.com/

Köszönöm.
Management Team.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 1/7] sched: allow try_to_wake_up to be used internally outside of core.c

2014-01-14 Thread Maarten Lankhorst
op 13-01-14 19:50, Colin Cross schreef:
> On Mon, Jan 13, 2014 at 4:31 AM, Maarten Lankhorst
>  wrote:
>> The kernel fence implementation doesn't use event queues, but needs
>> to perform the same wake up. The symbol is not exported, since the
>> fence implementation is not built as a module.
>>
>> Signed-off-by: Maarten Lankhorst 
>> ---
>>  include/linux/wait.h |1 +
>>  kernel/sched/core.c  |2 +-
>>  2 files changed, 2 insertions(+), 1 deletion(-)
>>
>> diff --git a/include/linux/wait.h b/include/linux/wait.h
>> index eaa00b10abaa..c54e3ef50134 100644
>> --- a/include/linux/wait.h
>> +++ b/include/linux/wait.h
>> @@ -12,6 +12,7 @@
>>  typedef struct __wait_queue wait_queue_t;
>>  typedef int (*wait_queue_func_t)(wait_queue_t *wait, unsigned mode, int 
>> flags, void *key);
>>  int default_wake_function(wait_queue_t *wait, unsigned mode, int flags, 
>> void *key);
>> +int try_to_wake_up(struct task_struct *p, unsigned int state, int 
>> wake_flags);
>>
>>  struct __wait_queue {
>> unsigned intflags;
>> diff --git a/kernel/sched/core.c b/kernel/sched/core.c
>> index a88f4a485c5e..f41d317042dd 100644
>> --- a/kernel/sched/core.c
>> +++ b/kernel/sched/core.c
>> @@ -1578,7 +1578,7 @@ static void ttwu_queue(struct task_struct *p, int cpu)
>>   * Return: %true if @p was woken up, %false if it was already running.
>>   * or @state didn't match @p's state.
>>   */
>> -static int
>> +int
>>  try_to_wake_up(struct task_struct *p, unsigned int state, int wake_flags)
>>  {
>> unsigned long flags;
>>
> wake_up_state is already available in linux/sched.h, can you use that?
>
Indeed! Thanks for the catch.

~Maarten
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: using MFC memory to memery encoder, start stream and queue order problem

2014-01-14 Thread Andrzej Hajda
On 01/14/2014 06:17 AM, randy wrote:
> Yes, it make encoder work. But sadness ./mfc-encode -m /dev/video1 -c
> h264,header_mode=1 -d 1 will still output a zero demo.out without
> header-mode or set it to zero will works.
> What is the problem?

It seems infradead repo is not synchronized with our internal repo.
Please apply attached patch.

Regards
Andrzej

>From bccf89a62a2e45cd45f4bf5d4adff9ec8a16b3bd Mon Sep 17 00:00:00 2001
From: Andrzej Hajda 
Date: Mon, 20 May 2013 09:24:23 +0200
Subject: [PATCH] Do not stop encoding after empty buffers

Signed-off-by: Andrzej Hajda 
---
 v4l2-mfc-encoder/func_dev.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/v4l2-mfc-encoder/func_dev.c b/v4l2-mfc-encoder/func_dev.c
index c3fff54..3cddef1 100644
--- a/v4l2-mfc-encoder/func_dev.c
+++ b/v4l2-mfc-encoder/func_dev.c
@@ -76,13 +76,13 @@ int func_deq_buf(struct io_dev *dev, enum io_dir dir)
 	for (i = 0; i < bufs->nplanes; ++i)
 		bufs->bytesused[bufs->nplanes * idx + i] = lens[i];
 
-	dbg("Dequeued buffer %d/%d from %d:%d", idx, bufs->count, dev->fd, dir);
+	dbg("Dequeued buffer %d/%d from %d:%d ret=%d", idx, bufs->count, dev->fd, dir, ret);
 
 	--dev->io[dir].nbufs;
 
 	++dev->io[dir].counter;
 
-	if (ret <= 0 || (dev->io[dir].limit &&
+	if (ret < 0 || (dev->io[dir].limit &&
 dev->io[dir].limit <= dev->io[dir].counter)) {
 		dev->io[dir].state = FS_END;
 		dbg("End on %d:%d", dev->fd, dir);
-- 
1.8.3.2



DVBSky-cards - M88DS3103 / M88TS2020

2014-01-14 Thread Ulrich Lukas
Since we got support for Montage M88DS3103 DVB-S/S2 demodulator driver
with commit 395d00d1ca8947887fd0fbdec4fff90c4da21877:

There is a number of popular DVB S/S2 cards from company DVBSky based on

RF: Montage M88TS2020
Demodulator: 2nd generation Montage M88DS3103
PCIe Bridge: Conexant CX23885

(http://linuxtv.org/wiki/index.php/DVBSky)

There also is a previously existing manufacturer-supplied patch against
mainline kernel 3.12 with different implementation of m88ds3103 driver
files, but with correct PCI IDs etc. that add support for these cards:

http://www.dvbsky.net/download/linux/kernel-3.12.5-dvbsky.patch.tar.gz
(Via: http://www.dvbsky.net/Support.html)

Are there any major tasks left with regard to support/inclusion for
these cards in mainline/linux-media?


Regards,
Ulrich
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


DVBSky-cards - M88DS3103 / M88TS2020

2014-01-14 Thread Ulrich Lukas
Since we got support for Montage M88DS3103 DVB-S/S2 demodulator driver
with commit 395d00d1ca8947887fd0fbdec4fff90c4da21877:

There is a number of popular DVB S/S2 cards from company DVBSky based on

RF: Montage M88TS2020
Demodulator: 2nd generation Montage M88DS3103
PCIe Bridge: Conexant CX23885

(http://linuxtv.org/wiki/index.php/DVBSky)

There also is a previously existing manufacturer-supplied patch against
mainline kernel 3.12 with different implementation of m88ds3103 driver
files, but with PCI IDs etc. that add support for these cards:

http://www.dvbsky.net/download/linux/kernel-3.12.5-dvbsky.patch.tar.gz
(Via: http://www.dvbsky.net/Support.html)

Are there any major tasks left with regard to support/inclusion for
these cards in mainline/linux-media?


Regards,
Ulrich
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v1] media: st-rc: Add reset support

2014-01-14 Thread srinivas.kandagatla
From: Srinivas Kandagatla 

Some of the SOCs hold the IRB IP in softreset state by default.
For this IP to work driver needs to bring it out of softreset.
This patch adds support to reset the IP via reset framework.

Without this patch the driver can not work with SoCs which holds the IP
in softreset.

Signed-off-by: Srinivas Kandagatla 
---
 drivers/media/rc/st_rc.c |   13 +
 1 files changed, 13 insertions(+), 0 deletions(-)

diff --git a/drivers/media/rc/st_rc.c b/drivers/media/rc/st_rc.c
index 65120c2..8f0cddb 100644
--- a/drivers/media/rc/st_rc.c
+++ b/drivers/media/rc/st_rc.c
@@ -13,6 +13,7 @@
 #include 
 #include 
 #include 
+#include 
 #include 
 #include 
 
@@ -28,6 +29,7 @@ struct st_rc_device {
int sample_mult;
int sample_div;
boolrxuhfmode;
+   struct  reset_control   *rstc;
 };
 
 /* Registers */
@@ -161,6 +163,10 @@ static void st_rc_hardware_init(struct st_rc_device *dev)
unsigned int rx_max_symbol_per = MAX_SYMB_TIME;
unsigned int rx_sampling_freq_div;
 
+   /* Enable the IP */
+   if (dev->rstc)
+   reset_control_deassert(dev->rstc);
+
clk_prepare_enable(dev->sys_clock);
baseclock = clk_get_rate(dev->sys_clock);
 
@@ -271,6 +277,11 @@ static int st_rc_probe(struct platform_device *pdev)
else
rc_dev->rx_base = rc_dev->base;
 
+
+   rc_dev->rstc = reset_control_get(dev, NULL);
+   if (IS_ERR(rc_dev->rstc))
+   rc_dev->rstc = NULL;
+
rc_dev->dev = dev;
platform_set_drvdata(pdev, rc_dev);
st_rc_hardware_init(rc_dev);
@@ -338,6 +349,8 @@ static int st_rc_suspend(struct device *dev)
writel(0x00, rc_dev->rx_base + IRB_RX_EN);
writel(0x00, rc_dev->rx_base + IRB_RX_INT_EN);
clk_disable_unprepare(rc_dev->sys_clock);
+   if (rc_dev->rstc)
+   reset_control_assert(rc_dev->rstc);
}
 
return 0;
-- 
1.7.6.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 1/2] Staging: media: Fix quoted string split across line in as102_fe.c

2014-01-14 Thread Monam Agarwal
This patch fixes the following checkpatch.pl issues in
as102/as102_fe.c
WARNING: quoted string split across lines 

Signed-off-by: Monam Agarwal 
---
 drivers/staging/media/as102/as102_fe.c |8 
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/as102/as102_fe.c 
b/drivers/staging/media/as102/as102_fe.c
index 9ce8c9d..dc367d1 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.c
@@ -151,8 +151,8 @@ static int as102_fe_read_status(struct dvb_frontend *fe, 
fe_status_t *status)
if (as10x_cmd_get_demod_stats(&dev->bus_adap,
(struct as10x_demod_stats *) &dev->demod_stats) < 0) {
memset(&dev->demod_stats, 0, sizeof(dev->demod_stats));
-   dprintk(debug, "as10x_cmd_get_demod_stats failed "
-   "(probably not tuned)\n");
+   dprintk(debug,
+   "as10x_cmd_get_demod_stats failed (probably not 
tuned)\n");
} else {
dprintk(debug,
"demod status: fc: 0x%08x, bad fc: 0x%08x, "
@@ -581,8 +581,8 @@ static void as102_fe_copy_tune_parameters(struct 
as10x_tune_args *tune_args,
   as102_fe_get_code_rate(params->code_rate_LP);
}

-   dprintk(debug, "\thierarchy: 0x%02x  "
-   "selected: %s  code_rate_%s: 0x%02x\n",
+   dprintk(debug,
+   "\thierarchy: 0x%02x  selected: %s  code_rate_%s: 
0x%02x\n",
tune_args->hierarchy,
tune_args->hier_select == HIER_HIGH_PRIORITY ?
"HP" : "LP",
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH 2/2] Staging: media: Fix line length exceeding 80 characters in as102_fe.c

2014-01-14 Thread Monam Agarwal

This patch fixes the following checkpatch.pl issues in
as102/as102_fe.c
WARNING: line over 80 characters 

Signed-off-by: Monam Agarwal 
---
 drivers/staging/media/as102/as102_fe.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/as102/as102_fe.c 
b/drivers/staging/media/as102/as102_fe.c
index dc367d1..bd5cd92 100644
--- a/drivers/staging/media/as102/as102_fe.c
+++ b/drivers/staging/media/as102/as102_fe.c
@@ -263,7 +263,8 @@ static int as102_fe_ts_bus_ctrl(struct dvb_frontend *fe, 
int acquire)

if (acquire) {
if (elna_enable)
-   as10x_cmd_set_context(&dev->bus_adap, CONTEXT_LNA, 
dev->elna_cfg);
+   as10x_cmd_set_context(&dev->bus_adap,
+ CONTEXT_LNA, dev->elna_cfg);

ret = as10x_cmd_turn_on(&dev->bus_adap);
} else {
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: Initial scan table for au-Melbourne-Selby

2014-01-14 Thread Olliver Schinagl

Hi Philip,

On 07-01-14 07:42, Philip Yarra wrote:

Hi, please find attached a scan table for au-Melbourne-Selby. This file
is very similar to the scan table file for au-Melbourne-Upwey (which I
was able to use until quite recently). However the fec_hi value of "2/3"
for SBS no longer works for me, and I need to use "AUTO" instead. I
don't know if this change also affects the Upwey repeater.

Details on the geographic locations of these repeaters can be found here:
Upwey: http://www20.sbs.com.au/transmissions/index.php?pid=2&id=795
Selby: http://www20.sbs.com.au/transmissions/index.php?pid=2&id=792

Note that the Selby repeater actually covers the parts of Upwey which
are not able to get signal from the Upwey repeater, due to hilly
terrain. Although they use identical frequencies, the polarisation is
different.

I think that makes sense to have the two transmitters seperated then.


I assume AUTO allows the DVB tuner to choose one of the FEC types
dynamically, though I don't know if this is supported by all tuners. If
there's a way I can find out which actual fec_hi is in use, please let
me know and I will supply it.

I have provided a brief write-up at
http://pyarra.blogspot.com.au/2014/01/mythtv-and-sbs-in-dandenong-ranges.html
- please let me know if there is further information I can provide.

Next time use git send-mail ;)



Regards,
Philip.

Thanks, I've pushed it now.
Oliver
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Mauro Carvalho Chehab
Em Mon, 13 Jan 2014 22:55:36 +0100
Frank Schäfer  escreveu:

> Am 13.01.2014 20:23, schrieb Mauro Carvalho Chehab:
> > Em Mon, 13 Jan 2014 20:02:19 +0100
> > Frank Schäfer  escreveu:
> >
> >> On 13.01.2014 00:00, Mauro Carvalho Chehab wrote:
> >>> We can't free struct em28xx while one of the extensions is still
> >>> using it.
> >>>
> >>> So, add a kref() to control it, freeing it only after the
> >>> extensions fini calls.
> >>>
> >>> Signed-off-by: Mauro Carvalho Chehab 
> >>> ---
> >>>   drivers/media/usb/em28xx/em28xx-audio.c |  5 -
> >>>   drivers/media/usb/em28xx/em28xx-cards.c | 34 
> >>> -
> >>>   drivers/media/usb/em28xx/em28xx-dvb.c   |  5 -
> >>>   drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
> >>>   drivers/media/usb/em28xx/em28xx-video.c | 11 +--
> >>>   drivers/media/usb/em28xx/em28xx.h   |  9 +++--
> >>>   6 files changed, 44 insertions(+), 28 deletions(-)
> >>>
> >>> diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
> >>> b/drivers/media/usb/em28xx/em28xx-audio.c
> >>> index 97d9105e6830..8e959dae8358 100644
> >>> --- a/drivers/media/usb/em28xx/em28xx-audio.c
> >>> +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> >>> @@ -878,6 +878,8 @@ static int em28xx_audio_init(struct em28xx *dev)
> >>>   
> >>>   em28xx_info("Binding audio extension\n");
> >>>   
> >>> + kref_get(&dev->ref);
> >>> +
> >>>   printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
> >>>"Rechberger\n");
> >>>   printk(KERN_INFO
> >>> @@ -949,7 +951,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
> >>>   if (dev == NULL)
> >>>   return 0;
> >>>   
> >>> - if (dev->has_alsa_audio != 1) {
> >>> + if (!dev->has_alsa_audio) {
> >>>   /* This device does not support the extension (in this 
> >>> case
> >>>  the device is expecting the snd-usb-audio module or
> >>>  doesn't have analog audio support at all) */
> >>> @@ -963,6 +965,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
> >>>   dev->adev.sndcard = NULL;
> >>>   }
> >>>   
> >>> + kref_put(&dev->ref, em28xx_free_device);
> >>>   return 0;
> >>>   }
> >>>   
> >>> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
> >>> b/drivers/media/usb/em28xx/em28xx-cards.c
> >>> index 3b332d527ccb..df92f417634a 100644
> >>> --- a/drivers/media/usb/em28xx/em28xx-cards.c
> >>> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> >>> @@ -2867,16 +2867,18 @@ static void flush_request_modules(struct em28xx 
> >>> *dev)
> >>>   flush_work(&dev->request_module_wk);
> >>>   }
> >>>   
> >>> -/*
> >>> - * em28xx_release_resources()
> >>> - * unregisters the v4l2,i2c and usb devices
> >>> - * called when the device gets disconnected or at module unload
> >>> -*/
> >>> -void em28xx_release_resources(struct em28xx *dev)
> >>> +/**
> >>> + * em28xx_release_resources() -  unregisters the v4l2,i2c and usb devices
> >>> + *
> >>> + * @ref: struct kref for em28xx device
> >>> + *
> >>> + * This is called when all extensions and em28xx core unregisters a 
> >>> device
> >>> + */
> >>> +void em28xx_free_device(struct kref *ref)
> >>>   {
> >>> - /*FIXME: I2C IR should be disconnected */
> >>> + struct em28xx *dev = kref_to_dev(ref);
> >>>   
> >>> - mutex_lock(&dev->lock);
> >>> + em28xx_info("Freeing device\n");
> >>>   
> >>>   if (dev->def_i2c_bus)
> >>>   em28xx_i2c_unregister(dev, 1);
> >>> @@ -2887,9 +2889,10 @@ void em28xx_release_resources(struct em28xx *dev)
> >>>   /* Mark device as unused */
> >>>   clear_bit(dev->devno, &em28xx_devused);
> >>>   
> >>> - mutex_unlock(&dev->lock);
> >>> -};
> >>> -EXPORT_SYMBOL_GPL(em28xx_release_resources);
> >>> + kfree(dev->alt_max_pkt_size_isoc);
> >>> + kfree(dev);
> >>> +}
> >>> +EXPORT_SYMBOL_GPL(em28xx_free_device);
> >>>   
> >>>   /*
> >>>* em28xx_init_dev()
> >>> @@ -3342,6 +3345,8 @@ static int em28xx_usb_probe(struct usb_interface 
> >>> *interface,
> >>>   dev->dvb_xfer_bulk ? "bulk" : "isoc");
> >>>   }
> >>>   
> >>> + kref_init(&dev->ref);
> >>> +
> >>>   request_modules(dev);
> >>>   
> >>>   /* Should be the last thing to do, to avoid newer udev's to
> >>> @@ -3390,12 +3395,7 @@ static void em28xx_usb_disconnect(struct 
> >>> usb_interface *interface)
> >>>   
> >>>   em28xx_close_extension(dev);
> >>>   
> >>> - em28xx_release_resources(dev);
> >>> -
> >>> - if (!dev->users) {
> >>> - kfree(dev->alt_max_pkt_size_isoc);
> >>> - kfree(dev);
> >>> - }
> >>> + kref_put(&dev->ref, em28xx_free_device);
> >>>   }
> >>>   
> >>>   static struct usb_driver em28xx_usb_driver = {
> >>> diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
> >>> b/drivers/media/usb/em28xx/em28xx-dvb.c
> >>> index 5ea563e3f0e4..8674ae5fce06 100644
> >>> --- a/drivers/media/usb/em28xx/em28xx-dvb.c
> >>>

[PATCH] Staging: media: Fix line length exceeding 80 characters in as102_drv.c

2014-01-14 Thread Monam Agarwal
This patch fixes the following checkpatch.pl warning in as102/as102_drv.c
WARNING: line over 80 characters in the file 

Signed-off-by: Monam Agarwal 
---
 drivers/staging/media/as102/as102_drv.c |3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/drivers/staging/media/as102/as102_drv.c 
b/drivers/staging/media/as102/as102_drv.c
index 8b7bb95..7c294bf 100644
--- a/drivers/staging/media/as102/as102_drv.c
+++ b/drivers/staging/media/as102/as102_drv.c
@@ -133,7 +133,8 @@ static int as10x_pid_filter(struct as102_dev_t *dev,
filter.pid = pid;
 
ret = as10x_cmd_add_PID_filter(bus_adap, &filter);
-   dprintk(debug, "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = 
%d\n",
+   dprintk(debug,
+   "ADD_PID_FILTER([%02d -> %02d], 0x%04x) ret = %d\n",
index, filter.idx, filter.pid, ret);
break;
}
-- 
1.7.9.5

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


FE_READ_SNR and FE_READ_SIGNAL_STRENGTH docs

2014-01-14 Thread Georgi Chorbadzhiyski
Hi guys, I'm confused the documentation on:

http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SNR
http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SIGNAL_STRENGTH

states that these ioctls return int16_t values but frontend.h states:

https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/dvb/frontend.h

#define FE_READ_SIGNAL_STRENGTH  _IOR('o', 71, __u16)
#define FE_READ_SNR  _IOR('o', 72, __u16)

So which one is true?

-- 
Georgi Chorbadzhiyski | http://georgi.unixsol.org/ | http://github.com/gfto/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: FE_READ_SNR and FE_READ_SIGNAL_STRENGTH docs

2014-01-14 Thread Mauro Carvalho Chehab
Em Tue, 14 Jan 2014 17:16:10 +0200
Georgi Chorbadzhiyski  escreveu:

> Hi guys, I'm confused the documentation on:
> 
> http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SNR
> http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SIGNAL_STRENGTH
> 
> states that these ioctls return int16_t values but frontend.h states:
> 
> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/dvb/frontend.h
> 
> #define FE_READ_SIGNAL_STRENGTH  _IOR('o', 71, __u16)
> #define FE_READ_SNR  _IOR('o', 72, __u16)
> 
> So which one is true?

Documentation is wrong. The returned values are unsigned. Would you mind send
us a patch fixing it?

Btw, the better is to use the new statistics API, when it is
available:

http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html#frontend-stat-properties

As it properly specifies the scale of each value.

If you're working in userspace, the libdvbv5 has functions that use
the new API automatically when the DVBv5 statistics are available on
a DVB driver, via  dvb_fe_retrieve_stats():

http://git.linuxtv.org/v4l-utils.git/blob/HEAD:/lib/include/dvb-fe.h

-- 

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] em28xx-audio: remove a deplock circular dependency

2014-01-14 Thread Mauro Carvalho Chehab
Em Mon, 13 Jan 2014 22:51:00 +0100
Frank Schäfer  escreveu:

> Am 13.01.2014 00:00, schrieb Mauro Carvalho Chehab:
> > We can't lock at pcm close, as it causes circular dependency
> > lock issues with .init and .fini callbacks. So, move the code
> > that puts the device on mute to the kthread.
> >
> > [  322.026316] ==
> > [  322.026356] [ INFO: possible circular locking dependency detected ]
> > [  322.026397] 3.13.0-rc1+ #24 Not tainted
> > [  322.026437] ---
> > [  322.026476] khubd/54 is trying to acquire lock:
> > [  322.026516]  (&pcm->open_mutex){+.+.+.}, at: [] 
> > snd_pcm_dev_disconnect+0x46/0x1e0 [snd_pcm]
> > [  322.026727]
> > but task is already holding lock:
> > [  322.026767]  (register_mutex#3){+.+.+.}, at: [] 
> > snd_pcm_dev_disconnect+0x24/0x1e0 [snd_pcm]
> > [  322.027005]
> > which lock already depends on the new lock.
> >
> > [  322.027045]
> > the existing dependency chain (in reverse order) is:
> > [  322.027084]
> > -> #2 (register_mutex#3){+.+.+.}:
> > [  322.027318][] __lock_acquire+0xb43/0x1330
> > [  322.027401][] lock_acquire+0xa2/0x120
> > [  322.027479][] mutex_lock_nested+0x5c/0x3c0
> > [  322.027559][] 
> > snd_pcm_dev_disconnect+0x24/0x1e0 [snd_pcm]
> > [  322.027642][] 
> > snd_device_disconnect+0x6a/0xf0 [snd]
> > [  322.027727][] 
> > snd_device_disconnect_all+0x4c/0x90 [snd]
> > [  322.027814][] 
> > snd_card_disconnect+0x126/0x1d0 [snd]
> > [  322.027898][] snd_card_free+0x18/0x90 [snd]
> > [  322.027982][] em28xx_audio_fini+0x8f/0xa0 
> > [em28xx_alsa]
> > [  322.028063][] 
> > em28xx_close_extension+0x56/0x90 [em28xx]
> > [  322.028143][] 
> > em28xx_usb_disconnect+0x79/0x90 [em28xx]
> > [  322.028222][] 
> > usb_unbind_interface+0x67/0x1d0
> > [  322.028302][] 
> > __device_release_driver+0x7f/0xf0
> > [  322.028381][] 
> > device_release_driver+0x25/0x40
> > [  322.028462][] bus_remove_device+0x11c/0x1a0
> > [  322.028540][] device_del+0x136/0x1d0
> > [  322.028619][] usb_disable_device+0xb0/0x290
> > [  322.028698][] usb_disconnect+0xb5/0x1d0
> > [  322.028779][] 
> > hub_port_connect_change+0xd6/0xad0
> > [  322.028859][] hub_events+0x313/0x9b0
> > [  322.028940][] hub_thread+0x35/0x170
> > [  322.029019][] kthread+0xff/0x120
> > [  322.029099][] ret_from_fork+0x7c/0xb0
> > [  322.029179]
> > -> #1 (&dev->lock#2){+.+.+.}:
> > [  322.029414][] __lock_acquire+0xb43/0x1330
> > [  322.029494][] lock_acquire+0xa2/0x120
> > [  322.029572][] mutex_lock_nested+0x5c/0x3c0
> > [  322.029651][] 
> > snd_em28xx_pcm_close+0x3e/0x100 [em28xx_alsa]
> > [  322.029732][] 
> > snd_pcm_release_substream.part.29+0x3f/0x90 [snd_pcm]
> > [  322.029816][] snd_pcm_release+0xb0/0xd0 
> > [snd_pcm]
> > [  322.029900][] __fput+0xe2/0x230
> > [  322.029979][] fput+0xe/0x10
> > [  322.030057][] task_work_run+0x9f/0xe0
> > [  322.030135][] do_notify_resume+0x61/0xa0
> > [  322.030223][] int_signal+0x12/0x17
> > [  322.030294]
> > -> #0 (&pcm->open_mutex){+.+.+.}:
> > [  322.030473][] check_prevs_add+0x947/0x950
> > [  322.030546][] __lock_acquire+0xb43/0x1330
> > [  322.030618][] lock_acquire+0xa2/0x120
> > [  322.030689][] mutex_lock_nested+0x5c/0x3c0
> > [  322.030760][] 
> > snd_pcm_dev_disconnect+0x46/0x1e0 [snd_pcm]
> > [  322.030835][] 
> > snd_device_disconnect+0x6a/0xf0 [snd]
> > [  322.030913][] 
> > snd_device_disconnect_all+0x4c/0x90 [snd]
> > [  322.030988][] 
> > snd_card_disconnect+0x126/0x1d0 [snd]
> > [  322.031067][] snd_card_free+0x18/0x90 [snd]
> > [  322.031146][] em28xx_audio_fini+0x8f/0xa0 
> > [em28xx_alsa]
> > [  322.031220][] 
> > em28xx_close_extension+0x56/0x90 [em28xx]
> > [  322.031292][] 
> > em28xx_usb_disconnect+0x79/0x90 [em28xx]
> > [  322.031363][] 
> > usb_unbind_interface+0x67/0x1d0
> > [  322.031433][] 
> > __device_release_driver+0x7f/0xf0
> > [  322.031503][] 
> > device_release_driver+0x25/0x40
> > [  322.031573][] bus_remove_device+0x11c/0x1a0
> > [  322.031643][] device_del+0x136/0x1d0
> > [  322.031714][] usb_disable_device+0xb0/0x290
> > [  322.031784][] usb_disconnect+0xb5/0x1d0
> > [  322.031853][] 
> > hub_port_connect_change+0xd6/0xad0
> > [  322.031922][] hub_events+0x313/0x9b0
> > [  322.031992][] hu

Re: FE_READ_SNR and FE_READ_SIGNAL_STRENGTH docs

2014-01-14 Thread Georgi Chorbadzhiyski
Around 01/14/2014 05:30 PM, Mauro Carvalho Chehab scribbled:
> Em Tue, 14 Jan 2014 17:16:10 +0200
> Georgi Chorbadzhiyski  escreveu:
> 
>> Hi guys, I'm confused the documentation on:
>>
>> http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SNR
>> http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SIGNAL_STRENGTH
>>
>> states that these ioctls return int16_t values but frontend.h states:
>>
>> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/dvb/frontend.h
>>
>> #define FE_READ_SIGNAL_STRENGTH  _IOR('o', 71, __u16)
>> #define FE_READ_SNR  _IOR('o', 72, __u16)
>>
>> So which one is true?
> 
> Documentation is wrong. The returned values are unsigned. Would you mind send
> us a patch fixing it?

I would be happy to, but I can't find the repo that holds the documentation.

> Btw, the better is to use the new statistics API, when it is
> available:
>   
> http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html#frontend-stat-properties
> 
> As it properly specifies the scale of each value.

When it's ready, I'll add support for the API in dvblast.

-- 
Georgi Chorbadzhiyski | http://georgi.unixsol.org/ | http://github.com/gfto/
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: FE_READ_SNR and FE_READ_SIGNAL_STRENGTH docs

2014-01-14 Thread Mauro Carvalho Chehab
Em Tue, 14 Jan 2014 17:55:19 +0200
Georgi Chorbadzhiyski  escreveu:

> Around 01/14/2014 05:30 PM, Mauro Carvalho Chehab scribbled:
> > Em Tue, 14 Jan 2014 17:16:10 +0200
> > Georgi Chorbadzhiyski  escreveu:
> > 
> >> Hi guys, I'm confused the documentation on:
> >>
> >> http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SNR
> >> http://linuxtv.org/downloads/v4l-dvb-apis/frontend_fcalls.html#FE_READ_SIGNAL_STRENGTH
> >>
> >> states that these ioctls return int16_t values but frontend.h states:
> >>
> >> https://git.kernel.org/cgit/linux/kernel/git/torvalds/linux.git/tree/include/uapi/linux/dvb/frontend.h
> >>
> >> #define FE_READ_SIGNAL_STRENGTH  _IOR('o', 71, __u16)
> >> #define FE_READ_SNR  _IOR('o', 72, __u16)
> >>
> >> So which one is true?
> > 
> > Documentation is wrong. The returned values are unsigned. Would you mind 
> > send
> > us a patch fixing it?
> 
> I would be happy to, but I can't find the repo that holds the documentation.

It is in the Kernel tree, under Documentation/DocBook/media/dvb.

> 
> > Btw, the better is to use the new statistics API, when it is
> > available:
> > 
> > http://linuxtv.org/downloads/v4l-dvb-apis/FE_GET_SET_PROPERTY.html#frontend-stat-properties
> > 
> > As it properly specifies the scale of each value.
> 
> When it's ready, I'll add support for the API in dvblast.

Good.

-- 

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Update the README name for libv4l

2014-01-14 Thread Gregor Jasny

On 13/01/14 10:28, Prabhakar Lad wrote:

The README for libv4l was renamed from README.lib to
README.libv4l but the reference to it was not fixed.
This patch fixes the above.


Thanks, applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH] Update the link pointing the patch for porting the application to libv4l2

2014-01-14 Thread Gregor Jasny

On 13/01/14 11:59, Prabhakar Lad wrote:

From: "Lad, Prabhakar" 

Signed-off-by: Lad, Prabhakar 
---
  README.libv4l |2 +-
  1 file changed, 1 insertion(+), 1 deletion(-)


Thanks, applied.
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: using MFC memory to memery encoder, start stream and queue order problem

2014-01-14 Thread randy
-BEGIN PGP SIGNED MESSAGE-
Hash: SHA1

于 2014年01月14日 18:29, Andrzej Hajda 写道:
> On 01/14/2014 06:17 AM, randy wrote:
>> Yes, it make encoder work. But sadness ./mfc-encode -m
>> /dev/video1 -c h264,header_mode=1 -d 1 will still output a zero
>> demo.out without header-mode or set it to zero will works. What
>> is the problem?
> 
> It seems infradead repo is not synchronized with our internal
> repo. Please apply attached patch.
> 
No, it has been applied in public repo.
And my code is in applied version, but it doesn't work.
Here is the log

mfc codec encoding example application
Andrzej Hajda 
Copyright 2012 Samsung Electronics Co., Ltd.

70.259455868:args.c:parse_args:190: codec: H264
70.259635952:args.c:parse_args:187: opt header_mode=1
mfc.c:mfc_create:85: error: Cannot subscribe EOS event for MFC
70.286725493:mfc.c:mfc_create:87: MFC device /dev/video1 opened with fd=3
70.294186576:v4l_dev.c:v4l_req_bufs:116: Succesfully requested 16
buffers for device 3:0
70.294508201:func_dev.c:func_req_bufs:42: Succesfully requested 16
buffers for device -1:1
70.294936410:func_dev.c:func_enq_buf:113: Enqueued buffer 0/16 to -1:1
70.295440952:func_dev.c:func_enq_buf:113: Enqueued buffer 1/16 to -1:1
70.295692535:func_dev.c:func_enq_buf:113: Enqueued buffer 2/16 to -1:1
70.295912035:func_dev.c:func_enq_buf:113: Enqueued buffer 3/16 to -1:1
70.296122285:func_dev.c:func_enq_buf:113: Enqueued buffer 4/16 to -1:1
70.296310368:func_dev.c:func_enq_buf:113: Enqueued buffer 5/16 to -1:1
70.296477410:func_dev.c:func_enq_buf:113: Enqueued buffer 6/16 to -1:1
70.296626993:func_dev.c:func_enq_buf:113: Enqueued buffer 7/16 to -1:1
70.296788618:func_dev.c:func_enq_buf:113: Enqueued buffer 8/16 to -1:1
70.296949910:func_dev.c:func_enq_buf:113: Enqueued buffer 9/16 to -1:1
70.297115327:func_dev.c:func_enq_buf:113: Enqueued buffer 10/16 to -1:1
70.297277993:func_dev.c:func_enq_buf:113: Enqueued buffer 11/16 to -1:1
70.297435618:func_dev.c:func_enq_buf:113: Enqueued buffer 12/16 to -1:1
70.297591993:func_dev.c:func_enq_buf:113: Enqueued buffer 13/16 to -1:1
70.297760868:func_dev.c:func_enq_buf:113: Enqueued buffer 14/16 to -1:1
70.297917910:func_dev.c:func_enq_buf:113: Enqueued buffer 15/16 to -1:1
70.336368993:v4l_dev.c:v4l_req_bufs:116: Succesfully requested 4
buffers for device 3:1
70.336587368:func_dev.c:func_req_bufs:42: Succesfully requested 4
buffers for device 4:0
70.342405784:v4l_dev.c:v4l_enq_buf:211: Enqueued buffer 0/4 to 3:1
70.348009117:v4l_dev.c:v4l_enq_buf:211: Enqueued buffer 1/4 to 3:1
70.352857159:v4l_dev.c:v4l_enq_buf:211: Enqueued buffer 2/4 to 3:1
70.357489076:v4l_dev.c:v4l_enq_buf:211: Enqueued buffer 3/4 to 3:1
State [enq cnt/max]: [Off 0 0/0|Rdy 16 0/1] [Off 0 0/0|Off 4 0/0] [Off
0 0/0|Off 0 0/0]
State [enq cnt/max]: [Off 0 0/0|Rdy 16 0/1] [Off 0 0/0|Off 4 0/0] [Off
0 0/0|Off 0 0/0]
70.357812534:func_dev.c:func_deq_buf:79: Dequeued buffer 0/16 from
- -1:1 ret=25344
70.357841701:func_dev.c:func_deq_buf:88: End on -1:1
70.357882201:v4l_dev.c:v4l_enq_buf:211: Enqueued buffer 0/16 to 3:0
70.357961534:v4l_dev.c:v4l_stream_set:76: Stream started on fd=3:0
70.358038117:v4l_dev.c:v4l_stream_set:92: Stream started on fd=3:1
70.358070659:v4l_dev.c:v4l_enq_buf:226: EOS sent to 3:0, ret=-1
State [enq cnt/max]: [Off 0 0/0|End 15 1/1] [Bus 1 0/1|Bus 4 0/0] [Off
0 0/0|Off 0 0/0]
70.358163367:io_dev.c:wait_for_ready_devs:64: Will poll fd=3 events=7
root@kagami:~/v4l2-mfc-encoder# ls -l demo.out
- -rw-r--r-- 1 root root 0 Jan 14 16:48 demo.out
> Regards Andrzej
> 

Thank you


ayaka
-BEGIN PGP SIGNATURE-
Version: GnuPG v1.4.12 (GNU/Linux)
Comment: Using GnuPG with Mozilla - http://enigmail.mozdev.org/

iQEcBAEBAgAGBQJS1Wq7AAoJEPb4VsMIzTziM/UH/0LSC7xRC35nzPhAPue8yFw+
/OMpCcM1OArsqKIGqrGNaDTnkePSkQ22/W1CbtbrJatpDmI1zLZOfJIK4w4PCd0E
LV/NoVqdr8N5aLsmrC5Ao7zXViCiSDVMxqyAGPXObXA+2IJDxf34yWAxTGIVYlo6
Q2B5EMWyF4GHBvF1shk/So0YF6RBpI8s6on54QoSaNon95dupsk1QQ0ceXmPj/6c
X/fI5M6etToml0txKpXD4auafLxb8ebZAn4ZHx2F69WFIJFozLL9FkYl6MizORkN
ke34+xhQUZ6NF4ykBtbCUHVacDegsbiW/ISKtpjxDoWLRcIZPy0BvuUE8guY/Uk=
=0BWS
-END PGP SIGNATURE-
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Frank Schäfer

On 14.01.2014 14:10, Mauro Carvalho Chehab wrote:

Em Mon, 13 Jan 2014 22:55:36 +0100
Frank Schäfer  escreveu:


Am 13.01.2014 20:23, schrieb Mauro Carvalho Chehab:

Em Mon, 13 Jan 2014 20:02:19 +0100
Frank Schäfer  escreveu:


On 13.01.2014 00:00, Mauro Carvalho Chehab wrote:

We can't free struct em28xx while one of the extensions is still
using it.

So, add a kref() to control it, freeing it only after the
extensions fini calls.

Signed-off-by: Mauro Carvalho Chehab 
---
   drivers/media/usb/em28xx/em28xx-audio.c |  5 -
   drivers/media/usb/em28xx/em28xx-cards.c | 34 
-
   drivers/media/usb/em28xx/em28xx-dvb.c   |  5 -
   drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
   drivers/media/usb/em28xx/em28xx-video.c | 11 +--
   drivers/media/usb/em28xx/em28xx.h   |  9 +++--
   6 files changed, 44 insertions(+), 28 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 97d9105e6830..8e959dae8358 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -878,6 +878,8 @@ static int em28xx_audio_init(struct em28xx *dev)
   
   	em28xx_info("Binding audio extension\n");
   
+	kref_get(&dev->ref);

+
printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
 "Rechberger\n");
printk(KERN_INFO
@@ -949,7 +951,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
if (dev == NULL)
return 0;
   
-	if (dev->has_alsa_audio != 1) {

+   if (!dev->has_alsa_audio) {
/* This device does not support the extension (in this case
   the device is expecting the snd-usb-audio module or
   doesn't have analog audio support at all) */
@@ -963,6 +965,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
dev->adev.sndcard = NULL;
}
   
+	kref_put(&dev->ref, em28xx_free_device);

return 0;
   }
   
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c b/drivers/media/usb/em28xx/em28xx-cards.c

index 3b332d527ccb..df92f417634a 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -2867,16 +2867,18 @@ static void flush_request_modules(struct em28xx *dev)
flush_work(&dev->request_module_wk);
   }
   
-/*

- * em28xx_release_resources()
- * unregisters the v4l2,i2c and usb devices
- * called when the device gets disconnected or at module unload
-*/
-void em28xx_release_resources(struct em28xx *dev)
+/**
+ * em28xx_release_resources() -  unregisters the v4l2,i2c and usb devices
+ *
+ * @ref: struct kref for em28xx device
+ *
+ * This is called when all extensions and em28xx core unregisters a device
+ */
+void em28xx_free_device(struct kref *ref)
   {
-   /*FIXME: I2C IR should be disconnected */
+   struct em28xx *dev = kref_to_dev(ref);
   
-	mutex_lock(&dev->lock);

+   em28xx_info("Freeing device\n");
   
   	if (dev->def_i2c_bus)

em28xx_i2c_unregister(dev, 1);
@@ -2887,9 +2889,10 @@ void em28xx_release_resources(struct em28xx *dev)
/* Mark device as unused */
clear_bit(dev->devno, &em28xx_devused);
   
-	mutex_unlock(&dev->lock);

-};
-EXPORT_SYMBOL_GPL(em28xx_release_resources);
+   kfree(dev->alt_max_pkt_size_isoc);
+   kfree(dev);
+}
+EXPORT_SYMBOL_GPL(em28xx_free_device);
   
   /*

* em28xx_init_dev()
@@ -3342,6 +3345,8 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
dev->dvb_xfer_bulk ? "bulk" : "isoc");
}
   
+	kref_init(&dev->ref);

+
request_modules(dev);
   
   	/* Should be the last thing to do, to avoid newer udev's to

@@ -3390,12 +3395,7 @@ static void em28xx_usb_disconnect(struct usb_interface 
*interface)
   
   	em28xx_close_extension(dev);
   
-	em28xx_release_resources(dev);

-
-   if (!dev->users) {
-   kfree(dev->alt_max_pkt_size_isoc);
-   kfree(dev);
-   }
+   kref_put(&dev->ref, em28xx_free_device);
   }
   
   static struct usb_driver em28xx_usb_driver = {

diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index 5ea563e3f0e4..8674ae5fce06 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1010,11 +1010,11 @@ static int em28xx_dvb_init(struct em28xx *dev)
em28xx_info("Binding DVB extension\n");
   
   	dvb = kzalloc(sizeof(struct em28xx_dvb), GFP_KERNEL);

-
if (dvb == NULL) {
em28xx_info("em28xx_dvb: memory allocation failed\n");
return -ENOMEM;
}
+   kref_get(&dev->ref);
dev->dvb = dvb;
dvb->fe[0] = dvb->fe[1] = NULL;
   
@@ -1442,6 +1442,7 @@ static int em28xx_dvb_init(struct em28xx *dev)

dvb->adapter.mfe_shared = mfe_shared;
   
   	em28xx_info("DVB extension successfully initialized\n");

+
   ret:
em28xx_set_

Re: [PATCH] em28xx: push mutex down to extensions on .fini callback

2014-01-14 Thread Frank Schäfer

On 13.01.2014 07:12, Mauro Carvalho Chehab wrote:

Avoid circular mutex lock by pushing the dev->lock to the .fini
callback on each extension.

As em28xx-dvb, em28xx-alsa and em28xx-rc have their own data
structures, and don't touch at the common structure during .fini,
only em28xx-v4l needs to be locked.

[   90.994317] ==
[   90.994356] [ INFO: possible circular locking dependency detected ]
[   90.994395] 3.13.0-rc1+ #24 Not tainted
[   90.994427] ---
[   90.994458] khubd/54 is trying to acquire lock:
[   90.994490]  (&card->controls_rwsem){.+}, at: [] 
snd_ctl_dev_free+0x28/0x60 [snd]
[   90.994656]
[   90.994656] but task is already holding lock:
[   90.994688]  (&dev->lock){+.+.+.}, at: [] 
em28xx_close_extension+0x31/0x90 [em28xx]
[   90.994843]
[   90.994843] which lock already depends on the new lock.
[   90.994843]
[   90.994874]
[   90.994874] the existing dependency chain (in reverse order) is:
[   90.994905]
-> #1 (&dev->lock){+.+.+.}:
[   90.995057][] __lock_acquire+0xb43/0x1330
[   90.995121][] lock_acquire+0xa2/0x120
[   90.995182][] mutex_lock_nested+0x5c/0x3c0
[   90.995245][] em28xx_vol_put_mute+0x1ba/0x1d0 
[em28xx_alsa]
[   90.995309][] snd_ctl_elem_write+0xfd/0x140 [snd]
[   90.995376][] snd_ctl_ioctl+0xe2/0x810 [snd]
[   90.995442][] do_vfs_ioctl+0x300/0x520
[   90.995504][] SyS_ioctl+0x81/0xa0
[   90.995568][] system_call_fastpath+0x16/0x1b
[   90.995630]
-> #0 (&card->controls_rwsem){.+}:
[   90.995780][] check_prevs_add+0x947/0x950
[   90.995841][] __lock_acquire+0xb43/0x1330
[   90.995901][] lock_acquire+0xa2/0x120
[   90.995962][] down_write+0x3b/0xa0
[   90.996022][] snd_ctl_dev_free+0x28/0x60 [snd]
[   90.996088][] snd_device_free+0x65/0x140 [snd]
[   90.996154][] snd_device_free_all+0x61/0xa0 [snd]
[   90.996219][] snd_card_do_free+0x14/0x130 [snd]
[   90.996283][] snd_card_free+0x84/0x90 [snd]
[   90.996349][] em28xx_audio_fini+0x97/0xb0 
[em28xx_alsa]
[   90.996411][] em28xx_close_extension+0x56/0x90 
[em28xx]
[   90.996475][] em28xx_usb_disconnect+0x79/0x90 
[em28xx]
[   90.996539][] usb_unbind_interface+0x67/0x1d0
[   90.996620][] __device_release_driver+0x7f/0xf0
[   90.996682][] device_release_driver+0x25/0x40
[   90.996742][] bus_remove_device+0x11c/0x1a0
[   90.996801][] device_del+0x136/0x1d0
[   90.996863][] usb_disable_device+0xb0/0x290
[   90.996923][] usb_disconnect+0xb5/0x1d0
[   90.996984][] hub_port_connect_change+0xd6/0xad0
[   90.997044][] hub_events+0x313/0x9b0
[   90.997105][] hub_thread+0x35/0x170
[   90.997165][] kthread+0xff/0x120
[   90.997226][] ret_from_fork+0x7c/0xb0
[   90.997287]
[   90.997287] other info that might help us debug this:
[   90.997287]
[   90.997318]  Possible unsafe locking scenario:
[   90.997318]
[   90.997348]CPU0CPU1
[   90.997378]
[   90.997408]   lock(&dev->lock);
[   90.997497]lock(&card->controls_rwsem);
[   90.997607]lock(&dev->lock);
[   90.997697]   lock(&card->controls_rwsem);
[   90.997786]
[   90.997786]  *** DEADLOCK ***
[   90.997786]
[   90.997817] 5 locks held by khubd/54:
[   90.997847]  #0:  (&__lockdep_no_validate__){..}, at: 
[] hub_events+0xb4/0x9b0
[   90.998025]  #1:  (&__lockdep_no_validate__){..}, at: 
[] usb_disconnect+0x66/0x1d0
[   90.998204]  #2:  (&__lockdep_no_validate__){..}, at: 
[] device_release_driver+0x1d/0x40
[   90.998383]  #3:  (em28xx_devlist_mutex){+.+.+.}, at: [] 
em28xx_close_extension+0x27/0x90 [em28xx]
[   90.998567]  #4:  (&dev->lock){+.+.+.}, at: [] 
em28xx_close_extension+0x31/0x90 [em28xx]

Signed-off-by: Mauro Carvalho Chehab 
---
  drivers/media/usb/em28xx/em28xx-core.c  | 2 --
  drivers/media/usb/em28xx/em28xx-video.c | 4 
  2 files changed, 4 insertions(+), 2 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-core.c 
b/drivers/media/usb/em28xx/em28xx-core.c
index b6dc3327c51c..898fb9bd88a2 100644
--- a/drivers/media/usb/em28xx/em28xx-core.c
+++ b/drivers/media/usb/em28xx/em28xx-core.c
@@ -1099,12 +1099,10 @@ void em28xx_close_extension(struct em28xx *dev)
const struct em28xx_ops *ops = NULL;
  
  	mutex_lock(&em28xx_devlist_mutex);

-   mutex_lock(&dev->lock);
list_for_each_entry(ops, &em28xx_extension_devlist, next) {
if (ops->fini)
ops->fini(dev);
}
-   mutex_unlock(&dev->lock);
list_del(&dev->devlist);
mutex_unlock(&em28xx_devlist_mutex);
  }
diff --git a/drivers/media/usb/em28xx/em28xx-video.c 
b/drivers/media/usb/em28xx/em28xx-video.c
index 004fe12ceec7..258628877951

Re: [PATCH 5/7] em28xx-audio: remove a deplock circular dependency

2014-01-14 Thread Frank Schäfer

On 14.01.2014 16:45, Mauro Carvalho Chehab wrote:

Em Mon, 13 Jan 2014 22:51:00 +0100
Frank Schäfer  escreveu:


Am 13.01.2014 00:00, schrieb Mauro Carvalho Chehab:

We can't lock at pcm close, as it causes circular dependency
lock issues with .init and .fini callbacks. So, move the code
that puts the device on mute to the kthread.

 [  322.026316] ==
 [  322.026356] [ INFO: possible circular locking dependency detected ]
 [  322.026397] 3.13.0-rc1+ #24 Not tainted
 [  322.026437] ---
 [  322.026476] khubd/54 is trying to acquire lock:
 [  322.026516]  (&pcm->open_mutex){+.+.+.}, at: [] 
snd_pcm_dev_disconnect+0x46/0x1e0 [snd_pcm]
 [  322.026727]
 but task is already holding lock:
 [  322.026767]  (register_mutex#3){+.+.+.}, at: [] 
snd_pcm_dev_disconnect+0x24/0x1e0 [snd_pcm]
 [  322.027005]
 which lock already depends on the new lock.

 [  322.027045]
 the existing dependency chain (in reverse order) is:
 [  322.027084]
 -> #2 (register_mutex#3){+.+.+.}:
 [  322.027318][] __lock_acquire+0xb43/0x1330
 [  322.027401][] lock_acquire+0xa2/0x120
 [  322.027479][] mutex_lock_nested+0x5c/0x3c0
 [  322.027559][] 
snd_pcm_dev_disconnect+0x24/0x1e0 [snd_pcm]
 [  322.027642][] snd_device_disconnect+0x6a/0xf0 
[snd]
 [  322.027727][] 
snd_device_disconnect_all+0x4c/0x90 [snd]
 [  322.027814][] snd_card_disconnect+0x126/0x1d0 
[snd]
 [  322.027898][] snd_card_free+0x18/0x90 [snd]
 [  322.027982][] em28xx_audio_fini+0x8f/0xa0 
[em28xx_alsa]
 [  322.028063][] 
em28xx_close_extension+0x56/0x90 [em28xx]
 [  322.028143][] em28xx_usb_disconnect+0x79/0x90 
[em28xx]
 [  322.028222][] usb_unbind_interface+0x67/0x1d0
 [  322.028302][] 
__device_release_driver+0x7f/0xf0
 [  322.028381][] device_release_driver+0x25/0x40
 [  322.028462][] bus_remove_device+0x11c/0x1a0
 [  322.028540][] device_del+0x136/0x1d0
 [  322.028619][] usb_disable_device+0xb0/0x290
 [  322.028698][] usb_disconnect+0xb5/0x1d0
 [  322.028779][] 
hub_port_connect_change+0xd6/0xad0
 [  322.028859][] hub_events+0x313/0x9b0
 [  322.028940][] hub_thread+0x35/0x170
 [  322.029019][] kthread+0xff/0x120
 [  322.029099][] ret_from_fork+0x7c/0xb0
 [  322.029179]
 -> #1 (&dev->lock#2){+.+.+.}:
 [  322.029414][] __lock_acquire+0xb43/0x1330
 [  322.029494][] lock_acquire+0xa2/0x120
 [  322.029572][] mutex_lock_nested+0x5c/0x3c0
 [  322.029651][] snd_em28xx_pcm_close+0x3e/0x100 
[em28xx_alsa]
 [  322.029732][] 
snd_pcm_release_substream.part.29+0x3f/0x90 [snd_pcm]
 [  322.029816][] snd_pcm_release+0xb0/0xd0 
[snd_pcm]
 [  322.029900][] __fput+0xe2/0x230
 [  322.029979][] fput+0xe/0x10
 [  322.030057][] task_work_run+0x9f/0xe0
 [  322.030135][] do_notify_resume+0x61/0xa0
 [  322.030223][] int_signal+0x12/0x17
 [  322.030294]
 -> #0 (&pcm->open_mutex){+.+.+.}:
 [  322.030473][] check_prevs_add+0x947/0x950
 [  322.030546][] __lock_acquire+0xb43/0x1330
 [  322.030618][] lock_acquire+0xa2/0x120
 [  322.030689][] mutex_lock_nested+0x5c/0x3c0
 [  322.030760][] 
snd_pcm_dev_disconnect+0x46/0x1e0 [snd_pcm]
 [  322.030835][] snd_device_disconnect+0x6a/0xf0 
[snd]
 [  322.030913][] 
snd_device_disconnect_all+0x4c/0x90 [snd]
 [  322.030988][] snd_card_disconnect+0x126/0x1d0 
[snd]
 [  322.031067][] snd_card_free+0x18/0x90 [snd]
 [  322.031146][] em28xx_audio_fini+0x8f/0xa0 
[em28xx_alsa]
 [  322.031220][] 
em28xx_close_extension+0x56/0x90 [em28xx]
 [  322.031292][] em28xx_usb_disconnect+0x79/0x90 
[em28xx]
 [  322.031363][] usb_unbind_interface+0x67/0x1d0
 [  322.031433][] 
__device_release_driver+0x7f/0xf0
 [  322.031503][] device_release_driver+0x25/0x40
 [  322.031573][] bus_remove_device+0x11c/0x1a0
 [  322.031643][] device_del+0x136/0x1d0
 [  322.031714][] usb_disable_device+0xb0/0x290
 [  322.031784][] usb_disconnect+0xb5/0x1d0
 [  322.031853][] 
hub_port_connect_change+0xd6/0xad0
 [  322.031922][] hub_events+0x313/0x9b0
 [  322.031992][] hub_thread+0x35/0x170
 [  322.032062][] kthread+0xff/0x120
 [  322.032135][] ret_from_fork+0x7c/0xb0
 [  322.032205]
 other info that might help us debug this:

 [  322.032240] Chain exists of:
   &pcm->open_mutex --> &dev->lock#2 --> register_mutex#3

 [  322.

Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Mauro Carvalho Chehab
Em Tue, 14 Jan 2014 19:13:00 +0100
Frank Schäfer  escreveu:

> On 14.01.2014 14:10, Mauro Carvalho Chehab wrote:
> > Em Mon, 13 Jan 2014 22:55:36 +0100
> > Frank Schäfer  escreveu:
> >
> >> Am 13.01.2014 20:23, schrieb Mauro Carvalho Chehab:
> >>> Em Mon, 13 Jan 2014 20:02:19 +0100
> >>> Frank Schäfer  escreveu:
> >>>
>  On 13.01.2014 00:00, Mauro Carvalho Chehab wrote:
> > We can't free struct em28xx while one of the extensions is still
> > using it.
> >
> > So, add a kref() to control it, freeing it only after the
> > extensions fini calls.
> >
> > Signed-off-by: Mauro Carvalho Chehab 
> > ---
> >drivers/media/usb/em28xx/em28xx-audio.c |  5 -
> >drivers/media/usb/em28xx/em28xx-cards.c | 34 
> > -
> >drivers/media/usb/em28xx/em28xx-dvb.c   |  5 -
> >drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
> >drivers/media/usb/em28xx/em28xx-video.c | 11 +--
> >drivers/media/usb/em28xx/em28xx.h   |  9 +++--
> >6 files changed, 44 insertions(+), 28 deletions(-)
> >
> > diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
> > b/drivers/media/usb/em28xx/em28xx-audio.c
> > index 97d9105e6830..8e959dae8358 100644
> > --- a/drivers/media/usb/em28xx/em28xx-audio.c
> > +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> > @@ -878,6 +878,8 @@ static int em28xx_audio_init(struct em28xx *dev)
> >
> > em28xx_info("Binding audio extension\n");
> >
> > +   kref_get(&dev->ref);
> > +
> > printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
> >  "Rechberger\n");
> > printk(KERN_INFO
> > @@ -949,7 +951,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
> > if (dev == NULL)
> > return 0;
> >
> > -   if (dev->has_alsa_audio != 1) {
> > +   if (!dev->has_alsa_audio) {
> > /* This device does not support the extension (in this 
> > case
> >the device is expecting the snd-usb-audio module or
> >doesn't have analog audio support at all) */
> > @@ -963,6 +965,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
> > dev->adev.sndcard = NULL;
> > }
> >
> > +   kref_put(&dev->ref, em28xx_free_device);
> > return 0;
> >}
> >
> > diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
> > b/drivers/media/usb/em28xx/em28xx-cards.c
> > index 3b332d527ccb..df92f417634a 100644
> > --- a/drivers/media/usb/em28xx/em28xx-cards.c
> > +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> > @@ -2867,16 +2867,18 @@ static void flush_request_modules(struct em28xx 
> > *dev)
> > flush_work(&dev->request_module_wk);
> >}
> >
> > -/*
> > - * em28xx_release_resources()
> > - * unregisters the v4l2,i2c and usb devices
> > - * called when the device gets disconnected or at module unload
> > -*/
> > -void em28xx_release_resources(struct em28xx *dev)
> > +/**
> > + * em28xx_release_resources() -  unregisters the v4l2,i2c and usb 
> > devices
> > + *
> > + * @ref: struct kref for em28xx device
> > + *
> > + * This is called when all extensions and em28xx core unregisters a 
> > device
> > + */
> > +void em28xx_free_device(struct kref *ref)
> >{
> > -   /*FIXME: I2C IR should be disconnected */
> > +   struct em28xx *dev = kref_to_dev(ref);
> >
> > -   mutex_lock(&dev->lock);
> > +   em28xx_info("Freeing device\n");
> >
> > if (dev->def_i2c_bus)
> > em28xx_i2c_unregister(dev, 1);
> > @@ -2887,9 +2889,10 @@ void em28xx_release_resources(struct em28xx *dev)
> > /* Mark device as unused */
> > clear_bit(dev->devno, &em28xx_devused);
> >
> > -   mutex_unlock(&dev->lock);
> > -};
> > -EXPORT_SYMBOL_GPL(em28xx_release_resources);
> > +   kfree(dev->alt_max_pkt_size_isoc);
> > +   kfree(dev);
> > +}
> > +EXPORT_SYMBOL_GPL(em28xx_free_device);
> >
> >/*
> > * em28xx_init_dev()
> > @@ -3342,6 +3345,8 @@ static int em28xx_usb_probe(struct usb_interface 
> > *interface,
> > dev->dvb_xfer_bulk ? "bulk" : "isoc");
> > }
> >
> > +   kref_init(&dev->ref);
> > +
> > request_modules(dev);
> >
> > /* Should be the last thing to do, to avoid newer udev's to
> > @@ -3390,12 +3395,7 @@ static void em28xx_usb_disconnect(struct 
> > usb_interface *interface)
> >
> > em28xx_close_extension(dev);
> >
> > -   em28xx_release_resources(dev);
> > -
> > -   

Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Mauro Carvalho Chehab
Em Tue, 14 Jan 2014 16:55:12 -0200
Mauro Carvalho Chehab  escreveu:

> Em Tue, 14 Jan 2014 19:13:00 +0100
> Frank Schäfer  escreveu:
> 
> > On 14.01.2014 14:10, Mauro Carvalho Chehab wrote:
> > > Em Mon, 13 Jan 2014 22:55:36 +0100
> > > Frank Schäfer  escreveu:
> > >
> > >> Am 13.01.2014 20:23, schrieb Mauro Carvalho Chehab:
> > >>> Em Mon, 13 Jan 2014 20:02:19 +0100
> > >>> Frank Schäfer  escreveu:
> > >>>
> >  On 13.01.2014 00:00, Mauro Carvalho Chehab wrote:
> > > We can't free struct em28xx while one of the extensions is still
> > > using it.
> > >
> > > So, add a kref() to control it, freeing it only after the
> > > extensions fini calls.
> > >
> > > Signed-off-by: Mauro Carvalho Chehab 
> > > ---
> > >drivers/media/usb/em28xx/em28xx-audio.c |  5 -
> > >drivers/media/usb/em28xx/em28xx-cards.c | 34 
> > > -
> > >drivers/media/usb/em28xx/em28xx-dvb.c   |  5 -
> > >drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
> > >drivers/media/usb/em28xx/em28xx-video.c | 11 +--
> > >drivers/media/usb/em28xx/em28xx.h   |  9 +++--
> > >6 files changed, 44 insertions(+), 28 deletions(-)
> > >
> > > diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
> > > b/drivers/media/usb/em28xx/em28xx-audio.c
> > > index 97d9105e6830..8e959dae8358 100644
> > > --- a/drivers/media/usb/em28xx/em28xx-audio.c
> > > +++ b/drivers/media/usb/em28xx/em28xx-audio.c
> > > @@ -878,6 +878,8 @@ static int em28xx_audio_init(struct em28xx *dev)
> > >
> > >   em28xx_info("Binding audio extension\n");
> > >
> > > + kref_get(&dev->ref);
> > > +
> > >   printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
> > >"Rechberger\n");
> > >   printk(KERN_INFO
> > > @@ -949,7 +951,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
> > >   if (dev == NULL)
> > >   return 0;
> > >
> > > - if (dev->has_alsa_audio != 1) {
> > > + if (!dev->has_alsa_audio) {
> > >   /* This device does not support the extension (in this 
> > > case
> > >  the device is expecting the snd-usb-audio module or
> > >  doesn't have analog audio support at all) */
> > > @@ -963,6 +965,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
> > >   dev->adev.sndcard = NULL;
> > >   }
> > >
> > > + kref_put(&dev->ref, em28xx_free_device);
> > >   return 0;
> > >}
> > >
> > > diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
> > > b/drivers/media/usb/em28xx/em28xx-cards.c
> > > index 3b332d527ccb..df92f417634a 100644
> > > --- a/drivers/media/usb/em28xx/em28xx-cards.c
> > > +++ b/drivers/media/usb/em28xx/em28xx-cards.c
> > > @@ -2867,16 +2867,18 @@ static void flush_request_modules(struct 
> > > em28xx *dev)
> > >   flush_work(&dev->request_module_wk);
> > >}
> > >
> > > -/*
> > > - * em28xx_release_resources()
> > > - * unregisters the v4l2,i2c and usb devices
> > > - * called when the device gets disconnected or at module unload
> > > -*/
> > > -void em28xx_release_resources(struct em28xx *dev)
> > > +/**
> > > + * em28xx_release_resources() -  unregisters the v4l2,i2c and usb 
> > > devices
> > > + *
> > > + * @ref: struct kref for em28xx device
> > > + *
> > > + * This is called when all extensions and em28xx core unregisters a 
> > > device
> > > + */
> > > +void em28xx_free_device(struct kref *ref)
> > >{
> > > - /*FIXME: I2C IR should be disconnected */
> > > + struct em28xx *dev = kref_to_dev(ref);
> > >
> > > - mutex_lock(&dev->lock);
> > > + em28xx_info("Freeing device\n");
> > >
> > >   if (dev->def_i2c_bus)
> > >   em28xx_i2c_unregister(dev, 1);
> > > @@ -2887,9 +2889,10 @@ void em28xx_release_resources(struct em28xx 
> > > *dev)
> > >   /* Mark device as unused */
> > >   clear_bit(dev->devno, &em28xx_devused);
> > >
> > > - mutex_unlock(&dev->lock);
> > > -};
> > > -EXPORT_SYMBOL_GPL(em28xx_release_resources);
> > > + kfree(dev->alt_max_pkt_size_isoc);
> > > + kfree(dev);
> > > +}
> > > +EXPORT_SYMBOL_GPL(em28xx_free_device);
> > >
> > >/*
> > > * em28xx_init_dev()
> > > @@ -3342,6 +3345,8 @@ static int em28xx_usb_probe(struct 
> > > usb_interface *interface,
> > >   dev->dvb_xfer_bulk ? "bulk" : "isoc");
> > >   }
> > >
> > > + kref_init(&dev->ref);
> > > +
> > >   request_modules(dev);
> > >
> > >   /* Should be the last thing to do, to avoid newer u

[PATCH] [media] em28xx-audio: flush work at .fini

2014-01-14 Thread Mauro Carvalho Chehab
As a pending action might be still there at the work
thread, flush it.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-audio.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 74575e0ed41b..1563f71a5ea2 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -967,6 +967,8 @@ static int em28xx_audio_fini(struct em28xx *dev)
em28xx_info("Closing audio extension");
 
snd_card_disconnect(dev->adev.sndcard);
+   flush_work(&dev->wq_trigger);
+
em28xx_audio_free_urb(dev);
 
if (dev->adev.sndcard) {
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 5/7] em28xx-audio: remove a deplock circular dependency

2014-01-14 Thread Mauro Carvalho Chehab
Em Tue, 14 Jan 2014 19:43:53 +0100
Frank Schäfer  escreveu:

> On 14.01.2014 16:45, Mauro Carvalho Chehab wrote:
> > Em Mon, 13 Jan 2014 22:51:00 +0100
> > Frank Schäfer  escreveu:
> >
> >> Am 13.01.2014 00:00, schrieb Mauro Carvalho Chehab:
> >>> We can't lock at pcm close, as it causes circular dependency
> >>> lock issues with .init and .fini callbacks. So, move the code
> >>> that puts the device on mute to the kthread.
> >>>
> >>>  [  322.026316] ==
> >>>  [  322.026356] [ INFO: possible circular locking dependency detected 
> >>> ]
> >>>  [  322.026397] 3.13.0-rc1+ #24 Not tainted
> >>>  [  322.026437] 
> >>> ---
> >>>  [  322.026476] khubd/54 is trying to acquire lock:
> >>>  [  322.026516]  (&pcm->open_mutex){+.+.+.}, at: [] 
> >>> snd_pcm_dev_disconnect+0x46/0x1e0 [snd_pcm]
> >>>  [  322.026727]
> >>>  but task is already holding lock:
> >>>  [  322.026767]  (register_mutex#3){+.+.+.}, at: [] 
> >>> snd_pcm_dev_disconnect+0x24/0x1e0 [snd_pcm]
> >>>  [  322.027005]
> >>>  which lock already depends on the new lock.
> >>>
> >>>  [  322.027045]
> >>>  the existing dependency chain (in reverse order) is:
> >>>  [  322.027084]
> >>>  -> #2 (register_mutex#3){+.+.+.}:
> >>>  [  322.027318][] 
> >>> __lock_acquire+0xb43/0x1330
> >>>  [  322.027401][] lock_acquire+0xa2/0x120
> >>>  [  322.027479][] 
> >>> mutex_lock_nested+0x5c/0x3c0
> >>>  [  322.027559][] 
> >>> snd_pcm_dev_disconnect+0x24/0x1e0 [snd_pcm]
> >>>  [  322.027642][] 
> >>> snd_device_disconnect+0x6a/0xf0 [snd]
> >>>  [  322.027727][] 
> >>> snd_device_disconnect_all+0x4c/0x90 [snd]
> >>>  [  322.027814][] 
> >>> snd_card_disconnect+0x126/0x1d0 [snd]
> >>>  [  322.027898][] snd_card_free+0x18/0x90 
> >>> [snd]
> >>>  [  322.027982][] 
> >>> em28xx_audio_fini+0x8f/0xa0 [em28xx_alsa]
> >>>  [  322.028063][] 
> >>> em28xx_close_extension+0x56/0x90 [em28xx]
> >>>  [  322.028143][] 
> >>> em28xx_usb_disconnect+0x79/0x90 [em28xx]
> >>>  [  322.028222][] 
> >>> usb_unbind_interface+0x67/0x1d0
> >>>  [  322.028302][] 
> >>> __device_release_driver+0x7f/0xf0
> >>>  [  322.028381][] 
> >>> device_release_driver+0x25/0x40
> >>>  [  322.028462][] 
> >>> bus_remove_device+0x11c/0x1a0
> >>>  [  322.028540][] device_del+0x136/0x1d0
> >>>  [  322.028619][] 
> >>> usb_disable_device+0xb0/0x290
> >>>  [  322.028698][] usb_disconnect+0xb5/0x1d0
> >>>  [  322.028779][] 
> >>> hub_port_connect_change+0xd6/0xad0
> >>>  [  322.028859][] hub_events+0x313/0x9b0
> >>>  [  322.028940][] hub_thread+0x35/0x170
> >>>  [  322.029019][] kthread+0xff/0x120
> >>>  [  322.029099][] ret_from_fork+0x7c/0xb0
> >>>  [  322.029179]
> >>>  -> #1 (&dev->lock#2){+.+.+.}:
> >>>  [  322.029414][] 
> >>> __lock_acquire+0xb43/0x1330
> >>>  [  322.029494][] lock_acquire+0xa2/0x120
> >>>  [  322.029572][] 
> >>> mutex_lock_nested+0x5c/0x3c0
> >>>  [  322.029651][] 
> >>> snd_em28xx_pcm_close+0x3e/0x100 [em28xx_alsa]
> >>>  [  322.029732][] 
> >>> snd_pcm_release_substream.part.29+0x3f/0x90 [snd_pcm]
> >>>  [  322.029816][] snd_pcm_release+0xb0/0xd0 
> >>> [snd_pcm]
> >>>  [  322.029900][] __fput+0xe2/0x230
> >>>  [  322.029979][] fput+0xe/0x10
> >>>  [  322.030057][] task_work_run+0x9f/0xe0
> >>>  [  322.030135][] do_notify_resume+0x61/0xa0
> >>>  [  322.030223][] int_signal+0x12/0x17
> >>>  [  322.030294]
> >>>  -> #0 (&pcm->open_mutex){+.+.+.}:
> >>>  [  322.030473][] 
> >>> check_prevs_add+0x947/0x950
> >>>  [  322.030546][] 
> >>> __lock_acquire+0xb43/0x1330
> >>>  [  322.030618][] lock_acquire+0xa2/0x120
> >>>  [  322.030689][] 
> >>> mutex_lock_nested+0x5c/0x3c0
> >>>  [  322.030760][] 
> >>> snd_pcm_dev_disconnect+0x46/0x1e0 [snd_pcm]
> >>>  [  322.030835][] 
> >>> snd_device_disconnect+0x6a/0xf0 [snd]
> >>>  [  322.030913][] 
> >>> snd_device_disconnect_all+0x4c/0x90 [snd]
> >>>  [  322.030988][] 
> >>> snd_card_disconnect+0x126/0x1d0 [snd]
> >>>  [  322.031067][] snd_card_free+0x18/0x90 
> >>> [snd]
> >>>  [  322.031146][] 
> >>> em28xx_audio_fini+0x8f/0xa0 [em28xx_alsa]
> >>>  [  322.031220][] 
> >>> em28xx_close_extension+0x56/0x90 [em28xx]
> >>>  [  322.031292][] 
> >>> em28xx_usb_disconnect+0x79/0x90 [em28xx]
> >>>  [  322.031363][] 
> >>> usb_unbind_interface+0x67/0x1d0
> >>>  [  322.031433][] 
> >>> __device_release_driver+0x7f/0

[PATCH] em28xx-alsa: Fix error patch for init/fini

2014-01-14 Thread Mauro Carvalho Chehab
If something bad happens during init, we free the card data.
However, we still keep it initialized, causing some dependent
code to be called at .fini.

Fix it.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-audio.c | 9 +
 1 file changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 1563f71a5ea2..45bea1adc11c 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -948,6 +948,7 @@ urb_free:
 
 card_free:
snd_card_free(card);
+   adev->sndcard = NULL;
 
return err;
 }
@@ -966,12 +967,12 @@ static int em28xx_audio_fini(struct em28xx *dev)
 
em28xx_info("Closing audio extension");
 
-   snd_card_disconnect(dev->adev.sndcard);
-   flush_work(&dev->wq_trigger);
+   if (dev->adev.sndcard) {
+   snd_card_disconnect(dev->adev.sndcard);
+   flush_work(&dev->wq_trigger);
 
-   em28xx_audio_free_urb(dev);
+   em28xx_audio_free_urb(dev);
 
-   if (dev->adev.sndcard) {
snd_card_free(dev->adev.sndcard);
dev->adev.sndcard = NULL;
}
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] em28xx-audio: provide an error code when URB submit fails

2014-01-14 Thread Mauro Carvalho Chehab
Instead of just saying:
[ 1646.412419] em2882/3 #0: submit of audio urb failed
Print the reason why it failed, to help debugging and fixing it.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-audio.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 73eeeaf6551f..1a01be604766 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -163,10 +163,9 @@ static void em28xx_audio_isocirq(struct urb *urb)
urb->status = 0;
 
status = usb_submit_urb(urb, GFP_ATOMIC);
-   if (status < 0) {
+   if (status < 0)
em28xx_errdev("resubmit of audio urb failed (error=%i)\n",
  status);
-   }
return;
 }
 
@@ -183,7 +182,8 @@ static int em28xx_init_audio_isoc(struct em28xx *dev)
 
errCode = usb_submit_urb(dev->adev.urb[i], GFP_ATOMIC);
if (errCode) {
-   em28xx_errdev("submit of audio urb failed\n");
+   em28xx_errdev("submit of audio urb failed (error=%i)\n",
+ errCode);
em28xx_deinit_isoc_audio(dev);
atomic_set(&dev->stream_started, 0);
return errCode;
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH v2] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Mauro Carvalho Chehab
We can't free struct em28xx while one of the extensions is still
using it.

So, add a kref() to control it, freeing it only after the
extensions fini calls.

Signed-off-by: Mauro Carvalho Chehab 
---

v2:
- patch was rebased;
- as em28xx-audio close uses struct em28xx dev, add a kref in order
  to track audio open/close.

 drivers/media/usb/em28xx/em28xx-audio.c |  8 +++-
 drivers/media/usb/em28xx/em28xx-cards.c | 34 -
 drivers/media/usb/em28xx/em28xx-dvb.c   |  5 -
 drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
 drivers/media/usb/em28xx/em28xx-video.c | 14 --
 drivers/media/usb/em28xx/em28xx.h   |  9 +++--
 6 files changed, 50 insertions(+), 28 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index 45bea1adc11c..73eeeaf6551f 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -265,6 +265,8 @@ static int snd_em28xx_capture_open(struct snd_pcm_substream 
*substream)
 
dprintk("opening device and trying to acquire exclusive lock\n");
 
+   kref_get(&dev->ref);
+
runtime->hw = snd_em28xx_hw_capture;
if ((dev->alt == 0 || dev->audio_ifnum) && dev->adev.users == 0) {
int nonblock = !!(substream->f_flags & O_NONBLOCK);
@@ -330,6 +332,7 @@ static int snd_em28xx_pcm_close(struct snd_pcm_substream 
*substream)
substream->runtime->dma_area = NULL;
}
mutex_unlock(&dev->lock);
+   kref_put(&dev->ref, em28xx_free_device);
 
return 0;
 }
@@ -886,6 +889,8 @@ static int em28xx_audio_init(struct em28xx *dev)
 
em28xx_info("Binding audio extension\n");
 
+   kref_get(&dev->ref);
+
printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
 "Rechberger\n");
printk(KERN_INFO
@@ -958,7 +963,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
if (dev == NULL)
return 0;
 
-   if (dev->has_alsa_audio != 1) {
+   if (!dev->has_alsa_audio) {
/* This device does not support the extension (in this case
   the device is expecting the snd-usb-audio module or
   doesn't have analog audio support at all) */
@@ -977,6 +982,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
dev->adev.sndcard = NULL;
}
 
+   kref_put(&dev->ref, em28xx_free_device);
return 0;
 }
 
diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index e08d65b2e352..8fc0a437054e 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -2867,16 +2867,18 @@ static void flush_request_modules(struct em28xx *dev)
flush_work(&dev->request_module_wk);
 }
 
-/*
- * em28xx_release_resources()
- * unregisters the v4l2,i2c and usb devices
- * called when the device gets disconnected or at module unload
-*/
-void em28xx_release_resources(struct em28xx *dev)
+/**
+ * em28xx_release_resources() -  unregisters the v4l2,i2c and usb devices
+ *
+ * @ref: struct kref for em28xx device
+ *
+ * This is called when all extensions and em28xx core unregisters a device
+ */
+void em28xx_free_device(struct kref *ref)
 {
-   /*FIXME: I2C IR should be disconnected */
+   struct em28xx *dev = kref_to_dev(ref);
 
-   mutex_lock(&dev->lock);
+   em28xx_info("Freeing device\n");
 
if (dev->def_i2c_bus)
em28xx_i2c_unregister(dev, 1);
@@ -2887,9 +2889,10 @@ void em28xx_release_resources(struct em28xx *dev)
/* Mark device as unused */
clear_bit(dev->devno, &em28xx_devused);
 
-   mutex_unlock(&dev->lock);
-};
-EXPORT_SYMBOL_GPL(em28xx_release_resources);
+   kfree(dev->alt_max_pkt_size_isoc);
+   kfree(dev);
+}
+EXPORT_SYMBOL_GPL(em28xx_free_device);
 
 /*
  * em28xx_init_dev()
@@ -3342,6 +3345,8 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
dev->dvb_xfer_bulk ? "bulk" : "isoc");
}
 
+   kref_init(&dev->ref);
+
request_modules(dev);
 
/* Should be the last thing to do, to avoid newer udev's to
@@ -3385,12 +3390,7 @@ static void em28xx_usb_disconnect(struct usb_interface 
*interface)
 
em28xx_close_extension(dev);
 
-   em28xx_release_resources(dev);
-
-   if (!dev->users) {
-   kfree(dev->alt_max_pkt_size_isoc);
-   kfree(dev);
-   }
+   kref_put(&dev->ref, em28xx_free_device);
 }
 
 static struct usb_driver em28xx_usb_driver = {
diff --git a/drivers/media/usb/em28xx/em28xx-dvb.c 
b/drivers/media/usb/em28xx/em28xx-dvb.c
index 881a813836eb..7df21e33a923 100644
--- a/drivers/media/usb/em28xx/em28xx-dvb.c
+++ b/drivers/media/usb/em28xx/em28xx-dvb.c
@@ -1005,11 +1005,11 @@ static int em28xx_dvb_init(struct em28xx *dev)
em28xx_info("Binding DVB extension\n");
 
 

Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Frank Schäfer
Am 14.01.2014 19:55, schrieb Mauro Carvalho Chehab:
> Em Tue, 14 Jan 2014 19:13:00 +0100
> Frank Schäfer  escreveu:
>
>> On 14.01.2014 14:10, Mauro Carvalho Chehab wrote:
>>> Em Mon, 13 Jan 2014 22:55:36 +0100
>>> Frank Schäfer  escreveu:
>>>
 Am 13.01.2014 20:23, schrieb Mauro Carvalho Chehab:
> Em Mon, 13 Jan 2014 20:02:19 +0100
> Frank Schäfer  escreveu:
>
>> On 13.01.2014 00:00, Mauro Carvalho Chehab wrote:
>>> We can't free struct em28xx while one of the extensions is still
>>> using it.
>>>
>>> So, add a kref() to control it, freeing it only after the
>>> extensions fini calls.
>>>
>>> Signed-off-by: Mauro Carvalho Chehab 
>>> ---
>>>drivers/media/usb/em28xx/em28xx-audio.c |  5 -
>>>drivers/media/usb/em28xx/em28xx-cards.c | 34 
>>> -
>>>drivers/media/usb/em28xx/em28xx-dvb.c   |  5 -
>>>drivers/media/usb/em28xx/em28xx-input.c |  8 +++-
>>>drivers/media/usb/em28xx/em28xx-video.c | 11 +--
>>>drivers/media/usb/em28xx/em28xx.h   |  9 +++--
>>>6 files changed, 44 insertions(+), 28 deletions(-)
>>>
>>> diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
>>> b/drivers/media/usb/em28xx/em28xx-audio.c
>>> index 97d9105e6830..8e959dae8358 100644
>>> --- a/drivers/media/usb/em28xx/em28xx-audio.c
>>> +++ b/drivers/media/usb/em28xx/em28xx-audio.c
>>> @@ -878,6 +878,8 @@ static int em28xx_audio_init(struct em28xx *dev)
>>>
>>> em28xx_info("Binding audio extension\n");
>>>
>>> +   kref_get(&dev->ref);
>>> +
>>> printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
>>>  "Rechberger\n");
>>> printk(KERN_INFO
>>> @@ -949,7 +951,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
>>> if (dev == NULL)
>>> return 0;
>>>
>>> -   if (dev->has_alsa_audio != 1) {
>>> +   if (!dev->has_alsa_audio) {
>>> /* This device does not support the extension (in this 
>>> case
>>>the device is expecting the snd-usb-audio module or
>>>doesn't have analog audio support at all) */
>>> @@ -963,6 +965,7 @@ static int em28xx_audio_fini(struct em28xx *dev)
>>> dev->adev.sndcard = NULL;
>>> }
>>>
>>> +   kref_put(&dev->ref, em28xx_free_device);
>>> return 0;
>>>}
>>>
>>> diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
>>> b/drivers/media/usb/em28xx/em28xx-cards.c
>>> index 3b332d527ccb..df92f417634a 100644
>>> --- a/drivers/media/usb/em28xx/em28xx-cards.c
>>> +++ b/drivers/media/usb/em28xx/em28xx-cards.c
>>> @@ -2867,16 +2867,18 @@ static void flush_request_modules(struct em28xx 
>>> *dev)
>>> flush_work(&dev->request_module_wk);
>>>}
>>>
>>> -/*
>>> - * em28xx_release_resources()
>>> - * unregisters the v4l2,i2c and usb devices
>>> - * called when the device gets disconnected or at module unload
>>> -*/
>>> -void em28xx_release_resources(struct em28xx *dev)
>>> +/**
>>> + * em28xx_release_resources() -  unregisters the v4l2,i2c and usb 
>>> devices
>>> + *
>>> + * @ref: struct kref for em28xx device
>>> + *
>>> + * This is called when all extensions and em28xx core unregisters a 
>>> device
>>> + */
>>> +void em28xx_free_device(struct kref *ref)
>>>{
>>> -   /*FIXME: I2C IR should be disconnected */
>>> +   struct em28xx *dev = kref_to_dev(ref);
>>>
>>> -   mutex_lock(&dev->lock);
>>> +   em28xx_info("Freeing device\n");
>>>
>>> if (dev->def_i2c_bus)
>>> em28xx_i2c_unregister(dev, 1);
>>> @@ -2887,9 +2889,10 @@ void em28xx_release_resources(struct em28xx *dev)
>>> /* Mark device as unused */
>>> clear_bit(dev->devno, &em28xx_devused);
>>>
>>> -   mutex_unlock(&dev->lock);
>>> -};
>>> -EXPORT_SYMBOL_GPL(em28xx_release_resources);
>>> +   kfree(dev->alt_max_pkt_size_isoc);
>>> +   kfree(dev);
>>> +}
>>> +EXPORT_SYMBOL_GPL(em28xx_free_device);
>>>
>>>/*
>>> * em28xx_init_dev()
>>> @@ -3342,6 +3345,8 @@ static int em28xx_usb_probe(struct usb_interface 
>>> *interface,
>>> dev->dvb_xfer_bulk ? "bulk" : "isoc");
>>> }
>>>
>>> +   kref_init(&dev->ref);
>>> +
>>> request_modules(dev);
>>>
>>> /* Should be the last thing to do, to avoid newer udev's to
>>> @@ -3390,12 +3395,7 @@ static void em28xx_usb_disconnect(struct 
>>> usb_interface *interface)
>>>
>>> em28xx_close_extension(dev);
>>>
>>> -  

Re: [PATCH 5/7] em28xx-audio: remove a deplock circular dependency

2014-01-14 Thread Frank Schäfer
Am 14.01.2014 20:59, schrieb Mauro Carvalho Chehab:
>> After thinking about this for a while:
>> > Does your patch
>> > 
>> > [PATCH] em28xx: push mutex down to extensions on .fini callback
>> > 
>> > which you've sent afterwards fix this warning, too ?
> Yes, the above patch fixed the circular lock issues.
Ok, great, one problem less. :-)
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Frank Schäfer
Am 14.01.2014 20:31, schrieb Mauro Carvalho Chehab:
>
> Ok, patch 5 is not needed anymore.
>
> However, after a series of removals and re-inserts, I got these:
>
>
> [120982.699455] [ cut here ]
> [120982.699509] WARNING: CPU: 0 PID: 7953 at lib/list_debug.c:33 
> __list_add+0xac/0xc0()
> [120982.699539] list_add corruption. prev->next should be next 
> (88019ffce4f8), but was 000d0007. (prev=880101dbfb48).
> [120982.699566] Modules linked in: lgdt330x tuner_xc2028 tuner tvp5150 
> rc_hauppauge em28xx_rc rc_core xc5000 drxk em28xx_dvb dvb_core em28xx_alsa 
> em28xx_v4l videobuf2_vmalloc videobuf2_memops videobuf2_core em28xx tveeprom 
> v4l2_common videodev media netconsole usb_storage fuse ccm 
> nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT 
> xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter 
> ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 
> ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables 
> iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack 
> iptable_mangle iptable_security iptable_raw bnep arc4 vfat fat iwldvm 
> mac80211 iwlwifi cfg80211 x86_pkg_temp_thermal coretemp kvm_intel kvm 
> crc32_pclmul crc32c_intel ghash_clmulni_intel
> [120982.701828]  snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel 
> snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm iTCO_wdt 
> iTCO_vendor_support btusb bluetooth joydev microcode serio_raw r8169 mii 
> i2c_i801 lpc_ich mfd_core rfkill snd_page_alloc snd_timer snd mei_me 
> soundcore mei shpchp nfsd auth_rpcgss nfs_acl lockd sunrpc nouveau i915 ttm 
> i2c_algo_bit drm_kms_helper drm i2c_core mxm_wmi wmi video [last unloaded: 
> videobuf2_memops]
> [120982.703581] CPU: 0 PID: 7953 Comm: xawtv Tainted: G  D  
> 3.13.0-rc1+ #24
> [120982.703610] Hardware name: SAMSUNG ELECTRONICS CO., LTD. 
> 550P5C/550P7C/SAMSUNG_NP1234567890, BIOS P04ABI.013.130220.dg 02/20/2013
> [120982.703638]  0009 88011f63bb70 816a03c6 
> 88011f63bbb8
> [120982.703794]  88011f63bba8 8106aaad 88018cfb3f48 
> 88019ffce4f8
> [120982.703924]  880101dbfb48 0282  
> 88011f63bc08
> [120982.704056] Call Trace:
> [120982.704093]  [] dump_stack+0x45/0x56
> [120982.704129]  [] warn_slowpath_common+0x7d/0xa0
> [120982.704162]  [] warn_slowpath_fmt+0x4c/0x50
> [120982.704197]  [] __list_add+0xac/0xc0
> [120982.704233]  [] buffer_queue+0x7b/0xb0 [em28xx_v4l]
> [120982.704432]  [] __enqueue_in_driver+0x74/0x80 
> [videobuf2_core]
> [120982.704469]  [] vb2_streamon+0xa0/0x140 [videobuf2_core]
> [120982.704505]  [] vb2_ioctl_streamon+0x48/0x50 
> [videobuf2_core]
> [120982.704543]  [] v4l_streamon+0x1a/0x20 [videodev]
> [120982.704581]  [] __video_do_ioctl+0x2a4/0x330 [videodev]
> [120982.704619]  [] ? v4l_dbg_s_register+0x150/0x150 
> [videodev]
> [120982.704658]  [] ? v4l_dbg_s_register+0x150/0x150 
> [videodev]
> [120982.704719]  [] video_usercopy+0x240/0x5d0 [videodev]
> [120982.704756]  [] ? trace_hardirqs_on+0xd/0x10
> [120982.704792]  [] ? v4l2_ioctl+0x5b/0x160 [videodev]
> [120982.704829]  [] ? v4l2_ioctl+0x5b/0x160 [videodev]
> [120982.704867]  [] video_ioctl2+0x15/0x20 [videodev]
> [120982.704903]  [] v4l2_ioctl+0x123/0x160 [videodev]
> [120982.704939]  [] do_vfs_ioctl+0x300/0x520
> [120982.704974]  [] ? file_has_perm+0x86/0xa0
> [120982.705006]  [] SyS_ioctl+0x81/0xa0
> [120982.705039]  [] system_call_fastpath+0x16/0x1b
> [120982.705070] ---[ end trace 7e24c4fe20a76f18 ]---
> [120985.899453] [ cut here ]
> [120985.899502] WARNING: CPU: 0 PID: 7953 at lib/list_debug.c:33 
> __list_add+0xac/0xc0()
> [120985.899531] list_add corruption. prev->next should be next 
> (88019ffce4f8), but was   (null). (prev=88018cfb0348).
> [120985.899559] Modules linked in: lgdt330x tuner_xc2028 tuner tvp5150 
> rc_hauppauge em28xx_rc rc_core xc5000 drxk em28xx_dvb dvb_core em28xx_alsa 
> em28xx_v4l videobuf2_vmalloc videobuf2_memops videobuf2_core em28xx tveeprom 
> v4l2_common videodev media netconsole usb_storage fuse ccm 
> nf_conntrack_netbios_ns nf_conntrack_broadcast ipt_MASQUERADE ip6t_REJECT 
> xt_conntrack ebtable_nat ebtable_broute bridge stp llc ebtable_filter 
> ebtables ip6table_nat nf_conntrack_ipv6 nf_defrag_ipv6 nf_nat_ipv6 
> ip6table_mangle ip6table_security ip6table_raw ip6table_filter ip6_tables 
> iptable_nat nf_conntrack_ipv4 nf_defrag_ipv4 nf_nat_ipv4 nf_nat nf_conntrack 
> iptable_mangle iptable_security iptable_raw bnep arc4 vfat fat iwldvm 
> mac80211 iwlwifi cfg80211 x86_pkg_temp_thermal coretemp kvm_intel kvm 
> crc32_pclmul crc32c_intel ghash_clmulni_intel
> [120985.901761]  snd_hda_codec_hdmi snd_hda_codec_realtek snd_hda_intel 
> snd_hda_codec snd_hwdep snd_seq snd_seq_device snd_pcm iTCO_wdt 
> iTCO_vendor_support btusb bluetooth joydev microcode serio_raw r8169 mii 
> i2c_i801 lpc_ich mfd_core

Re: [PATCH 3/7] em28xx: Only deallocate struct em28xx after finishing all extensions

2014-01-14 Thread Mauro Carvalho Chehab
Em Tue, 14 Jan 2014 21:48:16 +0100
Frank Schäfer  escreveu:

> Am 14.01.2014 19:55, schrieb Mauro Carvalho Chehab:
> > Em Tue, 14 Jan 2014 19:13:00 +0100
> > Frank Schäfer  escreveu:
> >
...
> >> At first glance it seems there are at least 2 issues:
> >> 1.) use after freeing in v4l-extension (happens when the device is 
> >> closed after the usb disconnect)
> > That's basically what this patch fixes. Both V4L2 and ALSA handles it
> > well, if you warn the subsystem that a device will be removed.
> >
> > If are there still any issues, we may add a kref_get() at device open,
> > an a kref_put() at device close on the affected sub-driver.
> Ok, I've tested it and I was right here.
> This is what happens when closing a disconnected device:
> 
> [  144.045691] usb 1-8: USB disconnect, device number 7
> [  144.047387] em2765 #0: disconnecting em2765 #0 video
> [  144.047403] em2765 #0: V4L2 device video1 deregistered
> [  144.050197] em2765 #0: Deregistering snapshot button
> [  144.058336] em2765 #0: Freeing device
> [  147.525267] : em28xx_v4l2_close() called
> [  147.525287] : em28xx_videodevice_release() called
> 
> 
> I will make some tests tomorrow, but here is a first suggestion how to
> fix this:
> 
> Remove the kref_put() call from em28xx_v4l2_fini().
> Instead, add the following lines to em28xx_videodevice_release():
> 
> if (dev->users == 0) {
> dev->users--; /* avoid multiple kref_put() calls when the
> devices are unregistered and no device is open */
> kref_put(&dev->ref, em28xx_free_device);
> }
> 
> That should fix it.

What I actually did on version 2 (already submitted) is that it is calling 
kref_get() at open, and kref_put() at close.

> Interestingly no oops happens. I will have to take a closer look at this
> tomorrow, but I suspect that the dev we obtain from struct file filp is
> an outdated copy of the original device struct.

Likely.

> If that would be true and no bad things can happen in the close()
> function we actually wouldn't need kref for the v4l extension at all.

Still, it will be writing on a deallocated buffer, and this can be
making some memory used by some other part of the Kernel dirty.

> Of course, the ideal solution would be, if we could just clear the
> device struct at the end of the usb disconnect handler, because we can
> be sure that the fini() functions have already made sure that dev isn't
> used anymore.
>
> Btw, what happens in em28xx-audio ?
> Does the ALSA core also allow to call the close() function when the
> device is already gone ?

I suspect so. This is what happens when I remove HVR-950 while both
audio and video are still streaming:

[ 4313.540907] usb 3-4: USB disconnect, device number 7
[ 4313.541280] em2882/3 #0: Disconnecting em2882/3 #0
[ 4313.541313] em2882/3 #0: Closing video extension
[ 4313.541352] em2882/3 #0: V4L2 device vbi0 deregistered
[ 4313.541635] em2882/3 #0: V4L2 device video0 deregistered
[ 4313.542188] em2882/3 #0: Closing audio extension

(I waited for ~5 secs before removing the driver)

[ 4317.470747] em2882/3 #0: couldn't setup AC97 register 2
[ 4317.470772] em2882/3 #0: couldn't setup AC97 register 4
[ 4317.470785] em2882/3 #0: couldn't setup AC97 register 6
[ 4317.470797] em2882/3 #0: couldn't setup AC97 register 54
[ 4317.470810] em2882/3 #0: couldn't setup AC97 register 56
[ 4317.470950] em2882/3 #0: Closing DVB extension
[ 4317.471890] xc2028 19-0061: destroying instance
[ 4317.471913] em2882/3 #0: Closing input extension
[ 4317.489374] em2882/3 #0: Freeing device

As the code now have a kref for open/close on both audio and video
extensions, that means that em28xx close was called after device
removal, as otherwise, we won't see the "Freeing device" print.


-- 

Cheers,
Mauro
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] [media] rc-core: reuse device numbers

2014-01-14 Thread Mauro Carvalho Chehab
Before changeset d8b4b5822f51e, the remote controller device numbers
were released when the device were unregistered. That helped to maintain
some sanity, as, when USB devices are replugged, the remote controller
would get the same number.

Restore the same behaviour.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/rc/rc-main.c | 20 +---
 1 file changed, 17 insertions(+), 3 deletions(-)

diff --git a/drivers/media/rc/rc-main.c b/drivers/media/rc/rc-main.c
index 46da365c9c84..02e2f38c9c85 100644
--- a/drivers/media/rc/rc-main.c
+++ b/drivers/media/rc/rc-main.c
@@ -22,6 +22,10 @@
 #include 
 #include "rc-core-priv.h"
 
+/* Bitmap to store allocated device numbers from 0 to IRRCV_NUM_DEVICES - 1 */
+#define IRRCV_NUM_DEVICES  256
+DECLARE_BITMAP(ir_core_dev_number, IRRCV_NUM_DEVICES);
+
 /* Sizes are in bytes, 256 bytes allows for 32 entries on x64 */
 #define IR_TAB_MIN_SIZE256
 #define IR_TAB_MAX_SIZE8192
@@ -1065,10 +1069,9 @@ EXPORT_SYMBOL_GPL(rc_free_device);
 int rc_register_device(struct rc_dev *dev)
 {
static bool raw_init = false; /* raw decoders loaded? */
-   static atomic_t devno = ATOMIC_INIT(0);
struct rc_map *rc_map;
const char *path;
-   int rc;
+   int rc, devno;
 
if (!dev || !dev->map_name)
return -EINVAL;
@@ -1096,7 +1099,15 @@ int rc_register_device(struct rc_dev *dev)
 */
mutex_lock(&dev->lock);
 
-   dev->devno = (unsigned long)(atomic_inc_return(&devno) - 1);
+   do {
+   devno = find_first_zero_bit(ir_core_dev_number,
+   IRRCV_NUM_DEVICES);
+   /* No free device slots */
+   if (devno >= IRRCV_NUM_DEVICES)
+   return -ENOMEM;
+   } while (test_and_set_bit(devno, ir_core_dev_number));
+
+   dev->devno = devno;
dev_set_name(&dev->dev, "rc%ld", dev->devno);
dev_set_drvdata(&dev->dev, dev);
rc = device_add(&dev->dev);
@@ -1186,6 +1197,7 @@ out_dev:
device_del(&dev->dev);
 out_unlock:
mutex_unlock(&dev->lock);
+   clear_bit(dev->devno, ir_core_dev_number);
return rc;
 }
 EXPORT_SYMBOL_GPL(rc_register_device);
@@ -1197,6 +1209,8 @@ void rc_unregister_device(struct rc_dev *dev)
 
del_timer_sync(&dev->timer_keyup);
 
+   clear_bit(dev->devno, ir_core_dev_number);
+
if (dev->driver_type == RC_DRIVER_IR_RAW)
ir_raw_event_unregister(dev);
 
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH] em28xx-cards: properly initialize the device bitmap

2014-01-14 Thread Mauro Carvalho Chehab
Instead of just creating a long int, use DECLARE_BITMAP().

No functional changes.

Signed-off-by: Mauro Carvalho Chehab 
---
 drivers/media/usb/em28xx/em28xx-cards.c | 10 +-
 1 file changed, 5 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-cards.c 
b/drivers/media/usb/em28xx/em28xx-cards.c
index 8fc0a437054e..cd0d01b53c73 100644
--- a/drivers/media/usb/em28xx/em28xx-cards.c
+++ b/drivers/media/usb/em28xx/em28xx-cards.c
@@ -66,7 +66,7 @@ MODULE_PARM_DESC(usb_xfer_mode,
 
 
 /* Bitmask marking allocated devices from 0 to EM28XX_MAXBOARDS - 1 */
-static unsigned long em28xx_devused;
+DECLARE_BITMAP(em28xx_devused, EM28XX_MAXBOARDS);
 
 struct em28xx_hash_table {
unsigned long hash;
@@ -2887,7 +2887,7 @@ void em28xx_free_device(struct kref *ref)
usb_put_dev(dev->udev);
 
/* Mark device as unused */
-   clear_bit(dev->devno, &em28xx_devused);
+   clear_bit(dev->devno, em28xx_devused);
 
kfree(dev->alt_max_pkt_size_isoc);
kfree(dev);
@@ -3097,7 +3097,7 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
 
/* Check to see next free device and mark as used */
do {
-   nr = find_first_zero_bit(&em28xx_devused, EM28XX_MAXBOARDS);
+   nr = find_first_zero_bit(em28xx_devused, EM28XX_MAXBOARDS);
if (nr >= EM28XX_MAXBOARDS) {
/* No free device slots */
printk(DRIVER_NAME ": Supports only %i em28xx 
boards.\n",
@@ -3105,7 +3105,7 @@ static int em28xx_usb_probe(struct usb_interface 
*interface,
retval = -ENOMEM;
goto err_no_slot;
}
-   } while (test_and_set_bit(nr, &em28xx_devused));
+   } while (test_and_set_bit(nr, em28xx_devused));
 
/* Don't register audio interfaces */
if (interface->altsetting[0].desc.bInterfaceClass == USB_CLASS_AUDIO) {
@@ -3360,7 +3360,7 @@ err_free:
kfree(dev);
 
 err:
-   clear_bit(nr, &em28xx_devused);
+   clear_bit(nr, em28xx_devused);
 
 err_no_slot:
usb_put_dev(udev);
-- 
1.8.3.1

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] [media] radio-usb-si4713: fix sparse non static symbol warnings

2014-01-14 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warnings:

drivers/media/radio/si4713/radio-usb-si4713.c:226:31: warning:
 symbol 'start_seq' was not declared. Should it be static?
drivers/media/radio/si4713/radio-usb-si4713.c:291:29: warning:
 symbol 'command_table' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/media/radio/si4713/radio-usb-si4713.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/media/radio/si4713/radio-usb-si4713.c 
b/drivers/media/radio/si4713/radio-usb-si4713.c
index f1e640d..779855b 100644
--- a/drivers/media/radio/si4713/radio-usb-si4713.c
+++ b/drivers/media/radio/si4713/radio-usb-si4713.c
@@ -223,7 +223,7 @@ struct si4713_start_seq_table {
  * (0x03): Get serial number of the board (Response : CB000-00-00)
  * (0x06, 0x03, 0x03, 0x08, 0x01, 0x0f) : Get Component revision
  */
-struct si4713_start_seq_table start_seq[] = {
+static struct si4713_start_seq_table start_seq[] = {
 
{ 1, { 0x03 } },
{ 2, { 0x32, 0x7f } },
@@ -288,7 +288,7 @@ struct si4713_command_table {
  * Byte 4 : Number of arguments + 1 (for the command byte)
  * Byte 5 : Number of response bytes
  */
-struct si4713_command_table command_table[] = {
+static struct si4713_command_table command_table[] = {
 
{ SI4713_CMD_POWER_UP,  { 0x00, SI4713_PWUP_NARGS + 1, 
SI4713_PWUP_NRESP} },
{ SI4713_CMD_GET_REV,   { 0x03, 0x01, SI4713_GETREV_NRESP } },

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] [media] au0828: Fix sparse non static symbol warning

2014-01-14 Thread Wei Yongjun
From: Wei Yongjun 

Fixes the following sparse warning:

drivers/media/usb/au0828/au0828-dvb.c:36:5: warning:
 symbol 'preallocate_big_buffers' was not declared. Should it be static?

Signed-off-by: Wei Yongjun 
---
 drivers/media/usb/au0828/au0828-dvb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/media/usb/au0828/au0828-dvb.c 
b/drivers/media/usb/au0828/au0828-dvb.c
index 19fe049..4ae8b10 100644
--- a/drivers/media/usb/au0828/au0828-dvb.c
+++ b/drivers/media/usb/au0828/au0828-dvb.c
@@ -33,7 +33,7 @@
 #include "mxl5007t.h"
 #include "tda18271.h"
 
-int preallocate_big_buffers;
+static int preallocate_big_buffers;
 module_param_named(preallocate_big_buffers, preallocate_big_buffers, int, 
0644);
 MODULE_PARM_DESC(preallocate_big_buffers, "Preallocate the larger transfer 
buffers at module load time");
 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


cron job: media_tree daily build: ERRORS

2014-01-14 Thread Hans Verkuil
This message is generated daily by a cron job that builds media_tree for
the kernels and architectures in the list below.

Results of the daily build of media_tree:

date:   Wed Jan 15 04:00:23 CET 2014
git branch: test
git hash:   bf6e8aaa32081ff3f639334ca6b3ca0eaec5adc0
gcc version:i686-linux-gcc (GCC) 4.8.2
sparse version: 0.4.5-rc1
host hardware:  x86_64
host os:3.12-6.slh.2-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: WARNINGS
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin: OK
linux-git-i686: OK
linux-git-m32r: OK
linux-git-mips: OK
linux-git-powerpc64: OK
linux-git-sh: OK
linux-git-x86_64: OK
linux-2.6.31.14-i686: ERRORS
linux-2.6.32.27-i686: ERRORS
linux-2.6.33.7-i686: WARNINGS
linux-2.6.34.7-i686: WARNINGS
linux-2.6.35.9-i686: WARNINGS
linux-2.6.36.4-i686: WARNINGS
linux-2.6.37.6-i686: WARNINGS
linux-2.6.38.8-i686: WARNINGS
linux-2.6.39.4-i686: WARNINGS
linux-3.0.60-i686: WARNINGS
linux-3.1.10-i686: WARNINGS
linux-3.2.37-i686: OK
linux-3.3.8-i686: OK
linux-3.4.27-i686: OK
linux-3.5.7-i686: OK
linux-3.6.11-i686: WARNINGS
linux-3.7.4-i686: WARNINGS
linux-3.8-i686: WARNINGS
linux-3.9.2-i686: WARNINGS
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12-i686: OK
linux-3.13-rc1-i686: OK
linux-2.6.31.14-x86_64: ERRORS
linux-2.6.32.27-x86_64: ERRORS
linux-2.6.33.7-x86_64: WARNINGS
linux-2.6.34.7-x86_64: WARNINGS
linux-2.6.35.9-x86_64: WARNINGS
linux-2.6.36.4-x86_64: WARNINGS
linux-2.6.37.6-x86_64: WARNINGS
linux-2.6.38.8-x86_64: WARNINGS
linux-2.6.39.4-x86_64: WARNINGS
linux-3.0.60-x86_64: WARNINGS
linux-3.1.10-x86_64: WARNINGS
linux-3.2.37-x86_64: OK
linux-3.3.8-x86_64: OK
linux-3.4.27-x86_64: OK
linux-3.5.7-x86_64: OK
linux-3.6.11-x86_64: WARNINGS
linux-3.7.4-x86_64: WARNINGS
linux-3.8-x86_64: WARNINGS
linux-3.9.2-x86_64: WARNINGS
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12-x86_64: OK
linux-3.13-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse version: 0.4.5-rc1
sparse: ERRORS

Detailed results are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.log

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Wednesday.tar.bz2

The Media Infrastructure API from this daily build is here:

http://www.xs4all.nl/~hverkuil/spec/media.html
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


[PATCH -next] [media] em28xx-audio: remove needless check before usb_free_coherent()

2014-01-14 Thread Wei Yongjun
From: Wei Yongjun 

usb_free_coherent() is safe with NULL addr and this check is
not required.

Signed-off-by: Wei Yongjun 
---
 drivers/media/usb/em28xx/em28xx-audio.c | 8 +++-
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/media/usb/em28xx/em28xx-audio.c 
b/drivers/media/usb/em28xx/em28xx-audio.c
index f3e3200..287ce17 100644
--- a/drivers/media/usb/em28xx/em28xx-audio.c
+++ b/drivers/media/usb/em28xx/em28xx-audio.c
@@ -695,11 +695,9 @@ static void em28xx_audio_free_urb(struct em28xx *dev)
if (!urb)
continue;
 
-   if (dev->adev.transfer_buffer[i])
-   usb_free_coherent(dev->udev,
- urb->transfer_buffer_length,
- dev->adev.transfer_buffer[i],
- urb->transfer_dma);
+   usb_free_coherent(dev->udev, urb->transfer_buffer_length,
+ dev->adev.transfer_buffer[i],
+ urb->transfer_dma);
 
usb_free_urb(urb);
}

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


how can I get compat_ioctl support for v4l2_subdev_fops

2014-01-14 Thread Jianle Wang
Hi all, :
I use the media-ctl from http://git.ideasonboard.org/media-ctl.git
It is compiled into a 32 bit application. Run on a 64 bit CPU. The
version of kernel is 3.10.

When call ioctl(, VIDIOC_SUBDEV_S_SELECTION,), meet the below warning:
[   97.186338] c0 707 (drv_test) compat_ioctl32: unknown ioctl 'V',
dir=3, #62 (0xc040563e)
[   97.203252] c0 707 (drv_test) WARNING: no compat_ioctl for v4l-subdev1

VIDIOC_SUBDEV_S_SELECTION is not supported for compat_iocl. And I list
others subdev’s ioctl, which are also not included

in v4l2_compat_iocl32().
How can I get these compat_ioctl?
Have they been added in v4l2_compat_iocl32() or We have added a
compat_ioctl32 in v4l2_subdev_fops?

VIDIOC_SUBDEV_G_FMT
VIDIOC_SUBDEV_S_FMT
VIDIOC_SUBDEV_G_CROP
VIDIOC_SUBDEV_S_CROP
VIDIOC_SUBDEV_ENUM_MBUS_CODE
VIDIOC_SUBDEV_ENUM_FRAME_SIZE
VIDIOC_SUBDEV_G_FRAME_INTERVAL
VIDIOC_SUBDEV_S_FRAME_INTERVAL
VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
VIDIOC_SUBDEV_G_SELECTION
VIDIOC_SUBDEV_S_SELECTION
default
v4l2_subdev_call(sd, core, ioctl, cmd, arg);
--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: using MFC memory to memery encoder, start stream and queue order problem

2014-01-14 Thread Andrzej Hajda
On 01/14/2014 05:50 PM, randy wrote:
> -BEGIN PGP SIGNED MESSAGE-
> Hash: SHA1
>
> 于 2014年01月14日 18:29, Andrzej Hajda 写道:
>> On 01/14/2014 06:17 AM, randy wrote:
>>> Yes, it make encoder work. But sadness ./mfc-encode -m
>>> /dev/video1 -c h264,header_mode=1 -d 1 will still output a zero
>>> demo.out without header-mode or set it to zero will works. What
>>> is the problem?
>> It seems infradead repo is not synchronized with our internal
>> repo. Please apply attached patch.
>>
> No, it has been applied in public repo.
> And my code is in applied version, but it doesn't work.
> Here is the log
> 
> mfc codec encoding example application
> Andrzej Hajda 
> Copyright 2012 Samsung Electronics Co., Ltd.
>
> 70.259455868:args.c:parse_args:190: codec: H264
> 70.259635952:args.c:parse_args:187: opt header_mode=1
> mfc.c:mfc_create:85: error: Cannot subscribe EOS event for MFC
This error shows that end-of-stream support is not implemented in the
MFC driver.
> 70.358070659:v4l_dev.c:v4l_enq_buf:226: EOS sent to 3:0, ret=-1
>
Ditto

Are you sure you have used kernel 3.12? Have you compiled the program with
proper kernel-headers?

Regards
Andrzej

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html


Re: how can I get compat_ioctl support for v4l2_subdev_fops

2014-01-14 Thread Hans Verkuil
Hi Jianle,

On 01/15/2014 07:28 AM, Jianle Wang wrote:
> Hi all, :
> I use the media-ctl from http://git.ideasonboard.org/media-ctl.git
> It is compiled into a 32 bit application. Run on a 64 bit CPU. The
> version of kernel is 3.10.
> 
> When call ioctl(, VIDIOC_SUBDEV_S_SELECTION,), meet the below warning:
> [   97.186338] c0 707 (drv_test) compat_ioctl32: unknown ioctl 'V',
> dir=3, #62 (0xc040563e)
> [   97.203252] c0 707 (drv_test) WARNING: no compat_ioctl for v4l-subdev1
> 
> VIDIOC_SUBDEV_S_SELECTION is not supported for compat_iocl. And I list
> others subdev’s ioctl, which are also not included
> 
> in v4l2_compat_iocl32().
> How can I get these compat_ioctl?
> Have they been added in v4l2_compat_iocl32() or We have added a
> compat_ioctl32 in v4l2_subdev_fops?

It's a bug, I'm afraid. A lot of the SUBDEV ioctls are missing in 
v4l2_compat_ioctl32.
Try the patch below, that should fix it.

Regards,

Hans

> 
> VIDIOC_SUBDEV_G_FMT
> VIDIOC_SUBDEV_S_FMT
> VIDIOC_SUBDEV_G_CROP
> VIDIOC_SUBDEV_S_CROP
> VIDIOC_SUBDEV_ENUM_MBUS_CODE
> VIDIOC_SUBDEV_ENUM_FRAME_SIZE
> VIDIOC_SUBDEV_G_FRAME_INTERVAL
> VIDIOC_SUBDEV_S_FRAME_INTERVAL
> VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL
> VIDIOC_SUBDEV_G_SELECTION
> VIDIOC_SUBDEV_S_SELECTION
> default
> v4l2_subdev_call(sd, core, ioctl, cmd, arg);
> --
> To unsubscribe from this list: send the line "unsubscribe linux-media" in
> the body of a message to majord...@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
> 

Signed-off-by: Hans Verkuil 

diff --git a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c 
b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
index 8f7a6a4..15d3586 100644
--- a/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
+++ b/drivers/media/v4l2-core/v4l2-compat-ioctl32.c
@@ -1007,6 +1007,7 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
return ret;
 
switch (cmd) {
+   /* V4L2 ioctls */
case VIDIOC_QUERYCAP:
case VIDIOC_RESERVED:
case VIDIOC_ENUM_FMT:
@@ -1087,8 +1088,21 @@ long v4l2_compat_ioctl32(struct file *file, unsigned int 
cmd, unsigned long arg)
case VIDIOC_QUERY_DV_TIMINGS:
case VIDIOC_DV_TIMINGS_CAP:
case VIDIOC_ENUM_FREQ_BANDS:
+
+   /* V4L2 subdev ioctls */
case VIDIOC_SUBDEV_G_EDID32:
case VIDIOC_SUBDEV_S_EDID32:
+   case VIDIOC_SUBDEV_G_FMT:
+   case VIDIOC_SUBDEV_S_FMT:
+   case VIDIOC_SUBDEV_G_FRAME_INTERVAL:
+   case VIDIOC_SUBDEV_S_FRAME_INTERVAL:
+   case VIDIOC_SUBDEV_ENUM_MBUS_CODE:
+   case VIDIOC_SUBDEV_ENUM_FRAME_SIZE:
+   case VIDIOC_SUBDEV_ENUM_FRAME_INTERVAL:
+   case VIDIOC_SUBDEV_G_CROP:
+   case VIDIOC_SUBDEV_S_CROP:
+   case VIDIOC_SUBDEV_G_SELECTION:
+   case VIDIOC_SUBDEV_S_SELECTION:
ret = do_video_ioctl(file, cmd, arg);
break;
 

--
To unsubscribe from this list: send the line "unsubscribe linux-media" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html