Message ID | 87h8vnvgxk.wl%kuninori.morimoto.gx@renesas.com (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Minor comment inline On Thu, Sep 28, 2017 at 2:59 AM, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > ALSA SoC platform/codec will be replaced to component soon. > But, some function exist in "platform" doesn't exist in "component". > Current soc-core has snd_soc_register_component(), but > doesn't have snd_soc_add_component() like snd_soc_add_platform(). > This patch adds it. > <snip> > +int snd_soc_register_component(struct device *dev, > + const struct snd_soc_component_driver *component_driver, > + struct snd_soc_dai_driver *dai_drv, > + int num_dai) > +{ > + struct snd_soc_component *component; > + > + component = kzalloc(sizeof(*component), GFP_KERNEL); > + if (!component) { > + dev_err(dev, "ASoC: Failed to allocate memory\n"); > + return -ENOMEM; No need to print an error message if kzalloc fails. The core will print it. > + } > + > + return snd_soc_add_component(dev, component, component_driver, > + dai_drv, num_dai); > +} > EXPORT_SYMBOL_GPL(snd_soc_register_component); thanks, Daniel.
Hi Daniel > > From: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> > > > > ALSA SoC platform/codec will be replaced to component soon. > > But, some function exist in "platform" doesn't exist in "component". > > Current soc-core has snd_soc_register_component(), but > > doesn't have snd_soc_add_component() like snd_soc_add_platform(). > > This patch adds it. <snip> > > +int snd_soc_register_component(struct device *dev, > > + const struct snd_soc_component_driver *component_driver, > > + struct snd_soc_dai_driver *dai_drv, > > + int num_dai) > > +{ > > + struct snd_soc_component *component; > > + > > + component = kzalloc(sizeof(*component), GFP_KERNEL); > > + if (!component) { > > + dev_err(dev, "ASoC: Failed to allocate memory\n"); > > + return -ENOMEM; > > No need to print an error message if kzalloc fails. The core will print it. Thanks. Yes I had noticed this warning from checkpatch. The main purpose of this patch is separate "register" function into "register" and "add". Thus, I keeped existing all code. I think "remove unneeded message" should be increment patch, but can you agree ? Best regards --- Kuninori Morimoto
Hi Kuninori, >> > + component = kzalloc(sizeof(*component), GFP_KERNEL); >> > + if (!component) { >> > + dev_err(dev, "ASoC: Failed to allocate memory\n"); >> > + return -ENOMEM; >> >> No need to print an error message if kzalloc fails. The core will print it. > > Thanks. Yes I had noticed this warning from checkpatch. > The main purpose of this patch is separate "register" function into > "register" and "add". > Thus, I keeped existing all code. > I think "remove unneeded message" should be increment patch, > but can you agree ? Makes sense. It's better to be sent as a separate patch.
Hi Daniel > >> > + component = kzalloc(sizeof(*component), GFP_KERNEL); > >> > + if (!component) { > >> > + dev_err(dev, "ASoC: Failed to allocate memory\n"); > >> > + return -ENOMEM; > >> > >> No need to print an error message if kzalloc fails. The core will print it. > > > > Thanks. Yes I had noticed this warning from checkpatch. > > The main purpose of this patch is separate "register" function into > > "register" and "add". > > Thus, I keeped existing all code. > > I think "remove unneeded message" should be increment patch, > > but can you agree ? > > Makes sense. It's better to be sent as a separate patch. Thanks. If you have no objection, I will post it if this patch was accepted. Or do you do this ? Best regards --- Kuninori Morimoto
On Thu, Sep 28, 2017 at 11:15 AM, Kuninori Morimoto <kuninori.morimoto.gx@renesas.com> wrote: > > Hi Daniel > >> >> > + component = kzalloc(sizeof(*component), GFP_KERNEL); >> >> > + if (!component) { >> >> > + dev_err(dev, "ASoC: Failed to allocate memory\n"); >> >> > + return -ENOMEM; >> >> >> >> No need to print an error message if kzalloc fails. The core will print it. >> > >> > Thanks. Yes I had noticed this warning from checkpatch. >> > The main purpose of this patch is separate "register" function into >> > "register" and "add". >> > Thus, I keeped existing all code. >> > I think "remove unneeded message" should be increment patch, >> > but can you agree ? >> >> Makes sense. It's better to be sent as a separate patch. > > Thanks. > If you have no objection, I will post it if this patch was accepted. > Or do you do this ? Lets have this patch reviewed & pushed and then will see. It's not that important.
Hi Mark I will post v2 patch which includes this "remove unneeded message" patch set. > >> >> > + component = kzalloc(sizeof(*component), GFP_KERNEL); > >> >> > + if (!component) { > >> >> > + dev_err(dev, "ASoC: Failed to allocate memory\n"); > >> >> > + return -ENOMEM; > >> >> > >> >> No need to print an error message if kzalloc fails. The core will print it. > >> > > >> > Thanks. Yes I had noticed this warning from checkpatch. > >> > The main purpose of this patch is separate "register" function into > >> > "register" and "add". > >> > Thus, I keeped existing all code. > >> > I think "remove unneeded message" should be increment patch, > >> > but can you agree ? > >> > >> Makes sense. It's better to be sent as a separate patch. > > > > Thanks. > > If you have no objection, I will post it if this patch was accepted. > > Or do you do this ? > > Lets have this patch reviewed & pushed and then will see. It's > not that important. > _______________________________________________ > Alsa-devel mailing list > Alsa-devel@alsa-project.org > http://mailman.alsa-project.org/mailman/listinfo/alsa-devel
diff --git a/include/sound/soc.h b/include/sound/soc.h index 11ca867..eea3007 100644 --- a/include/sound/soc.h +++ b/include/sound/soc.h @@ -468,6 +468,11 @@ int snd_soc_register_codec(struct device *dev, const struct snd_soc_codec_driver *codec_drv, struct snd_soc_dai_driver *dai_drv, int num_dai); void snd_soc_unregister_codec(struct device *dev); +int snd_soc_add_component(struct device *dev, + struct snd_soc_component *component, + const struct snd_soc_component_driver *component_driver, + struct snd_soc_dai_driver *dai_drv, + int num_dai); int snd_soc_register_component(struct device *dev, const struct snd_soc_component_driver *component_driver, struct snd_soc_dai_driver *dai_drv, int num_dai); diff --git a/sound/soc/soc-core.c b/sound/soc/soc-core.c index 6ec1273..166b6d2 100644 --- a/sound/soc/soc-core.c +++ b/sound/soc/soc-core.c @@ -3404,20 +3404,14 @@ static void snd_soc_component_del_unlocked(struct snd_soc_component *component) list_del(&component->list); } -int snd_soc_register_component(struct device *dev, - const struct snd_soc_component_driver *component_driver, - struct snd_soc_dai_driver *dai_drv, - int num_dai) +int snd_soc_add_component(struct device *dev, + struct snd_soc_component *component, + const struct snd_soc_component_driver *component_driver, + struct snd_soc_dai_driver *dai_drv, + int num_dai) { - struct snd_soc_component *component; int ret; - component = kzalloc(sizeof(*component), GFP_KERNEL); - if (!component) { - dev_err(dev, "ASoC: Failed to allocate memory\n"); - return -ENOMEM; - } - ret = snd_soc_component_initialize(component, component_driver, dev); if (ret) goto err_free; @@ -3441,6 +3435,24 @@ int snd_soc_register_component(struct device *dev, kfree(component); return ret; } +EXPORT_SYMBOL_GPL(snd_soc_add_component); + +int snd_soc_register_component(struct device *dev, + const struct snd_soc_component_driver *component_driver, + struct snd_soc_dai_driver *dai_drv, + int num_dai) +{ + struct snd_soc_component *component; + + component = kzalloc(sizeof(*component), GFP_KERNEL); + if (!component) { + dev_err(dev, "ASoC: Failed to allocate memory\n"); + return -ENOMEM; + } + + return snd_soc_add_component(dev, component, component_driver, + dai_drv, num_dai); +} EXPORT_SYMBOL_GPL(snd_soc_register_component); /**