All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] arch/ia64: no need to initialise statics to 0
@ 2022-05-08  2:26 ` Jason Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2022-05-08  2:26 UTC (permalink / raw)
  To: yury.norov; +Cc: wangborong, akpm, Julia.Lawall, linux-ia64, linux-kernel

Static variables do not need to be initialised to 0, because compiler
will initialise all uninitialised statics to 0. Thus, remove the
unneeded initializations.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
---
 arch/ia64/mm/tlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 7a2d608fba74..854e90c4e7eb 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -84,7 +84,7 @@ wrap_mmu_context (struct mm_struct *mm)
 		flush_bit = xchg(&ia64_ctx.flushmap[i], 0);
 		ia64_ctx.bitmap[i] ^= flush_bit;
 	}
- 
+
 	/* use offset at 300 to skip daemons */
 	ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap,
 				ia64_ctx.max_ctx, 300);
@@ -144,7 +144,7 @@ static inline void up_spin(struct spinaphore *ss)
 static struct spinaphore ptcg_sem;
 static u16 nptcg = 1;
 static int need_ptcg_sem = 1;
-static int toolatetochangeptcgsem = 0;
+static int toolatetochangeptcgsem;
 
 /*
  * Kernel parameter "nptcg=" overrides max number of concurrent global TLB
-- 
2.35.1


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

* [PATCH] arch/ia64: no need to initialise statics to 0
@ 2022-05-08  2:26 ` Jason Wang
  0 siblings, 0 replies; 4+ messages in thread
From: Jason Wang @ 2022-05-08  2:26 UTC (permalink / raw)
  To: yury.norov; +Cc: wangborong, akpm, Julia.Lawall, linux-ia64, linux-kernel

Static variables do not need to be initialised to 0, because compiler
will initialise all uninitialised statics to 0. Thus, remove the
unneeded initializations.

Signed-off-by: Jason Wang <wangborong@cdjrlc.com>
---
 arch/ia64/mm/tlb.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
index 7a2d608fba74..854e90c4e7eb 100644
--- a/arch/ia64/mm/tlb.c
+++ b/arch/ia64/mm/tlb.c
@@ -84,7 +84,7 @@ wrap_mmu_context (struct mm_struct *mm)
 		flush_bit = xchg(&ia64_ctx.flushmap[i], 0);
 		ia64_ctx.bitmap[i] ^= flush_bit;
 	}
- 
+
 	/* use offset at 300 to skip daemons */
 	ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap,
 				ia64_ctx.max_ctx, 300);
@@ -144,7 +144,7 @@ static inline void up_spin(struct spinaphore *ss)
 static struct spinaphore ptcg_sem;
 static u16 nptcg = 1;
 static int need_ptcg_sem = 1;
-static int toolatetochangeptcgsem = 0;
+static int toolatetochangeptcgsem;
 
 /*
  * Kernel parameter "nptcg=" overrides max number of concurrent global TLB
-- 
2.35.1

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

* Re: [PATCH] arch/ia64: no need to initialise statics to 0
  2022-05-08  2:26 ` Jason Wang
@ 2022-05-08  3:35   ` Yury Norov
  -1 siblings, 0 replies; 4+ messages in thread
From: Yury Norov @ 2022-05-08  3:35 UTC (permalink / raw)
  To: Jason Wang; +Cc: akpm, Julia.Lawall, linux-ia64, linux-kernel, Fenghua Yu

+ Fenghua Yu <fenghua.yu@intel.com>

On Sun, May 08, 2022 at 10:26:28AM +0800, Jason Wang wrote:
> Static variables do not need to be initialised to 0, because compiler
> will initialise all uninitialised statics to 0. Thus, remove the
> unneeded initializations.
> 
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>

Not sure why checkpatch picked me to be a reviewer for this.
Nevertheless...

> ---
>  arch/ia64/mm/tlb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
> index 7a2d608fba74..854e90c4e7eb 100644
> --- a/arch/ia64/mm/tlb.c
> +++ b/arch/ia64/mm/tlb.c
> @@ -84,7 +84,7 @@ wrap_mmu_context (struct mm_struct *mm)
>  		flush_bit = xchg(&ia64_ctx.flushmap[i], 0);
>  		ia64_ctx.bitmap[i] ^= flush_bit;
>  	}
> - 
> +

This one is unrelated to the patch description. Can you split the
patch, or add a couple words about this cleanup?

>  	/* use offset at 300 to skip daemons */
>  	ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap,
>  				ia64_ctx.max_ctx, 300);
> @@ -144,7 +144,7 @@ static inline void up_spin(struct spinaphore *ss)
>  static struct spinaphore ptcg_sem;
>  static u16 nptcg = 1;
>  static int need_ptcg_sem = 1;
> -static int toolatetochangeptcgsem = 0;
> +static int toolatetochangeptcgsem;

