[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <1a6fda13-3a06-420d-a62a-896a7f4866d9@wanadoo.fr>
Date: Sun, 16 Jun 2024 15:05:53 +0200
From: Christophe JAILLET <christophe.jaillet@...adoo.fr>
To: Youwan Wang <youwan@...china.com>, lpieralisi@...nel.org
Cc: guohanjun@...wei.com, linux-kernel@...r.kernel.org,
linux-arm-kernel@...ts.infradead.org, lenb@...nel.org
Subject: Re: [PATCH v1] ACPI /amba: Fix meaningless code for
amba_register_dummy_clk()
Le 16/06/2024 à 12:00, Youwan Wang a écrit :
> Defining `amba_dummy_clk` as static is meaningless.
>
> The conditional check `if (amba_dummy_clk)` is intended to
> determine whether the clock has already been registered.
> However,in this function, the variable `amba_dummy_clk`
> will always be NULL.
Hi,
can you elaborate on this "will always be NULL"?
I think that it is NULL on the first call of amba_register_dummy_clk(),
but if it is called again, it will have the value of
clk_register_fixed_rate() just a few lines after, doing exactly what the
comment says.
CJ
>
> Signed-off-by: Youwan Wang <youwan@...china.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);
Powered by blists - more mailing lists