[alsa-devel] [PATCH v2 01/25] ASoC: soc-core: use device_register()
Kuninori Morimoto
kuninori.morimoto.gx at renesas.com
Wed Aug 7 03:29:56 CEST 2019
From: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
It is easy to read code if it is cleanly using paired function/naming,
like start <-> stop, register <-> unregister, etc, etc.
But, current ALSA SoC code is very random, unbalance, not paired, etc.
soc-core.c is using device_unregiser(), but there is no its paired
device_regiser(). We can find its code at soc_post_component_init()
which is using device_initialize() and device_add().
Here, device_initialize() + device_add() = device_register().
device_initialize() is doing each dev member's initialization only.
So, the timing is not important here.
let's use device_register() instead of device_initialize()/device_add().
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx at renesas.com>
---
v1 -> v2
- no change
sound/soc/soc-core.c | 3 +--
1 file changed, 1 insertion(+), 2 deletions(-)
diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c
index 0f75dac..40bac40 100644
--- a/sound/soc/soc-core.c
+++ b/sound/soc/soc-core.c
@@ -1336,7 +1336,6 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
rtd->dev = kzalloc(sizeof(struct device), GFP_KERNEL);
if (!rtd->dev)
return -ENOMEM;
- device_initialize(rtd->dev);
rtd->dev->parent = rtd->card->dev;
rtd->dev->release = rtd_release;
rtd->dev->groups = soc_dev_attr_groups;
@@ -1347,7 +1346,7 @@ static int soc_post_component_init(struct snd_soc_pcm_runtime *rtd,
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].be_clients);
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_PLAYBACK].fe_clients);
INIT_LIST_HEAD(&rtd->dpcm[SNDRV_PCM_STREAM_CAPTURE].fe_clients);
- ret = device_add(rtd->dev);
+ ret = device_register(rtd->dev);
if (ret < 0) {
/* calling put_device() here to free the rtd->dev */
put_device(rtd->dev);
--
2.7.4
More information about the Alsa-devel
mailing list