LinuxPPC-Dev Archive on lore.kernel.org
 help / color / mirror / Atom feed
From: Scott Wood <scottwood@freescale.com>
To: linuxppc-dev@ozlabs.org
Cc: i2c@lm-sensors.org
Subject: [PATCH] powerpc: fsl_soc: Pre-allocate i2c bus number and pre-register devices.
Date: Thu, 17 May 2007 10:19:04 -0500	[thread overview]
Message-ID: <20070517151904.GA31862@ld0162-tx32.am.freescale.net> (raw)

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

                 reply	other threads:[~2007-05-17 15:26 UTC|newest]

Thread overview: [no followups] expand[flat|nested]  mbox.gz  Atom feed

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20070517151904.GA31862@ld0162-tx32.am.freescale.net \
    --to=scottwood@freescale.com \
    --cc=i2c@lm-sensors.org \
    --cc=linuxppc-dev@ozlabs.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox