diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-11 14:24:15 -0400 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2015-07-11 14:24:15 -0400 |
commit | e49251988b10e8787baa5f3d8ffd154e003f0963 (patch) | |
tree | 71f4b8a8dea7dc17f78ee0368d855a6f14ca1298 | |
parent | 8a7b8ff41ddc811f3e06d0bf6892bc3e2b1764b7 (diff) | |
parent | 4f001fd30145a6a8f72f9544c982cfd3dcb7c6df (diff) |
Merge branch 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux
Pull i2c fixes from Wolfram Sang:
"Mostly slight adjusments for new drivers, but also one core fix for
which finally the dependencies are now available as well"
* 'i2c/for-current' of git://git.kernel.org/pub/scm/linux/kernel/git/wsa/linux:
i2c: Mark instantiated device nodes with OF_POPULATE
i2c: jz4780: Fix return value if probe fails
i2c: xgene-slimpro: Fix missing mbox_free_channel call in probe error path
i2c: I2C_MT65XX should depend on HAS_DMA
-rw-r--r-- | drivers/i2c/busses/Kconfig | 1 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-jz4780.c | 15 | ||||
-rw-r--r-- | drivers/i2c/busses/i2c-xgene-slimpro.c | 1 | ||||
-rw-r--r-- | drivers/i2c/i2c-core.c | 16 |
4 files changed, 25 insertions, 8 deletions
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig index 35ac23768ce9..577d58d1f1a1 100644 --- a/drivers/i2c/busses/Kconfig +++ b/drivers/i2c/busses/Kconfig | |||
@@ -633,6 +633,7 @@ config I2C_MPC | |||
633 | config I2C_MT65XX | 633 | config I2C_MT65XX |
634 | tristate "MediaTek I2C adapter" | 634 | tristate "MediaTek I2C adapter" |
635 | depends on ARCH_MEDIATEK || COMPILE_TEST | 635 | depends on ARCH_MEDIATEK || COMPILE_TEST |
636 | depends on HAS_DMA | ||
636 | help | 637 | help |
637 | This selects the MediaTek(R) Integrated Inter Circuit bus driver | 638 | This selects the MediaTek(R) Integrated Inter Circuit bus driver |
638 | for MT65xx and MT81xx. | 639 | for MT65xx and MT81xx. |
diff --git a/drivers/i2c/busses/i2c-jz4780.c b/drivers/i2c/busses/i2c-jz4780.c index 19b2d689a5ef..f325663c27c5 100644 --- a/drivers/i2c/busses/i2c-jz4780.c +++ b/drivers/i2c/busses/i2c-jz4780.c | |||
@@ -764,12 +764,15 @@ static int jz4780_i2c_probe(struct platform_device *pdev) | |||
764 | if (IS_ERR(i2c->clk)) | 764 | if (IS_ERR(i2c->clk)) |
765 | return PTR_ERR(i2c->clk); | 765 | return PTR_ERR(i2c->clk); |
766 | 766 | ||
767 | clk_prepare_enable(i2c->clk); | 767 | ret = clk_prepare_enable(i2c->clk); |
768 | if (ret) | ||
769 | return ret; | ||
768 | 770 | ||
769 | if (of_property_read_u32(pdev->dev.of_node, "clock-frequency", | 771 | ret = of_property_read_u32(pdev->dev.of_node, "clock-frequency", |
770 | &clk_freq)) { | 772 | &clk_freq); |
773 | if (ret) { | ||
771 | dev_err(&pdev->dev, "clock-frequency not specified in DT"); | 774 | dev_err(&pdev->dev, "clock-frequency not specified in DT"); |
772 | return clk_freq; | 775 | goto err; |
773 | } | 776 | } |
774 | 777 | ||
775 | i2c->speed = clk_freq / 1000; | 778 | i2c->speed = clk_freq / 1000; |
@@ -790,10 +793,8 @@ static int jz4780_i2c_probe(struct platform_device *pdev) | |||
790 | i2c->irq = platform_get_irq(pdev, 0); | 793 | i2c->irq = platform_get_irq(pdev, 0); |
791 | ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, | 794 | ret = devm_request_irq(&pdev->dev, i2c->irq, jz4780_i2c_irq, 0, |
792 | dev_name(&pdev->dev), i2c); | 795 | dev_name(&pdev->dev), i2c); |
793 | if (ret) { | 796 | if (ret) |
794 | ret = -ENODEV; | ||
795 | goto err; | 797 | goto err; |
796 | } | ||
797 | 798 | ||
798 | ret = i2c_add_adapter(&i2c->adap); | 799 | ret = i2c_add_adapter(&i2c->adap); |
799 | if (ret < 0) { | 800 | if (ret < 0) { |
diff --git a/drivers/i2c/busses/i2c-xgene-slimpro.c b/drivers/i2c/busses/i2c-xgene-slimpro.c index dcca7076231e..1c9cb65ac4cf 100644 --- a/drivers/i2c/busses/i2c-xgene-slimpro.c +++ b/drivers/i2c/busses/i2c-xgene-slimpro.c | |||
@@ -419,6 +419,7 @@ static int xgene_slimpro_i2c_probe(struct platform_device *pdev) | |||
419 | rc = i2c_add_adapter(adapter); | 419 | rc = i2c_add_adapter(adapter); |
420 | if (rc) { | 420 | if (rc) { |
421 | dev_err(&pdev->dev, "Adapter registeration failed\n"); | 421 | dev_err(&pdev->dev, "Adapter registeration failed\n"); |
422 | mbox_free_channel(ctx->mbox_chan); | ||
422 | return rc; | 423 | return rc; |
423 | } | 424 | } |
424 | 425 | ||
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); | |||
1012 | */ | 1012 | */ |
1013 | void i2c_unregister_device(struct i2c_client *client) | 1013 | void i2c_unregister_device(struct i2c_client *client) |
1014 | { | 1014 | { |
1015 | if (client->dev.of_node) | ||
1016 | of_node_clear_flag(client->dev.of_node, OF_POPULATED); | ||
1015 | device_unregister(&client->dev); | 1017 | device_unregister(&client->dev); |
1016 | } | 1018 | } |
1017 | EXPORT_SYMBOL_GPL(i2c_unregister_device); | 1019 | EXPORT_SYMBOL_GPL(i2c_unregister_device); |
@@ -1320,8 +1322,11 @@ static void of_i2c_register_devices(struct i2c_adapter *adap) | |||
1320 | 1322 | ||
1321 | dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); | 1323 | dev_dbg(&adap->dev, "of_i2c: walking child nodes\n"); |
1322 | 1324 | ||
1323 | for_each_available_child_of_node(adap->dev.of_node, node) | 1325 | for_each_available_child_of_node(adap->dev.of_node, node) { |
1326 | if (of_node_test_and_set_flag(node, OF_POPULATED)) | ||
1327 | continue; | ||
1324 | of_i2c_register_device(adap, node); | 1328 | of_i2c_register_device(adap, node); |
1329 | } | ||
1325 | } | 1330 | } |
1326 | 1331 | ||
1327 | static int of_dev_node_match(struct device *dev, void *data) | 1332 | 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, | |||
1853 | if (adap == NULL) | 1858 | if (adap == NULL) |
1854 | return NOTIFY_OK; /* not for us */ | 1859 | return NOTIFY_OK; /* not for us */ |
1855 | 1860 | ||
1861 | if (of_node_test_and_set_flag(rd->dn, OF_POPULATED)) { | ||
1862 | put_device(&adap->dev); | ||
1863 | return NOTIFY_OK; | ||
1864 | } | ||
1865 | |||
1856 | client = of_i2c_register_device(adap, rd->dn); | 1866 | client = of_i2c_register_device(adap, rd->dn); |
1857 | put_device(&adap->dev); | 1867 | put_device(&adap->dev); |
1858 | 1868 | ||
@@ -1863,6 +1873,10 @@ static int of_i2c_notify(struct notifier_block *nb, unsigned long action, | |||
1863 | } | 1873 | } |
1864 | break; | 1874 | break; |
1865 | case OF_RECONFIG_CHANGE_REMOVE: | 1875 | case OF_RECONFIG_CHANGE_REMOVE: |
1876 | /* already depopulated? */ | ||
1877 | if (!of_node_check_flag(rd->dn, OF_POPULATED)) | ||
1878 | return NOTIFY_OK; | ||
1879 | |||
1866 | /* find our device by node */ | 1880 | /* find our device by node */ |
1867 | client = of_find_i2c_device_by_node(rd->dn); | 1881 | client = of_find_i2c_device_by_node(rd->dn); |
1868 | if (client == NULL) | 1882 | if (client == NULL) |