lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Date:   Thu, 19 Nov 2020 10:42:01 +0100
From:   Krzysztof Kozlowski <krzk@...nel.org>
To:     Alice Guo <alice.guo@....com>
Cc:     "robh+dt@...nel.org" <robh+dt@...nel.org>,
        "shawnguo@...nel.org" <shawnguo@...nel.org>,
        "s.hauer@...gutronix.de" <s.hauer@...gutronix.de>,
        dl-linux-imx <linux-imx@....com>, Peng Fan <peng.fan@....com>,
        "devicetree@...r.kernel.org" <devicetree@...r.kernel.org>,
        "linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
        "linux-arm-kernel@...ts.infradead.org" 
        <linux-arm-kernel@...ts.infradead.org>
Subject: Re: [EXT] Re: [PATCH v3 4/4] soc: imx8m: change to use platform
 driver

On Thu, Nov 19, 2020 at 07:32:17AM +0000, Alice Guo wrote:
> 
> 
> > -----Original Message-----
> > From: Krzysztof Kozlowski <krzk@...nel.org>
> > Sent: 2020年11月18日 22:11
> > To: Alice Guo <alice.guo@....com>
> > Cc: robh+dt@...nel.org; shawnguo@...nel.org; s.hauer@...gutronix.de;
> > dl-linux-imx <linux-imx@....com>; Peng Fan <peng.fan@....com>;
> > devicetree@...r.kernel.org; linux-kernel@...r.kernel.org;
> > linux-arm-kernel@...ts.infradead.org
> > Subject: Re: [EXT] Re: [PATCH v3 4/4] soc: imx8m: change to use platform driver
> > 
> > Caution: EXT Email
> > 
> > On Wed, Nov 18, 2020 at 02:07:41PM +0000, Alice Guo wrote:
> > >
> > >
> > > > -----Original Message-----
> > > > From: Krzysztof Kozlowski <krzk@...nel.org>
> > > > Sent: 2020年11月18日 18:42
> > > > To: Alice Guo <alice.guo@....com>
> > > > Cc: robh+dt@...nel.org; shawnguo@...nel.org; s.hauer@...gutronix.de;
> > > > dl-linux-imx <linux-imx@....com>; Peng Fan <peng.fan@....com>;
> > > > devicetree@...r.kernel.org; linux-kernel@...r.kernel.org;
> > > > linux-arm-kernel@...ts.infradead.org
> > > > Subject: Re: [EXT] Re: [PATCH v3 4/4] soc: imx8m: change to use
> > > > platform driver
> > > >
> > > > Caution: EXT Email
> > > >
> > > > On Wed, Nov 18, 2020 at 10:28:47AM +0000, Alice Guo wrote:
> > > >  >
> > > > > > If it is properly explained and there is no other way then yes,
> > > > > > you could. Here, for old DTBs, I would prefer to use
> > > > > > of_platform_device_create() and bind to "soc" node (child of root).
> > > > > > This way you would always have device and exactly one entry
> > > > > > point for the probe.
> > > > > >
> > > > >
> > > > > static struct platform_driver imx8_soc_init_driver = {
> > > > >       .probe = imx8_soc_init_probe,
> > > > >       .driver = {
> > > > >               .name = "soc@0",
> > > > >       },
> > > > > };
> > > > > Can I use "soc@0" to match this driver? It will not use
> > > > > of_platform_device_create(). It will use of_find_property() to
> > > > > determine whether and nvmem-cells can be used. If there is no
> > > > > nvmem-cells,
> > > > it will use the old way, which supports old DTBS. There is no need
> > > > to add new compatible.
> > > >
> > > > No, the soc@0 is not a proper name for the driver.
> > >
> > > I have no good idea, please give suggestion. Should I still add new compatible?
> > > Should I still keep device_initcall? If use
> > > of_platform_device_create(), which node should I use?
> > 
> > I mentioned my idea in the email before - of_platform_device_create() to bind
> > to the soc node. This will have to be in the initcall, you don't have a choice to
> > avoid it, since there was no compatible before.
> >
> 
> 	node = of_find_node_by_path("/soc@0");
> 	if (!node)
> 		return -ENODEV;
> 
> 	pdev = of_platform_device_create(node, "XXX", NULL);
> 	if (!pdev)
> 		return -ENODEV;
> 
> Cannot use of_platform_device_create because "of_node_test_and_set_flag(np, OF_POPULATED)" returns true.
> of_platform_device_create is used to create platform device, but soc@0 is created by common code. I don't know how
> to bind to the soc node. The way I did in v3 seems not bad, it can work correctly and support old DTBs. Can I keep this way?

Indeed, it would require some more hacks and actually might not work at
all since bus device is already created. Keep the old way and fix other
pointed out issues.

Best regards,
Krzysztof

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