Re: [alsa-devel] [PATCH 1/xx][sample] ASoC: add COMPONENT_FUNC() macro for snd_soc_component_driver

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 08/03/2016 03:13 AM, Kuninori Morimoto wrote:
> 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 <kuninori.morimoto.gx@xxxxxxxxxxx>
> ---
>  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.




[Index of Archives]     [Linux Samsung SOC]     [Linux Wireless]     [Linux Kernel]     [ATH6KL]     [Linux Bluetooth]     [Linux Netdev]     [Kernel Newbies]     [IDE]     [Security]     [Git]     [Netfilter]     [Bugtraq]     [Yosemite News]     [MIPS Linux]     [ARM Linux]     [Linux Security]     [Linux RAID]     [Linux ATA RAID]     [Samba]     [Device Mapper]

  Powered by Linux