diff mbox series

[1/4] dt-bindings: soc: imx8mp-media-blk-ctrl: Align block controller example name

Message ID 20230218235417.173325-1-marex@denx.de
State Superseded, archived
Headers show
Series [1/4] dt-bindings: soc: imx8mp-media-blk-ctrl: Align block controller example name | expand

Checks

Context Check Description
robh/checkpatch success
robh/patch-applied success
robh/dtbs-check warning build log
robh/dt-meta-schema success

Commit Message

Marek Vasut Feb. 18, 2023, 11:54 p.m. UTC
Align the block controller example node name with Linux imx8mp.dtsi .
No functional change.

Signed-off-by: Marek Vasut <marex@denx.de>
---
Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
Cc: Fabio Estevam <festevam@gmail.com>
Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Cc: Lucas Stach <l.stach@pengutronix.de>
Cc: NXP Linux Team <linux-imx@nxp.com>
Cc: Paul Elder <paul.elder@ideasonboard.com>
Cc: Peng Fan <peng.fan@nxp.com>
Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
Cc: Richard Cochran <richardcochran@gmail.com>
Cc: Richard Zhu <hongxing.zhu@nxp.com>
Cc: Rob Herring <robh+dt@kernel.org>
Cc: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Shawn Guo <shawnguo@kernel.org>
Cc: devicetree@vger.kernel.org
Cc: linux-arm-kernel@lists.infradead.org
---
 .../devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml  | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

Comments

Ying Liu Feb. 20, 2023, 2:16 a.m. UTC | #1
Hi Marek,

