of: Keep track of populated platform devices
authorPawel Moll <pawel.moll@arm.com>
Thu, 15 May 2014 15:55:24 +0000 (16:55 +0100)
committerMark Brown <broonie@kernel.org>
Mon, 16 Feb 2015 16:06:53 +0000 (01:06 +0900)
commite0bc89c5e7542c36e90d74070ca6af79ff3ec0cf
tree7e05212cc8d36a20d63f5e2a61a8bc7d7007b350
parente60dc703729b117d0b617249bcae373a430ebade
of: Keep track of populated platform devices

In "Device Tree powered" systems, platform devices are usually massively
populated with of_platform_populate() call, executed at some level of
initcalls, either by generic architecture or by platform-specific code.

There are situations though where certain devices must be created (and
bound with drivers) before all the others. This presents a challenge,
as devices created explicitly would be created again by
of_platform_populate().

This patch tries to solve that issue in a generic way, adding a
"populated" flag for a DT node description. Subsequent
of_platform_populate() will skip such nodes (and its children) in
a similar way to the non-available ones.

This patch also adds of_platform_depopulate() as an operation
complementary to the _populate() one. It removes a platform or an amba
device populated from the Device Tree, together with its all children
(leaving, however, devices without associated of_node untouched)
clearing the "populated" flag on the way.

Signed-off-by: Pawel Moll <pawel.moll@arm.com>
Reviewed-by: Rob Herring <robh@kernel.org>
Acked-by: Grant Likely <grant.likely@linaro.org>
(cherry picked from commit c6e126de43e7d4abfd6cf796b40589db3a046167)
Signed-off-by: Mark Brown <broonie@kernel.org>
Conflicts:
drivers/of/platform.c
include/linux/of_platform.h
drivers/of/platform.c
include/linux/of.h
include/linux/of_platform.h