]> 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)
commitd8a3c81870002a53bdbace5a769367191992cc7a
tree1f3e2ce6e3c5c2d943b525078766499542aff9b3
parentea3d3f94a52f7e2bc589eb703112ad9a924a0757
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