drivers: cpufreq: Mark function as static in cpufreq.c
A message that is not in the archive (sent off-list or not yet received): [email protected]@rashika
PATCH v2 1/1 drivers: cpufreq: Mark function as static in cpufreq.c
Mark function as static in cpufreq.c because it is not used outside this file.
This eliminates the following warning in cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for ‘show_boost’ [-Wmissing-prototypes]
--- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/cpufreq/cpufreq.c +1 -1
@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ -ssize_t show_boost (struct kobject *kobj, +static ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {return sprintf (buf,"%d\n" , cpufreq_driver->boost_enabled);
Signature · 1 line
1.7.9.5
Quoted 7 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for ‘show_boost’ [-Wmissing-prototypes]Signed-off-by Rashika Kheria <[email protected]>
I don't see any uses of this function in cpufreq.c; have uses appeared in a development branch?
Quoted 19 lines
drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +1
-1@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ -ssize_t show_boost (struct kobject *kobj, +static ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {return sprintf (buf,"%d\n" , cpufreq_driver->boost_enabled);Signature · 1 line
1.7.9.5
Quoted 4 lines · Josh Triplett
Quoted 3 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.
Quoted 8 lines
Quoted 4 lines
This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for 'show_boost' [-Wmissing-prototypes]Signed-off-by Rashika Kheria <[email protected]>I don't see any uses of this function in
cpufreq.c; have uses appeared in a development branch?
It isn't used directly but through "define_one_global_rw(boost);".
The "define_one_global_rw()" is defined in include/linux/cpufreq.h. It therefore, need the definition of the function.
Quoted 19 lines
Quoted 19 lines
drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +1
-2@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ -ssize_t show_boost (struct kobject *kobj, +static ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {return sprintf (buf,"%d\n" , cpufreq_driver->boost_enabled); --1.7.9.5
Signature · 3 lines
Rashika Kheria B.Tech CSE IIIT Hyderabad
Josh Triplett
Reviewed-byQuoted 10 lines · Rashika Kheria
Quoted 9 lines · Josh Triplett
Quoted 7 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for 'show_boost' [-Wmissing-prototypes]Signed-off-by Rashika Kheria <[email protected]>
Quoted 8 lines
Quoted 3 lines
I don't see any uses of this function in
cpufreq.c; have uses appeared in a development branch?It isn't used directly but through "
define_one_global_rw(boost);".The "
define_one_global_rw()" is defined ininclude/linux/cpufreq.h. It therefore, need the definition of the function.
Ah, that's quite non-obvious. Hiding the "show_" makes that hard to grep for.
Quoted 26 lines
Quoted 19 lines
Quoted 19 lines
drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +1
-2@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ -ssize_t show_boost (struct kobject *kobj, +static ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {return sprintf (buf,"%d\n" , cpufreq_driver->boost_enabled); --1.7.9.5
Signature · 3 lines
Rashika Kheria B.Tech CSE IIIT Hyderabad
Viresh Kumar
maintainerHi Rashika,
Quoted 5 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for 'show_boost' [-Wmissing-prototypes]
Can you please elaborate how this warning is related to the non-static definition of this function?
Quoted 21 lines
Signed-off-by Rashika Kheria <[email protected]>--- drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +1
-2@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ -ssize_t show_boost (struct kobject *kobj, +static ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {return sprintf (buf,"%d\n" , cpufreq_driver->boost_enabled); --1.7.9.5
Viresh Kumar
maintainerQuoted 11 lines · Viresh Kumar
Hi Rashika,
Quoted 5 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for 'show_boost' [-Wmissing-prototypes]Can you please elaborate how this warning is related to the non-static definition of this function?
Ping!!
Quoted 11 lines · Viresh Kumar
Hi Rashika,
Quoted 5 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for 'show_boost' [-Wmissing-prototypes]Can you please elaborate how this warning is related to the non-static definition of this function?
-Wmissing-prototypes warns when a non-static function is defined before a corresponding prototype (usually inside an included header file) is declared. In such a case, it is impossible to reference the non-static function from another file, and therefore the function should be marked static (usually). Hope that makes sense!
Viresh Kumar
maintainerQuoted 5 lines · Patrick Palka
-Wmissing-prototypes warns when a non-static function is defined before a corresponding prototype (usually inside an included header file) is declared. In such a case, it is impossible to reference the non-static function from another file, and therefore the function should be marked static (usually). Hope that makes sense!
I understand that it should be made static as we don't have a prototype in any other header file, but I thought we shouldn't get the warning we are getting.
warning: no previous prototype for 'show_boost'
Because we have prototype/definition of function before it is used. Maybe a warning like:
local function should be marked static could have been there ;)
Quoted 4 lines · Josh Triplett
Quoted 3 lines · Rashika Kheria
Mark function as static in
cpufreq.cbecause it is not used outside this file.
Quoted 8 lines
Quoted 4 lines
This eliminates the following warning in
cpufreq.c:drivers/cpufreq/cpufreq.c:355:9: warning: no previous prototype for ‘show_boost’ [-Wmissing-prototypes]Signed-off-by Rashika Kheria <[email protected]>I don't see any uses of this function in
cpufreq.c; have uses appeared in a development branch?
This is a sysfs accessor used to control the boost feature it is not used by the core but userspace.
Quoted 24 lines
Quoted 17 lines
drivers/cpufreq/cpufreq.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/cpufreq/cpufreq.c +1
-2@@ -352,7 +352,7 @@ EXPORT_SYMBOL_GPL(cpufreq_notify_post_transition);/********************************************************************* * SYSFS INTERFACE * *********************************************************************/ -ssize_t show_boost (struct kobject *kobj, +static ssize_t show_boost (struct kobject *kobj,struct attribute *attr,char *buf) {return sprintf (buf,"%d\n" , cpufreq_driver->boost_enabled); --Quoted 2 lines
1.7.9.5
--
To unsubscribe from this list: send the line "unsubscribe cpufreq" in the body of a message to [email protected]
More majordomo info at http://vger.kernel.org/majordomo-info.html