* [PATCH] cpupower: remove extern declarations in cmd_set()
@ 2026-03-31 4:59 Kaushlendra Kumar
2026-03-31 23:53 ` Shuah Khan
0 siblings, 1 reply; 5+ messages in thread
From: Kaushlendra Kumar @ 2026-03-31 4:59 UTC (permalink / raw)
To: shuah, jwyatt, jkacur; +Cc: linux-pm, Kaushlendra Kumar
extern char *optarg and extern int optind, opterr, optopt are
already declared by <getopt.h>, which is included at the top of
the file. Repeating extern declarations inside a function body
is misleading and unnecessary.
Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
---
tools/power/cpupower/utils/cpupower-set.c | 2 --
1 file changed, 2 deletions(-)
diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
index dcbdff5c9ae5..64d2d4b070b4 100644
--- a/tools/power/cpupower/utils/cpupower-set.c
+++ b/tools/power/cpupower/utils/cpupower-set.c
@@ -51,8 +51,6 @@ static int parse_int_range(const char *arg, int min, int max, int *out)
int cmd_set(int argc, char **argv)
{
- extern char *optarg;
- extern int optind, opterr, optopt;
unsigned int cpu;
struct utsname uts;
--
2.34.1
^ permalink raw reply related [flat|nested] 5+ messages in thread* Re: [PATCH] cpupower: remove extern declarations in cmd_set()
2026-03-31 4:59 [PATCH] cpupower: remove extern declarations in cmd_set() Kaushlendra Kumar
@ 2026-03-31 23:53 ` Shuah Khan
2026-04-01 2:49 ` Kumar, Kaushlendra
0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2026-03-31 23:53 UTC (permalink / raw)
To: Kaushlendra Kumar, shuah, jwyatt, jkacur; +Cc: linux-pm, Shuah Khan
On 3/30/26 22:59, Kaushlendra Kumar wrote:
> extern char *optarg and extern int optind, opterr, optopt are
> already declared by <getopt.h>, which is included at the top of
> the file. Repeating extern declarations inside a function body
> is misleading and unnecessary.
Okay - are there errors from compilers or static checkers? How
did you find the problem?
>
> Signed-off-by: Kaushlendra Kumar <kaushlendra.kumar@intel.com>
> ---
> tools/power/cpupower/utils/cpupower-set.c | 2 --
> 1 file changed, 2 deletions(-)
>
> diff --git a/tools/power/cpupower/utils/cpupower-set.c b/tools/power/cpupower/utils/cpupower-set.c
> index dcbdff5c9ae5..64d2d4b070b4 100644
> --- a/tools/power/cpupower/utils/cpupower-set.c
> +++ b/tools/power/cpupower/utils/cpupower-set.c
> @@ -51,8 +51,6 @@ static int parse_int_range(const char *arg, int min, int max, int *out)
>
> int cmd_set(int argc, char **argv)
> {
> - extern char *optarg;
> - extern int optind, opterr, optopt;
> unsigned int cpu;
> struct utsname uts;
>
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 5+ messages in thread* RE: [PATCH] cpupower: remove extern declarations in cmd_set()
2026-03-31 23:53 ` Shuah Khan
@ 2026-04-01 2:49 ` Kumar, Kaushlendra
2026-04-01 18:53 ` Shuah Khan
0 siblings, 1 reply; 5+ messages in thread
From: Kumar, Kaushlendra @ 2026-04-01 2:49 UTC (permalink / raw)
To: Shuah Khan, shuah@kernel.org, jwyatt@redhat.com,
jkacur@redhat.com
Cc: linux-pm@vger.kernel.org
On 4/1/26 XX:XX, Shuah Khan wrote:
> Okay - are there errors from compilers or static checkers? How did you find the problem?
No errors from compilers or static checkers. We found this while doing
local code modifications to the file. During the review of the changes,
we noticed the redundant extern declarations and cleaned them up as part
of good housekeeping.
Thanks,
Kaushlendra Kumar
^ permalink raw reply [flat|nested] 5+ messages in thread
* Re: [PATCH] cpupower: remove extern declarations in cmd_set()
2026-04-01 2:49 ` Kumar, Kaushlendra
@ 2026-04-01 18:53 ` Shuah Khan
2026-04-02 15:45 ` Kumar, Kaushlendra
0 siblings, 1 reply; 5+ messages in thread
From: Shuah Khan @ 2026-04-01 18:53 UTC (permalink / raw)
To: Kumar, Kaushlendra, shuah@kernel.org, jwyatt@redhat.com,
jkacur@redhat.com
Cc: linux-pm@vger.kernel.org, Shuah Khan
On 3/31/26 20:49, Kumar, Kaushlendra wrote:
> On 4/1/26 XX:XX, Shuah Khan wrote:
>> Okay - are there errors from compilers or static checkers? How did you find the problem?
>
> No errors from compilers or static checkers. We found this while doing
> local code modifications to the file. During the review of the changes,
> we noticed the redundant extern declarations and cleaned them up as part
> of good housekeeping.
There are a few other places in cpupower that can be fixed. Send
me a patch that removes just the extern declarations without the
parse_int_range() stuff
extern char *optarg;
extern int optind, opterr, optopt;
thanks,
-- Shuah
^ permalink raw reply [flat|nested] 5+ messages in thread
* RE: [PATCH] cpupower: remove extern declarations in cmd_set()
2026-04-01 18:53 ` Shuah Khan
@ 2026-04-02 15:45 ` Kumar, Kaushlendra
0 siblings, 0 replies; 5+ messages in thread
From: Kumar, Kaushlendra @ 2026-04-02 15:45 UTC (permalink / raw)
To: Shuah Khan, shuah@kernel.org, jwyatt@redhat.com,
jkacur@redhat.com
Cc: linux-pm@vger.kernel.org
> There are a few other places in cpupower that can be fixed. Send me a
> patch that removes just the extern declarations without the
> parse_int_range() stuff
>
> extern char *optarg;
> extern int optind, opterr, optopt;
Sure, will do.
Thanks,
Kaushlendra
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2026-04-02 15:45 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-03-31 4:59 [PATCH] cpupower: remove extern declarations in cmd_set() Kaushlendra Kumar
2026-03-31 23:53 ` Shuah Khan
2026-04-01 2:49 ` Kumar, Kaushlendra
2026-04-01 18:53 ` Shuah Khan
2026-04-02 15:45 ` Kumar, Kaushlendra
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox