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] [thread-next>] [day] [month] [year] [list]
Message-ID: <DD7A9A95166BF4418C4C1EB2033B6EE2038FA8E5@na3-mail.mgc.mentorg.com>
Date:	Wed, 5 Jan 2011 14:53:27 -0800
From:	"Blanchard, Hollis" <Hollis_Blanchard@...tor.com>
To:	"Grant Likely" <grant.likely@...retlab.ca>
Cc:	<devicetree-discuss@...ts.ozlabs.org>,
	<linuxppc-dev@...ts.ozlabs.org>, <linux-kernel@...r.kernel.org>,
	"Scott Wood" <scottwood@...escale.com>,
	"Benjamin Herrenschmidt" <benh@...nel.crashing.org>,
	"David Gibson" <david@...son.dropbear.id.au>,
	"Saxena, Deepak" <deepak_saxena@...tor.com>
Subject: Re: [PATCH] of/device: Don't register disabled devices

On 01/03/2011 03:01 PM, Grant Likely wrote:
> Device nodes with the property status="disabled" are not usable and so
> don't register them when parsing the device tree for devices.
>
This is great and all, but a fair amount of driver code explicitly 
searches the tree, rather than registering a probe function. That's why 
our earlier patches in this area were more comprehensive.

What are your thoughts on handling those cases?

Hollis Blanchard
Mentor Graphics, Embedded Systems Division

> ---
>   drivers/of/platform.c |   22 ++++++++++++++--------
>   1 files changed, 14 insertions(+), 8 deletions(-)
>
> diff --git a/drivers/of/platform.c b/drivers/of/platform.c
> index 5b4a07f..c01cd1a 100644
> --- a/drivers/of/platform.c
> +++ b/drivers/of/platform.c
> @@ -633,6 +633,9 @@ EXPORT_SYMBOL(of_device_alloc);
>    * @np: pointer to node to create device for
>    * @bus_id: name to assign device
>    * @parent: Linux device model parent device.
> + *
> + * Returns pointer to created platform device, or NULL if a device was not
> + * registered.  Unavailable devices will not get registered.
>    */
>   struct platform_device *of_platform_device_create(struct device_node *np,
>   					    const char *bus_id,
> @@ -640,6 +643,9 @@ struct platform_device *of_platform_device_create(struct device_node *np,
>   {
>   	struct platform_device *dev;
>
> +	if (!of_device_is_available(np))
> +		return NULL;
> +
>   	dev = of_device_alloc(np, bus_id, parent);
>   	if (!dev)
>   		return NULL;
> @@ -683,8 +689,9 @@ static int of_platform_bus_create(const struct device_node *bus,
>   		pr_debug("   create child: %s\n", child->full_name);
>   		dev = of_platform_device_create(child, NULL, parent);
>   		if (dev == NULL)
> -			rc = -ENOMEM;
> -		else if (!of_match_node(matches, child))
> +			continue;
> +
> +		if (!of_match_node(matches, child))
>   			continue;
>   		if (rc == 0) {
>   			pr_debug("   and sub busses\n");
> @@ -733,10 +740,9 @@ int of_platform_bus_probe(struct device_node *root,
>   	if (of_match_node(matches, root)) {
>   		pr_debug(" root match, create all sub devices\n");
>   		dev = of_platform_device_create(root, NULL, parent);
> -		if (dev == NULL) {
> -			rc = -ENOMEM;
> +		if (dev == NULL)
>   			goto bail;
> -		}
> +
>   		pr_debug(" create all sub busses\n");
>   		rc = of_platform_bus_create(root, matches,&dev->dev);
>   		goto bail;
> @@ -748,9 +754,9 @@ int of_platform_bus_probe(struct device_node *root,
>   		pr_debug("  match: %s\n", child->full_name);
>   		dev = of_platform_device_create(child, NULL, parent);
>   		if (dev == NULL)
> -			rc = -ENOMEM;
> -		else
> -			rc = of_platform_bus_create(child, matches,&dev->dev);
> +			continue;
> +
> +		rc = of_platform_bus_create(child, matches,&dev->dev);
>   		if (rc) {
>   			of_node_put(child);
>   			break;
>

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