[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <7cf6f6063943a57c1ef6bc45ea4d2cca.sboyd@kernel.org>
Date: Tue, 21 Mar 2023 16:02:57 -0700
From: Stephen Boyd <sboyd@...nel.org>
To: David Yang <mmyangfl@...il.com>
Cc: David Yang <mmyangfl@...il.com>,
Michael Turquette <mturquette@...libre.com>,
linux-clk@...r.kernel.org, linux-kernel@...r.kernel.org
Subject: Re: [PATCH v6 3/6] clk: hisilicon: Migrate devm APIs
Quoting David Yang (2023-03-21 13:00:24)
> diff --git a/drivers/clk/hisilicon/clk-hi3620.c b/drivers/clk/hisilicon/clk-hi3620.c
> index a3d04c7c3..d6307a8cd 100644
> --- a/drivers/clk/hisilicon/clk-hi3620.c
> +++ b/drivers/clk/hisilicon/clk-hi3620.c
> @@ -194,23 +194,25 @@ static struct hisi_gate_clock hi3620_separated_gate_clks[] __initdata = {
>
> static void __init hi3620_clk_init(struct device_node *np)
> {
> + struct platform_device *pdev = of_find_device_by_node(np);
This looks costly and sometimes incorrect. The use of devm_ APIs means
that a driver is bound to the device. When the driver is unbound the
devm APIs cleanup and remove resources allocated. If you're simply
finding the device associated with a device node you can't tell if the
device is bound to a driver or not. So you should stop passing a
device_node pointer to these functions and switch them to a struct
device, or keep the device_node because you don't have a struct device
that's bound to a driver in the caller, in which case you can't use devm
APIs.
Powered by blists - more mailing lists