All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 21:12 ` Wolfram Sang
  0 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2012-06-13 21:12 UTC (permalink / raw)
  To: linux-i2c
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Grant Likely, Laxman Dewangan,
	Peter Korsgaard, Kukjin Kim, Stephen Warren, Olof Johansson,
	Barry Song, Jochen Friedrich, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Pawel Moll, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core)

Currently, every driver has to do it on its own, but it should be done
in the core, like we already do with board_info structs.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

Based on v3.5-rc2. Only build tested, I don't have a OF based device
around at the moment.

@Peter: Why does ocores do the device registration manually via
platform_data instead of using board_info?

 drivers/i2c/busses/i2c-cpm.c                |    5 -----
 drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
 drivers/i2c/busses/i2c-gpio.c               |    2 --
 drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
 drivers/i2c/busses/i2c-imx.c                |    2 --
 drivers/i2c/busses/i2c-mpc.c                |    1 -
 drivers/i2c/busses/i2c-mxs.c                |    2 --
 drivers/i2c/busses/i2c-ocores.c             |    2 --
 drivers/i2c/busses/i2c-omap.c               |    2 --
 drivers/i2c/busses/i2c-pnx.c                |    2 --
 drivers/i2c/busses/i2c-pxa.c                |    1 -
 drivers/i2c/busses/i2c-s3c2410.c            |    1 -
 drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
 drivers/i2c/busses/i2c-tegra.c              |    2 --
 drivers/i2c/busses/i2c-versatile.c          |    1 -
 drivers/i2c/busses/i2c-xiic.c               |    2 --
 drivers/i2c/i2c-core.c                      |    3 +++
 17 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096..749e63c 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
 	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
 		cpm->adap.name);
 
-	/*
-	 * register OF I2C devices
-	 */
-	of_i2c_register_devices(&cpm->adap);
-
 	return 0;
 out_shut:
 	cpm_i2c_shutdown(cpm);
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef..cf3b23c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failure adding adapter\n");
 		goto err_free_irq;
 	}
-	of_i2c_register_devices(adap);
 
 	return 0;
 
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index e62d2d9..75e26b9 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_add_bus;
 
-	of_i2c_register_devices(adap);
-
 	platform_set_drvdata(pdev, priv);
 
 	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225..8894ab6 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
 	dev_info(&ofdev->dev, "using %s mode\n",
 		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
 
-	/* Now register all the child nodes */
-	of_i2c_register_devices(adap);
-
 	return 0;
 
 error_cleanup:
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 8d6b504..16d9356 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
 		goto fail5;
 	}
 
-	of_i2c_register_devices(&i2c_imx->adapter);
-
 	/* Set up platform driver data */
 	platform_set_drvdata(pdev, i2c_imx);
 
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b76731e..a86049a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
 		dev_err(i2c->dev, "failed to add adapter\n");
 		goto fail_add;
 	}
-	of_i2c_register_devices(&i2c->adap);
 
 	return result;
 
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 04eb441..2bc0ec6 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	of_i2c_register_devices(adap);
-
 	return 0;
 }
 
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 75194c5..a6a11cb 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
 	if (pdata) {
 		for (i = 0; i < pdata->num_devices; i++)
 			i2c_new_device(&i2c->adap, pdata->devices + i);
-	} else {
-		of_i2c_register_devices(&i2c->adap);
 	}
 
 	return 0;
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df60..c290091 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
-	of_i2c_register_devices(adap);
-
 	return 0;
 
 err_free_irq:
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 99389d2..c64d960 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
 		goto out_irq;
 	}
 
-	of_i2c_register_devices(&alg_data->adapter);
-
 	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
 		alg_data->adapter.name, res->start, alg_data->irq);
 
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index a997c7d..9475235 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 		printk(KERN_INFO "I2C: Failed to add bus\n");
 		goto eadapt;
 	}
-	of_i2c_register_devices(&i2c->adap);
 
 	platform_set_drvdata(dev, i2c);
 
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 0195915..ad3a79b 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 		goto err_cpufreq;
 	}
 
-	of_i2c_register_devices(&i2c->adap);
 	platform_set_drvdata(pdev, i2c);
 
 	pm_runtime_enable(&pdev->dev);
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 8110ca4..9acd286 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
 		 adap->nr, pd->bus_speed);
 
-	of_i2c_register_devices(adap);
 	return 0;
 
  err_all:
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 8b2e555..67388cc 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
-	of_i2c_register_devices(&i2c_dev->adapter);
-
 	return 0;
 err_free_irq:
 	free_irq(i2c_dev->irq, i2c_dev);
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
index eec20db..14a1432 100644
--- a/drivers/i2c/busses/i2c-versatile.c
+++ b/drivers/i2c/busses/i2c-versatile.c
@@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
 	ret = i2c_bit_add_numbered_bus(&i2c->adap);
 	if (ret >= 0) {
 		platform_set_drvdata(dev, i2c);
-		of_i2c_register_devices(&i2c->adap);
 		return 0;
 	}
 
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 641d0e5..d76bb71 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
 			i2c_new_device(&i2c->adap, pdata->devices + i);
 	}
 
-	of_i2c_register_devices(&i2c->adap);
-
 	return 0;
 
 add_adapter_failed:
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a6ad32b..4791833 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -39,6 +39,7 @@
 #include <linux/irqflags.h>
 #include <linux/rwsem.h>
 #include <linux/pm_runtime.h>
+#include <linux/of_i2c.h>
 #include <asm/uaccess.h>
 
 #include "i2c-core.h"
@@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 #endif
 
 	/* create pre-declared device nodes */
+	of_i2c_register_devices(adap);
+
 	if (adap->nr < __i2c_first_dynamic_bus_num)
 		i2c_scan_static_board_info(adap);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 21:12 ` Wolfram Sang
  0 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2012-06-13 21:12 UTC (permalink / raw)
  To: linux-i2c
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Laxman Dewangan, Kukjin Kim,
	Stephen Warren, Olof Johansson, Barry Song, Deepak Sikri,
	Haavard Skinnemoen, Pawel Moll, Wolfram Sang, Sascha Hauer,
	Rusty Russell, Tang Yuantian, Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Wolfram Sang, Kyungmin Park,
	Karol Lewandowski, Dirk Brandewie, Shawn Guo, linuxppc-dev

Currently, every driver has to do it on its own, but it should be done
in the core, like we already do with board_info structs.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

Based on v3.5-rc2. Only build tested, I don't have a OF based device
around at the moment.

@Peter: Why does ocores do the device registration manually via
platform_data instead of using board_info?

 drivers/i2c/busses/i2c-cpm.c                |    5 -----
 drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
 drivers/i2c/busses/i2c-gpio.c               |    2 --
 drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
 drivers/i2c/busses/i2c-imx.c                |    2 --
 drivers/i2c/busses/i2c-mpc.c                |    1 -
 drivers/i2c/busses/i2c-mxs.c                |    2 --
 drivers/i2c/busses/i2c-ocores.c             |    2 --
 drivers/i2c/busses/i2c-omap.c               |    2 --
 drivers/i2c/busses/i2c-pnx.c                |    2 --
 drivers/i2c/busses/i2c-pxa.c                |    1 -
 drivers/i2c/busses/i2c-s3c2410.c            |    1 -
 drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
 drivers/i2c/busses/i2c-tegra.c              |    2 --
 drivers/i2c/busses/i2c-versatile.c          |    1 -
 drivers/i2c/busses/i2c-xiic.c               |    2 --
 drivers/i2c/i2c-core.c                      |    3 +++
 17 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096..749e63c 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
 	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
 		cpm->adap.name);
 
-	/*
-	 * register OF I2C devices
-	 */
-	of_i2c_register_devices(&cpm->adap);
-
 	return 0;
 out_shut:
 	cpm_i2c_shutdown(cpm);
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef..cf3b23c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failure adding adapter\n");
 		goto err_free_irq;
 	}
-	of_i2c_register_devices(adap);
 
 	return 0;
 
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index e62d2d9..75e26b9 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_add_bus;
 
-	of_i2c_register_devices(adap);
-
 	platform_set_drvdata(pdev, priv);
 
 	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225..8894ab6 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
 	dev_info(&ofdev->dev, "using %s mode\n",
 		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
 
-	/* Now register all the child nodes */
-	of_i2c_register_devices(adap);
-
 	return 0;
 
 error_cleanup:
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 8d6b504..16d9356 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
 		goto fail5;
 	}
 
-	of_i2c_register_devices(&i2c_imx->adapter);
-
 	/* Set up platform driver data */
 	platform_set_drvdata(pdev, i2c_imx);
 
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b76731e..a86049a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
 		dev_err(i2c->dev, "failed to add adapter\n");
 		goto fail_add;
 	}
-	of_i2c_register_devices(&i2c->adap);
 
 	return result;
 
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 04eb441..2bc0ec6 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	of_i2c_register_devices(adap);
-
 	return 0;
 }
 
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 75194c5..a6a11cb 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
 	if (pdata) {
 		for (i = 0; i < pdata->num_devices; i++)
 			i2c_new_device(&i2c->adap, pdata->devices + i);
-	} else {
-		of_i2c_register_devices(&i2c->adap);
 	}
 
 	return 0;
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df60..c290091 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
-	of_i2c_register_devices(adap);
-
 	return 0;
 
 err_free_irq:
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 99389d2..c64d960 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
 		goto out_irq;
 	}
 
-	of_i2c_register_devices(&alg_data->adapter);
-
 	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
 		alg_data->adapter.name, res->start, alg_data->irq);
 
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index a997c7d..9475235 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 		printk(KERN_INFO "I2C: Failed to add bus\n");
 		goto eadapt;
 	}
