LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] powerpc: fsl_soc: Pre-allocate i2c bus number and pre-register devices.
@ 2007-05-17 15:19 Scott Wood
  0 siblings, 0 replies; only message in thread
From: Scott Wood @ 2007-05-17 15:19 UTC (permalink / raw)
  To: linuxppc-dev; +Cc: i2c

A bus number is dynamically allocated, used to register devices
with i2c_register_board_info(), and then passed to the i2c-mpc
driver to use with i2c_add_prenumbered_adapter().

Signed-off-by: Scott Wood <scottwood@freescale.com>
---
This supersedes the "Call of_register_i2c_devices() for	fsl-i2c" patch.

 arch/powerpc/sysdev/fsl_soc.c |    9 ++++++++-
 1 files changed, 8 insertions(+), 1 deletions(-)

diff --git a/arch/powerpc/sysdev/fsl_soc.c b/arch/powerpc/sysdev/fsl_soc.c
index cad1757..4ff0daf 100644
--- a/arch/powerpc/sysdev/fsl_soc.c
+++ b/arch/powerpc/sysdev/fsl_soc.c
@@ -26,6 +26,7 @@
 #include <linux/fsl_devices.h>
 #include <linux/fs_enet_pd.h>
 #include <linux/fs_uart_pd.h>
+#include <linux/i2c.h>
 
 #include <asm/system.h>
 #include <asm/atomic.h>
@@ -319,7 +320,13 @@ static int __init fsl_i2c_of_init(void)
 
 		of_irq_to_resource(np, 0, &r[1]);
 
-		i2c_dev = platform_device_register_simple("fsl-i2c", i, r, 2);
+		ret = i2c_alloc_bus_number();
+		if (ret < 0)
+			goto err;
+
+		of_register_i2c_devices(np, ret);
+
+		i2c_dev = platform_device_register_simple("fsl-i2c", ret, r, 2);
 		if (IS_ERR(i2c_dev)) {
 			ret = PTR_ERR(i2c_dev);
 			goto err;
-- 
1.5.0.3

^ permalink raw reply related	[flat|nested] only message in thread

only message in thread, other threads:[~2007-05-17 15:26 UTC | newest]

Thread overview: (only message) (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2007-05-17 15:19 [PATCH] powerpc: fsl_soc: Pre-allocate i2c bus number and pre-register devices Scott Wood

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox