Thread (11 messages) flat view 11 messages, 3 authors, 2011-12-01

Re: [PATCH] i2c-mpc: use the cell-index property to enumerate the I2C adapters

From: Grant Likely <hidden>
Date: 2011-12-01 21:55:49

On Thu, Dec 1, 2011 at 2:52 PM, Scott Wood [off-list ref] wrote:
On 12/01/2011 03:46 PM, Timur Tabi wrote:
quoted
Scott Wood wrote:
quoted
How is this going to interact with other i2c buses (e.g. on a board
FPGA) that might have a conflicting static numbering scheme? =A0Have yo=
u
quoted
quoted
ensured that no dynamic bus registrations (e.g. an i2c bus on a PCI
device) can happen before the static SoC i2c buses are added?
Hmm.... You have a point there.
quoted
quoted
An alternative approach is to create a function like this:

=A0 =A0 struct i2c_adapter *i2c_adapter_from_node(struct device_node *=
np);
quoted
quoted
quoted
I could then just use adap->nr directly.
If there isn't a way to get a "struct device" from "struct device_node"=
,
quoted
quoted
we should add it.
How do I do that? =A0Scan all the struct devices until I find one where =
dev->of_node =3D=3D np? =A0That seems really inefficient.
Ideally we would have a field in struct device_node that points to
struct device.
No.  There are cases where multiple devices may reference the same node.

It is better to walk the list of i2c adapters and look for one that
has the matching node pointer.  It really isn't an expensive operation
to do it that way.

g.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help