Linux MIPS Architecture development
 help / color / mirror / Atom feed
From: Paul Burton <paul.burton@imgtec.com>
To: Marcin Nowakowski <marcin.nowakowski@imgtec.com>, <ralf@linux-mips.org>
Cc: <linux-mips@linux-mips.org>, <trivial@kernel.org>
Subject: Re: [PATCH 11/11] MIPS: Declare various variables & functions static
Date: Tue, 29 Aug 2017 09:44:16 -0700	[thread overview]
Message-ID: <5605804.ME68hyheDo@np-p-burton> (raw)
In-Reply-To: <787b1a5b-2e77-41cc-235f-6dfd882b225a@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 5010 bytes --]

Hi Marcin,

On Tuesday, 29 August 2017 03:05:55 PDT Marcin Nowakowski wrote:
> On 23.08.2017 20:17, Paul Burton wrote:
> > We currently have various variables & functions which are only used
> > within a single translation unit, but which we don't declare static.
> > 
> > This causes various sparse warnings of the form:
> >    arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
> >    
> >      'mipsr2emustats' was not declared. Should it be static?
> >    
> >    arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
> >    
> >      was not declared. Should it be static?
> >    
> >    arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
> >    
> >      declared. Should it be static?
> > 
> > Fix these & others by declaring various affected variables & functions
> > static, avoiding the sparse warnings & redundant symbols.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> > Cc: linux-mips@linux-mips.org
> > 
> > ---
> > 
> >   arch/mips/kernel/cpu-probe.c          | 2 +-
> >   arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
> >   arch/mips/kernel/pm-cps.c             | 2 +-
> >   arch/mips/kernel/unaligned.c          | 2 +-
> >   arch/mips/mm/dma-default.c            | 4 ++--
> >   5 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > b/arch/mips/kernel/mips-r2-to-r6-emul.c index ae64c8f56a8c..ac23b4f09f02
> > 100644
> > --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> > @@ -46,9 +46,9 @@
> > 
> >   #define LL	"ll "
> >   #define SC	"sc "
> > 
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > -DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > +static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> 
> This leads to the following:
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:56: error:
> ‘mipsr2bremustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>                                                          ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:54: error:
> ‘mipsr2bdemustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:54: error: ‘mipsr2emustats’
> defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> 
> 
> when CONFIG_DEBUG_FS=n (eg. malta_qemu_32r6_defconfig)
> 
> Since these are not used without DEBUG_FS then I guess the following
> patch should be ok:
> 
> diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> b/arch/mips/kernel/mips-r2-to-r6-emul.c
> index 3bd721c..eb18b18 100644
> --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> @@ -46,9 +46,11 @@
>   #define LL     "ll "
>   #define SC     "sc "
> 
> +#ifdef CONFIG_DEBUG_FS
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> +#endif
> 
> if you're OK with it then I guess it may be best for Ralf to fold this
> change into your patch?

D'oh! That looks like a reasonable fix to me - could you fold it in Ralf?

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

WARNING: multiple messages have this Message-ID (diff)
From: Paul Burton <paul.burton@imgtec.com>
To: Marcin Nowakowski <marcin.nowakowski@imgtec.com>, ralf@linux-mips.org
Cc: linux-mips@linux-mips.org, trivial@kernel.org
Subject: Re: [PATCH 11/11] MIPS: Declare various variables & functions static
Date: Tue, 29 Aug 2017 09:44:16 -0700	[thread overview]
Message-ID: <5605804.ME68hyheDo@np-p-burton> (raw)
Message-ID: <20170829164416.vTG4GU7b66PFI535KzV9u3GagZXOODrd5OsWahesB1o@z> (raw)
In-Reply-To: <787b1a5b-2e77-41cc-235f-6dfd882b225a@imgtec.com>

