summaryrefslogtreecommitdiffstats
path: root/drivers/i2c/i2c-core.c
diff options
context:
space:
mode:
authorMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-07-17 09:12:19 -0300
committerMauro Carvalho Chehab <mchehab@osg.samsung.com>2015-07-17 09:12:19 -0300
commit675a9a9fda4e9b8634e7e93668f4a8c1311c0db4 (patch)
tree52c181cef67590e8a3527f58fa964e40a0a66b4c /drivers/i2c/i2c-core.c
parent41cc14ba11d7d8532ef4f615c39eb6ebdcdeef61 (diff)
parentbc0195aad0daa2ad5b0d76cce22b167bc3435590 (diff)
downloadtalos-op-linux-675a9a9fda4e9b8634e7e93668f4a8c1311c0db4.tar.gz
talos-op-linux-675a9a9fda4e9b8634e7e93668f4a8c1311c0db4.zip
Merge tag 'v4.2-rc2' into patchwork
Linux 4.2-rc2 We need to backport changeset 31f02455455d, with fixes a bug at include/linux/compiler.h that breaks sparse. * tag 'v4.2-rc2': (221 commits) Linux 4.2-rc2 Revert "drm/i915: Use crtc_state->active in primary check_plane func" freeing unlinked file indefinitely delayed fix a braino in ovl_d_select_inode() 9p: don't leave a half-initialized inode sitting around tick/broadcast: Prevent NULL pointer dereference selinux: fix mprotect PROT_EXEC regression caused by mm change parisc: Fix some PTE/TLB race conditions and optimize __flush_tlb_range based on timing results stifb: Implement hardware accelerated copyarea nfit: add support for NVDIMM "latch" flag nfit: update block I/O path to use PMEM API tools/testing/nvdimm: add mock acpi_nfit_flush_address entries to nfit_test tools/testing/nvdimm: fix return code for unimplemented commands tools/testing/nvdimm: mock ioremap_wt pmem: add maintainer for include/linux/pmem.h Revert "Input: synaptics - allocate 3 slots to keep stability in image sensors" arm64: entry32: remove pointless register assignment MIPS: O32: Use compat_sys_getsockopt. MIPS: c-r4k: Extend way_string array MIPS: Pistachio: Support CDMM & Fast Debug Channel ...
Diffstat (limited to 'drivers/i2c/i2c-core.c')
-rw-r--r--drivers/i2c/i2c-core.c16
1 files changed, 15 insertions, 1 deletions
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 069a41f116dd..e6d4935161e4 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -1012,6 +1012,8 @@ EXPORT_SYMBOL_GPL(i2c_new_device);
*/
void i2c_unregister_device(struct i2c_client *client)
{
+ if (client->dev.of_node)
+ of_node_clear_flag(client->dev.of_node, OF_POPULATED);
device_unregister(&client->dev);
}
EXPORT_SYMBOL_GPL(i2c_unregister_device);
@@ -1320,8 +1322,11 @@ static void of_i2c_register_devices(struct i2c_adapter *adap)
dev_dbg(&adap->dev, "of_i2c: walking child nodes\n");
- for_each_available_child_of_node(adap->dev.of_node, node)
+ for_each_available_child_of_node(adap->dev.of_node, node) {
+ if (of_node_test_and_set_flag(node, OF_POPULATED))
+ continue;
of_i2c_register_device(adap, node);
+ }
}
static int of_dev_node_match(struct device *dev, void *data)
@@ -1853,6 +1858,11 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,
if (adap == NULL)
return NOTIFY_OK; /* not for us */
+ if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) {
+ put_device(&adap->dev);
+ return NOTIFY_OK;
+ }
+
client = of_i2c_register_device(adap, rd->dn);
put_device(&adap->dev);
@@ -1863,6 +1873,10 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action,
}
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 */
client = of_find_i2c_device_by_node(rd->dn);
if (client == NULL)
OpenPOWER on IntegriCloud