Re: [PATCH] ALSA: constify snd_kcontrol_new structures

From: Takashi Iwai
Date: Sun Feb 19 2017 - 16:07:25 EST


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@p = {...};
>
> @ok1@
> identifier r1.i;
> position p;
> expression e1;
> @@
> snd_ctl_new1(&i@p,e1)
>
> @bad@
> position p!={r1.p,ok1.p};
> identifier r1.i;
> @@
> i@p
>
> @depends on !bad disable optional_qualifier@
> identifier r1.i;
> @@
> +const
> struct snd_kcontrol_new i;
>
> Signed-off-by: Bhumika Goyal <bhumirks@xxxxxxxxx>

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


thanks,

Takashi