RE: [PATCH V4 1/2] soc: imx: Add SCU SoC info driver support

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi, Marc/Leonard

> -----Original Message-----
> From: Marc Gonzalez [mailto:marc.w.gonzalez@xxxxxxx]
> Sent: Tuesday, May 21, 2019 8:34 PM
> To: Leonard Crestez <leonard.crestez@xxxxxxx>; Anson Huang
> <anson.huang@xxxxxxx>
> Cc: Mark Rutland <mark.rutland@xxxxxxx>; Rob Herring
> <robh+dt@xxxxxxxxxx>; Linux ARM <linux-arm-kernel@xxxxxxxxxxxxxxxxxxx>;
> DT <devicetree@xxxxxxxxxxxxxxx>
> Subject: Re: [PATCH V4 1/2] soc: imx: Add SCU SoC info driver support
> 
> On 21/05/2019 13:56, Leonard Crestez wrote:
> 
> > On 5/17/2019 8:49 AM, Anson Huang wrote:
> >
> >> +	root = of_find_node_by_path("/");
> >> +
> >> +	np = of_find_compatible_node(NULL, NULL, "fsl,imx-scu");
> >
> > It's possibly not very important for root or FW communication nodes
> > but you should probably of_node_put those back.
> 
> Isn't it better/simpler to use of_root?
> 
> extern struct device_node *of_root;

You are right, I will add below changes into V5, one change is to use extern of_root
directly, the other is to add of_put_node() after "fsl,imx-scu" is found.

@@ -56,7 +56,6 @@ static int imx_scu_soc_probe(struct platform_device *pdev)
 {
        struct soc_device_attribute *soc_dev_attr;
        struct soc_device *soc_dev;
-       struct device_node *root;
        u32 id, val;
        int ret;

@@ -72,8 +71,7 @@ static int imx_scu_soc_probe(struct platform_device *pdev)

        soc_dev_attr->family = "Freescale i.MX";

-       root = of_find_node_by_path("/");
-       ret = of_property_read_string(root,
+       ret = of_property_read_string(of_root,
                                      "model",
                                      &soc_dev_attr->machine);
        if (ret)
@@ -132,6 +130,8 @@ static int __init imx_scu_soc_init(void)
        if (!np)
                return -ENODEV;

+       of_node_put(np);
+
        ret = platform_driver_register(&imx_scu_soc_driver);
        if (ret)
                return ret;

thanks,
Anson

> 
> Regards.




[Index of Archives]     [Device Tree Compilter]     [Device Tree Spec]     [Linux Driver Backports]     [Video for Linux]     [Linux USB Devel]     [Linux PCI Devel]     [Linux Audio Users]     [Linux Kernel]     [Linux SCSI]     [XFree86]     [Yosemite Backpacking]


  Powered by Linux