On Sun, 2023-02-19 at 00:54 +0100, Marek Vasut wrote:
> Align the block controller example node name with Linux imx8mp.dtsi .
> No functional change.
> 
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Paul Elder <paul.elder@ideasonboard.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Richard Zhu <hongxing.zhu@nxp.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  .../devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml  | 2
> +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-
> media-blk-ctrl.yaml
> b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-
> ctrl.yaml
> index dadb6108e3213..d4fb58979de19 100644
> --- a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-
> ctrl.yaml
> +++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-
> ctrl.yaml
> @@ -94,7 +94,7 @@ examples:
>      #include <dt-bindings/clock/imx8mp-clock.h>
>      #include <dt-bindings/power/imx8mp-power.h>
>  
> -    media_blk_ctl: blk-ctl@32ec0000 {
> +    media_blk_ctl: blk-ctrl@32ec0000 {

Care to align the label with imx8mp.dtsi as well?

Regards,
Liu Ying

>          compatible = "fsl,imx8mp-media-blk-ctrl", "syscon";
>          reg = <0x32ec0000 0x138>;
>          power-domains = <&mediamix_pd>, <&mipi_phy1_pd>,
> <&mipi_phy1_pd>,
Ying Liu Feb. 20, 2023, 2:25 a.m. UTC | #2
Hi Marek,

On Sun, 2023-02-19 at 00:54 +0100, Marek Vasut wrote:
> This block should not be compatible with simple-bus and misuse it
> that way.
> Instead, the driver should scan its subnodes and bind drivers to
> them.
> 
> Fixes: 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Paul Elder <paul.elder@ideasonboard.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Richard Zhu <hongxing.zhu@nxp.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  arch/arm64/boot/dts/freescale/imx8mp.dtsi | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)

Need to swap this patch and patch 4/4. Otherwise, this patch would
break the usage of media_blk_ctrl's child device.

Regards,
Liu Ying
Ying Liu Feb. 20, 2023, 2:39 a.m. UTC | #3
Hi Marek,

On Sun, 2023-02-19 at 00:54 +0100, Marek Vasut wrote:
> This particular block can have DT subnodes describing the LVDS LDB
> bridge. Instead of misusing simple-bus to scan for those nodes, do
> the scan within the driver.
> 
> Fixes: 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")
> Signed-off-by: Marek Vasut <marex@denx.de>
> ---
> Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> Cc: Fabio Estevam <festevam@gmail.com>
> Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> Cc: Lucas Stach <l.stach@pengutronix.de>
> Cc: NXP Linux Team <linux-imx@nxp.com>
> Cc: Paul Elder <paul.elder@ideasonboard.com>
> Cc: Peng Fan <peng.fan@nxp.com>
> Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> Cc: Richard Cochran <richardcochran@gmail.com>
> Cc: Richard Zhu <hongxing.zhu@nxp.com>
> Cc: Rob Herring <robh+dt@kernel.org>
> Cc: Sascha Hauer <s.hauer@pengutronix.de>
> Cc: Shawn Guo <shawnguo@kernel.org>
> Cc: devicetree@vger.kernel.org
> Cc: linux-arm-kernel@lists.infradead.org
> ---
>  drivers/soc/imx/imx8m-blk-ctrl.c | 11 +++++++++++
>  1 file changed, 11 insertions(+)
> 
> diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c
> b/drivers/soc/imx/imx8m-blk-ctrl.c
> index 399cb85105a18..ab48f9dff4be5 100644
> --- a/drivers/soc/imx/imx8m-blk-ctrl.c
> +++ b/drivers/soc/imx/imx8m-blk-ctrl.c
> @@ -169,7 +169,9 @@ static int imx8m_blk_ctrl_probe(struct
> platform_device *pdev)
>  {
>  	const struct imx8m_blk_ctrl_data *bc_data;
>  	struct device *dev = &pdev->dev;
> +	struct platform_device *child;
>  	struct imx8m_blk_ctrl *bc;
> +	struct device_node *np;
>  	void __iomem *base;
>  	int i, ret;
>  
> @@ -310,6 +312,15 @@ static int imx8m_blk_ctrl_probe(struct
> platform_device *pdev)
>  
>  	dev_set_drvdata(dev, bc);

nit: I would put the below loop before dev_set_drvdata().

>  
> +	for_each_child_of_node(dev->of_node, np) {

Please call for_each_available_child_of_node() to create available
child devices only.

> +		child = of_platform_device_create(np, NULL, dev);
> +		if (!child)
> +			ret = -ENOMEM;

-ENODEV is more appropriate?

> +		of_node_put(np);

for_each_child_of_node() and for_each_available_child_node() would do
of_node_put() for you unless you break/return from the loop.

> +		if (ret)
> +			goto cleanup_provider;

Instead of return in case of creating child device failure, I would
give a warning message and continue to create other child devices if
any. So I would write:

-------------------------------8<-----------------------------------
        for_each_available_child_of_node(dev->of_node, np) {
                child = of_platform_device_create(np, NULL, dev);
                if (!child)
                        dev_warn(dev, "failed to create device for
%pOF\n", child);
        }
-------------------------------8<-----------------------------------

Even if return is used, dev_pm_genpd_remove_notifier() should be called
to bailout correctly.

Regards,
Liu Ying

> +	}
> +
>  	return 0;
>  
>  cleanup_provider:
Ying Liu Feb. 20, 2023, 2:57 a.m. UTC | #4
On Mon, 2023-02-20 at 10:39 +0800, Liu Ying wrote:
> Hi Marek,
> 
> On Sun, 2023-02-19 at 00:54 +0100, Marek Vasut wrote:
> > This particular block can have DT subnodes describing the LVDS LDB
> > bridge. Instead of misusing simple-bus to scan for those nodes, do
> > the scan within the driver.
> > 
> > Fixes: 94e6197dadc9 ("arm64: dts: imx8mp: Add LCDIF2 & LDB nodes")
> > Signed-off-by: Marek Vasut <marex@denx.de>
> > ---
> > Cc: Alexander Stein <alexander.stein@ew.tq-group.com>
> > Cc: Fabio Estevam <festevam@gmail.com>
> > Cc: Krzysztof Kozlowski <krzysztof.kozlowski+dt@linaro.org>
> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
> > Cc: Lucas Stach <l.stach@pengutronix.de>
> > Cc: NXP Linux Team <linux-imx@nxp.com>
> > Cc: Paul Elder <paul.elder@ideasonboard.com>
> > Cc: Peng Fan <peng.fan@nxp.com>
> > Cc: Pengutronix Kernel Team <kernel@pengutronix.de>
> > Cc: Richard Cochran <richardcochran@gmail.com>
> > Cc: Richard Zhu <hongxing.zhu@nxp.com>
> > Cc: Rob Herring <robh+dt@kernel.org>
> > Cc: Sascha Hauer <s.hauer@pengutronix.de>
> > Cc: Shawn Guo <shawnguo@kernel.org>
> > Cc: devicetree@vger.kernel.org
> > Cc: linux-arm-kernel@lists.infradead.org
> > ---
> >  drivers/soc/imx/imx8m-blk-ctrl.c | 11 +++++++++++
> >  1 file changed, 11 insertions(+)
> > 
> > diff --git a/drivers/soc/imx/imx8m-blk-ctrl.c
> > b/drivers/soc/imx/imx8m-blk-ctrl.c
> > index 399cb85105a18..ab48f9dff4be5 100644
> > --- a/drivers/soc/imx/imx8m-blk-ctrl.c
> > +++ b/drivers/soc/imx/imx8m-blk-ctrl.c
> > @@ -169,7 +169,9 @@ static int imx8m_blk_ctrl_probe(struct
> > platform_device *pdev)
> >  {
> >  	const struct imx8m_blk_ctrl_data *bc_data;
> >  	struct device *dev = &pdev->dev;
> > +	struct platform_device *child;
> >  	struct imx8m_blk_ctrl *bc;
> > +	struct device_node *np;
> >  	void __iomem *base;
> >  	int i, ret;
> >  
> > @@ -310,6 +312,15 @@ static int imx8m_blk_ctrl_probe(struct
> > platform_device *pdev)
> >  
> >  	dev_set_drvdata(dev, bc);
> 
> nit: I would put the below loop before dev_set_drvdata().
> 
> >  
> > +	for_each_child_of_node(dev->of_node, np) {
> 
> Please call for_each_available_child_of_node() to create available
> child devices only.

Just found that of_platform_device_create() checks if the device node
is available or not, so you may keep using for_each_child_of_node().

Regards,
Liu Ying

> 
> > +		child = of_platform_device_create(np, NULL, dev);
> > +		if (!child)
> > +			ret = -ENOMEM;
> 
> -ENODEV is more appropriate?
> 
> > +		of_node_put(np);
> 
> for_each_child_of_node() and for_each_available_child_node() would do
> of_node_put() for you unless you break/return from the loop.
> 
> > +		if (ret)
> > +			goto cleanup_provider;
> 
> Instead of return in case of creating child device failure, I would
> give a warning message and continue to create other child devices if
> any. So I would write:
> 
> -------------------------------8<-----------------------------------
>         for_each_available_child_of_node(dev->of_node, np) {
>                 child = of_platform_device_create(np, NULL, dev);
>                 if (!child)
>                         dev_warn(dev, "failed to create device for
> %pOF\n", child);
>         }
> -------------------------------8<-----------------------------------
> 
> Even if return is used, dev_pm_genpd_remove_notifier() should be
> called
> to bailout correctly.
> 
> Regards,
> Liu Ying
> 
> > +	}
> > +
> >  	return 0;
> >  
> >  cleanup_provider:
> 
>
diff mbox series

Patch

diff --git a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml
index dadb6108e3213..d4fb58979de19 100644
--- a/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml
+++ b/Documentation/devicetree/bindings/soc/imx/fsl,imx8mp-media-blk-ctrl.yaml
@@ -94,7 +94,7 @@  examples:
     #include <dt-bindings/clock/imx8mp-clock.h>
     #include <dt-bindings/power/imx8mp-power.h>
 
-    media_blk_ctl: blk-ctl@32ec0000 {
+    media_blk_ctl: blk-ctrl@32ec0000 {
         compatible = "fsl,imx8mp-media-blk-ctrl", "syscon";
         reg = <0x32ec0000 0x138>;
         power-domains = <&mediamix_pd>, <&mipi_phy1_pd>, <&mipi_phy1_pd>,