mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Sascha Hauer <s.hauer@pengutronix.de>
To: Barebox List <barebox@lists.infradead.org>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Subject: [PATCH] of: Add .of suffix to device names from devicetree
Date: Wed, 14 Nov 2018 09:52:33 +0100	[thread overview]
Message-ID: <20181114085233.5000-1-s.hauer@pengutronix.de> (raw)

Previous implementation used to add a number to the device names
for devices registered from the device tree which did not have a 'reg'
property, thus a device node named "state" resulted in a device name
"state.<x>". Current implementation skips that number and we get a
device named "state". This conflicts with our barebox state
implementation which tries to register a device named "state" itself.
We could rename the state device nodes of all our device trees, but it
causes less trouble to rename the devices.

This adds a ".of" suffix to the device names for devices registered from
the device tree which also has the nice effect that they now can easily
be recognized.

Fixes: 7e497d48acbd11 ("of: Port latest of_device_make_bus_id() implementation")

Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Cc: Andrey Smirnov <andrew.smirnov@gmail.com>
Cc: Jan Lübbe <jlu@pengutronix.de>
---
 drivers/of/platform.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/of/platform.c b/drivers/of/platform.c
index 17052f4199..ef8969ca8b 100644
--- a/drivers/of/platform.c
+++ b/drivers/of/platform.c
@@ -61,14 +61,14 @@ static void of_device_make_bus_id(struct device_d *dev)
 		 */
 		reg = of_get_property(node, "reg", NULL);
 		if (reg && (addr = of_translate_address(node, reg)) != OF_BAD_ADDR) {
-			dev_set_name(dev, dev->name ? "%llx.%s:%s" : "%llx.%s",
+			dev_set_name(dev, dev->name ? "%llx.%s:%s" : "%llx.%s.of",
 				     (unsigned long long)addr, node->name,
 				     dev->name);
 			return;
 		}
 
 		/* format arguments only used if dev_name() resolves to NULL */
-		dev_set_name(dev, dev->name ? "%s:%s" : "%s",
+		dev_set_name(dev, dev->name ? "%s:%s" : "%s.of",
 			     kbasename(node->full_name), dev->name);
 		node = node->parent;
 	}
-- 
2.19.1


_______________________________________________
barebox mailing list
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

             reply	other threads:[~2018-11-14  8:52 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2018-11-14  8:52 Sascha Hauer [this message]
2018-11-14 12:48 ` Jan Lübbe
2018-11-14 15:59 ` Andrey Smirnov
2018-11-15  9:33   ` Sascha Hauer
2018-12-31 11:12 ` Ladislav Michl
2019-01-04  8:12   ` Sascha Hauer

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=20181114085233.5000-1-s.hauer@pengutronix.de \
    --to=s.hauer@pengutronix.de \
    --cc=andrew.smirnov@gmail.com \
    --cc=barebox@lists.infradead.org \
    /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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox