[alsa-devel] [PATCH] ALSA: constify snd_kcontrol_new structures

Takashi Iwai tiwai at suse.de
Sun Feb 19 22:07:07 CET 2017


On Sun, 19 Feb 2017 19:48:09 +0100,
Bhumika Goyal wrote:
> 
> Declare snd_kcontrol_new structures as const as they are only passed as
> an argument to the function snd_ctl_new1. This argument is of type
> const, so snd_kcontrol_new structures having the same property can be
> made const too.
> Done using Coccinelle:
> 
> @r1 disable optional_qualifier @
> identifier i;
> position p;
> @@
> static struct snd_kcontrol_new i at p = {...};
> 
> @ok1@
> identifier r1.i;
> position p;
> expression e1;
> @@
> snd_ctl_new1(&i at p,e1)
> 
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i at p
> 
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct snd_kcontrol_new i;
> 
> Signed-off-by: Bhumika Goyal <bhumirks at gmail.com>

It's too large for a change at a minute before the merge window.
I'll postpone this for 4.12.


thanks,

Takashi


More information about the Alsa-devel mailing list