All of lore.kernel.org
 help / color / mirror / Atom feed
From: Mark Brown <broonie@kernel.org>
To: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Cc: Linux-ALSA <alsa-devel@alsa-project.org>,
	Mark Brown <broonie@kernel.org>
Subject: Applied "ASoC: soc-component: add snd_soc_pcm_component_mmap()" to the asoc tree
Date: Mon,  5 Aug 2019 17:09:56 +0100 (BST)	[thread overview]
Message-ID: <20190805160956.653CF2742EB0@ypsilon.sirena.org.uk> (raw)
In-Reply-To: <87muh14d02.wl-kuninori.morimoto.gx@renesas.com>

The patch

   ASoC: soc-component: add snd_soc_pcm_component_mmap()

has been applied to the asoc tree at

   https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-5.4

All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.  

You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.

If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.

Please add any relevant lists and maintainers to the CCs when replying
to this mail.

Thanks,
Mark

>From 205875e1a12ef9c61e939db9ded90fe3f6352e75 Mon Sep 17 00:00:00 2001
From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Date: Fri, 26 Jul 2019 13:52:04 +0900
Subject: [PATCH] ASoC: soc-component: add snd_soc_pcm_component_mmap()

Current ALSA SoC is directly using component->driver->ops->xxx,
thus, the code nested deeply, and it makes code difficult to read,
and is not good for encapsulation.

We want to implement component related function at soc-component.c,
but, some of them need to care whole snd_soc_pcm_runtime (= rtd)
connected component.

Let's call component related function which need to care with
for_each_rtdcom() loop as snd_soc_pcm_component_xxx().
This patch adds new snd_soc_pcm_component_mmap() and use it.

Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Link: https://lore.kernel.org/r/87muh14d02.wl-kuninori.morimoto.gx@renesas.com
Signed-off-by: Mark Brown <broonie@kernel.org>
---
 include/sound/soc-component.h |  2 ++
 sound/soc/soc-component.c     | 19 +++++++++++++++++++
 sound/soc/soc-pcm.c           | 23 +----------------------
 3 files changed, 22 insertions(+), 22 deletions(-)

diff --git a/include/sound/soc-component.h b/include/sound/soc-component.h
index 4cab257962a6..dd1ea5d71998 100644
--- a/include/sound/soc-component.h
+++ b/include/sound/soc-component.h
@@ -379,5 +379,7 @@ int snd_soc_pcm_component_copy_user(struct snd_pcm_substream *substream,
 				    void __user *buf, unsigned long bytes);
 struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
 					unsigned long offset);
+int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
+			       struct vm_area_struct *vma);
 
 #endif /* __SOC_COMPONENT_H */
diff --git a/sound/soc/soc-component.c b/sound/soc/soc-component.c
index d503bc9b0850..2aff1b087522 100644
--- a/sound/soc/soc-component.c
+++ b/sound/soc/soc-component.c
@@ -506,3 +506,22 @@ struct page *snd_soc_pcm_component_page(struct snd_pcm_substream *substream,
 
 	return NULL;
 }
+
+int snd_soc_pcm_component_mmap(struct snd_pcm_substream *substream,
+			       struct vm_area_struct *vma)
+{
+	struct snd_soc_pcm_runtime *rtd = substream->private_data;
+	struct snd_soc_rtdcom_list *rtdcom;
+	struct snd_soc_component *component;
+
+	for_each_rtdcom(rtd, rtdcom) {
+		component = rtdcom->component;
+
+		/* FIXME. it returns 1st mmap now */
+		if (component->driver->ops &&
+		    component->driver->ops->mmap)
+			return component->driver->ops->mmap(substream, vma);
+	}
+
+	return -EINVAL;
+}
diff --git a/sound/soc/soc-pcm.c b/sound/soc/soc-pcm.c
index fe34f2e5d75e..7bbee0d71942 100644
--- a/sound/soc/soc-pcm.c
+++ b/sound/soc/soc-pcm.c
@@ -2818,27 +2818,6 @@ static void soc_pcm_private_free(struct snd_pcm *pcm)
 	}
 }
 
-static int soc_rtdcom_mmap(struct snd_pcm_substream *substream,
-			   struct vm_area_struct *vma)
-{
-	struct snd_soc_pcm_runtime *rtd = substream->private_data;
-	struct snd_soc_rtdcom_list *rtdcom;
-	struct snd_soc_component *component;
-
-	for_each_rtdcom(rtd, rtdcom) {
-		component = rtdcom->component;
-
-		if (!component->driver->ops ||
-		    !component->driver->ops->mmap)
-			continue;
-
-		/* FIXME. it returns 1st mmap now */
-		return component->driver->ops->mmap(substream, vma);
-	}
-
-	return -EINVAL;
-}
-
 /* create a new pcm */
 int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 {
@@ -2968,7 +2947,7 @@ int soc_new_pcm(struct snd_soc_pcm_runtime *rtd, int num)
 		if (ops->page)
 			rtd->ops.page		= snd_soc_pcm_component_page;
 		if (ops->mmap)
-			rtd->ops.mmap		= soc_rtdcom_mmap;
+			rtd->ops.mmap		= snd_soc_pcm_component_mmap;
 	}
 
 	if (playback)
