On Saturday 11 January 2014, Andrew Lunn wrote:
The id of -1 causes platform_device_add() to set the device name to
plain "gpio-keys".
When using DT, the device name is created by the function
of_device_make_bus_id(). It has the following comment:
* This routine will first try using either the dcr-reg or the reg property
* value to derive a unique name. As a last resort it will use the node
* name followed by a unique number.
Since the gpio_keys node does not have a reg properties, it gets a
unique number appended to it. We end up with the device name
"gpio_keys.3"
So as it stands, it does not appear i can make the DT system use the
same device name as a board system.
But i'm also a little bit concerned by the "unique number" and this
ending up in /dev/input/by-path/platform-gpio_keys.3-event. Is this
path supposed to be stable? This unique number is not stable. An
unwitting change to the DT could cause its value to change. Do we need
to make it stable?
One possibility would be to create an artificial bus in DT for all
gpio-keys devices, use #address-cells=<1> and #size-cells=<0>
for it, and give each device a unique reg property. Not sure if that
would be considered an elegant solution though.
Arnd