There are at least 460 global static variables initialized explicitly.

yury:linux$ git grep "^static" | grep "= 0;" | wc -l
460

Are you going to fix them all? If not why this one is so special?

Before applying this, let's ask Fenghua - maybe it was his intention
to underline that the variable is initialized as 0.  

Thanks,
Yury

>  /*
>   * Kernel parameter "nptcg=" overrides max number of concurrent global TLB
> -- 
> 2.35.1

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

* Re: [PATCH] arch/ia64: no need to initialise statics to 0
@ 2022-05-08  3:35   ` Yury Norov
  0 siblings, 0 replies; 4+ messages in thread
From: Yury Norov @ 2022-05-08  3:35 UTC (permalink / raw)
  To: Jason Wang; +Cc: akpm, Julia.Lawall, linux-ia64, linux-kernel, Fenghua Yu

+ Fenghua Yu <fenghua.yu@intel.com>

On Sun, May 08, 2022 at 10:26:28AM +0800, Jason Wang wrote:
> Static variables do not need to be initialised to 0, because compiler
> will initialise all uninitialised statics to 0. Thus, remove the
> unneeded initializations.
> 
> Signed-off-by: Jason Wang <wangborong@cdjrlc.com>

Not sure why checkpatch picked me to be a reviewer for this.
Nevertheless...

> ---
>  arch/ia64/mm/tlb.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/arch/ia64/mm/tlb.c b/arch/ia64/mm/tlb.c
> index 7a2d608fba74..854e90c4e7eb 100644
> --- a/arch/ia64/mm/tlb.c
> +++ b/arch/ia64/mm/tlb.c
> @@ -84,7 +84,7 @@ wrap_mmu_context (struct mm_struct *mm)
>  		flush_bit = xchg(&ia64_ctx.flushmap[i], 0);
>  		ia64_ctx.bitmap[i] ^= flush_bit;
>  	}
> - 
> +

This one is unrelated to the patch description. Can you split the
patch, or add a couple words about this cleanup?

>  	/* use offset at 300 to skip daemons */
>  	ia64_ctx.next = find_next_zero_bit(ia64_ctx.bitmap,
>  				ia64_ctx.max_ctx, 300);
> @@ -144,7 +144,7 @@ static inline void up_spin(struct spinaphore *ss)
>  static struct spinaphore ptcg_sem;
>  static u16 nptcg = 1;
>  static int need_ptcg_sem = 1;
> -static int toolatetochangeptcgsem = 0;
> +static int toolatetochangeptcgsem;

There are at least 460 global static variables initialized explicitly.

yury:linux$ git grep "^static" | grep "= 0;" | wc -l
460

Are you going to fix them all? If not why this one is so special?

Before applying this, let's ask Fenghua - maybe it was his intention
to underline that the variable is initialized as 0.  

Thanks,
Yury

>  /*
>   * Kernel parameter "nptcg=" overrides max number of concurrent global TLB
> -- 
> 2.35.1

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

end of thread, other threads:[~2022-05-08  3:36 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2022-05-08  2:26 [PATCH] arch/ia64: no need to initialise statics to 0 Jason Wang
2022-05-08  2:26 ` Jason Wang
2022-05-08  3:35 ` Yury Norov
2022-05-08  3:35   ` Yury Norov

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.