From: Cezary Rojewski <cezary.rojewski@intel.com>
To: alsa-devel@alsa-project.org
Cc: pierre-louis.bossart@linux.intel.com,
Cezary Rojewski <cezary.rojewski@intel.com>,
lars@metafoo.de, olivier.moysan@st.com, alexandre.torgue@st.com,
tiwai@suse.com, arnaud.pouliquen@st.com, lgirdwood@gmail.com,
broonie@kernel.org, mcoquelin.stm32@gmail.com
Subject: [PATCH 2/3] ASoC: core: Simplify snd_soc_component_initialize declaration
Date: Fri, 31 Jul 2020 16:41:45 +0200 [thread overview]
Message-ID: <20200731144146.6678-3-cezary.rojewski@intel.com> (raw)
In-Reply-To: <20200731144146.6678-1-cezary.rojewski@intel.com>
Move 'name' field initialization responsibility back to
snd_soc_component_initialize to prepare snd_soc_add_component function
for being called separatelly as a second registration step.
Signed-off-by: Cezary Rojewski <cezary.rojewski@intel.com>
---
include/sound/soc.h | 2 +-
sound/soc/soc-core.c | 18 ++++++++----------
2 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/include/sound/soc.h b/include/sound/soc.h
index 77a304d36c61..787374362f83 100644
--- a/include/sound/soc.h
+++ b/include/sound/soc.h
@@ -416,7 +416,7 @@ static inline int snd_soc_resume(struct device *dev)
int snd_soc_poweroff(struct device *dev);
int snd_soc_component_initialize(struct snd_soc_component *component,
const struct snd_soc_component_driver *driver,
- struct device *dev, const char *name);
+ struct device *dev);
int snd_soc_add_component(struct device *dev,
struct snd_soc_component *component,
const struct snd_soc_component_driver *component_driver,
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 236755c7a79e..f528367bc3be 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -2443,14 +2443,19 @@ static void snd_soc_del_component_unlocked(struct snd_soc_component *component)
int snd_soc_component_initialize(struct snd_soc_component *component,
const struct snd_soc_component_driver *driver,
- struct device *dev, const char *name)
+ struct device *dev)
{
INIT_LIST_HEAD(&component->dai_list);
INIT_LIST_HEAD(&component->dobj_list);
INIT_LIST_HEAD(&component->card_list);
mutex_init(&component->io_mutex);
- component->name = name;
+ component->name = fmt_single_name(dev, &component->id);
+ if (!component->name) {
+ dev_err(dev, "ASoC: Failed to allocate name\n");
+ return -ENOMEM;
+ }
+
component->dev = dev;
component->driver = driver;
@@ -2464,19 +2469,12 @@ int snd_soc_add_component(struct device *dev,
struct snd_soc_dai_driver *dai_drv,
int num_dai)
{
- const char *name = fmt_single_name(dev, &component->id);
int ret;
int i;
- if (!name) {
- dev_err(dev, "ASoC: Failed to allocate name\n");
- return -ENOMEM;
- }
-
mutex_lock(&client_mutex);
- ret = snd_soc_component_initialize(component, component_driver,
- dev, name);
+ ret = snd_soc_component_initialize(component, component_driver, dev);
if (ret)
goto err_free;
--
2.17.1
next prev parent reply other threads:[~2020-07-31 14:43 UTC|newest]
Thread overview: 10+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-07-31 14:41 [PATCH 0/3] ASoC: core: Two step component registration Cezary Rojewski
2020-07-31 14:41 ` [PATCH 1/3] ASoC: core: Relocate and expose snd_soc_component_initialize Cezary Rojewski
2020-07-31 14:41 ` Cezary Rojewski [this message]
2020-07-31 14:41 ` [PATCH 3/3] ASoC: core: Two step component registration Cezary Rojewski
2020-07-31 15:07 ` [PATCH 0/3] " Pierre-Louis Bossart
2020-07-31 15:47 ` Cezary Rojewski
2020-07-31 15:58 ` Lars-Peter Clausen
2020-07-31 16:09 ` Cezary Rojewski
2020-07-31 16:42 ` Mark Brown
2020-07-31 18:54 ` 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=20200731144146.6678-3-cezary.rojewski@intel.com \
--to=cezary.rojewski@intel.com \
--cc=alexandre.torgue@st.com \
--cc=alsa-devel@alsa-project.org \
--cc=arnaud.pouliquen@st.com \
--cc=broonie@kernel.org \
--cc=lars@metafoo.de \
--cc=lgirdwood@gmail.com \
--cc=mcoquelin.stm32@gmail.com \
--cc=olivier.moysan@st.com \
--cc=pierre-louis.bossart@linux.intel.com \
--cc=tiwai@suse.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