[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <50A17E30.7030807@stericsson.com>
Date: Mon, 12 Nov 2012 23:54:40 +0100
From: Per Förlin <per.forlin@...ricsson.com>
To: Grant Likely <grant.likely@...retlab.ca>
Cc: "rob.herring@...xeda.com" <rob.herring@...xeda.com>,
Linus Walleij <linus.walleij@...aro.org>,
"lee.jones@...aro.org" <lee.jones@...aro.org>,
Fredrik SODERSTEDT <fredrik.soderstedt@...ricsson.com>,
"devicetree-discuss@...ts.ozlabs.org"
<devicetree-discuss@...ts.ozlabs.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>
Subject: Re: [PATCH] dt: platform: Extract device name from device tree blob
On 11/12/2012 04:20 PM, Grant Likely wrote:
> On Mon, Nov 12, 2012 at 2:59 PM, Per Forlin <per.forlin@...ricsson.com> wrote:
>> Add support to extract device name from device tree blob.
>> If the property "dev-name" is set in the DTS this name will
>> be used when creating the device.
>> The auxdata_lookup has precedence and will override
>> the "dev-name" property.
>
> Using a 'dev-name' property has the same problem that the 'cell-index'
> properties have in that it is encoding part of the global namespace
> local to the node and it becomes easy to create collisions. Instead of
> this check to see if one of the properties in /aliases points to the
> node and use that for the name.
>
> g.
>
Thanks Grant for your feedback,
Extract from exynos5250.dtsi:
-----------
aliases {
spi0 = &spi_0;
spi1 = &spi_1;
spi2 = &spi_2;
};
spi_0: spi@...20000 {
...
};
spi_1: spi@...30000 {
...
};
spi_2: spi@...40000 {
...
};
---------------
Alias refers to the device node. The device node is not aware of the alias.
How to get a device name from the aliases.
1. Traverse all aliases for each device node (time consuming if there are many aliases)
2. Make a new function of_alias_get_name(), today there is only of_alias_get_id()
3. The functionality of setting device_name based on alias name needs to be optional because one may want to use aliases without changing the name of the device.
All this is feasible but perhaps not optimal.
I don't really see how come name space is a big issue in this case. The name space of "dev-name" is local to the device node. A child device node can use the same dev-name as the parent (unless I'm mistaken which happens quite often). Introducing yet another property name pollutes the name space of the device node. Still I think the pros are stronger than the cons.
Do you still prefer to use the name of the Alias? Could you please elaborate a bit more how this can be done in practice?
I would agree with you if there was a reference from the device node to the alias.
My dev-name patch can be made smaller by moving read_string to:
static int of_platform_bus_create(struct device_node *bus,
platform_data = auxdata->platform_data;
}
+ if (!bus_id)
+ of_property_read_string(bus, "dev-name", &bus_id);
+
It would be nice to add something in the DTS to explicitly enable this feature to avoid collisions. Default this feature is disabled.
Any suggestions?
BR
Per
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists