From: Clemens Ladisch <clemens@ladisch.de>
To: Takashi Iwai <tiwai@suse.de>,
Mark Brown <broonie@opensource.wolfsonmicro.com>,
alsa-devel@alsa-project.org
Subject: [RFC PATCH 06/11] ALSA: implement MEDIA_IOC_SETUP_LINK
Date: Tue, 28 Aug 2012 00:32:31 +0200 [thread overview]
Message-ID: <503BF57F.6060703@ladisch.de> (raw)
In-Reply-To: <503BF48E.1090100@ladisch.de>
Just for compatibility with the media controller API, implement the
setup link ioctl, which does not actually do anything.
Signed-off-by: Clemens Ladisch <clemens@ladisch.de>
---
sound/core/media.c | 41 +++++++++++++++++++++++++++++++++++++++++
1 files changed, 41 insertions(+), 0 deletions(-)
diff --git a/sound/core/media.c b/sound/core/media.c
index aa90848..cbc51d9 100644
--- a/sound/core/media.c
+++ b/sound/core/media.c
@@ -289,6 +289,45 @@ static int snd_media_enum_links(struct snd_card *card,
return 0;
}
+static int snd_media_setup_link(struct snd_card *card,
+ struct media_link_desc __user *descp)
+{
+ struct media_link_desc desc;
+ struct snd_media_entity *source, *sink;
+ struct snd_media_link *link;
+ unsigned int i;
+ int err;
+
+ if (copy_from_user(&desc, descp, sizeof(desc)))
+ return -EFAULT;
+
+ if (desc.flags != (MEDIA_LNK_FL_ENABLED | MEDIA_LNK_FL_IMMUTABLE))
+ return -EINVAL;
+
+ mutex_lock(&card->media_mutex);
+ source = search_entity(card, desc.source.entity);
+ sink = search_entity(card, desc.sink.entity);
+ mutex_unlock(&card->media_mutex);
+ if (!source || !sink)
+ return -EINVAL;
+
+ err = -EINVAL;
+ mutex_lock(&card->media_mutex);
+ for (i = 0; i < card->media_links_count; i++) {
+ link = &card->media_links[i];
+ if (link->source_entity == desc.source.entity &&
+ link->sink_entity == desc.sink.entity &&
+ link->source_pad == desc.source.index &&
+ link->sink_pad == desc.sink.index) {
+ err = 0;
+ break;
+ }
+ }
+ mutex_unlock(&card->media_mutex);
+
+ return err;
+}
+
static int snd_media_control_ioctl(struct snd_card *card,
struct snd_ctl_file *ctl_file,
unsigned int cmd, unsigned long arg)
@@ -302,6 +341,8 @@ static int snd_media_control_ioctl(struct snd_card *card,
return snd_media_enum_entities(card, argp);
case MEDIA_IOC_ENUM_LINKS:
return snd_media_enum_links(card, argp);
+ case MEDIA_IOC_SETUP_LINK:
+ return snd_media_setup_link(card, argp);
default:
return -ENOIOCTLCMD;
}
next prev parent reply other threads:[~2012-08-27 22:33 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2012-08-27 22:28 [RFC PATCH 1/11] expose sound device topology information Clemens Ladisch
2012-08-27 22:29 ` [RFC PATCH 01/11] ALSA: implement MEDIA_IOC_DEVICE_INFO Clemens Ladisch
2012-09-07 2:13 ` Mark Brown
2012-09-07 7:14 ` Clemens Ladisch
2012-09-07 10:40 ` Takashi Iwai
2012-08-27 22:30 ` [RFC PATCH 02/11] ALSA: implement MEDIA_IOC_ENUM_ENTITIES Clemens Ladisch
2012-08-27 22:30 ` [RFC PATCH 03/11] ALSA: pcm: add ALSA PCM device entities Clemens Ladisch
2012-08-27 22:31 ` [RFC PATCH 04/11] ALSA: implement MEDIA_IOC_ENUM_LINKS (1) Clemens Ladisch
2012-08-27 22:31 ` [RFC PATCH 05/11] ALSA: implement MEDIA_IOC_ENUM_LINKS (2) Clemens Ladisch
2012-08-27 22:32 ` Clemens Ladisch [this message]
2012-08-27 22:33 ` [RFC PATCH 07/11] [media] media: add entity types for ALSA Clemens Ladisch
2012-08-27 22:33 ` [RFC PATCH 08/11] ALSA: usb-audio: implement card get_info callback Clemens Ladisch
2012-08-27 22:34 ` [RFC PATCH 09/11] ALSA: usb-audio: create PCM device entities Clemens Ladisch
2012-08-27 22:35 ` [RFC PATCH 10/11] ALSA: usb-audio: add terminal/unit entities and links Clemens Ladisch
2012-08-27 22:36 ` [RFC PATCH 11/11] ALSA: hda-intel: implement card get_info callback Clemens Ladisch
2012-09-04 15:56 ` [RFC PATCH 1/11] expose sound device topology information Takashi Iwai
2012-09-04 18:02 ` Clemens Ladisch
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=503BF57F.6060703@ladisch.de \
--to=clemens@ladisch.de \
--cc=alsa-devel@alsa-project.org \
--cc=broonie@opensource.wolfsonmicro.com \
--cc=tiwai@suse.de \
/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;
as well as URLs for NNTP newsgroup(s).