linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c:  Remove unused function
@ 2015-01-01 15:40 Rickard Strandqvist
  2015-01-02 10:10 ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Rickard Strandqvist @ 2015-01-01 15:40 UTC (permalink / raw)
  To: Linus Walleij, Russell King
  Cc: Rickard Strandqvist, linux-arm-kernel, linux-kernel

Remove the function mop500_regulator_init() that is not used anywhere.

This was partially found by using a static code analysis program called cppcheck.

Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
---
 arch/arm/mach-ux500/board-mop500-regulators.c |   41 -------------------------
 arch/arm/mach-ux500/board-mop500-regulators.h |    2 --
 2 files changed, 43 deletions(-)

diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
index 32d744e..156e83b 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.c
+++ b/arch/arm/mach-ux500/board-mop500-regulators.c
@@ -1022,44 +1022,3 @@ static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
 
 	BUG_ON(1);
 }
-
-void mop500_regulator_init(void)
-{
-	struct regulator_init_data *regulator;
-
-	/*
-	 * Temporarily turn on Vaux2 on 8520 machine
-	 */
-	if (cpu_is_u8520()) {
-		/* Vaux2 initialized to be on */
-		ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05);
-	}
-
-	/*
-	 * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
-	 * all HREFP_V20 boards)
-	 */
-	if (cpu_is_u8500v20()) {
-		/* VextSupply2RequestCtrl =  HP/OFF depending on VxRequest */
-		ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
-
-		/* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
-		ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2,
-			0x20, 0x20);
-
-		/* VextSupply2 = force HP at initialization */
-		ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04);
-
-		/* enable VextSupply2 during platform active */
-		regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
-		regulator->constraints.always_on = 1;
-
-		/* disable VextSupply2 in suspend */
-		regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
-		regulator->constraints.state_mem.disabled = 1;
-		regulator->constraints.state_standby.disabled = 1;
-
-		/* enable VextSupply2 HW control (used in suspend) */
-		regulator->driver_data = (void *)&ab8500_ext_supply2;
-	}
-}
diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
index 9bece38..dc3ee77 100644
--- a/arch/arm/mach-ux500/board-mop500-regulators.h
+++ b/arch/arm/mach-ux500/board-mop500-regulators.h
@@ -19,6 +19,4 @@ extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data;
 extern struct regulator_init_data tps61052_regulator;
 extern struct regulator_init_data gpio_en_3v3_regulator;
 
-void mop500_regulator_init(void);
-
 #endif
-- 
1.7.10.4


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

