[v1,1/2] clk: starfive: Fix RESET_STARFIVE_JH7110 can't be selected in a specified case

Message ID 20230417074115.30786-2-hal.feng@starfivetech.com
State New
Headers
Series A fix for StarFive JH7110 clock drivers |

Commit Message

Hal Feng April 17, 2023, 7:41 a.m. UTC
  When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]),
RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS
and CLK_STARFIVE_JH7110_AON.

Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation
test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant
selected options of CLK_STARFIVE_JH7110_AON because these options are
already selected by the dependency.

Fixes: edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
Fixes: b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
---
 drivers/clk/starfive/Kconfig | 5 +----
 1 file changed, 1 insertion(+), 4 deletions(-)
  

Comments

Conor Dooley April 17, 2023, 9:54 a.m. UTC | #1
On Mon, Apr 17, 2023 at 03:41:14PM +0800, Hal Feng wrote:
> When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]),
> RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS
> and CLK_STARFIVE_JH7110_AON.
> 
> Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation
> test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant
> selected options of CLK_STARFIVE_JH7110_AON because these options are
> already selected by the dependency.
> 
> Fixes: edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
> Fixes: b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
> ---
>  drivers/clk/starfive/Kconfig | 5 +----
>  1 file changed, 1 insertion(+), 4 deletions(-)
> 
> diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig
> index 71c1148ee5f6..3fad4adee841 100644
> --- a/drivers/clk/starfive/Kconfig
> +++ b/drivers/clk/starfive/Kconfig
> @@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
>  	depends on ARCH_STARFIVE || COMPILE_TEST
>  	select AUXILIARY_BUS
>  	select CLK_STARFIVE_JH71X0
> -	select RESET_STARFIVE_JH7110
> +	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE

Hmm, I don't really follow the logic above.
Why not just make the if be `if RESET_CONTROLLER` rather than
ARCH_STARFIVE?
I'm probably missing some obvious reason why not.

Cheers,
Conor.

>  	default ARCH_STARFIVE
>  	help
>  	  Say yes here to support the system clock controller on the
> @@ -35,9 +35,6 @@ config CLK_STARFIVE_JH7110_SYS
>  config CLK_STARFIVE_JH7110_AON
>  	tristate "StarFive JH7110 always-on clock support"
>  	depends on CLK_STARFIVE_JH7110_SYS
> -	select AUXILIARY_BUS
> -	select CLK_STARFIVE_JH71X0
> -	select RESET_STARFIVE_JH7110
>  	default m if ARCH_STARFIVE
>  	help
>  	  Say yes here to support the always-on clock controller on the
> -- 
> 2.38.1
>
  
Hal Feng April 17, 2023, 10:06 a.m. UTC | #2
On Mon, 17 Apr 2023 10:54:09 +0100, Conor Dooley wrote:
> On Mon, Apr 17, 2023 at 03:41:14PM +0800, Hal Feng wrote:
>> When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]),
>> RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS
>> and CLK_STARFIVE_JH7110_AON.
>> 
>> Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation
>> test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant
>> selected options of CLK_STARFIVE_JH7110_AON because these options are
>> already selected by the dependency.
>> 
>> Fixes: edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
>> Fixes: b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
>> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
>> ---
>>  drivers/clk/starfive/Kconfig | 5 +----
>>  1 file changed, 1 insertion(+), 4 deletions(-)
>> 
>> diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig
>> index 71c1148ee5f6..3fad4adee841 100644
>> --- a/drivers/clk/starfive/Kconfig
>> +++ b/drivers/clk/starfive/Kconfig
>> @@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
>>  	depends on ARCH_STARFIVE || COMPILE_TEST
>>  	select AUXILIARY_BUS
>>  	select CLK_STARFIVE_JH71X0
>> -	select RESET_STARFIVE_JH7110
>> +	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE
> 
> Hmm, I don't really follow the logic above.
> Why not just make the if be `if RESET_CONTROLLER` rather than
> ARCH_STARFIVE?
> I'm probably missing some obvious reason why not.

Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.

Best regards,
Hal
  
Conor Dooley April 17, 2023, 10:18 a.m. UTC | #3
On Mon, Apr 17, 2023 at 06:06:29PM +0800, Hal Feng wrote:
> On Mon, 17 Apr 2023 10:54:09 +0100, Conor Dooley wrote:
> > On Mon, Apr 17, 2023 at 03:41:14PM +0800, Hal Feng wrote:
> >> When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]),
> >> RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS
> >> and CLK_STARFIVE_JH7110_AON.
> >> 
> >> Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation
> >> test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant
> >> selected options of CLK_STARFIVE_JH7110_AON because these options are
> >> already selected by the dependency.
> >> 
> >> Fixes: edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
> >> Fixes: b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
> >> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
> >> ---
> >>  drivers/clk/starfive/Kconfig | 5 +----
> >>  1 file changed, 1 insertion(+), 4 deletions(-)
> >> 
> >> diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig
> >> index 71c1148ee5f6..3fad4adee841 100644
> >> --- a/drivers/clk/starfive/Kconfig
> >> +++ b/drivers/clk/starfive/Kconfig
> >> @@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
> >>  	depends on ARCH_STARFIVE || COMPILE_TEST
> >>  	select AUXILIARY_BUS
> >>  	select CLK_STARFIVE_JH71X0
> >> -	select RESET_STARFIVE_JH7110
> >> +	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE
> > 
> > Hmm, I don't really follow the logic above.
> > Why not just make the if be `if RESET_CONTROLLER` rather than
> > ARCH_STARFIVE?
> > I'm probably missing some obvious reason why not.
> 
> Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.

Aye, just the explicit dependency seems like it'd be less fragile and
more obvious in the future.
  
Stephen Boyd April 18, 2023, 12:22 a.m. UTC | #4
Quoting Conor Dooley (2023-04-17 03:18:35)
> On Mon, Apr 17, 2023 at 06:06:29PM +0800, Hal Feng wrote:
> > On Mon, 17 Apr 2023 10:54:09 +0100, Conor Dooley wrote:
> > > On Mon, Apr 17, 2023 at 03:41:14PM +0800, Hal Feng wrote:
> > >> When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]),
> > >> RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS
> > >> and CLK_STARFIVE_JH7110_AON.
> > >> 
> > >> Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation
> > >> test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant
> > >> selected options of CLK_STARFIVE_JH7110_AON because these options are
> > >> already selected by the dependency.
> > >> 
> > >> Fixes: edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
> > >> Fixes: b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
> > >> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
> > >> ---
> > >>  drivers/clk/starfive/Kconfig | 5 +----
> > >>  1 file changed, 1 insertion(+), 4 deletions(-)
> > >> 
> > >> diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig
> > >> index 71c1148ee5f6..3fad4adee841 100644
> > >> --- a/drivers/clk/starfive/Kconfig
> > >> +++ b/drivers/clk/starfive/Kconfig
> > >> @@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
> > >>    depends on ARCH_STARFIVE || COMPILE_TEST
> > >>    select AUXILIARY_BUS
> > >>    select CLK_STARFIVE_JH71X0
> > >> -  select RESET_STARFIVE_JH7110
> > >> +  select RESET_STARFIVE_JH7110 if ARCH_STARFIVE
> > > 
> > > Hmm, I don't really follow the logic above.
> > > Why not just make the if be `if RESET_CONTROLLER` rather than
> > > ARCH_STARFIVE?
> > > I'm probably missing some obvious reason why not.
> > 
> > Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.
> 
> Aye, just the explicit dependency seems like it'd be less fragile and
> more obvious in the future.

Agreed. Be explicit so we don't have to hunt down select dependencies.
  
Hal Feng April 18, 2023, 2:14 a.m. UTC | #5
On Mon, 17 Apr 2023 17:22:01 -0700, Stephen Boyd wrote:
> Quoting Conor Dooley (2023-04-17 03:18:35)
>> On Mon, Apr 17, 2023 at 06:06:29PM +0800, Hal Feng wrote:
>> > On Mon, 17 Apr 2023 10:54:09 +0100, Conor Dooley wrote:
>> > > On Mon, Apr 17, 2023 at 03:41:14PM +0800, Hal Feng wrote:
>> > >> When (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && RESET_CONTROLLER [=n]),
>> > >> RESET_STARFIVE_JH7110 can't be selected by CLK_STARFIVE_JH7110_SYS
>> > >> and CLK_STARFIVE_JH7110_AON.
>> > >> 
>> > >> Considering RESET_STARFIVE_JH7110 is not a necessary option for compilation
>> > >> test, we should select it only if ARCH_STARFIVE=y. Also, delete redundant
>> > >> selected options of CLK_STARFIVE_JH7110_AON because these options are
>> > >> already selected by the dependency.
>> > >> 
>> > >> Fixes: edab7204afe5 ("clk: starfive: Add StarFive JH7110 system clock driver")
>> > >> Fixes: b2ab3c94f41f ("clk: starfive: Add StarFive JH7110 always-on clock driver")
>> > >> Signed-off-by: Hal Feng <hal.feng@starfivetech.com>
>> > >> ---
>> > >>  drivers/clk/starfive/Kconfig | 5 +----
>> > >>  1 file changed, 1 insertion(+), 4 deletions(-)
>> > >> 
>> > >> diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig
>> > >> index 71c1148ee5f6..3fad4adee841 100644
>> > >> --- a/drivers/clk/starfive/Kconfig
>> > >> +++ b/drivers/clk/starfive/Kconfig
>> > >> @@ -26,7 +26,7 @@ config CLK_STARFIVE_JH7110_SYS
>> > >>    depends on ARCH_STARFIVE || COMPILE_TEST
>> > >>    select AUXILIARY_BUS
>> > >>    select CLK_STARFIVE_JH71X0
>> > >> -  select RESET_STARFIVE_JH7110
>> > >> +  select RESET_STARFIVE_JH7110 if ARCH_STARFIVE
>> > > 
>> > > Hmm, I don't really follow the logic above.
>> > > Why not just make the if be `if RESET_CONTROLLER` rather than
>> > > ARCH_STARFIVE?
>> > > I'm probably missing some obvious reason why not.
>> > 
>> > Note that RESET_CONTROLLER is selected by ARCH_STARFIVE. Thanks.
>> 
>> Aye, just the explicit dependency seems like it'd be less fragile and
>> more obvious in the future.
> 
> Agreed. Be explicit so we don't have to hunt down select dependencies.

