From: Dan Carpenter <dan.carpenter@oracle.com>
To: Shuah Khan <shuahkh@osg.samsung.com>
Cc: mchehab@osg.samsung.com, tiwai@suse.com, clemens@ladisch.de,
hans.verkuil@cisco.com, laurent.pinchart@ideasonboard.com,
sakari.ailus@linux.intel.com, javier@osg.samsung.com,
pawel@osciak.com, m.szyprowski@samsung.com,
kyungmin.park@samsung.com, perex@perex.cz, arnd@arndb.de,
tvboxspy@gmail.com, crope@iki.fi, ruchandani.tina@gmail.com,
corbet@lwn.net, chehabrafael@gmail.com, k.kozlowski@samsung.com,
stefanr@s5r6.in-berlin.de, inki.dae@samsung.com,
jh1009.sung@samsung.com, elfring@users.sourceforge.net,
prabhakar.csengg@gmail.com, sw0312.kim@samsung.com,
p.zabel@pengutronix.de, ricardo.ribalda@gmail.com,
labbott@fedoraproject.org, pierre-louis.bossart@linux.intel.com,
ricard.wanderlof@axis.com, julian@jusst.de,
takamichiho@gmail.com, dominic.sacre@gmx.de, misterpib@gmail.com,
daniel@zonque.org, gtmkramer@xs4all.nl, normalperson@yhbt.net,
joe@oampo.co.uk, linuxbugs@vittgam.net, johan@oljud.se,
klock.android@gmail.com, nenggun.kim@samsung.com,
j.anaszewski@samsung.com, geliangtang@163.com,
albert@huitsing.nl, linux-kernel@vger.kernel.org,
linux-media@vger.kernel.org, alsa-devel@alsa-project.org
Subject: Re: [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources
Date: Wed, 2 Mar 2016 23:41:31 +0300 [thread overview]
Message-ID: <20160302204131.GV5273@mwanda> (raw)
In-Reply-To: <1456937431-3794-1-git-send-email-shuahkh@osg.samsung.com>
On Wed, Mar 02, 2016 at 09:50:31AM -0700, Shuah Khan wrote:
> + mctl = kzalloc(sizeof(*mctl), GFP_KERNEL);
> + if (!mctl)
> + return -ENOMEM;
> +
> + mctl->media_dev = mdev;
> + if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
> + intf_type = MEDIA_INTF_T_ALSA_PCM_PLAYBACK;
> + mctl->media_entity.function = MEDIA_ENT_F_AUDIO_PLAYBACK;
> + mctl->media_pad.flags = MEDIA_PAD_FL_SOURCE;
> + mixer_pad = 1;
> + } else {
> + intf_type = MEDIA_INTF_T_ALSA_PCM_CAPTURE;
> + mctl->media_entity.function = MEDIA_ENT_F_AUDIO_CAPTURE;
> + mctl->media_pad.flags = MEDIA_PAD_FL_SINK;
> + mixer_pad = 2;
> + }
> + mctl->media_entity.name = pcm->name;
> + media_entity_pads_init(&mctl->media_entity, 1, &mctl->media_pad);
> + ret = media_device_register_entity(mctl->media_dev,
> + &mctl->media_entity);
> + if (ret)
> + goto err1;
Could we give this label a meaningful name instead of a number?
goto free_mctl;
> +
> + mctl->intf_devnode = media_devnode_create(mdev, intf_type, 0,
> + MAJOR(pcm_dev->devt),
> + MINOR(pcm_dev->devt));
> + if (!mctl->intf_devnode) {
> + ret = -ENOMEM;
> + goto err2;
goto unregister_device;
> + }
> + mctl->intf_link = media_create_intf_link(&mctl->media_entity,
> + &mctl->intf_devnode->intf,
> + MEDIA_LNK_FL_ENABLED);
> + if (!mctl->intf_link) {
> + ret = -ENOMEM;
> + goto err3;
goto delete_devnode;
> + }
> +
> + /* create link between mixer and audio */
> + media_device_for_each_entity(entity, mdev) {
> + switch (entity->function) {
> + case MEDIA_ENT_F_AUDIO_MIXER:
> + ret = media_create_pad_link(entity, mixer_pad,
> + &mctl->media_entity, 0,
> + MEDIA_LNK_FL_ENABLED);
> + if (ret)
> + goto err4;
This is a bit weird because we're inside a loop. Shouldn't we call
media_entity_remove_links() or something if this is the second time
through the loop?
I don't understand this. The kernel has the media_entity_cleanup() stub
function which is supposed to do this but it hasn't been implemented
yet?
regards,
dan carpenter
next prev parent reply other threads:[~2016-03-02 20:44 UTC|newest]
Thread overview: 12+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-03-02 16:50 [PATCH v5 22/22] sound/usb: Use Media Controller API to share media resources Shuah Khan
2016-03-02 20:41 ` Dan Carpenter [this message]
2016-03-02 22:57 ` Shuah Khan
2016-03-03 10:36 ` Dan Carpenter
2016-03-03 14:25 ` Shuah Khan
2016-03-03 18:21 ` Mauro Carvalho Chehab
2016-03-03 19:06 ` Shuah Khan
2016-03-05 10:00 ` Mauro Carvalho Chehab
2016-03-07 14:16 ` Shuah Khan
2016-03-07 20:03 ` Shuah Khan
2016-03-07 22:06 ` Shuah Khan
2016-03-07 22:10 ` Shuah Khan
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160302204131.GV5273@mwanda \
--to=dan.carpenter@oracle.com \
--cc=albert@huitsing.nl \
--cc=alsa-devel@alsa-project.org \
--cc=arnd@arndb.de \
--cc=chehabrafael@gmail.com \
--cc=clemens@ladisch.de \
--cc=corbet@lwn.net \
--cc=crope@iki.fi \
--cc=daniel@zonque.org \
--cc=dominic.sacre@gmx.de \
--cc=elfring@users.sourceforge.net \
--cc=geliangtang@163.com \
--cc=gtmkramer@xs4all.nl \
--cc=hans.verkuil@cisco.com \
--cc=inki.dae@samsung.com \
--cc=j.anaszewski@samsung.com \
--cc=javier@osg.samsung.com \
--cc=jh1009.sung@samsung.com \
--cc=joe@oampo.co.uk \
--cc=johan@oljud.se \
--cc=julian@jusst.de \
--cc=k.kozlowski@samsung.com \
--cc=klock.android@gmail.com \
--cc=kyungmin.park@samsung.com \
--cc=labbott@fedoraproject.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-media@vger.kernel.org \
--cc=linuxbugs@vittgam.net \
--cc=m.szyprowski@samsung.com \
--cc=mchehab@osg.samsung.com \
--cc=misterpib@gmail.com \
--cc=nenggun.kim@samsung.com \
--cc=normalperson@yhbt.net \
--cc=p.zabel@pengutronix.de \
--cc=pawel@osciak.com \
--cc=perex@perex.cz \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=prabhakar.csengg@gmail.com \
--cc=ricard.wanderlof@axis.com \
--cc=ricardo.ribalda@gmail.com \
--cc=ruchandani.tina@gmail.com \
--cc=sakari.ailus@linux.intel.com \
--cc=shuahkh@osg.samsung.com \
--cc=stefanr@s5r6.in-berlin.de \
--cc=sw0312.kim@samsung.com \
--cc=takamichiho@gmail.com \
--cc=tiwai@suse.com \
--cc=tvboxspy@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox