diff mbox series

[v3,3/3] of/property: Add of_fwnode_name()

Message ID 20181126114752.69597-4-heikki.krogerus@linux.intel.com (mailing list archive)
State Superseded, archived
Headers show
Series device property: Add fwnode_get_name() helper | expand

Commit Message

Heikki Krogerus Nov. 26, 2018, 11:47 a.m. UTC
This implements get_name fwnode op for DT.

Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
---
 drivers/of/property.c | 8 ++++++++
 1 file changed, 8 insertions(+)

Comments

Andy Shevchenko Nov. 26, 2018, 1:05 p.m. UTC | #1
On Mon, Nov 26, 2018 at 02:47:52PM +0300, Heikki Krogerus wrote:
> This implements get_name fwnode op for DT.

> +static int of_fwnode_get_name(const struct fwnode_handle *fwnode, char *buf,
> +			      size_t len)
> +{
> +	snprintf(buf, len, "%pOFn", to_of_node(fwnode));

Same concerns.

> +	return 0;
> +}
Heikki Krogerus Nov. 26, 2018, 1:40 p.m. UTC | #2
On Mon, Nov 26, 2018 at 03:05:32PM +0200, Andy Shevchenko wrote:
> On Mon, Nov 26, 2018 at 02:47:52PM +0300, Heikki Krogerus wrote:
> > This implements get_name fwnode op for DT.
> 
> > +static int of_fwnode_get_name(const struct fwnode_handle *fwnode, char *buf,
> > +			      size_t len)
> > +{
> > +	snprintf(buf, len, "%pOFn", to_of_node(fwnode));
> 
> Same concerns.

OK, I'll fix all of these.

thanks,
diff mbox series

Patch

diff --git a/drivers/of/property.c b/drivers/of/property.c
index f46828e3b082..253ed0e9d804 100644
--- a/drivers/of/property.c
+++ b/drivers/of/property.c
@@ -823,6 +823,13 @@  static void of_fwnode_put(struct fwnode_handle *fwnode)
 	of_node_put(to_of_node(fwnode));
 }
 
+static int of_fwnode_get_name(const struct fwnode_handle *fwnode, char *buf,
+			      size_t len)
+{
+	snprintf(buf, len, "%pOFn", to_of_node(fwnode));
+	return 0;
+}
+
 static bool of_fwnode_device_is_available(const struct fwnode_handle *fwnode)
 {
 	return of_device_is_available(to_of_node(fwnode));
@@ -987,6 +994,7 @@  of_fwnode_device_get_match_data(const struct fwnode_handle *fwnode,
 const struct fwnode_operations of_fwnode_ops = {
 	.get = of_fwnode_get,
 	.put = of_fwnode_put,
+	.get_name = of_fwnode_get_name,
 	.device_is_available = of_fwnode_device_is_available,
 	.device_get_match_data = of_fwnode_device_get_match_data,
 	.property_present = of_fwnode_property_present,