-	of_i2c_register_devices(&i2c->adap);
 
 	platform_set_drvdata(dev, i2c);
 
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 0195915..ad3a79b 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 		goto err_cpufreq;
 	}
 
-	of_i2c_register_devices(&i2c->adap);
 	platform_set_drvdata(pdev, i2c);
 
 	pm_runtime_enable(&pdev->dev);
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 8110ca4..9acd286 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
 		 adap->nr, pd->bus_speed);
 
-	of_i2c_register_devices(adap);
 	return 0;
 
  err_all:
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 8b2e555..67388cc 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
-	of_i2c_register_devices(&i2c_dev->adapter);
-
 	return 0;
 err_free_irq:
 	free_irq(i2c_dev->irq, i2c_dev);
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
index eec20db..14a1432 100644
--- a/drivers/i2c/busses/i2c-versatile.c
+++ b/drivers/i2c/busses/i2c-versatile.c
@@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
 	ret = i2c_bit_add_numbered_bus(&i2c->adap);
 	if (ret >= 0) {
 		platform_set_drvdata(dev, i2c);
-		of_i2c_register_devices(&i2c->adap);
 		return 0;
 	}
 
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 641d0e5..d76bb71 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
 			i2c_new_device(&i2c->adap, pdata->devices + i);
 	}
 
-	of_i2c_register_devices(&i2c->adap);
-
 	return 0;
 
 add_adapter_failed:
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a6ad32b..4791833 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -39,6 +39,7 @@
 #include <linux/irqflags.h>
 #include <linux/rwsem.h>
 #include <linux/pm_runtime.h>
+#include <linux/of_i2c.h>
 #include <asm/uaccess.h>
 
 #include "i2c-core.h"
@@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 #endif
 
 	/* create pre-declared device nodes */
+	of_i2c_register_devices(adap);
+
 	if (adap->nr < __i2c_first_dynamic_bus_num)
 		i2c_scan_static_board_info(adap);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 21:12 ` Wolfram Sang
  0 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2012-06-13 21:12 UTC (permalink / raw)
  To: linux-arm-kernel

Currently, every driver has to do it on its own, but it should be done
in the core, like we already do with board_info structs.

Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
---

Based on v3.5-rc2. Only build tested, I don't have a OF based device
around at the moment.

@Peter: Why does ocores do the device registration manually via
platform_data instead of using board_info?

 drivers/i2c/busses/i2c-cpm.c                |    5 -----
 drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
 drivers/i2c/busses/i2c-gpio.c               |    2 --
 drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
 drivers/i2c/busses/i2c-imx.c                |    2 --
 drivers/i2c/busses/i2c-mpc.c                |    1 -
 drivers/i2c/busses/i2c-mxs.c                |    2 --
 drivers/i2c/busses/i2c-ocores.c             |    2 --
 drivers/i2c/busses/i2c-omap.c               |    2 --
 drivers/i2c/busses/i2c-pnx.c                |    2 --
 drivers/i2c/busses/i2c-pxa.c                |    1 -
 drivers/i2c/busses/i2c-s3c2410.c            |    1 -
 drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
 drivers/i2c/busses/i2c-tegra.c              |    2 --
 drivers/i2c/busses/i2c-versatile.c          |    1 -
 drivers/i2c/busses/i2c-xiic.c               |    2 --
 drivers/i2c/i2c-core.c                      |    3 +++
 17 files changed, 3 insertions(+), 30 deletions(-)

diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
index c1e1096..749e63c 100644
--- a/drivers/i2c/busses/i2c-cpm.c
+++ b/drivers/i2c/busses/i2c-cpm.c
@@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
 	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
 		cpm->adap.name);
 
-	/*
-	 * register OF I2C devices
-	 */
-	of_i2c_register_devices(&cpm->adap);
-
 	return 0;
 out_shut:
 	cpm_i2c_shutdown(cpm);
diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
index 0506fef..cf3b23c 100644
--- a/drivers/i2c/busses/i2c-designware-platdrv.c
+++ b/drivers/i2c/busses/i2c-designware-platdrv.c
@@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
 		dev_err(&pdev->dev, "failure adding adapter\n");
 		goto err_free_irq;
 	}
-	of_i2c_register_devices(adap);
 
 	return 0;
 
diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
index e62d2d9..75e26b9 100644
--- a/drivers/i2c/busses/i2c-gpio.c
+++ b/drivers/i2c/busses/i2c-gpio.c
@@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
 	if (ret)
 		goto err_add_bus;
 
-	of_i2c_register_devices(adap);
-
 	platform_set_drvdata(pdev, priv);
 
 	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
index 806e225..8894ab6 100644
--- a/drivers/i2c/busses/i2c-ibm_iic.c
+++ b/drivers/i2c/busses/i2c-ibm_iic.c
@@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
 	dev_info(&ofdev->dev, "using %s mode\n",
 		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
 
-	/* Now register all the child nodes */
-	of_i2c_register_devices(adap);
-
 	return 0;
 
 error_cleanup:
diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
index 8d6b504..16d9356 100644
--- a/drivers/i2c/busses/i2c-imx.c
+++ b/drivers/i2c/busses/i2c-imx.c
@@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
 		goto fail5;
 	}
 
-	of_i2c_register_devices(&i2c_imx->adapter);
-
 	/* Set up platform driver data */
 	platform_set_drvdata(pdev, i2c_imx);
 
diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
index b76731e..a86049a 100644
--- a/drivers/i2c/busses/i2c-mpc.c
+++ b/drivers/i2c/busses/i2c-mpc.c
@@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
 		dev_err(i2c->dev, "failed to add adapter\n");
 		goto fail_add;
 	}
-	of_i2c_register_devices(&i2c->adap);
 
 	return result;
 
diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
index 04eb441..2bc0ec6 100644
--- a/drivers/i2c/busses/i2c-mxs.c
+++ b/drivers/i2c/busses/i2c-mxs.c
@@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
 		return err;
 	}
 
-	of_i2c_register_devices(adap);
-
 	return 0;
 }
 
diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
index 75194c5..a6a11cb 100644
--- a/drivers/i2c/busses/i2c-ocores.c
+++ b/drivers/i2c/busses/i2c-ocores.c
@@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
 	if (pdata) {
 		for (i = 0; i < pdata->num_devices; i++)
 			i2c_new_device(&i2c->adap, pdata->devices + i);
-	} else {
-		of_i2c_register_devices(&i2c->adap);
 	}
 
 	return 0;
diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
index 801df60..c290091 100644
--- a/drivers/i2c/busses/i2c-omap.c
+++ b/drivers/i2c/busses/i2c-omap.c
@@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
-	of_i2c_register_devices(adap);
-
 	return 0;
 
 err_free_irq:
diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
index 99389d2..c64d960 100644
--- a/drivers/i2c/busses/i2c-pnx.c
+++ b/drivers/i2c/busses/i2c-pnx.c
@@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
 		goto out_irq;
 	}
 
-	of_i2c_register_devices(&alg_data->adapter);
-
 	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
 		alg_data->adapter.name, res->start, alg_data->irq);
 
diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
index a997c7d..9475235 100644
--- a/drivers/i2c/busses/i2c-pxa.c
+++ b/drivers/i2c/busses/i2c-pxa.c
@@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
 		printk(KERN_INFO "I2C: Failed to add bus\n");
 		goto eadapt;
 	}
-	of_i2c_register_devices(&i2c->adap);
 
 	platform_set_drvdata(dev, i2c);
 
diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
index 0195915..ad3a79b 100644
--- a/drivers/i2c/busses/i2c-s3c2410.c
+++ b/drivers/i2c/busses/i2c-s3c2410.c
@@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
 		goto err_cpufreq;
 	}
 
-	of_i2c_register_devices(&i2c->adap);
 	platform_set_drvdata(pdev, i2c);
 
 	pm_runtime_enable(&pdev->dev);
diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
index 8110ca4..9acd286 100644
--- a/drivers/i2c/busses/i2c-sh_mobile.c
+++ b/drivers/i2c/busses/i2c-sh_mobile.c
@@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
 	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
 		 adap->nr, pd->bus_speed);
 
-	of_i2c_register_devices(adap);
 	return 0;
 
  err_all:
diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
index 8b2e555..67388cc 100644
--- a/drivers/i2c/busses/i2c-tegra.c
+++ b/drivers/i2c/busses/i2c-tegra.c
@@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
 		goto err_free_irq;
 	}
 
-	of_i2c_register_devices(&i2c_dev->adapter);
-
 	return 0;
 err_free_irq:
 	free_irq(i2c_dev->irq, i2c_dev);
diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
index eec20db..14a1432 100644
--- a/drivers/i2c/busses/i2c-versatile.c
+++ b/drivers/i2c/busses/i2c-versatile.c
@@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
 	ret = i2c_bit_add_numbered_bus(&i2c->adap);
 	if (ret >= 0) {
 		platform_set_drvdata(dev, i2c);
-		of_i2c_register_devices(&i2c->adap);
 		return 0;
 	}
 
diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
index 641d0e5..d76bb71 100644
--- a/drivers/i2c/busses/i2c-xiic.c
+++ b/drivers/i2c/busses/i2c-xiic.c
@@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
 			i2c_new_device(&i2c->adap, pdata->devices + i);
 	}
 
-	of_i2c_register_devices(&i2c->adap);
-
 	return 0;
 
 add_adapter_failed:
diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
index a6ad32b..4791833 100644
--- a/drivers/i2c/i2c-core.c
+++ b/drivers/i2c/i2c-core.c
@@ -39,6 +39,7 @@
 #include <linux/irqflags.h>
 #include <linux/rwsem.h>
 #include <linux/pm_runtime.h>
+#include <linux/of_i2c.h>
 #include <asm/uaccess.h>
 
 #include "i2c-core.h"
@@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
 #endif
 
 	/* create pre-declared device nodes */
+	of_i2c_register_devices(adap);
+
 	if (adap->nr < __i2c_first_dynamic_bus_num)
 		i2c_scan_static_board_info(adap);
 
-- 
1.7.10

^ permalink raw reply related	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-13 21:33   ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 36+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-13 21:33 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-ke

On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.

Won't that conflict with i2c-powermac doing it its own way ?

Cheers,
Ben.

> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
> 
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..749e63c 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
>  	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
>  		cpm->adap.name);
>  
> -	/*
> -	 * register OF I2C devices
> -	 */
> -	of_i2c_register_devices(&cpm->adap);
> -
>  	return 0;
>  out_shut:
>  	cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failure adding adapter\n");
>  		goto err_free_irq;
>  	}
> -	of_i2c_register_devices(adap);
>  
>  	return 0;
>  
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e62d2d9..75e26b9 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_bus;
>  
> -	of_i2c_register_devices(adap);
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 806e225..8894ab6 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
>  	dev_info(&ofdev->dev, "using %s mode\n",
>  		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>  
> -	/* Now register all the child nodes */
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 8d6b504..16d9356 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
>  		goto fail5;
>  	}
>  
> -	of_i2c_register_devices(&i2c_imx->adapter);
> -
>  	/* Set up platform driver data */
>  	platform_set_drvdata(pdev, i2c_imx);
>  
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index b76731e..a86049a 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
>  		dev_err(i2c->dev, "failed to add adapter\n");
>  		goto fail_add;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	return result;
>  
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 04eb441..2bc0ec6 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 75194c5..a6a11cb 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		for (i = 0; i < pdata->num_devices; i++)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
> -	} else {
> -		of_i2c_register_devices(&i2c->adap);
>  	}
>  
>  	return 0;
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 801df60..c290091 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  err_free_irq:
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 99389d2..c64d960 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> -	of_i2c_register_devices(&alg_data->adapter);
> -
>  	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
>  		alg_data->adapter.name, res->start, alg_data->irq);
>  
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index a997c7d..9475235 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	platform_set_drvdata(dev, i2c);
>  
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 0195915..ad3a79b 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  		goto err_cpufreq;
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
>  	platform_set_drvdata(pdev, i2c);
>  
>  	pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 8110ca4..9acd286 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>  	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
>  		 adap->nr, pd->bus_speed);
>  
> -	of_i2c_register_devices(adap);
>  	return 0;
>  
>   err_all:
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 8b2e555..67388cc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(&i2c_dev->adapter);
> -
>  	return 0;
>  err_free_irq:
>  	free_irq(i2c_dev->irq, i2c_dev);
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index eec20db..14a1432 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
>  	ret = i2c_bit_add_numbered_bus(&i2c->adap);
>  	if (ret >= 0) {
>  		platform_set_drvdata(dev, i2c);
> -		of_i2c_register_devices(&i2c->adap);
>  		return 0;
>  	}
>  
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..d76bb71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
> -
>  	return 0;
>  
>  add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 21:33   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 36+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-13 21:33 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Olof Johansson, Shawn Guo, linuxppc-dev

On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.

Won't that conflict with i2c-powermac doing it its own way ?

Cheers,
Ben.

> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
> 
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..749e63c 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
>  	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
>  		cpm->adap.name);
>  
> -	/*
> -	 * register OF I2C devices
> -	 */
> -	of_i2c_register_devices(&cpm->adap);
> -
>  	return 0;
>  out_shut:
>  	cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failure adding adapter\n");
>  		goto err_free_irq;
>  	}
> -	of_i2c_register_devices(adap);
>  
>  	return 0;
>  
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e62d2d9..75e26b9 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_bus;
>  
> -	of_i2c_register_devices(adap);
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 806e225..8894ab6 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
>  	dev_info(&ofdev->dev, "using %s mode\n",
>  		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>  
> -	/* Now register all the child nodes */
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 8d6b504..16d9356 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
>  		goto fail5;
>  	}
>  
> -	of_i2c_register_devices(&i2c_imx->adapter);
> -
>  	/* Set up platform driver data */
>  	platform_set_drvdata(pdev, i2c_imx);
>  
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index b76731e..a86049a 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
>  		dev_err(i2c->dev, "failed to add adapter\n");
>  		goto fail_add;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	return result;
>  
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 04eb441..2bc0ec6 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 75194c5..a6a11cb 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		for (i = 0; i < pdata->num_devices; i++)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
> -	} else {
> -		of_i2c_register_devices(&i2c->adap);
>  	}
>  
>  	return 0;
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 801df60..c290091 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  err_free_irq:
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 99389d2..c64d960 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> -	of_i2c_register_devices(&alg_data->adapter);
> -
>  	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
>  		alg_data->adapter.name, res->start, alg_data->irq);
>  
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index a997c7d..9475235 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	platform_set_drvdata(dev, i2c);
>  
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 0195915..ad3a79b 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  		goto err_cpufreq;
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
>  	platform_set_drvdata(pdev, i2c);
>  
>  	pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 8110ca4..9acd286 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>  	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
>  		 adap->nr, pd->bus_speed);
>  
> -	of_i2c_register_devices(adap);
>  	return 0;
>  
>   err_all:
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 8b2e555..67388cc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(&i2c_dev->adapter);
> -
>  	return 0;
>  err_free_irq:
>  	free_irq(i2c_dev->irq, i2c_dev);
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index eec20db..14a1432 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
>  	ret = i2c_bit_add_numbered_bus(&i2c->adap);
>  	if (ret >= 0) {
>  		platform_set_drvdata(dev, i2c);
> -		of_i2c_register_devices(&i2c->adap);
>  		return 0;
>  	}
>  
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..d76bb71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
> -
>  	return 0;
>  
>  add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 21:33   ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 36+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-13 21:33 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.

Won't that conflict with i2c-powermac doing it its own way ?

Cheers,
Ben.

> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
> 
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..749e63c 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
>  	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
>  		cpm->adap.name);
>  
> -	/*
> -	 * register OF I2C devices
> -	 */
> -	of_i2c_register_devices(&cpm->adap);
> -
>  	return 0;
>  out_shut:
>  	cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failure adding adapter\n");
>  		goto err_free_irq;
>  	}
> -	of_i2c_register_devices(adap);
>  
>  	return 0;
>  
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e62d2d9..75e26b9 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_bus;
>  
> -	of_i2c_register_devices(adap);
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 806e225..8894ab6 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
>  	dev_info(&ofdev->dev, "using %s mode\n",
>  		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>  
> -	/* Now register all the child nodes */
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 8d6b504..16d9356 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
>  		goto fail5;
>  	}
>  
> -	of_i2c_register_devices(&i2c_imx->adapter);
> -
>  	/* Set up platform driver data */
>  	platform_set_drvdata(pdev, i2c_imx);
>  
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index b76731e..a86049a 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
>  		dev_err(i2c->dev, "failed to add adapter\n");
>  		goto fail_add;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	return result;
>  
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 04eb441..2bc0ec6 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 75194c5..a6a11cb 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		for (i = 0; i < pdata->num_devices; i++)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
> -	} else {
> -		of_i2c_register_devices(&i2c->adap);
>  	}
>  
>  	return 0;
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 801df60..c290091 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  err_free_irq:
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 99389d2..c64d960 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> -	of_i2c_register_devices(&alg_data->adapter);
> -
>  	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
>  		alg_data->adapter.name, res->start, alg_data->irq);
>  
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index a997c7d..9475235 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	platform_set_drvdata(dev, i2c);
>  
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 0195915..ad3a79b 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  		goto err_cpufreq;
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
>  	platform_set_drvdata(pdev, i2c);
>  
>  	pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 8110ca4..9acd286 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>  	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
>  		 adap->nr, pd->bus_speed);
>  
> -	of_i2c_register_devices(adap);
>  	return 0;
>  
>   err_all:
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 8b2e555..67388cc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(&i2c_dev->adapter);
> -
>  	return 0;
>  err_free_irq:
>  	free_irq(i2c_dev->irq, i2c_dev);
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index eec20db..14a1432 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
>  	ret = i2c_bit_add_numbered_bus(&i2c->adap);
>  	if (ret >= 0) {
>  		platform_set_drvdata(dev, i2c);
> -		of_i2c_register_devices(&i2c->adap);
>  		return 0;
>  	}
>  
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..d76bb71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
> -
>  	return 0;
>  
>  add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-13 22:03   ` Stephen Warren
  -1 siblings, 0 replies; 36+ messages in thread
From: Stephen Warren @ 2012-06-13 22:03 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Jochen Friedrich, Grant Likely, Laxman Dewangan,
	linux-i2c, Peter Korsgaard, Kukjin Kim, Stephen Warren,
	Barry Song, Haojian Zhuang, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Vitaly Wool,
	Wolfram Sang, Sascha Hauer, Rusty Russell, Tang Yuantian, Jean

On 06/13/2012 03:12 PM, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.

At least on Tegra this works fine,
Tested-by: Stephen Warren <swarren@wwwdotorg.org>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 22:03   ` Stephen Warren
  0 siblings, 0 replies; 36+ messages in thread
From: Stephen Warren @ 2012-06-13 22:03 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Olof Johansson, Shawn Guo, linuxppc-dev

On 06/13/2012 03:12 PM, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.

At least on Tegra this works fine,
Tested-by: Stephen Warren <swarren@wwwdotorg.org>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-13 22:03   ` Stephen Warren
  0 siblings, 0 replies; 36+ messages in thread
From: Stephen Warren @ 2012-06-13 22:03 UTC (permalink / raw)
  To: linux-arm-kernel

On 06/13/2012 03:12 PM, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.

At least on Tegra this works fine,
Tested-by: Stephen Warren <swarren@wwwdotorg.org>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-14  4:40   ` Grant Likely
  -1 siblings, 0 replies; 36+ messages in thread
From: Grant Likely @ 2012-06-14  4:40 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Jochen Friedrich, Laxman Dewangan,
	Peter Korsgaard, Kukjin Kim, S tephen Warren, Olof Johansson,
	Barry Song, Haojian Zhuang, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Pawel Moll, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars

On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

FWIW, and without any actual compiling or testing:

Acked-by: Grant Likely <grant.likely@secretlab.ca>

On this topic, I'd also like to see all of drivers/of/of_i2c.c move
into drivers/i2c.  I've done the same for spi and gpio and I think the
result is cleaner.

g.

> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
> 
> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
> 
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..749e63c 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
>  	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
>  		cpm->adap.name);
>  
> -	/*
> -	 * register OF I2C devices
> -	 */
> -	of_i2c_register_devices(&cpm->adap);
> -
>  	return 0;
>  out_shut:
>  	cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failure adding adapter\n");
>  		goto err_free_irq;
>  	}
> -	of_i2c_register_devices(adap);
>  
>  	return 0;
>  
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e62d2d9..75e26b9 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_bus;
>  
> -	of_i2c_register_devices(adap);
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 806e225..8894ab6 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
>  	dev_info(&ofdev->dev, "using %s mode\n",
>  		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>  
> -	/* Now register all the child nodes */
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 8d6b504..16d9356 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
>  		goto fail5;
>  	}
>  
> -	of_i2c_register_devices(&i2c_imx->adapter);
> -
>  	/* Set up platform driver data */
>  	platform_set_drvdata(pdev, i2c_imx);
>  
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index b76731e..a86049a 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
>  		dev_err(i2c->dev, "failed to add adapter\n");
>  		goto fail_add;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	return result;
>  
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 04eb441..2bc0ec6 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 75194c5..a6a11cb 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		for (i = 0; i < pdata->num_devices; i++)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
> -	} else {
> -		of_i2c_register_devices(&i2c->adap);
>  	}
>  
>  	return 0;
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 801df60..c290091 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  err_free_irq:
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 99389d2..c64d960 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> -	of_i2c_register_devices(&alg_data->adapter);
> -
>  	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
>  		alg_data->adapter.name, res->start, alg_data->irq);
>  
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index a997c7d..9475235 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	platform_set_drvdata(dev, i2c);
>  
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 0195915..ad3a79b 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  		goto err_cpufreq;
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
>  	platform_set_drvdata(pdev, i2c);
>  
>  	pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 8110ca4..9acd286 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>  	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
>  		 adap->nr, pd->bus_speed);
>  
> -	of_i2c_register_devices(adap);
>  	return 0;
>  
>   err_all:
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 8b2e555..67388cc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(&i2c_dev->adapter);
> -
>  	return 0;
>  err_free_irq:
>  	free_irq(i2c_dev->irq, i2c_dev);
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index eec20db..14a1432 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
>  	ret = i2c_bit_add_numbered_bus(&i2c->adap);
>  	if (ret >= 0) {
>  		platform_set_drvdata(dev, i2c);
> -		of_i2c_register_devices(&i2c->adap);
>  		return 0;
>  	}
>  
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..d76bb71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
> -
>  	return 0;
>  
>  add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  
> -- 
> 1.7.10
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  4:40   ` Grant Likely
  0 siblings, 0 replies; 36+ messages in thread
From: Grant Likely @ 2012-06-14  4:40 UTC (permalink / raw)
  To: Wolfram Sang, linux-i2c
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, Kukjin Kim, S tephen Warren,
	Olof Johansson, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Pawel Moll, Wolfram Sang, Sascha Hauer,
	Rusty Russell, Tang Yuantian, Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Wolfram Sang, Kyungmin Park,
	Karol Lewandowski, Dirk Brandewie, Shawn Guo, linuxppc-dev

On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

FWIW, and without any actual compiling or testing:

Acked-by: Grant Likely <grant.likely@secretlab.ca>

On this topic, I'd also like to see all of drivers/of/of_i2c.c move
into drivers/i2c.  I've done the same for spi and gpio and I think the
result is cleaner.

g.

> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
> 
> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
> 
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..749e63c 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
>  	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
>  		cpm->adap.name);
>  
> -	/*
> -	 * register OF I2C devices
> -	 */
> -	of_i2c_register_devices(&cpm->adap);
> -
>  	return 0;
>  out_shut:
>  	cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failure adding adapter\n");
>  		goto err_free_irq;
>  	}
> -	of_i2c_register_devices(adap);
>  
>  	return 0;
>  
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e62d2d9..75e26b9 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_bus;
>  
> -	of_i2c_register_devices(adap);
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 806e225..8894ab6 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
>  	dev_info(&ofdev->dev, "using %s mode\n",
>  		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>  
> -	/* Now register all the child nodes */
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 8d6b504..16d9356 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
>  		goto fail5;
>  	}
>  
> -	of_i2c_register_devices(&i2c_imx->adapter);
> -
>  	/* Set up platform driver data */
>  	platform_set_drvdata(pdev, i2c_imx);
>  
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index b76731e..a86049a 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
>  		dev_err(i2c->dev, "failed to add adapter\n");
>  		goto fail_add;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	return result;
>  
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 04eb441..2bc0ec6 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 75194c5..a6a11cb 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		for (i = 0; i < pdata->num_devices; i++)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
> -	} else {
> -		of_i2c_register_devices(&i2c->adap);
>  	}
>  
>  	return 0;
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 801df60..c290091 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  err_free_irq:
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 99389d2..c64d960 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> -	of_i2c_register_devices(&alg_data->adapter);
> -
>  	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
>  		alg_data->adapter.name, res->start, alg_data->irq);
>  
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index a997c7d..9475235 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	platform_set_drvdata(dev, i2c);
>  
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 0195915..ad3a79b 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  		goto err_cpufreq;
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
>  	platform_set_drvdata(pdev, i2c);
>  
>  	pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 8110ca4..9acd286 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>  	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
>  		 adap->nr, pd->bus_speed);
>  
> -	of_i2c_register_devices(adap);
>  	return 0;
>  
>   err_all:
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 8b2e555..67388cc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(&i2c_dev->adapter);
> -
>  	return 0;
>  err_free_irq:
>  	free_irq(i2c_dev->irq, i2c_dev);
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index eec20db..14a1432 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
>  	ret = i2c_bit_add_numbered_bus(&i2c->adap);
>  	if (ret >= 0) {
>  		platform_set_drvdata(dev, i2c);
> -		of_i2c_register_devices(&i2c->adap);
>  		return 0;
>  	}
>  
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..d76bb71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
> -
>  	return 0;
>  
>  add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  
> -- 
> 1.7.10
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  4:40   ` Grant Likely
  0 siblings, 0 replies; 36+ messages in thread
From: Grant Likely @ 2012-06-14  4:40 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

FWIW, and without any actual compiling or testing:

Acked-by: Grant Likely <grant.likely@secretlab.ca>

On this topic, I'd also like to see all of drivers/of/of_i2c.c move
into drivers/i2c.  I've done the same for spi and gpio and I think the
result is cleaner.

g.

> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
> 
> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
> 
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-cpm.c b/drivers/i2c/busses/i2c-cpm.c
> index c1e1096..749e63c 100644
> --- a/drivers/i2c/busses/i2c-cpm.c
> +++ b/drivers/i2c/busses/i2c-cpm.c
> @@ -673,11 +673,6 @@ static int __devinit cpm_i2c_probe(struct platform_device *ofdev)
>  	dev_dbg(&ofdev->dev, "hw routines for %s registered.\n",
>  		cpm->adap.name);
>  
> -	/*
> -	 * register OF I2C devices
> -	 */
> -	of_i2c_register_devices(&cpm->adap);
> -
>  	return 0;
>  out_shut:
>  	cpm_i2c_shutdown(cpm);
> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>  		dev_err(&pdev->dev, "failure adding adapter\n");
>  		goto err_free_irq;
>  	}
> -	of_i2c_register_devices(adap);
>  
>  	return 0;
>  
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index e62d2d9..75e26b9 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -195,8 +195,6 @@ static int __devinit i2c_gpio_probe(struct platform_device *pdev)
>  	if (ret)
>  		goto err_add_bus;
>  
> -	of_i2c_register_devices(adap);
> -
>  	platform_set_drvdata(pdev, priv);
>  
>  	dev_info(&pdev->dev, "using pins %u (SDA) and %u (SCL%s)\n",
> diff --git a/drivers/i2c/busses/i2c-ibm_iic.c b/drivers/i2c/busses/i2c-ibm_iic.c
> index 806e225..8894ab6 100644
> --- a/drivers/i2c/busses/i2c-ibm_iic.c
> +++ b/drivers/i2c/busses/i2c-ibm_iic.c
> @@ -759,9 +759,6 @@ static int __devinit iic_probe(struct platform_device *ofdev)
>  	dev_info(&ofdev->dev, "using %s mode\n",
>  		 dev->fast_mode ? "fast (400 kHz)" : "standard (100 kHz)");
>  
> -	/* Now register all the child nodes */
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  error_cleanup:
> diff --git a/drivers/i2c/busses/i2c-imx.c b/drivers/i2c/busses/i2c-imx.c
> index 8d6b504..16d9356 100644
> --- a/drivers/i2c/busses/i2c-imx.c
> +++ b/drivers/i2c/busses/i2c-imx.c
> @@ -568,8 +568,6 @@ static int __init i2c_imx_probe(struct platform_device *pdev)
>  		goto fail5;
>  	}
>  
> -	of_i2c_register_devices(&i2c_imx->adapter);
> -
>  	/* Set up platform driver data */
>  	platform_set_drvdata(pdev, i2c_imx);
>  
> diff --git a/drivers/i2c/busses/i2c-mpc.c b/drivers/i2c/busses/i2c-mpc.c
> index b76731e..a86049a 100644
> --- a/drivers/i2c/busses/i2c-mpc.c
> +++ b/drivers/i2c/busses/i2c-mpc.c
> @@ -675,7 +675,6 @@ static int __devinit fsl_i2c_probe(struct platform_device *op)
>  		dev_err(i2c->dev, "failed to add adapter\n");
>  		goto fail_add;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	return result;
>  
> diff --git a/drivers/i2c/busses/i2c-mxs.c b/drivers/i2c/busses/i2c-mxs.c
> index 04eb441..2bc0ec6 100644
> --- a/drivers/i2c/busses/i2c-mxs.c
> +++ b/drivers/i2c/busses/i2c-mxs.c
> @@ -379,8 +379,6 @@ static int __devinit mxs_i2c_probe(struct platform_device *pdev)
>  		return err;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  }
>  
> diff --git a/drivers/i2c/busses/i2c-ocores.c b/drivers/i2c/busses/i2c-ocores.c
> index 75194c5..a6a11cb 100644
> --- a/drivers/i2c/busses/i2c-ocores.c
> +++ b/drivers/i2c/busses/i2c-ocores.c
> @@ -344,8 +344,6 @@ static int __devinit ocores_i2c_probe(struct platform_device *pdev)
>  	if (pdata) {
>  		for (i = 0; i < pdata->num_devices; i++)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
> -	} else {
> -		of_i2c_register_devices(&i2c->adap);
>  	}
>  
>  	return 0;
> diff --git a/drivers/i2c/busses/i2c-omap.c b/drivers/i2c/busses/i2c-omap.c
> index 801df60..c290091 100644
> --- a/drivers/i2c/busses/i2c-omap.c
> +++ b/drivers/i2c/busses/i2c-omap.c
> @@ -1121,8 +1121,6 @@ omap_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(adap);
> -
>  	return 0;
>  
>  err_free_irq:
> diff --git a/drivers/i2c/busses/i2c-pnx.c b/drivers/i2c/busses/i2c-pnx.c
> index 99389d2..c64d960 100644
> --- a/drivers/i2c/busses/i2c-pnx.c
> +++ b/drivers/i2c/busses/i2c-pnx.c
> @@ -730,8 +730,6 @@ static int __devinit i2c_pnx_probe(struct platform_device *pdev)
>  		goto out_irq;
>  	}
>  
> -	of_i2c_register_devices(&alg_data->adapter);
> -
>  	dev_dbg(&pdev->dev, "%s: Master at %#8x, irq %d.\n",
>  		alg_data->adapter.name, res->start, alg_data->irq);
>  
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index a997c7d..9475235 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -1194,7 +1194,6 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
>  	}
> -	of_i2c_register_devices(&i2c->adap);
>  
>  	platform_set_drvdata(dev, i2c);
>  
> diff --git a/drivers/i2c/busses/i2c-s3c2410.c b/drivers/i2c/busses/i2c-s3c2410.c
> index 0195915..ad3a79b 100644
> --- a/drivers/i2c/busses/i2c-s3c2410.c
> +++ b/drivers/i2c/busses/i2c-s3c2410.c
> @@ -1058,7 +1058,6 @@ static int s3c24xx_i2c_probe(struct platform_device *pdev)
>  		goto err_cpufreq;
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
>  	platform_set_drvdata(pdev, i2c);
>  
>  	pm_runtime_enable(&pdev->dev);
> diff --git a/drivers/i2c/busses/i2c-sh_mobile.c b/drivers/i2c/busses/i2c-sh_mobile.c
> index 8110ca4..9acd286 100644
> --- a/drivers/i2c/busses/i2c-sh_mobile.c
> +++ b/drivers/i2c/busses/i2c-sh_mobile.c
> @@ -670,7 +670,6 @@ static int sh_mobile_i2c_probe(struct platform_device *dev)
>  	dev_info(&dev->dev, "I2C adapter %d with bus speed %lu Hz\n",
>  		 adap->nr, pd->bus_speed);
>  
> -	of_i2c_register_devices(adap);
>  	return 0;
>  
>   err_all:
> diff --git a/drivers/i2c/busses/i2c-tegra.c b/drivers/i2c/busses/i2c-tegra.c
> index 8b2e555..67388cc 100644
> --- a/drivers/i2c/busses/i2c-tegra.c
> +++ b/drivers/i2c/busses/i2c-tegra.c
> @@ -684,8 +684,6 @@ static int __devinit tegra_i2c_probe(struct platform_device *pdev)
>  		goto err_free_irq;
>  	}
>  
> -	of_i2c_register_devices(&i2c_dev->adapter);
> -
>  	return 0;
>  err_free_irq:
>  	free_irq(i2c_dev->irq, i2c_dev);
> diff --git a/drivers/i2c/busses/i2c-versatile.c b/drivers/i2c/busses/i2c-versatile.c
> index eec20db..14a1432 100644
> --- a/drivers/i2c/busses/i2c-versatile.c
> +++ b/drivers/i2c/busses/i2c-versatile.c
> @@ -108,7 +108,6 @@ static int i2c_versatile_probe(struct platform_device *dev)
>  	ret = i2c_bit_add_numbered_bus(&i2c->adap);
>  	if (ret >= 0) {
>  		platform_set_drvdata(dev, i2c);
> -		of_i2c_register_devices(&i2c->adap);
>  		return 0;
>  	}
>  
> diff --git a/drivers/i2c/busses/i2c-xiic.c b/drivers/i2c/busses/i2c-xiic.c
> index 641d0e5..d76bb71 100644
> --- a/drivers/i2c/busses/i2c-xiic.c
> +++ b/drivers/i2c/busses/i2c-xiic.c
> @@ -754,8 +754,6 @@ static int __devinit xiic_i2c_probe(struct platform_device *pdev)
>  			i2c_new_device(&i2c->adap, pdata->devices + i);
>  	}
>  
> -	of_i2c_register_devices(&i2c->adap);
> -
>  	return 0;
>  
>  add_adapter_failed:
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  
> -- 
> 1.7.10
> 

-- 
Grant Likely, B.Sc, P.Eng.
Secret Lab Technologies, Ltd.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-14  7:31   ` Peter Korsgaard
  -1 siblings, 0 replies; 36+ messages in thread
From: Peter Korsgaard @ 2012-06-14  7:31 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Grant Likely, Laxman Dewangan,
	linux-i2c, Kukjin Kim, Stephen Warren, Olof Johansson,
	Barry Song, Jochen Friedrich, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Pawel Moll, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus

>>>>> "Wolfram" == Wolfram Sang <w.sang@pengutronix.de> writes:

 Wolfram> Currently, every driver has to do it on its own, but it should
 Wolfram> be done in the core, like we already do with board_info
 Wolfram> structs.

 Wolfram> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
 Wolfram> ---

 Wolfram> Based on v3.5-rc2. Only build tested, I don't have a OF based device
 Wolfram> around at the moment.

Neither have I, but it looks good.

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

 Wolfram> @Peter: Why does ocores do the device registration manually via
 Wolfram> platform_data instead of using board_info?

Because of dd14be4c274 (i2c-ocores: Can add I2C devices to the bus), a
patch I wasn't CC'ed on and haven't acked. I only noticed it later when
the I2C tree got merged into mainline.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  7:31   ` Peter Korsgaard
  0 siblings, 0 replies; 36+ messages in thread
From: Peter Korsgaard @ 2012-06-14  7:31 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Laxman Dewangan, linux-i2c,
	Kukjin Kim, Stephen Warren, Olof Johansson, Barry Song,
	Deepak Sikri, Haavard Skinnemoen, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Dirk Brandewie, Shawn Guo, linuxppc-dev

>>>>> "Wolfram" == Wolfram Sang <w.sang@pengutronix.de> writes:

 Wolfram> Currently, every driver has to do it on its own, but it should
 Wolfram> be done in the core, like we already do with board_info
 Wolfram> structs.

 Wolfram> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
 Wolfram> ---

 Wolfram> Based on v3.5-rc2. Only build tested, I don't have a OF based device
 Wolfram> around at the moment.

Neither have I, but it looks good.

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

 Wolfram> @Peter: Why does ocores do the device registration manually via
 Wolfram> platform_data instead of using board_info?

Because of dd14be4c274 (i2c-ocores: Can add I2C devices to the bus), a
patch I wasn't CC'ed on and haven't acked. I only noticed it later when
the I2C tree got merged into mainline.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  7:31   ` Peter Korsgaard
  0 siblings, 0 replies; 36+ messages in thread
From: Peter Korsgaard @ 2012-06-14  7:31 UTC (permalink / raw)
  To: linux-arm-kernel

>>>>> "Wolfram" == Wolfram Sang <w.sang@pengutronix.de> writes:

 Wolfram> Currently, every driver has to do it on its own, but it should
 Wolfram> be done in the core, like we already do with board_info
 Wolfram> structs.

 Wolfram> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
 Wolfram> ---

 Wolfram> Based on v3.5-rc2. Only build tested, I don't have a OF based device
 Wolfram> around at the moment.

Neither have I, but it looks good.

Acked-by: Peter Korsgaard <jacmet@sunsite.dk>

 Wolfram> @Peter: Why does ocores do the device registration manually via
 Wolfram> platform_data instead of using board_info?

Because of dd14be4c274 (i2c-ocores: Can add I2C devices to the bus), a
patch I wasn't CC'ed on and haven't acked. I only noticed it later when
the I2C tree got merged into mainline.

