diff options
author | Pantelis Antoniou <pantelis.antoniou@konsulko.com> | 2014-12-16 19:45:26 +0200 |
---|---|---|
committer | Alex Shi <alex.shi@linaro.org> | 2015-12-16 15:29:22 +0800 |
commit | 6dd54590170efcb6c950a4163960a98a1e07db66 (patch) | |
tree | 5e44b62a680ea601d98996d4558f2fffee034db5 | |
parent | 787716e26d57e35a70fe706a8efc2ac2814f5bb8 (diff) |
of/platform: Handle of_populate drivers in notifier
When using overlays with drivers calling of_populate the notifier
will try to create the device twice. Using the populated bit
before proceeding protects against this.
Signed-off-by: Pantelis Antoniou <pantelis.antoniou@konsulko.com>
Signed-off-by: Grant Likely <grant.likely@linaro.org>
(cherry picked from commit 15204ab1ebc5aba608cd19c83c37b98438b938b0)
Signed-off-by: Alex Shi <alex.shi@linaro.org>
-rw-r--r-- | drivers/of/platform.c | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/drivers/of/platform.c b/drivers/of/platform.c index cd87a36495be..0d12451d2652 100644 --- a/drivers/of/platform.c +++ b/drivers/of/platform.c @@ -564,6 +564,10 @@ static int of_platform_notify(struct notifier_block *nb, if (!of_node_check_flag(rd->dn->parent, OF_POPULATED_BUS)) return NOTIFY_OK; /* not for us */ + /* already populated? (driver using of_populate manually) */ + if (of_node_check_flag(rd->dn, OF_POPULATED)) + return NOTIFY_OK; + /* pdev_parent may be NULL when no bus platform device */ pdev_parent = of_find_device_by_node(rd->dn->parent); pdev = of_platform_device_create(rd->dn, NULL, @@ -579,6 +583,11 @@ static int of_platform_notify(struct notifier_block *nb, break; case OF_RECONFIG_CHANGE_REMOVE: + + /* already depopulated? */ + if (!of_node_check_flag(rd->dn, OF_POPULATED)) + return NOTIFY_OK; + /* find our device by node */ pdev = of_find_device_by_node(rd->dn); if (pdev == NULL) |