[-- Attachment #1: Type: text/plain, Size: 5010 bytes --]

Hi Marcin,

On Tuesday, 29 August 2017 03:05:55 PDT Marcin Nowakowski wrote:
> On 23.08.2017 20:17, Paul Burton wrote:
> > We currently have various variables & functions which are only used
> > within a single translation unit, but which we don't declare static.
> > 
> > This causes various sparse warnings of the form:
> >    arch/mips/kernel/mips-r2-to-r6-emul.c:49:1: warning: symbol
> >    
> >      'mipsr2emustats' was not declared. Should it be static?
> >    
> >    arch/mips/kernel/unaligned.c:1381:11: warning: symbol 'reg16to32st'
> >    
> >      was not declared. Should it be static?
> >    
> >    arch/mips/mm/mmap.c:146:15: warning: symbol 'arch_mmap_rnd' was not
> >    
> >      declared. Should it be static?
> > 
> > Fix these & others by declaring various affected variables & functions
> > static, avoiding the sparse warnings & redundant symbols.
> > 
> > Signed-off-by: Paul Burton <paul.burton@imgtec.com>
> > Cc: Ralf Baechle <ralf@linux-mips.org>
> > Cc: linux-mips@linux-mips.org
> > 
> > ---
> > 
> >   arch/mips/kernel/cpu-probe.c          | 2 +-
> >   arch/mips/kernel/mips-r2-to-r6-emul.c | 6 +++---
> >   arch/mips/kernel/pm-cps.c             | 2 +-
> >   arch/mips/kernel/unaligned.c          | 2 +-
> >   arch/mips/mm/dma-default.c            | 4 ++--
> >   5 files changed, 8 insertions(+), 8 deletions(-)
> > 
> > diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > b/arch/mips/kernel/mips-r2-to-r6-emul.c index ae64c8f56a8c..ac23b4f09f02
> > 100644
> > --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> > +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> > @@ -46,9 +46,9 @@
> > 
> >   #define LL	"ll "
> >   #define SC	"sc "
> > 
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > -DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > -DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> > +static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
> > +static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> 
> This leads to the following:
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:56: error:
> ‘mipsr2bremustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>                                                          ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:51:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:54: error:
> ‘mipsr2bdemustats’ defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:50:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>          ^~~~~~~~~~~~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:54: error: ‘mipsr2emustats’
> defined but not used [-Werror=unused-variable]
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>                                                        ^
> ../include/linux/percpu-defs.h:105:19: note: in definition of macro
> ‘DEFINE_PER_CPU_SECTION’
>    __typeof__(type) name
>                     ^~~~
> ../arch/mips/kernel/mips-r2-to-r6-emul.c:49:8: note: in expansion of
> macro ‘DEFINE_PER_CPU’
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
> 
> 
> when CONFIG_DEBUG_FS=n (eg. malta_qemu_32r6_defconfig)
> 
> Since these are not used without DEBUG_FS then I guess the following
> patch should be ok:
> 
> diff --git a/arch/mips/kernel/mips-r2-to-r6-emul.c
> b/arch/mips/kernel/mips-r2-to-r6-emul.c
> index 3bd721c..eb18b18 100644
> --- a/arch/mips/kernel/mips-r2-to-r6-emul.c
> +++ b/arch/mips/kernel/mips-r2-to-r6-emul.c
> @@ -46,9 +46,11 @@
>   #define LL     "ll "
>   #define SC     "sc "
> 
> +#ifdef CONFIG_DEBUG_FS
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2emustats);
>   static DEFINE_PER_CPU(struct mips_r2_emulator_stats, mipsr2bdemustats);
>   static DEFINE_PER_CPU(struct mips_r2br_emulator_stats, mipsr2bremustats);
> +#endif
> 
> if you're OK with it then I guess it may be best for Ralf to fold this
> change into your patch?

D'oh! That looks like a reasonable fix to me - could you fold it in Ralf?

Thanks,
    Paul

[-- Attachment #2: This is a digitally signed message part. --]
[-- Type: application/pgp-signature, Size: 833 bytes --]

  parent reply	other threads:[~2017-08-29 16:44 UTC|newest]

Thread overview: 30+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2017-08-23 18:17 [PATCH 00/11] MIPS: Fix various sparse warnings Paul Burton
2017-08-23 18:17 ` Paul Burton
2017-08-23 18:17 ` [PATCH 01/11] MIPS: generic: Include asm/bootinfo.h for plat_fdt_relocated() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 02/11] MIPS: generic: Include asm/time.h for get_c0_*_int() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 03/11] MIPS: Include asm/setup.h for cpu_cache_init() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 04/11] MIPS: Include linux/cpu.h for arch_cpu_idle() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 05/11] MIPS: Include asm/delay.h for __{,n,u}delay() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 06/11] MIPS: Include elf-randomize.h for arch_mmap_rnd() & arch_randomize_brk() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 07/11] MIPS: Include linux/initrd.h for free_initrd_mem() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 08/11] MIPS: math-emu: Correct user fault_addr type Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 09/11] MIPS: Remove __invalidate_kernel_vmap_range Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 10/11] MIPS: Remove plat_timer_setup() Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-23 18:17 ` [PATCH 11/11] MIPS: Declare various variables & functions static Paul Burton
2017-08-23 18:17   ` Paul Burton
2017-08-29 10:07   ` Marcin Nowakowski
2017-08-29 10:07     ` Marcin Nowakowski
     [not found]   ` <787b1a5b-2e77-41cc-235f-6dfd882b225a@imgtec.com>
2017-08-29 16:44     ` Paul Burton [this message]
2017-08-29 16:44       ` Paul Burton
2017-08-29 16:46       ` Ralf Baechle
2017-08-25 21:20 ` [PATCH 00/11] MIPS: Fix various sparse warnings Florian Fainelli

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=5605804.ME68hyheDo@np-p-burton \
    --to=paul.burton@imgtec.com \
    --cc=linux-mips@linux-mips.org \
    --cc=marcin.nowakowski@imgtec.com \
    --cc=ralf@linux-mips.org \
    --cc=trivial@kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox