Re: [PATCH MC Next Gen v2 2/3] sound/usb: Create media mixer function and control interface entities

2015-10-22 Thread Takashi Iwai
On Wed, 21 Oct 2015 01:25:15 +0200,
Shuah Khan wrote:
> 
> Add support for creating MEDIA_ENT_F_AUDIO_MIXER entity for
> each mixer and a MEDIA_INTF_T_ALSA_CONTROL control interface
> entity that links to mixer entities. MEDIA_INTF_T_ALSA_CONTROL
> entity corresponds to the control device for the card.
> 
> Signed-off-by: Shuah Khan 
> ---
>  sound/usb/card.c |  5 +++
>  sound/usb/media.c| 89 
> 
>  sound/usb/media.h| 20 
>  sound/usb/mixer.h|  1 +
>  sound/usb/usbaudio.h |  1 +
>  5 files changed, 116 insertions(+)
> 
> diff --git a/sound/usb/card.c b/sound/usb/card.c
> index 469d2bf..d004cb4 100644
> --- a/sound/usb/card.c
> +++ b/sound/usb/card.c
> @@ -560,6 +560,9 @@ static int usb_audio_probe(struct usb_interface *intf,
>   if (err < 0)
>   goto __error;
>  
> + /* Create media entities for mixer and control dev */
> + media_mixer_init(chip);
> +
>   usb_chip[chip->index] = chip;
>   chip->num_interfaces++;
>   chip->probing = 0;
> @@ -616,6 +619,8 @@ static void usb_audio_disconnect(struct usb_interface 
> *intf)
>   list_for_each(p, &chip->midi_list) {
>   snd_usbmidi_disconnect(p);
>   }
> + /* delete mixer media resources */
> + media_mixer_delete(chip);
>   /* release mixer resources */
>   list_for_each_entry(mixer, &chip->mixer_list, list) {
>   snd_usb_mixer_disconnect(mixer);
> diff --git a/sound/usb/media.c b/sound/usb/media.c
> index 0cbfee6..a26ea8b 100644
> --- a/sound/usb/media.c
> +++ b/sound/usb/media.c
> @@ -199,4 +199,93 @@ void media_stop_pipeline(struct snd_usb_substream *subs)
>   if (mctl)
>   media_disable_source(mctl);
>  }
> +
> +int media_mixer_init(struct snd_usb_audio *chip)
> +{
> + struct device *ctl_dev = &chip->card->ctl_dev;
> + struct media_intf_devnode *ctl_intf;
> + struct usb_mixer_interface *mixer;
> + struct media_device *mdev;
> + struct media_mixer_ctl *mctl;
> + u32 intf_type = MEDIA_INTF_T_ALSA_CONTROL;
> + int ret;
> +
> + mdev = media_device_find_devres(&chip->dev->dev);
> + if (!mdev)
> + return -ENODEV;
> +
> + ctl_intf = (struct media_intf_devnode *) chip->ctl_intf_media_devnode;

Why do we need cast?  Can't chip->ctl_intf_media_devnode itself be
struct media_intf_devndoe pointer?


> + if (!ctl_intf) {
> + ctl_intf = (void *) media_devnode_create(mdev,
> +  intf_type, 0,
> +  MAJOR(ctl_dev->devt),
> +  MINOR(ctl_dev->devt));
> + if (!ctl_intf)
> + return -ENOMEM;
> + }

Is chip->ctl_intf_media_devnode assigned anywhere at all?

Not directly related with this patchset: the above uses
media_devnode_create(), which I assume it's a device-file
(major:minor) specific.  What if sound hardware with multiple codecs
and so on in general?


> +
> + list_for_each_entry(mixer, &chip->mixer_list, list) {
> +
> + if (mixer->media_mixer_ctl)
> + continue;
> +
> + /* allocate media_ctl */
> + mctl = kzalloc(sizeof(struct media_ctl), GFP_KERNEL);
> + if (!mctl)
> + return -ENOMEM;
> +
> + mixer->media_mixer_ctl = (void *) mctl;
> + mctl->media_dev = mdev;
> +
> + mctl->media_entity.function = MEDIA_ENT_F_AUDIO_MIXER;
> + mctl->media_entity.name = chip->card->mixername;
> + mctl->media_pad[0].flags = MEDIA_PAD_FL_SINK;
> + mctl->media_pad[1].flags = MEDIA_PAD_FL_SOURCE;
> + mctl->media_pad[2].flags = MEDIA_PAD_FL_SOURCE;
> + media_entity_init(&mctl->media_entity, MEDIA_MIXER_PAD_MAX,
> +   mctl->media_pad);
> + ret =  media_device_register_entity(mctl->media_dev,
> + &mctl->media_entity);
> + if (ret)
> + return ret;

Will the last (unfinished) mctl be freed properly in the error path?

> + mctl->intf_link = media_create_intf_link(&mctl->media_entity,
> +  &ctl_intf->intf,
> +  MEDIA_LNK_FL_ENABLED);
> + if (!mctl->intf_link) {
> + media_device_unregister_entity(&mctl->media_entity);
> + return -ENOMEM;

Ditto.

> + }
> + mctl->intf_devnode = ctl_intf;
> + }
> + return 0;
> +}
> +
> +void media_mixer_delete(struct snd_usb_audio *chip)
> +{
> + struct usb_mixer_interface *mixer;
> + struct media_device *mdev;
> +
> + mdev = media_device_find_devres(&chip->dev->dev);
>

re: [media] go7007: don't continue if firmware can't be loaded

2015-10-22 Thread Dan Carpenter
Hello Hans Verkuil,

The patch 59aea928d57f: "[media] go7007: don't continue if firmware
can't be loaded" from Mar 17, 2013, leads to the following static
checker warning:

drivers/media/usb/go7007/go7007-usb.c:1292 go7007_usb_probe()
warn: we tested 'board->flags & (1 << 0)' before and it was 'true'

drivers/media/usb/go7007/go7007-usb.c
  1289  
  1290  /* Allocate the URBs and buffers for receiving the audio stream 
*/
  1291  if ((board->flags & GO7007_USB_EZUSB) &&
  1292  (board->flags & GO7007_BOARD_HAS_AUDIO)) {

We used to test "go->audio_enabled" enabled here.  The GO7007_USB_EZUSB
and GO7007_BOARD_HAS_AUDIO are different names for BIT(0).

  1293  for (i = 0; i < 8; ++i) {
  1294  usb->audio_urbs[i] = usb_alloc_urb(0, 
GFP_KERNEL);
  1295  if (usb->audio_urbs[i] == NULL)
  1296  goto allocfail;
  1297  usb->audio_urbs[i]->transfer_buffer = 
kmalloc(4096,
  1298  
GFP_KERNEL);
  1299  if (usb->audio_urbs[i]->transfer_buffer == NULL)
  1300  goto allocfail;
  1301  usb_fill_bulk_urb(usb->audio_urbs[i], 
usb->usbdev,
  1302  usb_rcvbulkpipe(usb->usbdev, 8),
  1303  usb->audio_urbs[i]->transfer_buffer, 
4096,
  1304  go7007_usb_read_audio_pipe_complete, 
go);
  1305  }
  1306  }


regards,
dan carpenter
--
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] DocBook media: s/input stream/capture stream/

2015-10-22 Thread Hans Verkuil
The term "input stream" is confusing since it is not clear whether this is an
input stream from the point of view of the application or from the point of
view of the hardware. So replace it with the more standard term "capture 
stream".

Signed-off-by: Hans Verkuil 

diff --git a/Documentation/DocBook/media/v4l/io.xml 
b/Documentation/DocBook/media/v4l/io.xml
index 7bbc2a4..87d34ff 100644
--- a/Documentation/DocBook/media/v4l/io.xml
+++ b/Documentation/DocBook/media/v4l/io.xml
@@ -699,7 +699,7 @@ linkend="v4l2-buf-type" />
 buffer. It depends on the negotiated data format and may change with
 each buffer for compressed variable size data like JPEG images.
 Drivers must set this field when type
-refers to an input stream, applications when it refers to an output stream.
+refers to a capture stream, applications when it refers to an output stream.
 If the application sets this to 0 for an output stream, then
 bytesused will be set to the size of the
 buffer (see the length field of this struct) by
@@ -720,14 +720,14 @@ linkend="buffer-flags" />.
Indicates the field order of the image in the
 buffer, see . This field is not used when
 the buffer contains VBI data. Drivers must set it when
-type refers to an input stream,
+type refers to a capture stream,
 applications when it refers to an output stream.
  
  
struct timeval
timestamp

-   For input streams this is time when the first data
+   For capture streams this is time when the first data
byte was captured, as returned by the
clock_gettime() function for the relevant
clock id; see V4L2_BUF_FLAG_TIMESTAMP_* in
@@ -866,7 +866,7 @@ must set this to 0.

The number of bytes occupied by data in the plane
  (its payload). Drivers must set this field when 
type
- refers to an input stream, applications when it refers to an 
output stream.
+ refers to a capture stream, applications when it refers to an 
output stream.
  If the application sets this to 0 for an output stream, then
  bytesused will be set to the size of 
the
  plane (see the length field of this 
struct)
@@ -919,7 +919,7 @@ must set this to 0.

Offset in bytes to video data in the plane.
  Drivers must set this field when type
- refers to an input stream, applications when it refers to an 
output stream.
+ refers to a capture stream, applications when it refers to an 
output stream.
  Note that data_offset is included in 
bytesused.
  So the size of the image in the plane is
  
bytesused-data_offset at
--
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] go7007: fix broken test

