From: Sudip Mukherjee <sudipm.mukherjee@gmail.com>
To: Dong Aisheng <aisheng.dong@nxp.com>
Cc: Stephen Boyd <sboyd@kernel.org>,
linux-imx@nxp.com, Sascha Hauer <kernel@pengutronix.de>,
Shawn Guo <shawnguo@kernel.org>,
linux-clk@vger.kernel.org, linux-arm-kernel@lists.infradead.org
Subject: Re: [PATCH 1/1] clk: imx: scu: remove the calling of device_is_bound
Date: Thu, 19 Nov 2020 13:08:00 +0000 [thread overview]
Message-ID: <20201119130800.boyqn4rtczq4wcvn@debian> (raw)
In-Reply-To: <20201119114302.26263-1-aisheng.dong@nxp.com>
Hi Dong,
On Thu, Nov 19, 2020 at 07:43:02PM +0800, Dong Aisheng wrote:
> The device_is_bound() is unvisable to drivers when built as modules.
> It's also not aimed to be used by drivers according to Greg K.H.
> Let's remove it from clk-scu driver and find another way to do proper
> driver loading sequence.
Greg was asking to use device_link for this issue. Have you tried something
like the following: (untested as I dont have the hardware).
diff --git a/drivers/clk/imx/clk-imx8qxp.c b/drivers/clk/imx/clk-imx8qxp.c
index 5b3d4ede7c7c..9ae6c768ea05 100644
--- a/drivers/clk/imx/clk-imx8qxp.c
+++ b/drivers/clk/imx/clk-imx8qxp.c
@@ -25,7 +25,7 @@ static int imx8qxp_clk_probe(struct platform_device *pdev)
u32 clk_cells;
int ret, i;
- ret = imx_clk_scu_init(ccm_node);
+ ret = imx_clk_scu_init(ccm_node, pdev);
if (ret)
return ret;
diff --git a/drivers/clk/imx/clk-scu.c b/drivers/clk/imx/clk-scu.c
index d10f60e48ece..e834bfadc2a6 100644
--- a/drivers/clk/imx/clk-scu.c
+++ b/drivers/clk/imx/clk-scu.c
@@ -151,8 +151,9 @@ static inline struct clk_scu *to_clk_scu(struct clk_hw *hw)
return container_of(hw, struct clk_scu, hw);
}
-int imx_clk_scu_init(struct device_node *np)
+int imx_clk_scu_init(struct device_node *np, struct platform_device *pdev)
{
+ struct device *dev = &pdev->dev;
struct platform_device *pd_dev;
u32 clk_cells;
int ret, i;
@@ -173,12 +174,12 @@ int imx_clk_scu_init(struct device_node *np)
*/
pd_np = of_find_compatible_node(NULL, NULL, "fsl,scu-pd");
pd_dev = of_find_device_by_node(pd_np);
- if (!pd_dev || !device_is_bound(&pd_dev->dev)) {
+ if (!pd_dev || !device_link_add(dev, &pd_dev->dev,
+ DL_FLAG_AUTOREMOVE_CONSUMER)) {
of_node_put(pd_np);
return -EPROBE_DEFER;
}
}
-
return platform_driver_register(&imx_clk_scu_driver);
}
diff --git a/drivers/clk/imx/clk-scu.h b/drivers/clk/imx/clk-scu.h
index e8352164923e..14e2baf14757 100644
--- a/drivers/clk/imx/clk-scu.h
+++ b/drivers/clk/imx/clk-scu.h
@@ -13,7 +13,7 @@
extern struct list_head imx_scu_clks[];
extern const struct dev_pm_ops imx_clk_lpcg_scu_pm_ops;
-int imx_clk_scu_init(struct device_node *np);
+int imx_clk_scu_init(struct device_node *np, struct platform_device *pdev);
struct clk_hw *imx_scu_of_clk_src_get(struct of_phandle_args *clkspec,
void *data);
struct clk_hw *imx_clk_scu_alloc_dev(const char *name,
--
Regards
Sudip
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel
next prev parent reply other threads:[~2020-11-19 13:09 UTC|newest]
Thread overview: 7+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-11-19 11:43 [PATCH 1/1] clk: imx: scu: remove the calling of device_is_bound Dong Aisheng
2020-11-19 13:08 ` Sudip Mukherjee [this message]
2020-11-19 15:30 ` Aisheng Dong
2020-11-19 17:44 ` Sudip Mukherjee
2020-11-24 10:28 ` Aisheng Dong
2020-11-24 10:33 ` Aisheng Dong
2020-11-30 13:54 ` Shawn Guo
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=20201119130800.boyqn4rtczq4wcvn@debian \
--to=sudipm.mukherjee@gmail.com \
--cc=aisheng.dong@nxp.com \
--cc=kernel@pengutronix.de \
--cc=linux-arm-kernel@lists.infradead.org \
--cc=linux-clk@vger.kernel.org \
--cc=linux-imx@nxp.com \
--cc=sboyd@kernel.org \
--cc=shawnguo@kernel.org \
/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;
as well as URLs for NNTP newsgroup(s).