With further consideration, on the other hand, if we set `if ARCH_STARFIVE`
here, it can point out that we need the reset driver to boot up JH7110
besides the clock drivers, and the reset driver is not a necessary option
for compilation test. So the reset driver is independent to the clock
drivers when you doing a compilation test.

If we set `if RESET_CONTROLLER` here, the reset driver will be compiled
automatically when (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && 
RESET_CONTROLLER [=y] && CLK_STARFIVE_JH7110_SYS [=y]).

Best regards,
Hal
  
Conor Dooley April 18, 2023, 6:31 a.m. UTC | #6
On Tue, Apr 18, 2023 at 10:14:06AM +0800, Hal Feng wrote:
> On Mon, 17 Apr 2023 17:22:01 -0700, Stephen Boyd wrote:
> > Quoting Conor Dooley (2023-04-17 03:18:35)

> >> Aye, just the explicit dependency seems like it'd be less fragile and
> >> more obvious in the future.
> > 
> > Agreed. Be explicit so we don't have to hunt down select dependencies.
> 
> With further consideration, on the other hand, if we set `if ARCH_STARFIVE`
> here, it can point out that we need the reset driver to boot up JH7110
> besides the clock drivers, and the reset driver is not a necessary option
> for compilation test. So the reset driver is independent to the clock
> drivers when you doing a compilation test.

If ARCH_STARFIVE is enabled, both options (RESET_CONTROLLER &
RESET_STARFIVE_JH7110) will be selected & you don't need to worry about
people not realising this. Try it out & look at the option in
menuconfig.

> If we set `if RESET_CONTROLLER` here, the reset driver will be compiled
> automatically when (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && 
> RESET_CONTROLLER [=y] && CLK_STARFIVE_JH7110_SYS [=y]).

This is what we want, right? The more often it gets built by randconfig
etc the better, especially for archs that are not RISC-V.

Cheers,
Conor.
  
Hal Feng April 18, 2023, 12:42 p.m. UTC | #7
On Tue, 18 Apr 2023 07:31:47 +0100, Conor Dooley wrote:
> On Tue, Apr 18, 2023 at 10:14:06AM +0800, Hal Feng wrote:
>> On Mon, 17 Apr 2023 17:22:01 -0700, Stephen Boyd wrote:
>> > Quoting Conor Dooley (2023-04-17 03:18:35)
> 
>> >> Aye, just the explicit dependency seems like it'd be less fragile and
>> >> more obvious in the future.
>> > 
>> > Agreed. Be explicit so we don't have to hunt down select dependencies.
>> 
>> With further consideration, on the other hand, if we set `if ARCH_STARFIVE`
>> here, it can point out that we need the reset driver to boot up JH7110
>> besides the clock drivers, and the reset driver is not a necessary option
>> for compilation test. So the reset driver is independent to the clock
>> drivers when you doing a compilation test.
> 
> If ARCH_STARFIVE is enabled, both options (RESET_CONTROLLER &
> RESET_STARFIVE_JH7110) will be selected & you don't need to worry about
> people not realising this. Try it out & look at the option in
> menuconfig.
> 
>> If we set `if RESET_CONTROLLER` here, the reset driver will be compiled
>> automatically when (ARCH_STARFIVE [=n] && COMPILE_TEST [=y] && 
>> RESET_CONTROLLER [=y] && CLK_STARFIVE_JH7110_SYS [=y]).
> 
> This is what we want, right? The more often it gets built by randconfig
> etc the better, especially for archs that are not RISC-V.

OK, will fix it in v2.

Best regards,
Hal
  

Patch

diff --git a/drivers/clk/starfive/Kconfig b/drivers/clk/starfive/Kconfig
index 71c1148ee5f6..3fad4adee841 100644
--- a/drivers/clk/starfive/Kconfig
+++ b/drivers/clk/starfive/Kconfig
@@ -26,7 +26,7 @@  config CLK_STARFIVE_JH7110_SYS
 	depends on ARCH_STARFIVE || COMPILE_TEST
 	select AUXILIARY_BUS
 	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
+	select RESET_STARFIVE_JH7110 if ARCH_STARFIVE
 	default ARCH_STARFIVE
 	help
 	  Say yes here to support the system clock controller on the
@@ -35,9 +35,6 @@  config CLK_STARFIVE_JH7110_SYS
 config CLK_STARFIVE_JH7110_AON
 	tristate "StarFive JH7110 always-on clock support"
 	depends on CLK_STARFIVE_JH7110_SYS
-	select AUXILIARY_BUS
-	select CLK_STARFIVE_JH71X0
-	select RESET_STARFIVE_JH7110
 	default m if ARCH_STARFIVE
 	help
 	  Say yes here to support the always-on clock controller on the