All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
       [not found] <linux-pm@vger.kernel.org20140226154625.GA10701@rashika>
@ 2014-02-26 16:38 ` Rashika Kheria
  2014-02-26 16:41   ` Josh Triplett
  0 siblings, 1 reply; 9+ messages in thread
From: Rashika Kheria @ 2014-02-26 16:38 UTC (permalink / raw)
  To: josh, linux-kernel, Rafael J. Wysocki, Viresh Kumar, cpufreq

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]

Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
---
 drivers/cpufreq/cpufreq.c |    2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
index 08ca8c9..54fd670 100644
--- a/drivers/cpufreq/cpufreq.c
+++ b/drivers/cpufreq/cpufreq.c
@@ -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


^ permalink raw reply related	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-26 16:38 ` [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c Rashika Kheria
@ 2014-02-26 16:41   ` Josh Triplett
  2014-02-26 16:45     ` Rashika Kheria
  2014-02-26 16:52     ` Dirk Brandewie
  0 siblings, 2 replies; 9+ messages in thread
From: Josh Triplett @ 2014-02-26 16:41 UTC (permalink / raw)
  To: Rashika Kheria; +Cc: linux-kernel, Rafael J. Wysocki, Viresh Kumar, cpufreq

On Wed, Feb 26, 2014 at 10:08:26PM +0530, Rashika Kheria wrote:
> 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]
> 
> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>

I don't see any uses of this function in cpufreq.c; have uses appeared
in a development branch?

>  drivers/cpufreq/cpufreq.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 08ca8c9..54fd670 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -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
> 

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-26 16:41   ` Josh Triplett
@ 2014-02-26 16:45     ` Rashika Kheria
  2014-02-26 17:08       ` Josh Triplett
  2014-02-26 16:52     ` Dirk Brandewie
  1 sibling, 1 reply; 9+ messages in thread
From: Rashika Kheria @ 2014-02-26 16:45 UTC (permalink / raw)
  To: Josh Triplett; +Cc: Linux-Kernel, Rafael J. Wysocki, Viresh Kumar, cpufreq

On Wed, Feb 26, 2014 at 10:11 PM, Josh Triplett <josh@joshtriplett.org> wrote:
> On Wed, Feb 26, 2014 at 10:08:26PM +0530, Rashika Kheria wrote:
>> 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]
>>
>> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
>
> 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.

>>  drivers/cpufreq/cpufreq.c |    2 +-
>>  1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 08ca8c9..54fd670 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -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
>>



-- 
Rashika Kheria
B.Tech CSE
IIIT Hyderabad

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-26 16:41   ` Josh Triplett
  2014-02-26 16:45     ` Rashika Kheria
@ 2014-02-26 16:52     ` Dirk Brandewie
  1 sibling, 0 replies; 9+ messages in thread
From: Dirk Brandewie @ 2014-02-26 16:52 UTC (permalink / raw)
  To: Josh Triplett, Rashika Kheria
  Cc: dirk.brandewie, linux-kernel, Rafael J. Wysocki, Viresh Kumar, cpufreq

On 02/26/2014 08:41 AM, Josh Triplett wrote:
> On Wed, Feb 26, 2014 at 10:08:26PM +0530, Rashika Kheria wrote:
>> 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]
>>
>> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
>
> 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.


>>   drivers/cpufreq/cpufreq.c |    2 +-
>>   1 file changed, 1 insertion(+), 1 deletion(-)
>>
>> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
>> index 08ca8c9..54fd670 100644
>> --- a/drivers/cpufreq/cpufreq.c
>> +++ b/drivers/cpufreq/cpufreq.c
>> @@ -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
>>
> --
> To unsubscribe from this list: send the line "unsubscribe cpufreq" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
>


^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-26 16:45     ` Rashika Kheria
@ 2014-02-26 17:08       ` Josh Triplett
  2014-02-27  5:25         ` Viresh Kumar
  0 siblings, 1 reply; 9+ messages in thread
From: Josh Triplett @ 2014-02-26 17:08 UTC (permalink / raw)
  To: Rashika Kheria; +Cc: Linux-Kernel, Rafael J. Wysocki, Viresh Kumar, cpufreq

On Wed, Feb 26, 2014 at 10:15:57PM +0530, Rashika Kheria wrote:
> On Wed, Feb 26, 2014 at 10:11 PM, Josh Triplett <josh@joshtriplett.org> wrote:
> > On Wed, Feb 26, 2014 at 10:08:26PM +0530, Rashika Kheria wrote:
> >> 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]
> >>
> >> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> >
> > 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.

Ah, that's quite non-obvious.  Hiding the "show_" makes that hard to
grep for.