* Re: [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c: Remove unused function
  2015-01-01 15:40 [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c: Remove unused function Rickard Strandqvist
@ 2015-01-02 10:10 ` Arnd Bergmann
  2015-01-18 18:07   ` Lee Jones
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2015-01-02 10:10 UTC (permalink / raw)
  To: linux-arm-kernel
  Cc: Rickard Strandqvist, Linus Walleij, Russell King, linux-kernel,
	lee.jones

On Thursday 01 January 2015 16:40:05 Rickard Strandqvist wrote:
> Remove the function mop500_regulator_init() that is not used anywhere.
> 
> This was partially found by using a static code analysis program called cppcheck.
> 
> Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>

This looks wrong: For one thing, you failed to notice that now another function
in the same file becomes unused, or that half of the file is not used
anyway.

It also seems that the fact that this function is not called was an accident
and it should in fact be called. Maybe Lee has some more insight in this,
as he added the function in the first place.

Finally (unrelated to your patch, but triggered by looking at it), I suspect
we should just move the ab8500_regulator_plat_data and everything it references
to drivers/regulator/ab8500-ext.c, because we only have one instance of it
and won't ever have more.

	Arnd

> ---
>  arch/arm/mach-ux500/board-mop500-regulators.c |   41 -------------------------
>  arch/arm/mach-ux500/board-mop500-regulators.h |    2 --
>  2 files changed, 43 deletions(-)
> 
> diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
> index 32d744e..156e83b 100644
> --- a/arch/arm/mach-ux500/board-mop500-regulators.c
> +++ b/arch/arm/mach-ux500/board-mop500-regulators.c
> @@ -1022,44 +1022,3 @@ static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
>  
>  	BUG_ON(1);
>  }
> -
> -void mop500_regulator_init(void)
> -{
> -	struct regulator_init_data *regulator;
> -
> -	/*
> -	 * Temporarily turn on Vaux2 on 8520 machine
> -	 */
> -	if (cpu_is_u8520()) {
> -		/* Vaux2 initialized to be on */
> -		ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05);
> -	}
> -
> -	/*
> -	 * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
> -	 * all HREFP_V20 boards)
> -	 */
> -	if (cpu_is_u8500v20()) {
> -		/* VextSupply2RequestCtrl =  HP/OFF depending on VxRequest */
> -		ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
> -
> -		/* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
> -		ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2,
> -			0x20, 0x20);
> -
> -		/* VextSupply2 = force HP at initialization */
> -		ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04);
> -
> -		/* enable VextSupply2 during platform active */
> -		regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
> -		regulator->constraints.always_on = 1;
> -
> -		/* disable VextSupply2 in suspend */
> -		regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
> -		regulator->constraints.state_mem.disabled = 1;
> -		regulator->constraints.state_standby.disabled = 1;
> -
> -		/* enable VextSupply2 HW control (used in suspend) */
> -		regulator->driver_data = (void *)&ab8500_ext_supply2;
> -	}
> -}
> diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
> index 9bece38..dc3ee77 100644
> --- a/arch/arm/mach-ux500/board-mop500-regulators.h
> +++ b/arch/arm/mach-ux500/board-mop500-regulators.h
> @@ -19,6 +19,4 @@ extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data;
>  extern struct regulator_init_data tps61052_regulator;
>  extern struct regulator_init_data gpio_en_3v3_regulator;
>  
> -void mop500_regulator_init(void);
> -
>  #endif
> 


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

