lkml.org 
[lkml]   [2019]   [Sep]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v5 05/11] device property: Add fwnode_get_name for returning the name of a node
Moi,

Thanks for the comments.

On Tue, Sep 03, 2019 at 01:10:13PM +0300, Heikki Krogerus wrote:
> 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);

Fixed.

>
> > + 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?

Good point.

In practice this will happen rarely outside the tests, but indeed the root
node would usually not be a software node. I'll drop the above three lines
checking for the parent node, and change nodes created in the test
accordingly.

--
Terveisin,

Sakari Ailus
sakari.ailus@linux.intel.com

\
 
 \ /
  Last update: 2019-09-03 13:25    [W:0.040 / U:0.224 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site