aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/i2c
diff options
context:
space:
mode:
authorOlof Johansson <olof@lixom.net>2012-09-22 01:53:48 -0400
committerOlof Johansson <olof@lixom.net>2012-09-22 01:54:15 -0400
commitb536661bb0091b19123fa0c22f7087fd886d7b37 (patch)
treee83c4ff9bbfe94155cbc7b25fb3b62b814e79ad7 /drivers/i2c
parent20804abdbcfced47b460e5794a685d48225ac754 (diff)
parentfb997a46626dca2778fa7570bb516d8486f2f837 (diff)
Merge branch 'v3.7-samsung-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung into next/fixes-non-critical
A few non-critical fixes/cleanups for samsung platforms. * 'v3.7-samsung-fixes-1' of git://git.kernel.org/pub/scm/linux/kernel/git/kgene/linux-samsung: ARM: SAMSUNG: Add missing variable declaration in s3c64xx_spi1_set_platdata() ARM: S3C24XX: removes unnecessary semicolon ARM: S3C24xx: delete double assignment ARM: EXYNOS: fix address for EXYNOS4 MDMA1 ARM: EXYNOS: fixed SYSMMU setup definition to mate parameter name + sync to 3.6-rc6
Diffstat (limited to 'drivers/i2c')
-rw-r--r--drivers/i2c/algos/i2c-algo-pca.c6
-rw-r--r--drivers/i2c/busses/Kconfig6
-rw-r--r--drivers/i2c/busses/Makefile5
-rw-r--r--drivers/i2c/busses/i2c-designware-core.c11
-rw-r--r--drivers/i2c/busses/i2c-i801.c3
-rw-r--r--drivers/i2c/busses/i2c-mxs.c13
-rw-r--r--drivers/i2c/busses/i2c-pnx.c53
-rw-r--r--drivers/i2c/i2c-core.c22
8 files changed, 83 insertions, 36 deletions
diff --git a/drivers/i2c/algos/i2c-algo-pca.c b/drivers/i2c/algos/i2c-algo-pca.c
index 73133b1063f..6f5f98d69af 100644
--- a/drivers/i2c/algos/i2c-algo-pca.c
+++ b/drivers/i2c/algos/i2c-algo-pca.c
@@ -476,17 +476,17 @@ static int pca_init(struct i2c_adapter *adap)
476 /* To avoid integer overflow, use clock/100 for calculations */ 476 /* To avoid integer overflow, use clock/100 for calculations */
477 clock = pca_clock(pca_data) / 100; 477 clock = pca_clock(pca_data) / 100;
478 478
479 if (pca_data->i2c_clock > 10000) { 479 if (pca_data->i2c_clock > 1000000) {
480 mode = I2C_PCA_MODE_TURBO; 480 mode = I2C_PCA_MODE_TURBO;
481 min_tlow = 14; 481 min_tlow = 14;
482 min_thi = 5; 482 min_thi = 5;
483 raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */ 483 raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */
484 } else if (pca_data->i2c_clock > 4000) { 484 } else if (pca_data->i2c_clock > 400000) {
485 mode = I2C_PCA_MODE_FASTP; 485 mode = I2C_PCA_MODE_FASTP;
486 min_tlow = 17; 486 min_tlow = 17;
487 min_thi = 9; 487 min_thi = 9;
488 raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */ 488 raise_fall_time = 22; /* Raise 11e-8s, Fall 11e-8s */
489 } else if (pca_data->i2c_clock > 1000) { 489 } else if (pca_data->i2c_clock > 100000) {
490 mode = I2C_PCA_MODE_FAST; 490 mode = I2C_PCA_MODE_FAST;
491 min_tlow = 44; 491 min_tlow = 44;
492 min_thi = 20; 492 min_thi = 20;
diff --git a/drivers/i2c/busses/Kconfig b/drivers/i2c/busses/Kconfig
index b4aaa1bd672..970a1612e79 100644
--- a/drivers/i2c/busses/Kconfig
+++ b/drivers/i2c/busses/Kconfig
@@ -104,6 +104,7 @@ config I2C_I801
104 DH89xxCC (PCH) 104 DH89xxCC (PCH)
105 Panther Point (PCH) 105 Panther Point (PCH)
106 Lynx Point (PCH) 106 Lynx Point (PCH)
107 Lynx Point-LP (PCH)
107 108
108 This driver can also be built as a module. If so, the module 109 This driver can also be built as a module. If so, the module
109 will be called i2c-i801. 110 will be called i2c-i801.
@@ -354,9 +355,13 @@ config I2C_DAVINCI
354 devices such as DaVinci NIC. 355 devices such as DaVinci NIC.
355 For details please see http://www.ti.com/davinci 356 For details please see http://www.ti.com/davinci
356 357
358config I2C_DESIGNWARE_CORE
359 tristate
360
357config I2C_DESIGNWARE_PLATFORM 361config I2C_DESIGNWARE_PLATFORM
358 tristate "Synopsys DesignWare Platform" 362 tristate "Synopsys DesignWare Platform"
359 depends on HAVE_CLK 363 depends on HAVE_CLK
364 select I2C_DESIGNWARE_CORE
360 help 365 help
361 If you say yes to this option, support will be included for the 366 If you say yes to this option, support will be included for the
362 Synopsys DesignWare I2C adapter. Only master mode is supported. 367 Synopsys DesignWare I2C adapter. Only master mode is supported.
@@ -367,6 +372,7 @@ config I2C_DESIGNWARE_PLATFORM
367config I2C_DESIGNWARE_PCI 372config I2C_DESIGNWARE_PCI
368 tristate "Synopsys DesignWare PCI" 373 tristate "Synopsys DesignWare PCI"
369 depends on PCI 374 depends on PCI
375 select I2C_DESIGNWARE_CORE
370 help 376 help
371 If you say yes to this option, support will be included for the 377 If you say yes to this option, support will be included for the
372 Synopsys DesignWare I2C adapter. Only master mode is supported. 378 Synopsys DesignWare I2C adapter. Only master mode is supported.
diff --git a/drivers/i2c/busses/Makefile b/drivers/i2c/busses/Makefile
index ce3c2be7fb4..37c4182cc98 100644
--- a/drivers/i2c/busses/Makefile
+++ b/drivers/i2c/busses/Makefile
@@ -33,10 +33,11 @@ obj-$(CONFIG_I2C_AU1550) += i2c-au1550.o
33obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o 33obj-$(CONFIG_I2C_BLACKFIN_TWI) += i2c-bfin-twi.o
34obj-$(CONFIG_I2C_CPM) += i2c-cpm.o 34obj-$(CONFIG_I2C_CPM) += i2c-cpm.o
35obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o 35obj-$(CONFIG_I2C_DAVINCI) += i2c-davinci.o
36obj-$(CONFIG_I2C_DESIGNWARE_CORE) += i2c-designware-core.o
36obj-$(CONFIG_I2C_DESIGNWARE_PLATFORM) += i2c-designware-platform.o 37obj-$(CONFIG_I2C_DESIGNWARE_PLATFORM) += i2c-designware-platform.o
37i2c-designware-platform-objs := i2c-designware-platdrv.o i2c-designware-core.o 38i2c-designware-platform-objs := i2c-designware-platdrv.o
38obj-$(CONFIG_I2C_DESIGNWARE_PCI) += i2c-designware-pci.o 39obj-$(CONFIG_I2C_DESIGNWARE_PCI) += i2c-designware-pci.o
39i2c-designware-pci-objs := i2c-designware-pcidrv.o i2c-designware-core.o 40i2c-designware-pci-objs := i2c-designware-pcidrv.o
40obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o 41obj-$(CONFIG_I2C_EG20T) += i2c-eg20t.o
41obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o 42obj-$(CONFIG_I2C_GPIO) += i2c-gpio.o
42obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o 43obj-$(CONFIG_I2C_HIGHLANDER) += i2c-highlander.o
diff --git a/drivers/i2c/busses/i2c-designware-core.c b/drivers/i2c/busses/i2c-designware-core.c
index 1e48bec80ed..7b8ebbefb58 100644
--- a/drivers/i2c/busses/i2c-designware-core.c
+++ b/drivers/i2c/busses/i2c-designware-core.c
@@ -25,6 +25,7 @@
25 * ---------------------------------------------------------------------------- 25 * ----------------------------------------------------------------------------
26 * 26 *
27 */ 27 */
28#include <linux/export.h>
28#include <linux/clk.h> 29#include <linux/clk.h>
29#include <linux/errno.h> 30#include <linux/errno.h>
30#include <linux/err.h> 31#include <linux/err.h>
@@ -316,6 +317,7 @@ int i2c_dw_init(struct dw_i2c_dev *dev)
316 dw_writel(dev, dev->master_cfg , DW_IC_CON); 317 dw_writel(dev, dev->master_cfg , DW_IC_CON);
317 return 0; 318 return 0;
318} 319}
320EXPORT_SYMBOL_GPL(i2c_dw_init);
319 321
320/* 322/*
321 * Waiting for bus not busy 323 * Waiting for bus not busy
@@ -568,12 +570,14 @@ done:
568 570
569 return ret; 571 return ret;
570} 572}
573EXPORT_SYMBOL_GPL(i2c_dw_xfer);
571 574
572u32 i2c_dw_func(struct i2c_adapter *adap) 575u32 i2c_dw_func(struct i2c_adapter *adap)
573{ 576{
574 struct dw_i2c_dev *dev = i2c_get_adapdata(adap); 577 struct dw_i2c_dev *dev = i2c_get_adapdata(adap);
575 return dev->functionality; 578 return dev->functionality;
576} 579}
580EXPORT_SYMBOL_GPL(i2c_dw_func);
577 581
578static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev) 582static u32 i2c_dw_read_clear_intrbits(struct dw_i2c_dev *dev)
579{ 583{
@@ -678,17 +682,20 @@ tx_aborted:
678 682
679 return IRQ_HANDLED; 683 return IRQ_HANDLED;
680} 684}
685EXPORT_SYMBOL_GPL(i2c_dw_isr);
681 686
682void i2c_dw_enable(struct dw_i2c_dev *dev) 687void i2c_dw_enable(struct dw_i2c_dev *dev)
683{ 688{
684 /* Enable the adapter */ 689 /* Enable the adapter */
685 dw_writel(dev, 1, DW_IC_ENABLE); 690 dw_writel(dev, 1, DW_IC_ENABLE);
686} 691}
692EXPORT_SYMBOL_GPL(i2c_dw_enable);
687 693
688u32 i2c_dw_is_enabled(struct dw_i2c_dev *dev) 694u32 i2c_dw_is_enabled(struct dw_i2c_dev *dev)
689{ 695{
690 return dw_readl(dev, DW_IC_ENABLE); 696 return dw_readl(dev, DW_IC_ENABLE);
691} 697}
698EXPORT_SYMBOL_GPL(i2c_dw_is_enabled);
692 699
693void i2c_dw_disable(struct dw_i2c_dev *dev) 700void i2c_dw_disable(struct dw_i2c_dev *dev)
694{ 701{
@@ -699,18 +706,22 @@ void i2c_dw_disable(struct dw_i2c_dev *dev)
699 dw_writel(dev, 0, DW_IC_INTR_MASK); 706 dw_writel(dev, 0, DW_IC_INTR_MASK);
700 dw_readl(dev, DW_IC_CLR_INTR); 707 dw_readl(dev, DW_IC_CLR_INTR);
701} 708}
709EXPORT_SYMBOL_GPL(i2c_dw_disable);
702 710
703void i2c_dw_clear_int(struct dw_i2c_dev *dev) 711void i2c_dw_clear_int(struct dw_i2c_dev *dev)
704{ 712{
705 dw_readl(dev, DW_IC_CLR_INTR); 713 dw_readl(dev, DW_IC_CLR_INTR);
706} 714}
715EXPORT_SYMBOL_GPL(i2c_dw_clear_int);
707 716
708void i2c_dw_disable_int(struct dw_i2c_dev *dev) 717void i2c_dw_disable_int(struct dw_i2c_dev *dev)
709{ 718{
710 dw_writel(dev, 0, DW_IC_INTR_MASK); 719 dw_writel(dev, 0, DW_IC_INTR_MASK);
711} 720}
721EXPORT_SYMBOL_GPL(i2c_dw_disable_int);
712 722
713u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev) 723u32 i2c_dw_read_comp_param(struct dw_i2c_dev *dev)
714{ 724{
715 return dw_readl(dev, DW_IC_COMP_PARAM_1); 725 return dw_readl(dev, DW_IC_COMP_PARAM_1);
716} 726}
727EXPORT_SYMBOL_GPL(i2c_dw_read_comp_param);
diff --git a/drivers/i2c/busses/i2c-i801.c b/drivers/i2c/busses/i2c-i801.c
index 898dcf9c7ad..33e9b0c09af 100644
--- a/drivers/i2c/busses/i2c-i801.c
+++ b/drivers/i2c/busses/i2c-i801.c
@@ -52,6 +52,7 @@
52 DH89xxCC (PCH) 0x2330 32 hard yes yes yes 52 DH89xxCC (PCH) 0x2330 32 hard yes yes yes
53 Panther Point (PCH) 0x1e22 32 hard yes yes yes 53 Panther Point (PCH) 0x1e22 32 hard yes yes yes
54 Lynx Point (PCH) 0x8c22 32 hard yes yes yes 54 Lynx Point (PCH) 0x8c22 32 hard yes yes yes
55 Lynx Point-LP (PCH) 0x9c22 32 hard yes yes yes
55 56
56 Features supported by this driver: 57 Features supported by this driver:
57 Software PEC no 58 Software PEC no
@@ -155,6 +156,7 @@
155#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330 156#define PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS 0x2330
156#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30 157#define PCI_DEVICE_ID_INTEL_5_3400_SERIES_SMBUS 0x3b30
157#define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS 0x8c22 158#define PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS 0x8c22
159#define PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_SMBUS 0x9c22
158 160
159struct i801_priv { 161struct i801_priv {
160 struct i2c_adapter adapter; 162 struct i2c_adapter adapter;
@@ -771,6 +773,7 @@ static DEFINE_PCI_DEVICE_TABLE(i801_ids) = {
771 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) }, 773 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_DH89XXCC_SMBUS) },
772 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS) }, 774 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_PANTHERPOINT_SMBUS) },
773 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS) }, 775 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LYNXPOINT_SMBUS) },
776 { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_LYNXPOINT_LP_SMBUS) },
774 { 0, } 777 { 0, }
775}; 778};
776 779
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 088c5c1ed17..51f05b8520e 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -365,10 +365,6 @@ static int mxs_i2c_get_ofdata(struct mxs_i2c_dev *i2c)
365 struct device_node *node = dev->of_node; 365 struct device_node *node = dev->of_node;
366 int ret; 366 int ret;
367 367
368 if (!node)
369 return -EINVAL;
370
371 i2c->speed = &mxs_i2c_95kHz_config;
372 ret = of_property_read_u32(node, "clock-frequency", &speed); 368 ret = of_property_read_u32(node, "clock-frequency", &speed);
373 if (ret) 369 if (ret)
374 dev_warn(dev, "No I2C speed selected, using 100kHz\n"); 370 dev_warn(dev, "No I2C speed selected, using 100kHz\n");
@@ -419,10 +415,13 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
419 return err; 415 return err;
420 416
421 i2c->dev = dev; 417 i2c->dev = dev;
418 i2c->speed = &mxs_i2c_95kHz_config;
422 419
423 err = mxs_i2c_get_ofdata(i2c); 420 if (dev->of_node) {
424 if (err) 421 err = mxs_i2c_get_ofdata(i2c);
425 return err; 422 if (err)
423 return err;
424 }
426 425
427 platform_set_drvdata(pdev, i2c); 426 platform_set_drvdata(pdev, i2c);
428 427
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 5d54416770b..8488bddfe46 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -48,8 +48,9 @@ enum {
48 mcntrl_afie = 0x00000002, 48 mcntrl_afie = 0x00000002,
49 mcntrl_naie = 0x00000004, 49 mcntrl_naie = 0x00000004,
50 mcntrl_drmie = 0x00000008, 50 mcntrl_drmie = 0x00000008,
51 mcntrl_daie = 0x00000020, 51 mcntrl_drsie = 0x00000010,
52 mcntrl_rffie = 0x00000040, 52 mcntrl_rffie = 0x00000020,
53 mcntrl_daie = 0x00000040,
53 mcntrl_tffie = 0x00000080, 54 mcntrl_tffie = 0x00000080,
54 mcntrl_reset = 0x00000100, 55 mcntrl_reset = 0x00000100,
55 mcntrl_cdbmode = 0x00000400, 56 mcntrl_cdbmode = 0x00000400,
@@ -290,31 +291,37 @@ static int i2c_pnx_master_rcv(struct i2c_pnx_algo_data *alg_data)
290 * or we didn't 'ask' for it yet. 291 * or we didn't 'ask' for it yet.
291 */ 292 */
292 if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) { 293 if (ioread32(I2C_REG_STS(alg_data)) & mstatus_rfe) {
293 dev_dbg(&alg_data->adapter.dev, 294 /* 'Asking' is done asynchronously, e.g. dummy TX of several
294 "%s(): Write dummy data to fill Rx-fifo...\n", 295 * bytes is done before the first actual RX arrives in FIFO.
295 __func__); 296 * Therefore, ordered bytes (via TX) are counted separately.
297 */
298 if (alg_data->mif.order) {
299 dev_dbg(&alg_data->adapter.dev,
300 "%s(): Write dummy data to fill Rx-fifo...\n",
301 __func__);
296 302
297 if (alg_data->mif.len == 1) { 303 if (alg_data->mif.order == 1) {
298 /* Last byte, do not acknowledge next rcv. */ 304 /* Last byte, do not acknowledge next rcv. */
299 val |= stop_bit; 305 val |= stop_bit;
306
307 /*
308 * Enable interrupt RFDAIE (data in Rx fifo),
309 * and disable DRMIE (need data for Tx)
310 */
311 ctl = ioread32(I2C_REG_CTL(alg_data));
312 ctl |= mcntrl_rffie | mcntrl_daie;
313 ctl &= ~mcntrl_drmie;
314 iowrite32(ctl, I2C_REG_CTL(alg_data));
315 }
300 316
301 /* 317 /*
302 * Enable interrupt RFDAIE (data in Rx fifo), 318 * Now we'll 'ask' for data:
303 * and disable DRMIE (need data for Tx) 319 * For each byte we want to receive, we must
320 * write a (dummy) byte to the Tx-FIFO.
304 */ 321 */
305 ctl = ioread32(I2C_REG_CTL(alg_data)); 322 iowrite32(val, I2C_REG_TX(alg_data));
306 ctl |= mcntrl_rffie | mcntrl_daie; 323 alg_data->mif.order--;
307 ctl &= ~mcntrl_drmie;
308 iowrite32(ctl, I2C_REG_CTL(alg_data));
309 } 324 }
310
311 /*
312 * Now we'll 'ask' for data:
313 * For each byte we want to receive, we must
314 * write a (dummy) byte to the Tx-FIFO.
315 */
316 iowrite32(val, I2C_REG_TX(alg_data));
317
318 return 0; 325 return 0;
319 } 326 }
320 327
@@ -514,6 +521,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
514 521
515 alg_data->mif.buf = pmsg->buf; 522 alg_data->mif.buf = pmsg->buf;
516 alg_data->mif.len = pmsg->len; 523 alg_data->mif.len = pmsg->len;
524 alg_data->mif.order = pmsg->len;
517 alg_data->mif.mode = (pmsg->flags & I2C_M_RD) ? 525 alg_data->mif.mode = (pmsg->flags & I2C_M_RD) ?
518 I2C_SMBUS_READ : I2C_SMBUS_WRITE; 526 I2C_SMBUS_READ : I2C_SMBUS_WRITE;
519 alg_data->mif.ret = 0; 527 alg_data->mif.ret = 0;
@@ -566,6 +574,7 @@ i2c_pnx_xfer(struct i2c_adapter *adap, struct i2c_msg *msgs, int num)
566 /* Cleanup to be sure... */ 574 /* Cleanup to be sure... */
567 alg_data->mif.buf = NULL; 575 alg_data->mif.buf = NULL;
568 alg_data->mif.len = 0; 576 alg_data->mif.len = 0;
577 alg_data->mif.order = 0;
569 578
570 dev_dbg(&alg_data->adapter.dev, "%s(): exiting, stat = %x\n", 579 dev_dbg(&alg_data->adapter.dev, "%s(): exiting, stat = %x\n",
571 __func__, ioread32(I2C_REG_STS(alg_data))); 580 __func__, ioread32(I2C_REG_STS(alg_data)));
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index 2efa56c5ff2..2091ae8f539 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -637,6 +637,22 @@ static void i2c_adapter_dev_release(struct device *dev)
637} 637}
638 638
639/* 639/*
640 * This function is only needed for mutex_lock_nested, so it is never
641 * called unless locking correctness checking is enabled. Thus we
642 * make it inline to avoid a compiler warning. That's what gcc ends up
643 * doing anyway.
644 */
645static inline unsigned int i2c_adapter_depth(struct i2c_adapter *adapter)
646{
647 unsigned int depth = 0;
648
649 while ((adapter = i2c_parent_is_i2c_adapter(adapter)))
650 depth++;
651
652 return depth;
653}
654
655/*
640 * Let users instantiate I2C devices through sysfs. This can be used when 656 * Let users instantiate I2C devices through sysfs. This can be used when
641 * platform initialization code doesn't contain the proper data for 657 * platform initialization code doesn't contain the proper data for
642 * whatever reason. Also useful for drivers that do device detection and 658 * whatever reason. Also useful for drivers that do device detection and
@@ -726,7 +742,8 @@ i2c_sysfs_delete_device(struct device *dev, struct device_attribute *attr,
726 742
727 /* Make sure the device was added through sysfs */ 743 /* Make sure the device was added through sysfs */
728 res = -ENOENT; 744 res = -ENOENT;
729 mutex_lock(&adap->userspace_clients_lock); 745 mutex_lock_nested(&adap->userspace_clients_lock,
746 i2c_adapter_depth(adap));
730 list_for_each_entry_safe(client, next, &adap->userspace_clients, 747 list_for_each_entry_safe(client, next, &adap->userspace_clients,
731 detected) { 748 detected) {
732 if (client->addr == addr) { 749 if (client->addr == addr) {
@@ -1073,7 +1090,8 @@ int i2c_del_adapter(struct i2c_adapter *adap)
1073 return res; 1090 return res;
1074 1091
1075 /* Remove devices instantiated from sysfs */ 1092 /* Remove devices instantiated from sysfs */
1076 mutex_lock(&adap->userspace_clients_lock); 1093 mutex_lock_nested(&adap->userspace_clients_lock,
1094 i2c_adapter_depth(adap));
1077 list_for_each_entry_safe(client, next, &adap->userspace_clients, 1095 list_for_each_entry_safe(client, next, &adap->userspace_clients,
1078 detected) { 1096 detected) {
1079 dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name, 1097 dev_dbg(&adap->dev, "Removing %s at 0x%x\n", client->name,