* Re: [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c: Remove unused function
  2015-01-02 10:10 ` Arnd Bergmann
@ 2015-01-18 18:07   ` Lee Jones
  2015-01-19 10:00     ` Arnd Bergmann
  0 siblings, 1 reply; 5+ messages in thread
From: Lee Jones @ 2015-01-18 18:07 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: linux-arm-kernel, Rickard Strandqvist, Linus Walleij,
	Russell King, linux-kernel

On Fri, 02 Jan 2015, Arnd Bergmann wrote:

> On Thursday 01 January 2015 16:40:05 Rickard Strandqvist wrote:
> > Remove the function mop500_regulator_init() that is not used anywhere.
> > 
> > This was partially found by using a static code analysis program called cppcheck.
> > 
> > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> 
> This looks wrong: For one thing, you failed to notice that now another function
> in the same file becomes unused, or that half of the file is not used
> anyway.
> 
> It also seems that the fact that this function is not called was an accident
> and it should in fact be called. Maybe Lee has some more insight in this,
> as he added the function in the first place.
> 
> Finally (unrelated to your patch, but triggered by looking at it), I suspect
> we should just move the ab8500_regulator_plat_data and everything it references
> to drivers/regulator/ab8500-ext.c, because we only have one instance of it
> and won't ever have more.

This is old code.  The development of this stuff was halted before it
could be finished.  Feel free to remove it and all other unused code
it uncovers.

> > ---
> >  arch/arm/mach-ux500/board-mop500-regulators.c |   41 -------------------------
> >  arch/arm/mach-ux500/board-mop500-regulators.h |    2 --
> >  2 files changed, 43 deletions(-)
> > 
> > diff --git a/arch/arm/mach-ux500/board-mop500-regulators.c b/arch/arm/mach-ux500/board-mop500-regulators.c
> > index 32d744e..156e83b 100644
> > --- a/arch/arm/mach-ux500/board-mop500-regulators.c
> > +++ b/arch/arm/mach-ux500/board-mop500-regulators.c
> > @@ -1022,44 +1022,3 @@ static void ab8500_modify_reg_init(int id, u8 mask, u8 value)
> >  
> >  	BUG_ON(1);
> >  }
> > -
> > -void mop500_regulator_init(void)
> > -{
> > -	struct regulator_init_data *regulator;
> > -
> > -	/*
> > -	 * Temporarily turn on Vaux2 on 8520 machine
> > -	 */
> > -	if (cpu_is_u8520()) {
> > -		/* Vaux2 initialized to be on */
> > -		ab8500_modify_reg_init(AB8505_VAUX12REGU, 0x0f, 0x05);
> > -	}
> > -
> > -	/*
> > -	 * Handle AB8500_EXT_SUPPLY2 on HREFP_V20_V50 boards (do it for
> > -	 * all HREFP_V20 boards)
> > -	 */
> > -	if (cpu_is_u8500v20()) {
> > -		/* VextSupply2RequestCtrl =  HP/OFF depending on VxRequest */
> > -		ab8500_modify_reg_init(AB8500_REGUREQUESTCTRL3, 0x01, 0x01);
> > -
> > -		/* VextSupply2SysClkReq1HPValid = SysClkReq1 controlled */
> > -		ab8500_modify_reg_init(AB8500_REGUSYSCLKREQ1HPVALID2,
> > -			0x20, 0x20);
> > -
> > -		/* VextSupply2 = force HP at initialization */
> > -		ab8500_modify_reg_init(AB8500_EXTSUPPLYREGU, 0x0c, 0x04);
> > -
> > -		/* enable VextSupply2 during platform active */
> > -		regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
> > -		regulator->constraints.always_on = 1;
> > -
> > -		/* disable VextSupply2 in suspend */
> > -		regulator = &ab8500_ext_regulators[AB8500_EXT_SUPPLY2];
> > -		regulator->constraints.state_mem.disabled = 1;
> > -		regulator->constraints.state_standby.disabled = 1;
> > -
> > -		/* enable VextSupply2 HW control (used in suspend) */
> > -		regulator->driver_data = (void *)&ab8500_ext_supply2;
> > -	}
> > -}
> > diff --git a/arch/arm/mach-ux500/board-mop500-regulators.h b/arch/arm/mach-ux500/board-mop500-regulators.h
> > index 9bece38..dc3ee77 100644
> > --- a/arch/arm/mach-ux500/board-mop500-regulators.h
> > +++ b/arch/arm/mach-ux500/board-mop500-regulators.h
> > @@ -19,6 +19,4 @@ extern struct ab8500_regulator_platform_data ab8505_regulator_plat_data;
> >  extern struct regulator_init_data tps61052_regulator;
> >  extern struct regulator_init_data gpio_en_3v3_regulator;
> >  
> > -void mop500_regulator_init(void);
> > -
> >  #endif
> > 
> 

-- 
Lee Jones
Linaro STMicroelectronics Landing Team Lead
Linaro.org │ Open source software for ARM SoCs
Follow Linaro: Facebook | Twitter | Blog

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

* Re: [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c: Remove unused function
  2015-01-18 18:07   ` Lee Jones
@ 2015-01-19 10:00     ` Arnd Bergmann
  2015-01-20 23:05       ` Rickard Strandqvist
  0 siblings, 1 reply; 5+ messages in thread
From: Arnd Bergmann @ 2015-01-19 10:00 UTC (permalink / raw)
  To: Lee Jones
  Cc: linux-arm-kernel, Rickard Strandqvist, Linus Walleij,
	Russell King, linux-kernel

On Sunday 18 January 2015 18:07:47 Lee Jones wrote:
> On Fri, 02 Jan 2015, Arnd Bergmann wrote:
> 
> > On Thursday 01 January 2015 16:40:05 Rickard Strandqvist wrote:
> > > Remove the function mop500_regulator_init() that is not used anywhere.
> > > 
> > > This was partially found by using a static code analysis program called cppcheck.
> > > 
> > > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
> > 
> > This looks wrong: For one thing, you failed to notice that now another function
> > in the same file becomes unused, or that half of the file is not used
> > anyway.
> > 
> > It also seems that the fact that this function is not called was an accident
> > and it should in fact be called. Maybe Lee has some more insight in this,
> > as he added the function in the first place.
> > 
> > Finally (unrelated to your patch, but triggered by looking at it), I suspect
> > we should just move the ab8500_regulator_plat_data and everything it references
> > to drivers/regulator/ab8500-ext.c, because we only have one instance of it
> > and won't ever have more.
> 
> This is old code.  The development of this stuff was halted before it
> could be finished.  Feel free to remove it and all other unused code
> it uncovers.
> 

Thanks for the confirmation!

Richard, do you feel up to doing the task of the broader cleanup here?

	Arnd

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

* Re: [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c: Remove unused function
  2015-01-19 10:00     ` Arnd Bergmann
@ 2015-01-20 23:05       ` Rickard Strandqvist
  0 siblings, 0 replies; 5+ messages in thread
From: Rickard Strandqvist @ 2015-01-20 23:05 UTC (permalink / raw)
  To: Arnd Bergmann
  Cc: Lee Jones, linux-arm-kernel, Linus Walleij, Russell King,
	Linux Kernel Mailing List

2015-01-19 11:00 GMT+01:00 Arnd Bergmann <arnd@arndb.de>:
> On Sunday 18 January 2015 18:07:47 Lee Jones wrote:
>> On Fri, 02 Jan 2015, Arnd Bergmann wrote:
>>
>> > On Thursday 01 January 2015 16:40:05 Rickard Strandqvist wrote:
>> > > Remove the function mop500_regulator_init() that is not used anywhere.
>> > >
>> > > This was partially found by using a static code analysis program called cppcheck.
>> > >
>> > > Signed-off-by: Rickard Strandqvist <rickard_strandqvist@spectrumdigital.se>
>> >
>> > This looks wrong: For one thing, you failed to notice that now another function
>> > in the same file becomes unused, or that half of the file is not used
>> > anyway.
>> >
>> > It also seems that the fact that this function is not called was an accident
>> > and it should in fact be called. Maybe Lee has some more insight in this,
>> > as he added the function in the first place.
>> >
>> > Finally (unrelated to your patch, but triggered by looking at it), I suspect
>> > we should just move the ab8500_regulator_plat_data and everything it references
>> > to drivers/regulator/ab8500-ext.c, because we only have one instance of it
>> > and won't ever have more.
>>
>> This is old code.  The development of this stuff was halted before it
>> could be finished.  Feel free to remove it and all other unused code
>> it uncovers.
>>
>
> Thanks for the confirmation!
>
> Richard, do you feel up to doing the task of the broader cleanup here?
>
>         Arnd



Hi

Yes, of course :)
Will see how much I can remove or move to
arch/arm/mach-ux500/cpu-db8500.c   like ab8500_regulator_plat_data.
And I believe there is more that I can do the same with.

So something is going on, but need a little more time...


Kind regards
Rickard Strandqvist

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

end of thread, other threads:[~2015-01-20 23:05 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2015-01-01 15:40 [PATCH] arch: arm: mach-ux500: board-mop500-regulators.c: Remove unused function Rickard Strandqvist
2015-01-02 10:10 ` Arnd Bergmann
2015-01-18 18:07   ` Lee Jones
2015-01-19 10:00     ` Arnd Bergmann
2015-01-20 23:05       ` Rickard Strandqvist

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).