Re: [PATCH] powercap/dtpm: move dtpm_subsys definition to dtpm.c

From: Daniel Lezcano
Date: Fri Apr 22 2022 - 10:02:43 EST


On 22/04/2022 15:56, Rafael J. Wysocki wrote:
On Mon, Apr 18, 2022 at 8:08 PM Tom Rix <trix@xxxxxxxxxx> wrote:

Smatch reports this issue
dtpm_devfreq.c:200:24: warning: symbol 'dtpm_devfreq_ops'
was not declared. Should it be static?

dtpm_devfreq_ops is declared in dtpm_subsys.h where it
is also used

extern struct dtpm_subsys_ops dtpm_devfreq_ops;
struct dtpm_subsys_ops *dtpm_subsys[] = {
...
&dtpm_devfreq_ops,

Global variables should not be defined in header files.
This only works because dtpm.c is the only includer
of dtpm_subsys.h and user of dtpm_susys[].

Move the definition of dtpm_subsys[] to dtpm.c and change
the storage-class specifier to static.

Signed-off-by: Tom Rix <trix@xxxxxxxxxx>

Daniel, any comments?

Or do you want to pick it up yourself?

Yes, I'll pick it

Thanks


--
<http://www.linaro.org/> Linaro.org │ Open source software for ARM SoCs

Follow Linaro: <http://www.facebook.com/pages/Linaro> Facebook |
<http://twitter.com/#!/linaroorg> Twitter |
<http://www.linaro.org/linaro-blog/> Blog