diff mbox series

[v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk()

Message ID 20240618115845.261297-1-youwan@nfschina.com (mailing list archive)
State New
Headers show
Series [v3] ACPI /amba: Fix meaningless code for amba_register_dummy_clk() | expand

Commit Message

Youwan Wang June 18, 2024, 11:58 a.m. UTC
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(-)

Comments

Sudeep Holla June 19, 2024, 12:33 p.m. UTC | #1
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
diff mbox series

Patch

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