-- 
Bye, Peter Korsgaard

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-14  7:53   ` viresh kumar
  -1 siblings, 0 replies; 36+ messages in thread
From: viresh kumar @ 2012-06-14  7:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Mauro Carvalho Chehab, Tony Lindgren, Linus Walleij,
	Jochen Friedrich, Grant Likely, Laxman Dewangan, linux-i2c,
	Peter Korsgaard, Kukjin Kim, Stephen Warren, Barry Song,
	Haojian Zhuang, Deepak Sikri, Li Yang, Haavard Skinnemoen,
	spear-devel, Dirk Brandewie, Pawel Moll, Vitaly Wool,
	Wolfram Sang, Sascha Hauer, Rusty Russell, Tang Yuantian, Jean

On Wed, Jun 13, 2012 at 10:12 PM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---


> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
>                dev_err(&pdev->dev, "failure adding adapter\n");
>                goto err_free_irq;
>        }
> -       of_i2c_register_devices(adap);
>
>        return 0;

For SPEAr,

Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  7:53   ` viresh kumar
  0 siblings, 0 replies; 36+ messages in thread
From: viresh kumar @ 2012-06-14  7:53 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Mauro Carvalho Chehab, Tony Lindgren, Linus Walleij,
	Laxman Dewangan, linux-i2c, Kukjin Kim, Stephen Warren,
	Barry Song, Haojian Zhuang, Deepak Sikri, Haavard Skinnemoen,
	spear-devel, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Olof Johansson, Shawn Guo, linuxppc-dev

On Wed, Jun 13, 2012 at 10:12 PM, Wolfram Sang <w.sang@pengutronix.de> wrot=
e:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---


> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/bu=
sses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_dev=
ice *pdev)
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0dev_err(&pdev->dev, "failure adding adapte=
r\n");
> =A0 =A0 =A0 =A0 =A0 =A0 =A0 =A0goto err_free_irq;
> =A0 =A0 =A0 =A0}
> - =A0 =A0 =A0 of_i2c_register_devices(adap);
>
> =A0 =A0 =A0 =A0return 0;

For SPEAr,

Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  7:53   ` viresh kumar
  0 siblings, 0 replies; 36+ messages in thread
From: viresh kumar @ 2012-06-14  7:53 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 13, 2012 at 10:12 PM, Wolfram Sang <w.sang@pengutronix.de> wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---


> diff --git a/drivers/i2c/busses/i2c-designware-platdrv.c b/drivers/i2c/busses/i2c-designware-platdrv.c
> index 0506fef..cf3b23c 100644
> --- a/drivers/i2c/busses/i2c-designware-platdrv.c
> +++ b/drivers/i2c/busses/i2c-designware-platdrv.c
> @@ -147,7 +147,6 @@ static int __devinit dw_i2c_probe(struct platform_device *pdev)
> ? ? ? ? ? ? ? ?dev_err(&pdev->dev, "failure adding adapter\n");
> ? ? ? ? ? ? ? ?goto err_free_irq;
> ? ? ? ?}
> - ? ? ? of_i2c_register_devices(adap);
>
> ? ? ? ?return 0;

For SPEAr,

Reviewed-by: Viresh Kumar <viresh.linux@gmail.com>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:33   ` Benjamin Herrenschmidt
  (?)
@ 2012-06-14  9:14     ` Wolfram Sang
  -1 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2012-06-14  9:14 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-ke


[-- Attachment #1.1: Type: text/plain, Size: 840 bytes --]

On Thu, Jun 14, 2012 at 07:33:37AM +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> > Currently, every driver has to do it on its own, but it should be done
> > in the core, like we already do with board_info structs.
> > 
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > ---
> > 
> > Based on v3.5-rc2. Only build tested, I don't have a OF based device
> > around at the moment.
> 
> Won't that conflict with i2c-powermac doing it its own way ?

Yup :(

I assume there is no chance that the powermac devicetree can be
pre-processed to be compatible with of_i2c_register_devices?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #1.2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  9:14     ` Wolfram Sang
  0 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2012-06-14  9:14 UTC (permalink / raw)
  To: Benjamin Herrenschmidt
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Olof Johansson, Shawn Guo, linuxppc-dev