2015-10-22 Thread Hans Verkuil
The wrong flags field was tested for the GO7007_BOARD_HAS_AUDIO flag: that
flag is in board->main_info.flags, not in board->flags.

Signed-off-by: Hans Verkuil 
Reported-by: Dan Carpenter 

diff --git a/drivers/media/usb/go7007/go7007-usb.c 
b/drivers/media/usb/go7007/go7007-usb.c
index 4857c46..aa9eca4 100644
--- a/drivers/media/usb/go7007/go7007-usb.c
+++ b/drivers/media/usb/go7007/go7007-usb.c
@@ -1289,7 +1289,7 @@ static int go7007_usb_probe(struct usb_interface *intf,

/* Allocate the URBs and buffers for receiving the audio stream */
if ((board->flags & GO7007_USB_EZUSB) &&
-   (board->flags & GO7007_BOARD_HAS_AUDIO)) {
+   (board->main_info.flags & GO7007_BOARD_HAS_AUDIO)) {
for (i = 0; i < 8; ++i) {
usb->audio_urbs[i] = usb_alloc_urb(0, GFP_KERNEL);
if (usb->audio_urbs[i] == NULL)
--
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] uvcvideo: small cleanup in uvc_video_clock_update()

2015-10-22 Thread Dan Carpenter
Smatch is not smart enough to see that "&stream->clock.lock" and
"&clock->lock" are the same thing so it complains about the locking
here.  Let's make it more consistent.

Signed-off-by: Dan Carpenter 

diff --git a/drivers/media/usb/uvc/uvc_video.c 
b/drivers/media/usb/uvc/uvc_video.c
index 2b276ab..4abe3e9 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -709,7 +709,7 @@ void uvc_video_clock_update(struct uvc_streaming *stream,
vbuf->timestamp.tv_usec = ts.tv_nsec / NSEC_PER_USEC;
 
 done:
-   spin_unlock_irqrestore(&stream->clock.lock, flags);
+   spin_unlock_irqrestore(&clock->lock, flags);
 }
 
 /* 
--
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


[GIT PULL for v4.3] media fixes

2015-10-22 Thread Mauro Carvalho Chehab
Hi Linus

Please pull from:
  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media media/v4.3-4

For some regression fixes and potential security issues:
- netup_unidvb: fix potential crash when spi is NULL
- rtl28xxu: fix control message flaws
- m88ds3103: fix a regression on Kernel 4.2;
- c8sectpfe: fix some issues on this new driver;
- v4l2-flash-led-class: fix a Kbuild dependency;
- si2157 and si2158: check for array boundary when uploading
  firmware files;
- horus3a and lnbh25: fix some building troubles when some options
  aren't selected;
- ir-hix5hd2: drop the use of IRQF_NO_SUSPEND

Thanks!
Mauro

-

PS.: Those patches are at linux next, but I had do do a rebase, as
there were other patches there on my fixes branch that were meant
to go only for 4.4. Normally, I would re-push and wait for it to be
merged on -next, but Steven won't be releasing a -next version until
Nov, 2.

The following changes since commit 6ff33f3902c3b1c5d0db6b1e2c70b6d76fba357f:

  Linux 4.3-rc1 (2015-09-12 16:35:56 -0700)

are available in the git repository at:

  git://git.kernel.org/pub/scm/linux/kernel/git/mchehab/linux-media media/v4.3-4

for you to fetch changes up to 56ea37da3b93dfe46cb5c3ee0ee4cc44229ece47:

  [media] m88ds3103: use own reg update_bits() implementation (2015-10-22 
15:48:28 -0200)


media fixes for v4.3-rc7


Abylay Ospan (1):
  [media] netup_unidvb: fix potential crash when spi is NULL

Antti Palosaari (2):
  [media] rtl28xxu: fix control message flaws
  [media] m88ds3103: use own reg update_bits() implementation

Colin Ian King (1):
  [media] c8sectpfe: fix ininitialized error return on firmware load failure

Jacek Anaszewski (1):
  [media] v4l2-flash-led-class: Add missing VIDEO_V4L2 Kconfig dependency

Javier Martinez Canillas (2):
  [media] horus3a: Fix horus3a_attach() function parameters
  [media] lnbh25: Fix lnbh25_attach() function return type

Laura Abbott (2):
  [media] si2157: Bounds check firmware
  [media] si2168: Bounds check firmware

Sudeep Holla (1):
  [media] ir-hix5hd2: drop the use of IRQF_NO_SUSPEND

Sudip Mukherjee (1):
  [media] c8sectpfe: fix return of garbage

 drivers/media/dvb-frontends/horus3a.h |  4 +-
 drivers/media/dvb-frontends/lnbh25.h  |  2 +-
 drivers/media/dvb-frontends/m88ds3103.c   | 73 +-
 drivers/media/dvb-frontends/si2168.c  |  4 +
 drivers/media/pci/netup_unidvb/netup_unidvb_spi.c | 12 +-
 drivers/media/platform/sti/c8sectpfe/c8sectpfe-core.c |  7 +-
 drivers/media/rc/ir-hix5hd2.c |  2 +-
 drivers/media/tuners/si2157.c |  4 +
 drivers/media/usb/dvb-usb-v2/rtl28xxu.c   | 15 +-
 drivers/media/usb/dvb-usb-v2/rtl28xxu.h   |  2 +-
 drivers/media/v4l2-core/Kconfig   |  2 +-
 11 files changed, 81 insertions(+), 46 deletions(-)

--
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


Your Inheritance

2015-10-22 Thread
Hello,

I wish to notify you that late Gianni Agnelli, had included you as beneficiary 
of his Will. He left the sum of sixty Million, Five Hundred Thousand Dollars 
(US$60, 500,000.00) to you in the Codicil and last testament to his Will. This 
may sound strange and unbelievable to you; you are advised to contact Hollis 
Grey Chambers via our personal email address:  holli...@foxmail.com

Regards,
Hollis Grey Chambers.
--
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: OK

2015-10-22 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:   Fri Oct 23 04:00:18 CEST 2015
git branch: test
git hash:   79f5b6ae960d380c829fb67d5dadcd1d025d2775
gcc version:i686-linux-gcc (GCC) 5.1.0
sparse version: v0.5.0-51-ga53cea2
smatch version: 0.4.1-3153-g7d56ab3
host hardware:  x86_64
host os:4.0.0-3.slh.1-amd64

linux-git-arm-at91: OK
linux-git-arm-davinci: OK
linux-git-arm-exynos: OK
linux-git-arm-mx: OK
linux-git-arm-omap: OK
linux-git-arm-omap1: OK
linux-git-arm-pxa: OK
linux-git-blackfin-bf561: 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.32.27-i686: OK
linux-2.6.33.7-i686: OK
linux-2.6.34.7-i686: OK
linux-2.6.35.9-i686: OK
linux-2.6.36.4-i686: OK
linux-2.6.37.6-i686: OK
linux-2.6.38.8-i686: OK
linux-2.6.39.4-i686: OK
linux-3.0.60-i686: OK
linux-3.1.10-i686: OK
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: OK
linux-3.7.4-i686: OK
linux-3.8-i686: OK
linux-3.9.2-i686: OK
linux-3.10.1-i686: OK
linux-3.11.1-i686: OK
linux-3.12.23-i686: OK
linux-3.13.11-i686: OK
linux-3.14.9-i686: OK
linux-3.15.2-i686: OK
linux-3.16.7-i686: OK
linux-3.17.8-i686: OK
linux-3.18.7-i686: OK
linux-3.19-i686: OK
linux-4.0-i686: OK
linux-4.1.1-i686: OK
linux-4.2-i686: OK
linux-4.3-rc1-i686: OK
linux-2.6.32.27-x86_64: OK
linux-2.6.33.7-x86_64: OK
linux-2.6.34.7-x86_64: OK
linux-2.6.35.9-x86_64: OK
linux-2.6.36.4-x86_64: OK
linux-2.6.37.6-x86_64: OK
linux-2.6.38.8-x86_64: OK
linux-2.6.39.4-x86_64: OK
linux-3.0.60-x86_64: OK
linux-3.1.10-x86_64: OK
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: OK
linux-3.7.4-x86_64: OK
linux-3.8-x86_64: OK
linux-3.9.2-x86_64: OK
linux-3.10.1-x86_64: OK
linux-3.11.1-x86_64: OK
linux-3.12.23-x86_64: OK
linux-3.13.11-x86_64: OK
linux-3.14.9-x86_64: OK
linux-3.15.2-x86_64: OK
linux-3.16.7-x86_64: OK
linux-3.17.8-x86_64: OK
linux-3.18.7-x86_64: OK
linux-3.19-x86_64: OK
linux-4.0-x86_64: OK
linux-4.1.1-x86_64: OK
linux-4.2-x86_64: OK
linux-4.3-rc1-x86_64: OK
apps: OK
spec-git: OK
sparse: WARNINGS
smatch: ERRORS

Detailed results are available here:

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

Full logs are available here:

http://www.xs4all.nl/~hverkuil/logs/Friday.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] Staging: media: lirc Braces not needed for single statement

2015-10-22 Thread Nilesh Kokane
Fixed the braces issue for single statement.

Signed-off-by: Nilesh Kokane 
---
 drivers/staging/media/lirc/lirc_imon.c | 6 ++
 1 file changed, 2 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/media/lirc/lirc_imon.c 
b/drivers/staging/media/lirc/lirc_imon.c
index 62ec9f7..a6cae49 100644
--- a/drivers/staging/media/lirc/lirc_imon.c
+++ b/drivers/staging/media/lirc/lirc_imon.c
@@ -785,13 +785,11 @@ static int imon_probe(struct usb_interface *interface,
}
 
driver = kzalloc(sizeof(struct lirc_driver), GFP_KERNEL);
-   if (!driver) {
+   if (!driver)
goto free_context;
-   }
rbuf = kmalloc(sizeof(struct lirc_buffer), GFP_KERNEL);
-   if (!rbuf) {
+   if (!rbuf)
goto free_driver;
-   }
if (lirc_buffer_init(rbuf, BUF_CHUNK_SIZE, BUF_SIZE)) {
dev_err(dev, "%s: lirc_buffer_init failed\n", __func__);
goto free_rbuf;
-- 
1.9.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