linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk()
@ 2024-06-18 11:58 Youwan Wang
  2024-06-19 12:33 ` Sudeep Holla
  2024-06-20 13:37 ` [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk Youwan Wang
  0 siblings, 2 replies; 8+ messages in thread
From: Youwan Wang @ 2024-06-18 11:58 UTC (permalink / raw)
  To: lpieralisi
  Cc: guohanjun, linux-kernel, linux-arm-kernel, lenb, rafael,
	sudeep.holla, linux-acpi, Youwan Wang

Defining `amba_dummy_clk` as static is meaningless.

The amba_register_dummy_clk() function is static and
is called during initialization. I think 'amba_dummy_clk'
should be NULL each time when initializing

Signed-off-by: Youwan Wang <youwan@nfschina.com>
---
 drivers/acpi/arm64/amba.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
index 60be8ee1dbdc..ef438417cc80 100644
--- a/drivers/acpi/arm64/amba.c
+++ b/drivers/acpi/arm64/amba.c
@@ -35,11 +35,7 @@ static const struct acpi_device_id amba_id_list[] = {
 
 static void amba_register_dummy_clk(void)
 {
-	static struct clk *amba_dummy_clk;
-
-	/* If clock already registered */
-	if (amba_dummy_clk)
-		return;
+	struct clk *amba_dummy_clk;
 
 	amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
 	clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);
-- 
2.25.1



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

* Re: [PATCH v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk()
  2024-06-18 11:58 [PATCH v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk() Youwan Wang
@ 2024-06-19 12:33 ` Sudeep Holla
  2024-06-20 13:37 ` [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk Youwan Wang
  1 sibling, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2024-06-19 12:33 UTC (permalink / raw)
  To: Youwan Wang
  Cc: lpieralisi, guohanjun, Sudeep Holla, linux-kernel,
	linux-arm-kernel, lenb, rafael, linux-acpi

On Tue, Jun 18, 2024 at 07:58:45PM +0800, Youwan Wang wrote:
> Defining `amba_dummy_clk` as static is meaningless.
> 
> The amba_register_dummy_clk() function is static and
> is called during initialization. I think 'amba_dummy_clk'
> should be NULL each time when initializing
>

Also I missed to read the commit message, please update it as follows:

"
ACPI / amba: Drop unnecessary check for registered amba_dummy_clk

amba_register_dummy_clk() is called only once from acpi_amba_init()
and acpi_amba_init() itself is called once during the initialisation.
amba_dummy_clk cann't be initialised before this in any other code
path and hence the check for already registered amba_dummy_clk is
not necessary. Drop the same.
"

Also few other things to note:
1. You missed to add my Acked-by which I gave to your v2
2. This is v3 and new reviewers of this patch have absolutely no idea
   what got changed from v1->v2->v3. It is always good to add change log
   across versions
3. I asked you to add ARM64 maintainers as we would request them to pick
   this up via ARM64 tree.
	Catalin Marinas <catalin.marinas@arm.com
	Will Deacon <will@kernel.org>

--
Regards,
Sudeep


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

* [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
  2024-06-18 11:58 [PATCH v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk() Youwan Wang
  2024-06-19 12:33 ` Sudeep Holla
@ 2024-06-20 13:37 ` Youwan Wang
  2024-06-24  2:09   ` Hanjun Guo
  2024-06-24  2:31   ` [PATCH v4] " Youwan Wang
  1 sibling, 2 replies; 8+ messages in thread
From: Youwan Wang @ 2024-06-20 13:37 UTC (permalink / raw)
  To: youwan
  Cc: guohanjun, lenb, linux-acpi, linux-arm-kernel, linux-kernel,
	lpieralisi, rafael, sudeep.holla, catalin.marinas, will

amba_register_dummy_clk() is called only once from acpi_amba_init()
and acpi_amba_init() itself is called once during the initialisation.
amba_dummy_clk can't be initialised before this in any other code
path and hence the check for already registered amba_dummy_clk is
not necessary. Drop the same.

Signed-off-by: Youwan Wang <youwan@nfschina.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
---
v1->v2->v3: Modify the commit log description
---
 drivers/acpi/arm64/amba.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
index 60be8ee1dbdc..ef438417cc80 100644
--- a/drivers/acpi/arm64/amba.c
+++ b/drivers/acpi/arm64/amba.c
@@ -35,11 +35,7 @@ static const struct acpi_device_id amba_id_list[] = {
 
 static void amba_register_dummy_clk(void)
 {
-	static struct clk *amba_dummy_clk;
-
-	/* If clock already registered */
-	if (amba_dummy_clk)
-		return;
+	struct clk *amba_dummy_clk;
 
 	amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
 	clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);
-- 
2.25.1



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

* Re: [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
  2024-06-20 13:37 ` [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk Youwan Wang
@ 2024-06-24  2:09   ` Hanjun Guo
  2024-06-24  2:31   ` [PATCH v4] " Youwan Wang
  1 sibling, 0 replies; 8+ messages in thread
From: Hanjun Guo @ 2024-06-24  2:09 UTC (permalink / raw)
  To: Youwan Wang
  Cc: lenb, linux-acpi, linux-arm-kernel, linux-kernel, lpieralisi,
	rafael, sudeep.holla, catalin.marinas, will

Hi Youwan,

Please use v4 for your patch subject which was suggested by Sudeep:

[PATCH v4] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk

On 2024/6/20 21:37, Youwan Wang wrote:
> amba_register_dummy_clk() is called only once from acpi_amba_init()
> and acpi_amba_init() itself is called once during the initialisation.
> amba_dummy_clk can't be initialised before this in any other code
> path and hence the check for already registered amba_dummy_clk is
> not necessary. Drop the same.
> 
> Signed-off-by: Youwan Wang <youwan@nfschina.com>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> ---
> v1->v2->v3: Modify the commit log description

Please update it as follows:

Changes from v3:
- Update the commit message suggested by Sudeep;
- Add Acked-by from Sudeep;
- +Cc ARM64 maintainers Catalin and Will.

> ---
>   drivers/acpi/arm64/amba.c | 6 +-----
>   1 file changed, 1 insertion(+), 5 deletions(-)
> 
> diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
> index 60be8ee1dbdc..ef438417cc80 100644
> --- a/drivers/acpi/arm64/amba.c
> +++ b/drivers/acpi/arm64/amba.c
> @@ -35,11 +35,7 @@ static const struct acpi_device_id amba_id_list[] = {
>   
>   static void amba_register_dummy_clk(void)
>   {
> -	static struct clk *amba_dummy_clk;
> -
> -	/* If clock already registered */
> -	if (amba_dummy_clk)
> -		return;
> +	struct clk *amba_dummy_clk;
>   
>   	amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
>   	clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);

With that updated,

Acked-by: Hanjun Guo <guohanjun@huawei.com>

Thanks
Hanjun


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

* [PATCH v4] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
  2024-06-20 13:37 ` [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk Youwan Wang
  2024-06-24  2:09   ` Hanjun Guo
@ 2024-06-24  2:31   ` Youwan Wang
  2024-06-24 14:48     ` Sudeep Holla
                       ` (2 more replies)
  1 sibling, 3 replies; 8+ messages in thread
From: Youwan Wang @ 2024-06-24  2:31 UTC (permalink / raw)
  To: youwan
  Cc: guohanjun, lenb, linux-acpi, linux-arm-kernel, linux-kernel,
	lpieralisi, rafael, sudeep.holla, catalin.marinas, will

amba_register_dummy_clk() is called only once from acpi_amba_init()
and acpi_amba_init() itself is called once during the initialisation.
amba_dummy_clk can't be initialised before this in any other code
path and hence the check for already registered amba_dummy_clk is
not necessary. Drop the same.

Signed-off-by: Youwan Wang <youwan@nfschina.com>
Acked-by: Sudeep Holla <sudeep.holla@arm.com>
Acked-by: Hanjun Guo <guohanjun@huawei.com>
---
v1->v2->v3: Modify the commit log description
v3->v4: Update the commit message suggested by Sudeep;
        Add Acked-by from Sudeep;
        +Cc ARM64 maintainers Catalin and Will.
---
 drivers/acpi/arm64/amba.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

diff --git a/drivers/acpi/arm64/amba.c b/drivers/acpi/arm64/amba.c
index 60be8ee1dbdc..ef438417cc80 100644
--- a/drivers/acpi/arm64/amba.c
+++ b/drivers/acpi/arm64/amba.c
@@ -35,11 +35,7 @@ static const struct acpi_device_id amba_id_list[] = {
 
 static void amba_register_dummy_clk(void)
 {
-	static struct clk *amba_dummy_clk;
-
-	/* If clock already registered */
-	if (amba_dummy_clk)
-		return;
+	struct clk *amba_dummy_clk;
 
 	amba_dummy_clk = clk_register_fixed_rate(NULL, "apb_pclk", NULL, 0, 0);
 	clk_register_clkdev(amba_dummy_clk, "apb_pclk", NULL);
-- 
2.25.1



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

* Re: [PATCH v4] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
  2024-06-24  2:31   ` [PATCH v4] " Youwan Wang
@ 2024-06-24 14:48     ` Sudeep Holla
  2024-06-24 15:02     ` Sudeep Holla
  2024-06-24 18:11     ` Catalin Marinas
  2 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2024-06-24 14:48 UTC (permalink / raw)
  To: Youwan Wang
  Cc: guohanjun, lenb, linux-acpi, linux-arm-kernel, linux-kernel,
	lpieralisi, rafael, catalin.marinas, will, Sudeep Holla

On Mon, Jun 24, 2024 at 10:31:01AM +0800, Youwan Wang wrote:
> amba_register_dummy_clk() is called only once from acpi_amba_init()
> and acpi_amba_init() itself is called once during the initialisation.
> amba_dummy_clk can't be initialised before this in any other code
> path and hence the check for already registered amba_dummy_clk is
> not necessary. Drop the same.
> 
> Signed-off-by: Youwan Wang <youwan@nfschina.com>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> Acked-by: Hanjun Guo <guohanjun@huawei.com>
> ---
> v1->v2->v3: Modify the commit log description
> v3->v4: Update the commit message suggested by Sudeep;
>         Add Acked-by from Sudeep;
>         +Cc ARM64 maintainers Catalin and Will.


I think I have told you many time now and you are missing to understand
few basic stuff. So I suggest to give
`Documentation/process/submitting-patches.rst`
under the kernel source a read and especially the section
`The canonical patch format`

Ideally this patch should have been v5 as you added Hanjun's Ack
Also "v1->v2->v3: Modify the commit log description" makes no sense.

The changelog should list all the deltas like:
v4->v5:
	- <blah3 blah3>
v3->v4:
	- <blah2 blah2>
v2->v3:
	- <blah1 blah1>
v1->v2:
	- <blah blah>

Anyways, it is only for your learning and future references.

--
Regards,
Sudeep


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

* Re: [PATCH v4] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
  2024-06-24  2:31   ` [PATCH v4] " Youwan Wang
  2024-06-24 14:48     ` Sudeep Holla
@ 2024-06-24 15:02     ` Sudeep Holla
  2024-06-24 18:11     ` Catalin Marinas
  2 siblings, 0 replies; 8+ messages in thread
From: Sudeep Holla @ 2024-06-24 15:02 UTC (permalink / raw)
  To: Youwan Wang, catalin.marinas
  Cc: guohanjun, lenb, linux-acpi, linux-arm-kernel, linux-kernel,
	lpieralisi, rafael, will, Sudeep Holla

On Mon, Jun 24, 2024 at 10:31:01AM +0800, Youwan Wang wrote:
> amba_register_dummy_clk() is called only once from acpi_amba_init()
> and acpi_amba_init() itself is called once during the initialisation.
> amba_dummy_clk can't be initialised before this in any other code
> path and hence the check for already registered amba_dummy_clk is
> not necessary. Drop the same.
> 
> Signed-off-by: Youwan Wang <youwan@nfschina.com>
> Acked-by: Sudeep Holla <sudeep.holla@arm.com>
> Acked-by: Hanjun Guo <guohanjun@huawei.com>
> ---

Hi Catalin,

Can you please pick up this simple cleanup patch under ACPI changes ?
It is very hard to follow the versions as it is messed up, but this
version is good to take though.

--
Regards,
Sudeep


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

* Re: [PATCH v4] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
  2024-06-24  2:31   ` [PATCH v4] " Youwan Wang
  2024-06-24 14:48     ` Sudeep Holla
  2024-06-24 15:02     ` Sudeep Holla
@ 2024-06-24 18:11     ` Catalin Marinas
  2 siblings, 0 replies; 8+ messages in thread
From: Catalin Marinas @ 2024-06-24 18:11 UTC (permalink / raw)
  To: Youwan Wang
  Cc: Will Deacon, guohanjun, lenb, linux-acpi, linux-arm-kernel,
	linux-kernel, lpieralisi, rafael, sudeep.holla

On Mon, 24 Jun 2024 10:31:01 +0800, Youwan Wang wrote:
> amba_register_dummy_clk() is called only once from acpi_amba_init()
> and acpi_amba_init() itself is called once during the initialisation.
> amba_dummy_clk can't be initialised before this in any other code
> path and hence the check for already registered amba_dummy_clk is
> not necessary. Drop the same.
> 
> 
> [...]

Applied to arm64 (for-next/acpi), thanks!

[1/1] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk
      https://git.kernel.org/arm64/c/bfe3f0df3e3c

-- 
Catalin



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

end of thread, other threads:[~2024-06-24 18:12 UTC | newest]

Thread overview: 8+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-06-18 11:58 [PATCH v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk() Youwan Wang
2024-06-19 12:33 ` Sudeep Holla
2024-06-20 13:37 ` [PATCH] ACPI / amba: Drop unnecessary check for registered amba_dummy_clk Youwan Wang
2024-06-24  2:09   ` Hanjun Guo
2024-06-24  2:31   ` [PATCH v4] " Youwan Wang
2024-06-24 14:48     ` Sudeep Holla
2024-06-24 15:02     ` Sudeep Holla
2024-06-24 18:11     ` Catalin Marinas

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).