]> git.baikalelectronics.ru Git - kernel.git/commit
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)
commit9f0810fa3fd87656fa38ed6ef497e6c7a99c1896
tree1f3e2ce6e3c5c2d943b525078766499542aff9b3
parent2c00c29293b3a7c954e85089e02d2b82076ab126
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