public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Stephen Boyd <sboyd@kernel.org>
To: David Yang <mmyangfl@gmail.com>
Cc: David Yang <mmyangfl@gmail.com>,
	Michael Turquette <mturquette@baylibre.com>,
	linux-clk@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH v6 3/6] clk: hisilicon: Migrate devm APIs
Date: Tue, 21 Mar 2023 16:02:57 -0700	[thread overview]
Message-ID: <7cf6f6063943a57c1ef6bc45ea4d2cca.sboyd@kernel.org> (raw)
In-Reply-To: <20230321200031.1812026-4-mmyangfl@gmail.com>

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.

  reply	other threads:[~2023-03-21 23:03 UTC|newest]

Thread overview: 10+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-03-21 20:00 [PATCH v6 0/6] Add CRG driver for Hi3798MV100 SoC David Yang
2023-03-21 20:00 ` [PATCH v6 1/6] clk: hisilicon: Rename Hi3798CV200 to Hi3798 David Yang
2023-03-21 20:00 ` [PATCH v6 2/6] clk: hisilicon: Extract common functions David Yang
2023-03-21 20:00 ` [PATCH v6 3/6] clk: hisilicon: Migrate devm APIs David Yang
2023-03-21 23:02   ` Stephen Boyd [this message]
2023-03-22  8:03   ` kernel test robot
2023-03-21 20:00 ` [PATCH v6 4/6] clk: hisilicon: Add complex clock for Hi3798 David Yang
2023-03-21 20:00 ` [PATCH v6 5/6] dt-bindings: clock: Add Hi3798MV100 CRG David Yang
2023-03-21 20:00 ` [PATCH v6 6/6] clk: hisilicon: Add CRG driver for Hi3798MV100 SoC David Yang
2023-03-21 23:04 ` [PATCH v6 0/6] " Stephen Boyd

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=7cf6f6063943a57c1ef6bc45ea4d2cca.sboyd@kernel.org \
    --to=sboyd@kernel.org \
    --cc=linux-clk@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mmyangfl@gmail.com \
    --cc=mturquette@baylibre.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox