[PATCH] drm/amdgpu: Constify some tables

Emil Velikov emil.l.velikov at gmail.com
Sun Apr 24 18:43:12 UTC 2016


On 24 April 2016 at 18:31, Christian König <deathsimple at vodafone.de> wrote:
> Am 24.04.2016 um 13:55 schrieb Nils Wallménius:
>>
>> Some more tables with constant data were added with the polaris support
>>
>> Signed-off-by: Nils Wallménius <nils.wallmenius at gmail.com>
>
>
> Acked-by: Christian König <christian.koenig at amd.com>
>
> BTW: Do you find those with some kind of automated tool? Would be nice to
> fix those before we make the patches public as well.
>
For symbols already declared static one can use the following:

$ git grep "static .*\[.*\] *= *{"  | grep -v -w const

For ones that are not - the compiler should give you a nice warning
already (-Wimplicit) if it doesn't you can use the following

$ git grep "\[.*\] *= *{"  | egrep -v -w "const|static"
$ grep + filecount == 1 -> declare static. use the top rule.

If your code does not use trailing {, just replace with with $.

In either case human interaction is needed, as the compiler will
kindly warn when someone (struct which parents these or function that
uses them) discards the const qualifier.

-Emil
P.S. Cool thing is that most drivers are almost OK (nouveau does stand
out with ~600 non static & non const symbols)


More information about the dri-devel mailing list