Thread (1 message) 1 message, 1 author, 2014-05-22

Re: [RFC/PATCH] of: platform: Remove unique device name enforcement

From: Ezequiel Garcia <hidden>
Date: 2014-05-22 15:57:06

On 21 May 04:43 PM, Grant Likely wrote:
[..]
Yet another approach. How about this patch? If the unit address cannot
be translated, then append the translated name of the parent.
[..]
commit 177e5ff131639c8568248e5b9b2380066ce305d6
Author: Grant Likely [off-list ref]
Date:   Wed May 21 15:40:31 2014 +0900

    of: Ensure unique names without sacrificing determinism
    
    The way the driver core is implemented, every device using the same bus
    type is required to have a unique name because a symlink to each device
    is created in the appropriate /sys/bus/*/devices directory, and two
    identical names causes a collision.
    
    The current code handles the requirement by using an globally
    incremented counter that is appended to the device name. It works, but
    it means any change to device registration will change the assigned
    numbers. Instead, if we build up the name by using information from the
    parent nodes, then it can be guaranteed to be unique without adding a
    random number to the end of it.
    
    Signed-off-by: Grant Likely [off-list ref]
This solves the issue I complained about. Now the names of the devices match
the name of nodes, so the system knows what names to expect.

Before:

$ ls /sys/devices/
44e10800.pinmux   gpio-keys.8       pmu.0             system
ARMv7 Cortex-A8   hdmi.5            rotary-encoder.9  userhelper.10
backlight.6       ocp.3             soc.1             virtual
breakpoint        panel.7           soc0
fixedregulator.4  platform          software

After:

$ ls /sys/devices/
44e10800.pinmux   gpio-keys         pmu               system
ARMv7 Cortex-A8   hdmi              rotary-encoder    userhelper
backlight         ocp               soc               virtual
breakpoint        panel             soc0
fixedregulator@0  platform          software

Tested-by: Ezequiel Garcia <redacted>

It would be great if this patch could be merged.

Thanks a lot Grant,
-- 
Ezequiel Garcia, VanguardiaSur
www.vanguardiasur.com.ar
--
To unsubscribe from this list: send the line "unsubscribe devicetree" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help