of: Ensure unique names without sacrificing determinism
authorGrant Likely <grant.likely@linaro.org>
Wed, 21 May 2014 06:40:31 +0000 (15:40 +0900)
committerGrant Likely <grant.likely@linaro.org>
Thu, 22 May 2014 22:58:26 +0000 (07:58 +0900)
commit07e461cd7e73a84f0e3757932b93cc80976fd749
tree1f3e2ce6e3c5c2d943b525078766499542aff9b3
parenteafd370dfe487facfdef499057f4eac9aa0b4bf5
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 <grant.likely@linaro.org>
Cc: Ezequiel Garcia <ezequiel@vanguardiasur.com.ar>
Cc: Rob Herring <robh@kernel.org>
drivers/of/platform.c