All of lore.kernel.org
 help / color / mirror / Atom feed
From: biju.das@bp.renesas.com (Biju Das)
To: cip-dev@lists.cip-project.org
Subject: [cip-dev] [PATCH 4.19.y-cip 32/57] ASoC: rsnd: use ring buffer for rsnd_mod_name()
Date: Thu, 17 Oct 2019 08:05:04 +0100	[thread overview]
Message-ID: <1571295929-47286-33-git-send-email-biju.das@bp.renesas.com> (raw)
In-Reply-To: <1571295929-47286-1-git-send-email-biju.das@bp.renesas.com>

From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>

commit 0246c661b6f0051ef7bfbfff01d8ef7fd0359372 upstream.

commit c0ea089dbad4 ("ASoC: rsnd: rsnd_mod_name() handles both name and
ID") merged "name" and "ID" on rsnd_mod_name() to handle sub-ID
(= for CTU/BUSIF).
Then, it decided to share static char to avoid pointless memory.
But, it doesn't work correctry in below case, because last called
name will be used.

	dev_xxx(dev, "%s is connected to %s\n",
		rsnd_mod_name(mod_a),  /* ssiu[00] */
		rsnd_mod_name(mod_b)); /* ssi[0]   */
	->
	rcar_sound ec500000.sound: ssi[0] is connected to ssi[0]
	                           ~~~~~~                 ~~~~~~
We still don't want to have pointless memory, so let's use ring buffer.
16byte x 5 is very enough for this purpose.

	dev_xxx(dev, "%s is connected to %s\n",
		rsnd_mod_name(mod_a),  /* ssiu[00] */
		rsnd_mod_name(mod_b)); /* ssi[0]   */
	->
	rcar_sound ec500000.sound: ssiu[00] is connected to ssi[0]
	                           ~~~~~~~~                 ~~~~~~
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Mark Brown <broonie@kernel.org>
Signed-off-by: Biju Das <biju.das@bp.renesas.com>
---
 sound/soc/sh/rcar/core.c | 9 ++++++++-
 1 file changed, 8 insertions(+), 1 deletion(-)

diff --git a/sound/soc/sh/rcar/core.c b/sound/soc/sh/rcar/core.c
index f0c0114..2697046 100644
--- a/sound/soc/sh/rcar/core.c
+++ b/sound/soc/sh/rcar/core.c
@@ -137,10 +137,17 @@ struct dma_chan *rsnd_mod_dma_req(struct rsnd_dai_stream *io,
 	return mod->ops->dma_req(io, mod);
 }
 
+#define MOD_NAME_NUM   5
 #define MOD_NAME_SIZE 16
 char *rsnd_mod_name(struct rsnd_mod *mod)
 {
-	static char name[MOD_NAME_SIZE];
+	static char names[MOD_NAME_NUM][MOD_NAME_SIZE];
+	static int num;
+	char *name = names[num];
+
+	num++;
+	if (num >= MOD_NAME_NUM)
+		num = 0;
 
 	/*
 	 * Let's use same char to avoid pointlessness memory
-- 
2.7.4

  parent reply	other threads:[~2019-10-17  7:05 UTC|newest]

Thread overview: 106+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-10-17  7:04 [cip-dev] [PATCH 4.19.y-cip 00/57] Audio improvements/SSIU BUSIF/ Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 01/57] ASoC: rsnd: add warning message to rsnd_kctrl_accept_runtime() Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 02/57] ASoC: rsnd: add support for 16/24 bit slot widths Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 03/57] ASoC: rsnd: add support for 8 bit S8 format Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 04/57] ASoC: rsnd: remove is_play parameter from hw_rule function Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 05/57] ASoC: rsnd: ssi: Fix issue in dma data address assignment Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 06/57] ASoC: rsnd: ssi: Check runtime channel number rather than hw_params Biju Das
2019-10-20  9:12   ` Pavel Machek
2019-10-21 12:10     ` Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 07/57] ASoc: rsnd: dma: Calculate dma address with consider of BUSIF Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 08/57] ASoc: rsnd: dma: Calculate PDMACHCRE " Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 09/57] ASoC: rsnd: ssiu: Support BUSIF other than BUSIF0 Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 10/57] ASoC: rsnd: ssiu: Support to init different BUSIF instance Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 11/57] ASoC: rsnd: merge .nolock_start and .prepare Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 12/57] ASoC: rsnd: gen: use tab instead of white-space Biju Das
2019-10-20  9:22   ` Pavel Machek
2019-10-21 12:12     ` Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 13/57] ASoC: rsnd: don't use %p for dev_dbg() Biju Das
2019-10-20  9:27   ` Pavel Machek
2019-10-21 12:17     ` Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 14/57] ASoC: add for_each_rtd_codec_dai() macro Biju Das
2019-10-20  9:36   ` Pavel Machek
2019-10-21 12:18     ` Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 15/57] ASoC: convert for_each_rtd_codec_dai() for missing part Biju Das
2019-10-20  9:41   ` Pavel Machek
2019-10-21 12:22     ` Biju Das
2019-10-23  1:20       ` Kuninori Morimoto
2019-10-23  6:47         ` Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 16/57] ASoC: add for_each_dpcm_fe() macro Biju Das
2019-10-20  9:48   ` Pavel Machek
2019-10-21 12:26     ` Biju Das
2019-10-23  1:28       ` Kuninori Morimoto
2019-11-18 15:30         ` Pavel Machek
2019-11-19  1:24           ` Kuninori Morimoto
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 17/57] ASoC: add for_each_dpcm_be() macro Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 18/57] ASoC: rsnd: fixup SSI clock during suspend/resume modes Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 19/57] ASoC: rsnd: use 32bit TDM width as default Biju Das
2019-10-20  9:49   ` Pavel Machek
2019-10-21 13:54     ` Biju Das
2019-10-23  1:45       ` Kuninori Morimoto
2019-11-18 15:32         ` Pavel Machek
2019-11-19  0:53           ` Kuninori Morimoto
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 20/57] ASoC: rsnd: enable TDM settings for SSI parent Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 21/57] ASoC: rsnd: tidyup SSICR::SWSP for TDM Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 22/57] ASoC: rsnd: move .get_status under rsnd_mod_ops Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 23/57] ASoC: rsnd: add .get_id/.get_id_sub Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 24/57] ASoC: rsnd: rsnd_mod_name() handles both name and ID Biju Das
2019-10-20 10:34   ` Pavel Machek
2019-10-21 13:26     ` Biju Das
2019-11-18 15:34       ` Pavel Machek
2019-11-18 15:41         ` Biju Das
2019-11-19  1:03           ` Kuninori Morimoto
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 25/57] ASoC: rsnd: remove endpoint bidirectional check Biju Das
2019-10-20 10:38   ` Pavel Machek
2019-10-21 13:40     ` Biju Das
2019-10-23  1:38       ` Kuninori Morimoto
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 26/57] ASoC: rsnd: rename rsnd_runtime_is_ssi_xxx() Biju Das
2019-10-17  7:04 ` [cip-dev] [PATCH 4.19.y-cip 27/57] ASoC: rsnd: use defined io_playback/io_capture Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 28/57] ASoC: rsnd: move HDMI information from ssi.c to core.c Biju Das
2019-10-20 10:40   ` Pavel Machek
2019-10-21 13:48     ` Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 29/57] ASoC: rsnd: handle DPCM converted rate/chan under core Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 30/57] ASoC: rsnd: add SSIU BUSIF support Biju Das
2019-10-20 10:50   ` Pavel Machek
2019-10-21 13:46     ` Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 31/57] ASoC: rsnd: add TDM Split mode support Biju Das
2019-10-17  7:05 ` Biju Das [this message]
2019-10-20 10:54   ` [cip-dev] [PATCH 4.19.y-cip 32/57] ASoC: rsnd: use ring buffer for rsnd_mod_name() Pavel Machek
2019-10-21 13:50     ` Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 33/57] ASoC: rsnd: tidyup rsnd_parse_connect_ssiu_compatible() Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 34/57] ASoC: rsnd: makes rsnd_ssi_is_dma_mode() static Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 35/57] ASoC: rsnd: tidyup registering method for rsnd_kctrl_new() Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 36/57] ASoC: rsnd: indicates Channel and Mode for debug Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 37/57] ASoC: rsnd: fixup mod ID for CTU regmap read/write Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 38/57] ASoC: rsnd: add missing TDM Split mode support for simple-card Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 39/57] ASoC: rsnd: remove RSND_REG_ from rsnd_reg Biju Das
2019-10-25 12:03   ` Pavel Machek
2019-10-28  0:36     ` Kuninori Morimoto
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 40/57] ASoC: rsnd: update BSDSR/BSDISR handling Biju Das
2019-10-27  7:33   ` Pavel Machek
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 41/57] ASoC: rsnd: fixup MIX kctrl registration Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 42/57] ASoC: rsnd: synchronize connection check for simple-card/audio-graph Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 43/57] ASoC: rsnd: fixup TDM Split mode check for CTU Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 44/57] ASoC: sh: Avoid passing NULL to memory allocators Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 45/57] ASoC: sh: Drop superfluous PCM preallocation error checks Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 46/57] ASoC: rsnd: ssiu: correct shift bit for ssiu9 Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 47/57] ASoC: rsnd: gen: fix SSI9 4/5/6/7 busif related register address Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 48/57] ASoC: rsnd: src: Avoid a potential deadlock Biju Das
2019-10-27  7:45   ` Pavel Machek
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 49/57] ASoC: rsnd: src: fix compiler warnings Biju Das
2019-10-27  7:47   ` Pavel Machek
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 50/57] ASoC: rsnd: fixup 6ch settings to 8ch Biju Das
2019-10-27  7:51   ` Pavel Machek
2019-10-28  0:43     ` Kuninori Morimoto
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 51/57] ASoC: rsnd: move pcm_new from snd_soc_component_driver to snd_soc_dai_driver Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 52/57] ASoC: rsnd: fixup mod ID calculation in rsnd_ctu_probe_ Biju Das
2019-10-27  7:56   ` Pavel Machek
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 53/57] ASoC: rsnd: ssiu: tidyup SSI_MODE1/2 settings Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 54/57] ASoC: rsnd: add missing pin sharing with SSI9 Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 55/57] ASoC: rsnd: Support hw_free() callback at DAI level Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 56/57] ASoC: rsnd: do error check after rsnd_channel_normalization() Biju Das
2019-10-17  7:05 ` [cip-dev] [PATCH 4.19.y-cip 57/57] arm64: dts: renesas: r8a774a1: Add SSIU support for sound Biju Das
2019-10-18 21:49 ` [cip-dev] [PATCH 4.19.y-cip 00/57] Audio improvements/SSIU BUSIF/ Pavel Machek
2019-11-14 16:20 ` Biju Das
2019-11-15 21:46   ` Pavel Machek
2019-11-18  7:43     ` Biju Das

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=1571295929-47286-33-git-send-email-biju.das@bp.renesas.com \
    --to=biju.das@bp.renesas.com \
    --cc=cip-dev@lists.cip-project.org \
    /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.