On Wed, Nov 14, 2018 at 12:52 AM Sascha Hauer <s.hauer@xxxxxxxxxxxxxx> wrote: > > 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. > State implementation will register a device named the same as alias pointing to corresponding node, so the problem only arises if DT has both a state node named "foo" and an alias to it named "foo" as well. It seems that the whole alias/standalone device creation code in common/state/state.c was written precisely because original DT naming scheme was not producing "fixed/stable" names, so changing then naming scheme from matching what Linux does in order to fit some assumptions in state code and unfortunate DT naming, while the easiest solution, seems a bit backwards. Can we fix this using an early internal DT fixup that would rename problematic node and maybe even print a warning urging users to rename their state nodes? Thanks, Andrey Smirnov > 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@xxxxxxxxxxxxxx> > Cc: Andrey Smirnov <andrew.smirnov@xxxxxxxxx> > Cc: Jan Lübbe <jlu@xxxxxxxxxxxxxx> > --- > 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@xxxxxxxxxxxxxxxxxxx http://lists.infradead.org/mailman/listinfo/barebox