[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20181210073605.GA24718@kuha.fi.intel.com>
Date: Mon, 10 Dec 2018 09:36:05 +0200
From: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
To: Rob Herring <robh@...nel.org>
Cc: "Rafael J. Wysocki" <rjw@...ysocki.net>,
Mika Westerberg <mika.westerberg@...ux.intel.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Frank Rowand <frowand.list@...il.com>,
linux-kernel@...r.kernel.org, linux-acpi@...r.kernel.org,
devicetree@...r.kernel.org
Subject: Re: [PATCH v5 1/3] device property: Introduce fwnode_get_name()
On Fri, Dec 07, 2018 at 11:24:27AM -0600, Rob Herring wrote:
> On Wed, Nov 28, 2018 at 02:59:50PM +0300, Heikki Krogerus wrote:
> > This helper returns the name of the node. The name is
> > primarily expected to be returned from a new fwnode
> > operation meant for this purpose, but when no name is
> > returned, the helper will also attempt to read a device
> > property "name".
> >
> > Reviewed-by: Andy Shevchenko <andriy.shevchenko@...ux.intel.com>
> > Signed-off-by: Heikki Krogerus <heikki.krogerus@...ux.intel.com>
> > ---
> > drivers/base/property.c | 36 ++++++++++++++++++++++++++++++++++++
> > include/linux/fwnode.h | 3 +++
> > include/linux/property.h | 2 ++
> > 3 files changed, 41 insertions(+)
> >
> > diff --git a/drivers/base/property.c b/drivers/base/property.c
> > index 240ab5230ff6..8bd35b44d9ec 100644
> > --- a/drivers/base/property.c
> > +++ b/drivers/base/property.c
> > @@ -1156,6 +1156,42 @@ void fwnode_handle_put(struct fwnode_handle *fwnode)
> > }
> > EXPORT_SYMBOL_GPL(fwnode_handle_put);
> >
> > +/**
> > + * fwnode_get_name - Copy the name of an fwnode to a buffer
> > + * @fwnode: Pointer to the node
> > + * @buf: Buffer where the name is copied to
> > + * @len: Size of the buffer
> > + *
> > + * Copies the node name of @fwnode to @buf. The routine attempts to first use
> > + * the get_name fwnode op of @fwnode, and if it fails, the routine attempts to
> > + * read a property "name".
> > + *
> > + * NOTE: @buf must be large enough to accommodate the name and trailing '\0'.
> > + *
> > + * Returns 0 on success or errno in case of an error.
> > + */
> > +int fwnode_get_name(const struct fwnode_handle *fwnode, char *buf, size_t len)
> > +{
> > + const char *name;
> > + int ret;
> > +
> > + ret = fwnode_call_int_op(fwnode, get_name, buf, len);
> > + if (ret == 0 || ret == -EOVERFLOW)
> > + return ret;
> > +
> > + ret = fwnode_call_int_op(fwnode, property_read_string_array,
> > + "name", &name, 1);
>
> Do you expect this to work on DT? It does today, but I plan to change
> that. 'name' is a fake property on FDT.
>
> Again, I think this is all working at too low of a level. Name is used
> either for matching or an informational string. For matching, this
> should remain firmware specific. For imformational strings,
> device_node.full_name works.
OK, I'll remove call.
thanks,
--
heikki
Powered by blists - more mailing lists