Reviewed-by: Josh Triplett <josh@joshtriplett.org>

> >>  drivers/cpufreq/cpufreq.c |    2 +-
> >>  1 file changed, 1 insertion(+), 1 deletion(-)
> >>
> >> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> >> index 08ca8c9..54fd670 100644
> >> --- a/drivers/cpufreq/cpufreq.c
> >> +++ b/drivers/cpufreq/cpufreq.c
> >> @@ -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
> >>
> 
> 
> 
> -- 
> Rashika Kheria
> B.Tech CSE
> IIIT Hyderabad

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-26 17:08       ` Josh Triplett
@ 2014-02-27  5:25         ` Viresh Kumar
  2014-03-03  0:29           ` Viresh Kumar
  2014-03-03  3:42           ` Patrick Palka
  0 siblings, 2 replies; 9+ messages in thread
From: Viresh Kumar @ 2014-02-27  5:25 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: josh, Linux Kernel Mailing List, Rafael J. Wysocki, cpufreq

Hi Rashika,

On 26 February 2014 22:08, Rashika Kheria <rashika.kheria@gmail.com> wrote:
> 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]

Can you please elaborate how this warning is related to
the non-static definition of this function?

> Signed-off-by: Rashika Kheria <rashika.kheria@gmail.com>
> ---
>  drivers/cpufreq/cpufreq.c |    2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
>
> diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c
> index 08ca8c9..54fd670 100644
> --- a/drivers/cpufreq/cpufreq.c
> +++ b/drivers/cpufreq/cpufreq.c
> @@ -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
>

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-27  5:25         ` Viresh Kumar
@ 2014-03-03  0:29           ` Viresh Kumar
  2014-03-03  3:42           ` Patrick Palka
  1 sibling, 0 replies; 9+ messages in thread
From: Viresh Kumar @ 2014-03-03  0:29 UTC (permalink / raw)
  To: Rashika Kheria
  Cc: josh, Linux Kernel Mailing List, Rafael J. Wysocki, cpufreq

On 27 February 2014 10:55, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> Hi Rashika,
>
> On 26 February 2014 22:08, Rashika Kheria <rashika.kheria@gmail.com> wrote:
>> 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]
>
> Can you please elaborate how this warning is related to
> the non-static definition of this function?

Ping!!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-02-27  5:25         ` Viresh Kumar
  2014-03-03  0:29           ` Viresh Kumar
@ 2014-03-03  3:42           ` Patrick Palka
  2014-03-03  7:20             ` Viresh Kumar
  1 sibling, 1 reply; 9+ messages in thread
From: Patrick Palka @ 2014-03-03  3:42 UTC (permalink / raw)
  To: Viresh Kumar
  Cc: Rashika Kheria, Josh Triplett, Linux Kernel Mailing List,
	Rafael J. Wysocki, cpufreq

On Thu, Feb 27, 2014 at 12:25 AM, Viresh Kumar <viresh.kumar@linaro.org> wrote:
> Hi Rashika,
>
> On 26 February 2014 22:08, Rashika Kheria <rashika.kheria@gmail.com> wrote:
>> 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]
>
> 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!

^ permalink raw reply	[flat|nested] 9+ messages in thread

* Re: [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c
  2014-03-03  3:42           ` Patrick Palka
@ 2014-03-03  7:20             ` Viresh Kumar
  0 siblings, 0 replies; 9+ messages in thread
From: Viresh Kumar @ 2014-03-03  7:20 UTC (permalink / raw)
  To: Patrick Palka
  Cc: Rashika Kheria, Josh Triplett, Linux Kernel Mailing List,
	Rafael J. Wysocki, cpufreq

On 3 March 2014 09:12, Patrick Palka <patrick@parcs.ath.cx> wrote:
> -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 ;)

^ permalink raw reply	[flat|nested] 9+ messages in thread

end of thread, other threads:[~2014-03-03  7:20 UTC | newest]

Thread overview: 9+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
     [not found] <linux-pm@vger.kernel.org20140226154625.GA10701@rashika>
2014-02-26 16:38 ` [PATCH v2] drivers: cpufreq: Mark function as static in cpufreq.c Rashika Kheria
2014-02-26 16:41   ` Josh Triplett
2014-02-26 16:45     ` Rashika Kheria
2014-02-26 17:08       ` Josh Triplett
2014-02-27  5:25         ` Viresh Kumar
2014-03-03  0:29           ` Viresh Kumar
2014-03-03  3:42           ` Patrick Palka
2014-03-03  7:20             ` Viresh Kumar
2014-02-26 16:52     ` Dirk Brandewie

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.