powercap/dtpm: move dtpm_subsys definition to dtpm.c
Subsystems (2)
PATCH 1/1 powercap/dtpm: move dtpm_subsys definition to dtpm.c
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.
--- drivers/powercap/dtpm.c | 9 +++++++++ drivers/powercap/dtpm_subsys.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/powercap/dtpm.c +9 -0
@@ -29,6 +29,15 @@#define DTPM_POWER_LIMIT_FLAG 0 +static struct dtpm_subsys_ops *dtpm_subsys[] = { +#ifdef CONFIG_DTPM_CPU + &dtpm_cpu_ops, +#endif +#ifdef CONFIG_DTPM_DEVFREQ + &dtpm_devfreq_ops, +#endif +}; +static const char *constraint_name[] = {"Instantaneous" , };
drivers/powercap/dtpm_subsys.h +0 -9
@@ -10,13 +10,4 @@extern struct dtpm_subsys_ops dtpm_cpu_ops;extern struct dtpm_subsys_ops dtpm_devfreq_ops; -struct dtpm_subsys_ops *dtpm_subsys[] = { -#ifdef CONFIG_DTPM_CPU - &dtpm_cpu_ops, -#endif -#ifdef CONFIG_DTPM_DEVFREQ - &dtpm_devfreq_ops, -#endif -}; -#endif
Signature · 1 line
2.27.0
Rafael J. Wysocki
maintainerQuoted 13 lines · Tom Rix
Smatch reports this issue
dtpm_devfreq.c:200:24: warning: symbol 'dtpm_devfreq_ops'
was not declared. Should it be static?
dtpm_devfreq_opsis declared indtpm_subsys.hwhere it is also usedextern struct
dtpm_subsys_opsdtpm_devfreq_ops; structdtpm_subsys_ops*dtpm_subsys[] = {
...
&dtpm_devfreq_ops,
Quoted 8 lines
Global variables should not be defined in header files. This only works because
dtpm.cis the only includer ofdtpm_subsys.hand user of dtpm_susys[].Move the definition of dtpm_subsys[] to
dtpm.cand change the storage-class specifier to static.Signed-off-by Tom Rix <[email protected]>
Daniel, any comments?
Or do you want to pick it up yourself?
Quoted 46 lines
--- drivers/powercap/dtpm.c | 9 +++++++++ drivers/powercap/dtpm_subsys.h | 9 --------- 2 files changed, 9 insertions(+), 9 deletions(-)drivers/powercap/dtpm.c +9
-0@@ -29,6 +29,15 @@#define DTPM_POWER_LIMIT_FLAG 0 +static struct dtpm_subsys_ops *dtpm_subsys[] = { +#ifdef CONFIG_DTPM_CPU + &dtpm_cpu_ops, +#endif +#ifdef CONFIG_DTPM_DEVFREQ + &dtpm_devfreq_ops, +#endif +}; +static const char *constraint_name[] = {"Instantaneous" , };drivers/powercap/dtpm_subsys.h +0
-10@@ -10,13 +10,4 @@extern struct dtpm_subsys_ops dtpm_cpu_ops;extern struct dtpm_subsys_ops dtpm_devfreq_ops; -struct dtpm_subsys_ops *dtpm_subsys[] = { -#ifdef CONFIG_DTPM_CPU - &dtpm_cpu_ops, -#endif -#ifdef CONFIG_DTPM_DEVFREQ - &dtpm_devfreq_ops, -#endif -}; -#endif --2.27.0
Quoted 18 lines · Rafael J. Wysocki
Quoted 17 lines · Tom Rix
Smatch reports this issue
dtpm_devfreq.c:200:24: warning: symbol 'dtpm_devfreq_ops'
was not declared. Should it be static?
dtpm_devfreq_opsis declared indtpm_subsys.hwhere it is also usedextern struct
dtpm_subsys_opsdtpm_devfreq_ops; structdtpm_subsys_ops*dtpm_subsys[] = {
...
&dtpm_devfreq_ops,Global variables should not be defined in header files. This only works because
dtpm.cis the only includer ofdtpm_subsys.hand user of dtpm_susys[].
Quoted 8 lines
Quoted 4 lines
Move the definition of dtpm_subsys[] to
dtpm.cand change the storage-class specifier to static.Signed-off-by Tom Rix <[email protected]>Daniel, any comments?
Or do you want to pick it up yourself?
Yes, I'll pick it
Thanks
Signature · 5 lines
<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