-- 
2.20.1

  reply	other threads:[~2019-08-05 16:09 UTC|newest]

Thread overview: 61+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-07-26  4:48 [PATCH v2 00/29] ASoC: add soc-component.c Kuninori Morimoto
2019-07-26  4:49 ` [PATCH v2 01/29] ASoC: Intel: skl-pcm: disable skl_get_time_info Kuninori Morimoto
2019-08-05 15:45   ` Mark Brown
2019-08-05 16:06     ` Pierre-Louis Bossart
2019-08-06  0:00       ` Kuninori Morimoto
2019-07-26  4:49 ` [PATCH v2 02/29] ASoC: soc-pcm: remove soc_rtdcom_ack() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-pcm: remove soc_rtdcom_ack()" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 03/29] ASoC: soc-pcm: remove soc_rtdcom_copy_kernel() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-pcm: remove soc_rtdcom_copy_kernel()" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 04/29] ASoC: soc-pcm: remove soc_fill_silence() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-pcm: remove soc_fill_silence()" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 05/29] ASoC: add soc-component.c Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: add soc-component.c" to the asoc tree Mark Brown
2019-07-26  4:49 ` [PATCH v2 06/29] ASoC: soc-component: add snd_soc_component_get/put() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_get/put()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 07/29] ASoC: soc-component: add snd_soc_component_open() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_open()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 08/29] ASoC: soc-component: add snd_soc_component_close() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_close()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 09/29] ASoC: soc-component: add snd_soc_component_prepare() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_prepare()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 10/29] ASoC: soc-component: add snd_soc_component_hw_params() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_hw_params()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 11/29] ASoC: soc-component: add snd_soc_component_hw_free() Kuninori Morimoto
2019-08-05 16:10   ` Applied "ASoC: soc-component: add snd_soc_component_hw_free()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 12/29] ASoC: soc-component: add snd_soc_component_trigger() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_trigger()" to the asoc tree Mark Brown
2019-07-26  4:50 ` [PATCH v2 13/29] ASoC: soc-component: add snd_soc_component_suspend() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_suspend()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 14/29] ASoC: soc-component: add snd_soc_component_resume() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_resume()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 15/29] ASoC: soc-component: add snd_soc_component_is_suspended() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_is_suspended()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 16/29] ASoC: soc-component: add snd_soc_component_probe() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_probe()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 17/29] ASoC: soc-component: add snd_soc_component_remove() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_remove()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 18/29] ASoC: soc-component: add snd_soc_component_of_xlate_dai_id() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_of_xlate_dai_id()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 19/29] ASoC: soc-component: add snd_soc_component_of_xlate_dai_name() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_component_of_xlate_dai_name()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 20/29] ASoC: soc-component: move snd_soc_component_seq_notifier() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: move snd_soc_component_seq_notifier()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 21/29] ASoC: soc-component: move snd_soc_component_stream_event() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: move snd_soc_component_stream_event()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 22/29] ASoC: soc-component: move snd_soc_component_set_bias_level() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: move snd_soc_component_set_bias_level()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 23/29] ASoC: soc-component: add snd_soc_pcm_component_pointer() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_pointer()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 24/29] ASoC: soc-component: add snd_soc_pcm_component_ioctrl() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_ioctrl()" to the asoc tree Mark Brown
2019-07-26  4:51 ` [PATCH v2 25/29] ASoC: soc-component: add snd_soc_pcm_component_copy_user() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_copy_user()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 26/29] ASoC: soc-component: add snd_soc_pcm_component_page() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_page()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 27/29] ASoC: soc-component: add snd_soc_pcm_component_mmap() Kuninori Morimoto
2019-08-05 16:09   ` Mark Brown [this message]
2019-07-26  4:52 ` [PATCH v2 28/29] ASoC: soc-component: add snd_soc_pcm_component_pcm_new() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_pcm_new()" to the asoc tree Mark Brown
2019-07-26  4:52 ` [PATCH v2 29/29] ASoC: soc-component: add snd_soc_pcm_component_pcm_free() Kuninori Morimoto
2019-08-05 16:09   ` Applied "ASoC: soc-component: add snd_soc_pcm_component_pcm_free()" to the asoc tree Mark Brown

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=20190805160956.653CF2742EB0@ypsilon.sirena.org.uk \
    --to=broonie@kernel.org \
    --cc=alsa-devel@alsa-project.org \
    --cc=kuninori.morimoto.gx@renesas.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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.