From mboxrd@z Thu Jan 1 00:00:00 1970 From: Kuninori Morimoto Subject: Re: [alsa-devel] [PATCH 1/xx][sample] ASoC: add COMPONENT_FUNC() macro for snd_soc_component_driver Date: Thu, 4 Aug 2016 00:39:54 +0000 Message-ID: <87shulml13.wl%kuninori.morimoto.gx@renesas.com> References: <87k2fy8xy5.wl%kuninori.morimoto.gx@renesas.com> <87invi8xwc.wl%kuninori.morimoto.gx@renesas.com> <7de0934c-6d6a-ad51-7d5a-693bcf999a56@metafoo.de> Mime-Version: 1.0 (generated by SEMI-EPG 1.14.7 - "Harue") Content-Type: text/plain; charset="US-ASCII" Return-path: In-Reply-To: <7de0934c-6d6a-ad51-7d5a-693bcf999a56@metafoo.de> Sender: linux-renesas-soc-owner@vger.kernel.org To: Lars-Peter Clausen Cc: Mark Brown , linux-renesas-soc@vger.kernel.org, Linux-ALSA , Simon , Liam Girdwood List-Id: alsa-devel@alsa-project.org Hi Lars Thank you for your feedback > > snd_soc_component_driver requests some struct xxx, and int num_xxx. > > To make initialize easy, this patch adds COMPONENT_FUNC() macro. > > > > Signed-off-by: Kuninori Morimoto > > --- > > include/sound/soc.h | 3 +++ > > 1 file changed, 3 insertions(+) > > > > diff --git a/include/sound/soc.h b/include/sound/soc.h > > index 6144882..41c21f9 100644 > > --- a/include/sound/soc.h > > +++ b/include/sound/soc.h > > @@ -795,6 +795,9 @@ struct snd_soc_component_driver { > > int probe_order; > > int remove_order; > > }; > > +#define COMPONENT_FUNC(name, func) \ > > + .name = func, \ > > + .num_##name = ARRAY_SIZE(func) > > I'd avoid like to a void this kind of macro. Sure it slightly reduces > boilerplate code, but it is difficult to parse for both humans as well as > machines. Makes the code much less intuitive to understand and also breaks > automated scripts. Thanks, and yes agree. Now, I'm creating many patches without above macro.