linuxppc-dev.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
From: Grant Likely <grant.likely@secretlab.ca>
To: Jean Delvare <khali@linux-fr.org>
Cc: Wolfram Sang <w.sang@pengutronix.de>,
	David Brownell <david-b@pacbell.net>,
	linuxppc-dev list <Linuxppc-dev@ozlabs.org>,
	Timur Tabi <timur@freescale.com>, Linux I2C <i2c@lm-sensors.org>
Subject: Re: [i2c] [PATCH] Convert i2c-mpc from a platform driver to an of_platform one
Date: Sun, 29 Jun 2008 00:58:12 -0600	[thread overview]
Message-ID: <20080629065812.GO13876@secretlab.ca> (raw)
In-Reply-To: <20080629083143.7f39b3c1@hyperion.delvare>

On Sun, Jun 29, 2008 at 08:31:43AM +0200, Jean Delvare wrote:
> Hi Jon, Grant,
> 
> On Sat, 28 Jun 2008 22:49:40 -0600, Grant Likely wrote:
> > On Sat, Jun 28, 2008 at 10:05:28PM -0400, Jon Smirl wrote:
> > > >
> > > > The driver was previously using i2c_add_numbered_adapter(), giving MPC
> > > >  platform the possibility to use new-style i2c drivers:
> > > >  http://git.kernel.org/?p=linux/kernel/git/torvalds/linux-2.6.git;a=commit;h=1469fa263870acd890a4b9f6ef557acc5d673b44
> > > >  You're breaking this, I doubt it's on purpose?
> > > 
> > > Grant, what do you want here? You're the one who converted it to
> > > i2c_add_numbered_adapter. But in other posts you've said that the
> > > device tree should have nothing to do with bus numbering.
> > 
> > Yes, I did make that change, but that was when it was a platform bus
> > driver.  Converting it to an of_platform bus driver entirely changes the
> > situation and it should go back to using i2c_add_adapter() with a parse
> > of the device tree for child nodes.
> 
> I am surprised and disappointed, as this sounds like a regression.
> Registering the i2c buses with random numbers and parsing the device
> tree later to figure out which devices are where, is what everybody was
> doing before the new i2c device/driver matching model was implemented,
> because there was no other way. I'm curious why you are going back to
> this approach when i2c-core now offers something way cleaner and more
> efficient.

Ah, but the whole random number parsing thing is no longer necessary
because we ensure that registration of i2c devices always occurs
after the i2c adapter is created (for device tree aware i2c adapter
drivers.  adapters that aren't device tree aware still need to assign a
number).

After the i2c adapter registers itself, of_register_i2c_devices() is called
which walks through the child nodes of the i2c adapter node in the device
tree.  Each child node is an i2c device, and it immediately get
registered with the adapter.  Because this ensures that i2c device
registration always happens after adapter registration, and since the
pointer to the i2c_adapter is known, then i2c_new_device() can be used
directly without ever needing to know the bus number.

g.

  reply	other threads:[~2008-06-29  6:58 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2008-06-11  2:40 [PATCH] Convert i2c-mpc from a platform driver to an of_platform one Jon Smirl
2008-06-11 16:00 ` [i2c] " Wolfram Sang
2008-06-11 16:14   ` Jon Smirl
2008-06-25 13:25     ` Jean Delvare
2008-06-25 13:58 ` Jean Delvare
2008-06-29  2:05   ` Jon Smirl
2008-06-29  4:49     ` Grant Likely
2008-06-29  6:31       ` Jean Delvare
2008-06-29  6:58         ` Grant Likely [this message]
2008-06-29  7:17           ` Jean Delvare
2008-06-29 16:24             ` Sean MacLennan
2008-06-29 16:35               ` Jean Delvare
2008-06-30  2:51             ` David Brownell
2008-06-29  4:57 ` Grant Likely

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=20080629065812.GO13876@secretlab.ca \
    --to=grant.likely@secretlab.ca \
    --cc=Linuxppc-dev@ozlabs.org \
    --cc=david-b@pacbell.net \
    --cc=i2c@lm-sensors.org \
    --cc=khali@linux-fr.org \
    --cc=timur@freescale.com \
    --cc=w.sang@pengutronix.de \
    /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;
as well as URLs for NNTP newsgroup(s).