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 for Android: free password hash cracker in your pocket
[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Date:   Tue, 3 Sep 2019 13:10:13 +0300
From:   Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To:     Sakari Ailus <sakari.ailus@...ux.intel.com>
Cc:     Petr Mladek <pmladek@...e.com>, linux-kernel@...r.kernel.org,
        rafael@...nel.org,
        Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
        linux-acpi@...r.kernel.org, devicetree@...r.kernel.org,
        Rob Herring <robh@...nel.org>
Subject: Re: [PATCH v5 05/11] device property: Add fwnode_get_name for
 returning the name of a node

Hi Sakari,

On Mon, Sep 02, 2019 at 04:57:26PM +0300, Sakari Ailus wrote:
> diff --git a/drivers/base/swnode.c b/drivers/base/swnode.c
> index 951e7efd47c23..a4a0f5b80bad3 100644
> --- a/drivers/base/swnode.c
> +++ b/drivers/base/swnode.c
> @@ -515,6 +515,25 @@ static int software_node_read_string_array(const struct fwnode_handle *fwnode,
>  						propname, val, nval);
>  }
>  
> +static const char *
> +software_node_get_name(const struct fwnode_handle *fwnode)
> +{
> +	const struct software_node *softnode = to_software_node(fwnode);
> +	const struct swnode *swnode = software_node_to_swnode(softnode);

Why not just:

        struct swnode *swnode = to_swnode(fwnode);

> +	struct fwnode_handle *parent;
> +
> +	if (!swnode)
> +		return "(null)";
> +
> +	parent = fwnode_get_parent(&swnode->fwnode);
> +	if (!parent)
> +		return "";

Please note that there is no root software node object (the kset is
the root), so you will get "" with most nodes. I'm assuming that is
not the intention, or is it?

> +	fwnode_handle_put(parent);
> +
> +	return kobject_name(&swnode->kobj);
> +}
> +
>  static struct fwnode_handle *
>  software_node_get_parent(const struct fwnode_handle *fwnode)
>  {
> @@ -615,6 +634,7 @@ static const struct fwnode_operations software_node_ops = {
>  	.property_present = software_node_property_present,
>  	.property_read_int_array = software_node_read_int_array,
>  	.property_read_string_array = software_node_read_string_array,
> +	.get_name = software_node_get_name,
>  	.get_parent = software_node_get_parent,
>  	.get_next_child_node = software_node_get_next_child,
>  	.get_named_child_node = software_node_get_named_child_node,

thanks,

-- 
heikki

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