[-- Attachment #1: Type: text/plain, Size: 840 bytes --]

On Thu, Jun 14, 2012 at 07:33:37AM +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> > Currently, every driver has to do it on its own, but it should be done
> > in the core, like we already do with board_info structs.
> > 
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > ---
> > 
> > Based on v3.5-rc2. Only build tested, I don't have a OF based device
> > around at the moment.
> 
> Won't that conflict with i2c-powermac doing it its own way ?

Yup :(

I assume there is no chance that the powermac devicetree can be
pre-processed to be compatible with of_i2c_register_devices?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |

[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 198 bytes --]

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14  9:14     ` Wolfram Sang
  0 siblings, 0 replies; 36+ messages in thread
From: Wolfram Sang @ 2012-06-14  9:14 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, Jun 14, 2012 at 07:33:37AM +1000, Benjamin Herrenschmidt wrote:
> On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> > Currently, every driver has to do it on its own, but it should be done
> > in the core, like we already do with board_info structs.
> > 
> > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > ---
> > 
> > Based on v3.5-rc2. Only build tested, I don't have a OF based device
> > around at the moment.
> 
> Won't that conflict with i2c-powermac doing it its own way ?

Yup :(

I assume there is no chance that the powermac devicetree can be
pre-processed to be compatible with of_i2c_register_devices?

Regards,

   Wolfram

-- 
Pengutronix e.K.                           | Wolfram Sang                |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 198 bytes
Desc: Digital signature
URL: <http://lists.infradead.org/pipermail/linux-arm-kernel/attachments/20120614/3bc4eeb9/attachment.sig>

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-14 10:28   ` Pawel Moll
  -1 siblings, 0 replies; 36+ messages in thread
From: Pawel Moll @ 2012-06-14 10:28 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Jochen Friedrich, Grant Likely, Laxman Dewangan,
	linux-i2c, Peter Korsgaard, Kukjin Kim, Stephen Warren,
	Barry Song, Haojian Zhuang, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Dirk Brandewie, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core)

On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/i2c-core.c                      |    3 +++

For what it's worth

Tested-by: Pawel Moll <pawel.moll@arm.com>

on Versatile Express.

Regards

Paweł



_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 10:28   ` Pawel Moll
  0 siblings, 0 replies; 36+ messages in thread
From: Pawel Moll @ 2012-06-14 10:28 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Wolfram Sang, Sascha Hauer,
	Rusty Russell, Tang Yuantian, Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Olof Johansson, Shawn Guo, linuxppc-dev

On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>=20
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/i2c-core.c                      |    3 +++

For what it's worth

Tested-by: Pawel Moll <pawel.moll@arm.com>

on Versatile Express.

Regards

Pawe=C5=82

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 10:28   ` Pawel Moll
  0 siblings, 0 replies; 36+ messages in thread
From: Pawel Moll @ 2012-06-14 10:28 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/i2c-core.c                      |    3 +++

For what it's worth

Tested-by: Pawel Moll <pawel.moll@arm.com>

on Versatile Express.

Regards

Pawe?

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-14 10:42   ` Jean Delvare
  -1 siblings, 0 replies; 36+ messages in thread
From: Jean Delvare @ 2012-06-14 10:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Grant Likely, Laxman Dewangan,
	linux-i2c, Peter Korsgaard, Kukjin Kim, Stephen Warren,
	Barry Song, Jochen Friedrich, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Pawel Moll, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian, Olof Johansson,
	Magnus Damm

Hi Wolfram,

On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
> (...)
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  

This was proposed in the past, and rejected because of dependency
issues. I don't think the situation changed. of_i2c needs i2c-core for
i2c_new_device(), and with the change above, i2c-core needs of_i2c for
of_i2c_register_devices(). If either is built as a module, it will fail.

This might be the reason why of_spi ended up being merged into
drivers/spi according to Grant? I have no objection to the same being
done for of_i2c if it makes everybody happy, as long as it does not
create additional dependencies (i.e. I2C should not depend on OF.)

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 10:42   ` Jean Delvare
  0 siblings, 0 replies; 36+ messages in thread
From: Jean Delvare @ 2012-06-14 10:42 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Laxman Dewangan, linux-i2c,
	Kukjin Kim, Stephen Warren, Barry Song, Deepak Sikri,
	Haavard Skinnemoen, Pawel Moll, Wolfram Sang, Sascha Hauer,
	Rusty Russell, Tang Yuantian, Olof Johansson, Magnus Damm,
	Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Dirk Brandewie, Shawn Guo, linuxppc-dev

Hi Wolfram,

On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
> (...)
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  

This was proposed in the past, and rejected because of dependency
issues. I don't think the situation changed. of_i2c needs i2c-core for
i2c_new_device(), and with the change above, i2c-core needs of_i2c for
of_i2c_register_devices(). If either is built as a module, it will fail.

This might be the reason why of_spi ended up being merged into
drivers/spi according to Grant? I have no objection to the same being
done for of_i2c if it makes everybody happy, as long as it does not
create additional dependencies (i.e. I2C should not depend on OF.)

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 10:42   ` Jean Delvare
  0 siblings, 0 replies; 36+ messages in thread
From: Jean Delvare @ 2012-06-14 10:42 UTC (permalink / raw)
  To: linux-arm-kernel

Hi Wolfram,

On Wed, 13 Jun 2012 23:12:10 +0200, Wolfram Sang wrote:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
> 
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> ---
> 
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
> (...)
> diff --git a/drivers/i2c/i2c-core.c b/drivers/i2c/i2c-core.c
> index a6ad32b..4791833 100644
> --- a/drivers/i2c/i2c-core.c
> +++ b/drivers/i2c/i2c-core.c
> @@ -39,6 +39,7 @@
>  #include <linux/irqflags.h>
>  #include <linux/rwsem.h>
>  #include <linux/pm_runtime.h>
> +#include <linux/of_i2c.h>
>  #include <asm/uaccess.h>
>  
>  #include "i2c-core.h"
> @@ -880,6 +881,8 @@ static int i2c_register_adapter(struct i2c_adapter *adap)
>  #endif
>  
>  	/* create pre-declared device nodes */
> +	of_i2c_register_devices(adap);
> +
>  	if (adap->nr < __i2c_first_dynamic_bus_num)
>  		i2c_scan_static_board_info(adap);
>  

This was proposed in the past, and rejected because of dependency
issues. I don't think the situation changed. of_i2c needs i2c-core for
i2c_new_device(), and with the change above, i2c-core needs of_i2c for
of_i2c_register_devices(). If either is built as a module, it will fail.

This might be the reason why of_spi ended up being merged into
drivers/spi according to Grant? I have no objection to the same being
done for of_i2c if it makes everybody happy, as long as it does not
create additional dependencies (i.e. I2C should not depend on OF.)

-- 
Jean Delvare

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-14  9:14     ` Wolfram Sang
  (?)
@ 2012-06-14 11:35       ` Benjamin Herrenschmidt
  -1 siblings, 0 replies; 36+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-14 11:35 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-ke

On Thu, 2012-06-14 at 11:14 +0200, Wolfram Sang wrote:
> On Thu, Jun 14, 2012 at 07:33:37AM +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> > > Currently, every driver has to do it on its own, but it should be done
> > > in the core, like we already do with board_info structs.
> > > 
> > > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > > ---
> > > 
> > > Based on v3.5-rc2. Only build tested, I don't have a OF based device
> > > around at the moment.
> > 
> > Won't that conflict with i2c-powermac doing it its own way ?
> 
> Yup :(
> 
> I assume there is no chance that the powermac devicetree can be
> pre-processed to be compatible with of_i2c_register_devices?

That would be nasty and need a lot of testing on all sort of machines I
don't have direct access to.

Maybe we can set a flag somewhere to indicate to the core not to run the
default probing on that controller ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 11:35       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 36+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-14 11:35 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Barry Song, Haojian Zhuang, Deepak Sikri,
	Haavard Skinnemoen, Dirk Brandewie, Pawel Moll, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Olof Johansson, Shawn Guo, linuxppc-dev

On Thu, 2012-06-14 at 11:14 +0200, Wolfram Sang wrote:
> On Thu, Jun 14, 2012 at 07:33:37AM +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> > > Currently, every driver has to do it on its own, but it should be done
> > > in the core, like we already do with board_info structs.
> > > 
> > > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > > ---
> > > 
> > > Based on v3.5-rc2. Only build tested, I don't have a OF based device
> > > around at the moment.
> > 
> > Won't that conflict with i2c-powermac doing it its own way ?
> 
> Yup :(
> 
> I assume there is no chance that the powermac devicetree can be
> pre-processed to be compatible with of_i2c_register_devices?

That would be nasty and need a lot of testing on all sort of machines I
don't have direct access to.

Maybe we can set a flag somewhere to indicate to the core not to run the
default probing on that controller ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 11:35       ` Benjamin Herrenschmidt
  0 siblings, 0 replies; 36+ messages in thread
From: Benjamin Herrenschmidt @ 2012-06-14 11:35 UTC (permalink / raw)
  To: linux-arm-kernel

On Thu, 2012-06-14 at 11:14 +0200, Wolfram Sang wrote:
> On Thu, Jun 14, 2012 at 07:33:37AM +1000, Benjamin Herrenschmidt wrote:
> > On Wed, 2012-06-13 at 23:12 +0200, Wolfram Sang wrote:
> > > Currently, every driver has to do it on its own, but it should be done
> > > in the core, like we already do with board_info structs.
> > > 
> > > Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>
> > > ---
> > > 
> > > Based on v3.5-rc2. Only build tested, I don't have a OF based device
> > > around at the moment.
> > 
> > Won't that conflict with i2c-powermac doing it its own way ?
> 
> Yup :(
> 
> I assume there is no chance that the powermac devicetree can be
> pre-processed to be compatible with of_i2c_register_devices?

That would be nasty and need a lot of testing on all sort of machines I
don't have direct access to.

Maybe we can set a flag somewhere to indicate to the core not to run the
default probing on that controller ?

Cheers,
Ben.

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-14 17:29   ` Linus Walleij
  -1 siblings, 0 replies; 36+ messages in thread
From: Linus Walleij @ 2012-06-14 17:29 UTC (permalink / raw)
  To: Wolfram Sang, Lee Jones
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Haojian Zhuang, Grant Likely, Laxman Dewangan, linux-i2c,
	Peter Korsgaard, Kukjin Kim, Stephen Warren, Olof Johansson,
	Barry Song, Jochen Friedrich, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Pawel Moll, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core),
	Magnus

On Wed, Jun 13, 2012 at 11:12 PM, Wolfram Sang <w.sang@pengutronix.de> wrote:

> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Lee might be able to test this with his DT bindings (and patch them to use
the new handling in the core..)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 17:29   ` Linus Walleij
  0 siblings, 0 replies; 36+ messages in thread
From: Linus Walleij @ 2012-06-14 17:29 UTC (permalink / raw)
  To: Wolfram Sang, Lee Jones
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Haojian Zhuang, Laxman Dewangan, linux-i2c, Kukjin Kim,
	Stephen Warren, Olof Johansson, Barry Song, Deepak Sikri,
	Haavard Skinnemoen, Pawel Moll, Wolfram Sang, Sascha Hauer,
	Rusty Russell, Tang Yuantian, Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Dirk Brandewie, Shawn Guo, linuxppc-dev

On Wed, Jun 13, 2012 at 11:12 PM, Wolfram Sang <w.sang@pengutronix.de> wrote:

> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Lee might be able to test this with his DT bindings (and patch them to use
the new handling in the core..)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-14 17:29   ` Linus Walleij
  0 siblings, 0 replies; 36+ messages in thread
From: Linus Walleij @ 2012-06-14 17:29 UTC (permalink / raw)
  To: linux-arm-kernel

On Wed, Jun 13, 2012 at 11:12 PM, Wolfram Sang <w.sang@pengutronix.de> wrote:

> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

Acked-by: Linus Walleij <linus.walleij@linaro.org>

Lee might be able to test this with his DT bindings (and patch them to use
the new handling in the core..)

Yours,
Linus Walleij

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
  2012-06-13 21:12 ` Wolfram Sang
  (?)
@ 2012-06-21  1:16   ` Barry Song
  -1 siblings, 0 replies; 36+ messages in thread
From: Barry Song @ 2012-06-21  1:16 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Grant Likely, Laxman Dewangan,
	linux-i2c, Peter Korsgaard, Kukjin Kim, Stephen Warren,
	Olof Johansson, Jochen Friedrich, Deepak Sikri, Li Yang,
	Haavard Skinnemoen, Pawel Moll, Vitaly Wool, Wolfram Sang,
	Sascha Hauer, Rusty Russell, Tang Yuantian,
	Jean Delvare (PC drivers, core)

2012/6/14 Wolfram Sang <w.sang@pengutronix.de>:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

Acked-by: Barry Song <barry.song@lianlab.org>

> ---
>
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
>
> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
>
>  drivers/i2c/busses/i2c-cpm.c                |    5 -----
>  drivers/i2c/busses/i2c-designware-platdrv.c |    1 -
>  drivers/i2c/busses/i2c-gpio.c               |    2 --
>  drivers/i2c/busses/i2c-ibm_iic.c            |    3 ---
>  drivers/i2c/busses/i2c-imx.c                |    2 --
>  drivers/i2c/busses/i2c-mpc.c                |    1 -
>  drivers/i2c/busses/i2c-mxs.c                |    2 --
>  drivers/i2c/busses/i2c-ocores.c             |    2 --
>  drivers/i2c/busses/i2c-omap.c               |    2 --
>  drivers/i2c/busses/i2c-pnx.c                |    2 --
>  drivers/i2c/busses/i2c-pxa.c                |    1 -
>  drivers/i2c/busses/i2c-s3c2410.c            |    1 -
>  drivers/i2c/busses/i2c-sh_mobile.c          |    1 -
>  drivers/i2c/busses/i2c-tegra.c              |    2 --
>  drivers/i2c/busses/i2c-versatile.c          |    1 -
>  drivers/i2c/busses/i2c-xiic.c               |    2 --
>  drivers/i2c/i2c-core.c                      |    3 +++
>  17 files changed, 3 insertions(+), 30 deletions(-)

-barry
_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

^ permalink raw reply	[flat|nested] 36+ messages in thread

* Re: [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-21  1:16   ` Barry Song
  0 siblings, 0 replies; 36+ messages in thread
From: Barry Song @ 2012-06-21  1:16 UTC (permalink / raw)
  To: Wolfram Sang
  Cc: Viresh Kumar, Mauro Carvalho Chehab, Tony Lindgren,
	Linus Walleij, Haojian Zhuang, Laxman Dewangan, linux-i2c,
	Kukjin Kim, Stephen Warren, Olof Johansson, Deepak Sikri,
	Haavard Skinnemoen, Pawel Moll, Wolfram Sang, Sascha Hauer,
	Rusty Russell, Tang Yuantian, Jean Delvare (PC drivers, core),
	Magnus Damm, Lars-Peter Clausen, Ben Dooks (embedded platforms),
	linux-arm-kernel, Jiri Kosina, Kyungmin Park, Karol Lewandowski,
	Dirk Brandewie, Shawn Guo, linuxppc-dev

MjAxMi82LzE0IFdvbGZyYW0gU2FuZyA8dy5zYW5nQHBlbmd1dHJvbml4LmRlPjoKPiBDdXJyZW50
bHksIGV2ZXJ5IGRyaXZlciBoYXMgdG8gZG8gaXQgb24gaXRzIG93biwgYnV0IGl0IHNob3VsZCBi
ZSBkb25lCj4gaW4gdGhlIGNvcmUsIGxpa2Ugd2UgYWxyZWFkeSBkbyB3aXRoIGJvYXJkX2luZm8g
c3RydWN0cy4KPgo+IFNpZ25lZC1vZmYtYnk6IFdvbGZyYW0gU2FuZyA8dy5zYW5nQHBlbmd1dHJv
bml4LmRlPgoKQWNrZWQtYnk6IEJhcnJ5IFNvbmcgPGJhcnJ5LnNvbmdAbGlhbmxhYi5vcmc+Cgo+
IC0tLQo+Cj4gQmFzZWQgb24gdjMuNS1yYzIuIE9ubHkgYnVpbGQgdGVzdGVkLCBJIGRvbid0IGhh
dmUgYSBPRiBiYXNlZCBkZXZpY2UKPiBhcm91bmQgYXQgdGhlIG1vbWVudC4KPgo+IEBQZXRlcjog
V2h5IGRvZXMgb2NvcmVzIGRvIHRoZSBkZXZpY2UgcmVnaXN0cmF0aW9uIG1hbnVhbGx5IHZpYQo+
IHBsYXRmb3JtX2RhdGEgaW5zdGVhZCBvZiB1c2luZyBib2FyZF9pbmZvPwo+Cj4gwqBkcml2ZXJz
L2kyYy9idXNzZXMvaTJjLWNwbS5jIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfCDCoCDCoDUgLS0t
LS0KPiDCoGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMtZGVzaWdud2FyZS1wbGF0ZHJ2LmMgfCDCoCDC
oDEgLQo+IMKgZHJpdmVycy9pMmMvYnVzc2VzL2kyYy1ncGlvLmMgwqAgwqAgwqAgwqAgwqAgwqAg
wqAgfCDCoCDCoDIgLS0KPiDCoGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMtaWJtX2lpYy5jIMKgIMKg
IMKgIMKgIMKgIMKgfCDCoCDCoDMgLS0tCj4gwqBkcml2ZXJzL2kyYy9idXNzZXMvaTJjLWlteC5j
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfCDCoCDCoDIgLS0KPiDCoGRyaXZlcnMvaTJjL2J1c3Nl
cy9pMmMtbXBjLmMgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqB8IMKgIMKgMSAtCj4gwqBkcml2ZXJz
L2kyYy9idXNzZXMvaTJjLW14cy5jIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfCDCoCDCoDIgLS0K
PiDCoGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMtb2NvcmVzLmMgwqAgwqAgwqAgwqAgwqAgwqAgfCDC
oCDCoDIgLS0KPiDCoGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMtb21hcC5jIMKgIMKgIMKgIMKgIMKg
IMKgIMKgIHwgwqAgwqAyIC0tCj4gwqBkcml2ZXJzL2kyYy9idXNzZXMvaTJjLXBueC5jIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgfCDCoCDCoDIgLS0KPiDCoGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMt
cHhhLmMgwqAgwqAgwqAgwqAgwqAgwqAgwqAgwqB8IMKgIMKgMSAtCj4gwqBkcml2ZXJzL2kyYy9i
dXNzZXMvaTJjLXMzYzI0MTAuYyDCoCDCoCDCoCDCoCDCoCDCoHwgwqAgwqAxIC0KPiDCoGRyaXZl
cnMvaTJjL2J1c3Nlcy9pMmMtc2hfbW9iaWxlLmMgwqAgwqAgwqAgwqAgwqB8IMKgIMKgMSAtCj4g
wqBkcml2ZXJzL2kyYy9idXNzZXMvaTJjLXRlZ3JhLmMgwqAgwqAgwqAgwqAgwqAgwqAgwqB8IMKg
IMKgMiAtLQo+IMKgZHJpdmVycy9pMmMvYnVzc2VzL2kyYy12ZXJzYXRpbGUuYyDCoCDCoCDCoCDC
oCDCoHwgwqAgwqAxIC0KPiDCoGRyaXZlcnMvaTJjL2J1c3Nlcy9pMmMteGlpYy5jIMKgIMKgIMKg
IMKgIMKgIMKgIMKgIHwgwqAgwqAyIC0tCj4gwqBkcml2ZXJzL2kyYy9pMmMtY29yZS5jIMKgIMKg
IMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgIMKgfCDCoCDCoDMgKysrCj4gwqAxNyBmaWxlcyBjaGFu
Z2VkLCAzIGluc2VydGlvbnMoKyksIDMwIGRlbGV0aW9ucygtKQoKLWJhcnJ5Cg==

^ permalink raw reply	[flat|nested] 36+ messages in thread

* [PATCH] i2c: let the core register devices from devicetree
@ 2012-06-21  1:16   ` Barry Song
  0 siblings, 0 replies; 36+ messages in thread
From: Barry Song @ 2012-06-21  1:16 UTC (permalink / raw)
  To: linux-arm-kernel

2012/6/14 Wolfram Sang <w.sang@pengutronix.de>:
> Currently, every driver has to do it on its own, but it should be done
> in the core, like we already do with board_info structs.
>
> Signed-off-by: Wolfram Sang <w.sang@pengutronix.de>

Acked-by: Barry Song <barry.song@lianlab.org>

> ---
>
> Based on v3.5-rc2. Only build tested, I don't have a OF based device
> around at the moment.
>
> @Peter: Why does ocores do the device registration manually via
> platform_data instead of using board_info?
>
> ?drivers/i2c/busses/i2c-cpm.c ? ? ? ? ? ? ? ?| ? ?5 -----
> ?drivers/i2c/busses/i2c-designware-platdrv.c | ? ?1 -
> ?drivers/i2c/busses/i2c-gpio.c ? ? ? ? ? ? ? | ? ?2 --
> ?drivers/i2c/busses/i2c-ibm_iic.c ? ? ? ? ? ?| ? ?3 ---
> ?drivers/i2c/busses/i2c-imx.c ? ? ? ? ? ? ? ?| ? ?2 --
> ?drivers/i2c/busses/i2c-mpc.c ? ? ? ? ? ? ? ?| ? ?1 -
> ?drivers/i2c/busses/i2c-mxs.c ? ? ? ? ? ? ? ?| ? ?2 --
> ?drivers/i2c/busses/i2c-ocores.c ? ? ? ? ? ? | ? ?2 --
> ?drivers/i2c/busses/i2c-omap.c ? ? ? ? ? ? ? | ? ?2 --
> ?drivers/i2c/busses/i2c-pnx.c ? ? ? ? ? ? ? ?| ? ?2 --
> ?drivers/i2c/busses/i2c-pxa.c ? ? ? ? ? ? ? ?| ? ?1 -
> ?drivers/i2c/busses/i2c-s3c2410.c ? ? ? ? ? ?| ? ?1 -
> ?drivers/i2c/busses/i2c-sh_mobile.c ? ? ? ? ?| ? ?1 -
> ?drivers/i2c/busses/i2c-tegra.c ? ? ? ? ? ? ?| ? ?2 --
> ?drivers/i2c/busses/i2c-versatile.c ? ? ? ? ?| ? ?1 -
> ?drivers/i2c/busses/i2c-xiic.c ? ? ? ? ? ? ? | ? ?2 --
> ?drivers/i2c/i2c-core.c ? ? ? ? ? ? ? ? ? ? ?| ? ?3 +++
> ?17 files changed, 3 insertions(+), 30 deletions(-)

-barry

^ permalink raw reply	[flat|nested] 36+ messages in thread

end of thread, other threads:[~2012-06-21  1:16 UTC | newest]

Thread overview: 36+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2012-06-13 21:12 [PATCH] i2c: let the core register devices from devicetree Wolfram Sang
2012-06-13 21:12 ` Wolfram Sang
2012-06-13 21:12 ` Wolfram Sang
2012-06-13 21:33 ` Benjamin Herrenschmidt
2012-06-13 21:33   ` Benjamin Herrenschmidt
2012-06-13 21:33   ` Benjamin Herrenschmidt
2012-06-14  9:14   ` Wolfram Sang
2012-06-14  9:14     ` Wolfram Sang
2012-06-14  9:14     ` Wolfram Sang
2012-06-14 11:35     ` Benjamin Herrenschmidt
2012-06-14 11:35       ` Benjamin Herrenschmidt
2012-06-14 11:35       ` Benjamin Herrenschmidt
2012-06-13 22:03 ` Stephen Warren
2012-06-13 22:03   ` Stephen Warren
2012-06-13 22:03   ` Stephen Warren
2012-06-14  4:40 ` Grant Likely
2012-06-14  4:40   ` Grant Likely
2012-06-14  4:40   ` Grant Likely
2012-06-14  7:31 ` Peter Korsgaard
2012-06-14  7:31   ` Peter Korsgaard
2012-06-14  7:31   ` Peter Korsgaard
2012-06-14  7:53 ` viresh kumar
2012-06-14  7:53   ` viresh kumar
2012-06-14  7:53   ` viresh kumar
2012-06-14 10:28 ` Pawel Moll
2012-06-14 10:28   ` Pawel Moll
2012-06-14 10:28   ` Pawel Moll
2012-06-14 10:42 ` Jean Delvare
2012-06-14 10:42   ` Jean Delvare
2012-06-14 10:42   ` Jean Delvare
2012-06-14 17:29 ` Linus Walleij
2012-06-14 17:29   ` Linus Walleij
2012-06-14 17:29   ` Linus Walleij
2012-06-21  1:16 ` Barry Song
2012-06-21  1:16   ` Barry Song
2012-06-21  1:16   ` Barry Song

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.