All of lore.kernel.org
 help / color / mirror / Atom feed
From: Rob Herring <robh@kernel.org>
To: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Cc: "Rafael J. Wysocki" <rjw@rjwysocki.net>,
	Mika Westerberg <mika.westerberg@linux.intel.com>,
	Andy Shevchenko <andriy.shevchenko@linux.intel.com>,
	Frank Rowand <frowand.list@gmail.com>,
	linux-kernel@vger.kernel.org, linux-acpi@vger.kernel.org,
	devicetree@vger.kernel.org
Subject: Re: [PATCH v5 1/3] device property: Introduce fwnode_get_name()
Date: Fri, 7 Dec 2018 11:24:27 -0600	[thread overview]
Message-ID: <20181207172427.GA6642@bogus> (raw)
In-Reply-To: <20181128115952.80890-2-heikki.krogerus@linux.intel.com>

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@linux.intel.com>
> Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.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.

Rob

  reply	other threads:[~2018-12-07 17:24 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-28 11:59 [PATCH v5 0/3] device property: Add fwnode_get_name() helper Heikki Krogerus
2018-11-28 11:59 ` [PATCH v5 1/3] device property: Introduce fwnode_get_name() Heikki Krogerus
2018-12-07 17:24   ` Rob Herring [this message]
2018-12-10  7:36     ` Heikki Krogerus
2018-11-28 11:59 ` [PATCH v5 2/3] ACPI: property: Add acpi_fwnode_name() Heikki Krogerus
2018-11-28 11:59 ` [PATCH v5 3/3] of/property: Add of_fwnode_name() Heikki Krogerus

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20181207172427.GA6642@bogus \
    --to=robh@kernel.org \
    --cc=andriy.shevchenko@linux.intel.com \
    --cc=devicetree@vger.kernel.org \
    --cc=frowand.list@gmail.com \
    --cc=heikki.krogerus@linux.intel.com \
    --cc=linux-acpi@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=mika.westerberg@linux.intel.com \
    --cc=rjw@rjwysocki.net \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.