[PATCH 3/5] I2C: Put I2C devices on their own bus
Jean-Christophe PLAGNIOL-VILLARD
plagnioj at jcrosoft.com
Tue Sep 11 11:56:19 EDT 2012
On 16:27 Tue 11 Sep , Sascha Hauer wrote:
> On Tue, Sep 11, 2012 at 04:04:55PM +0200, Jean-Christophe PLAGNIOL-VILLARD wrote:
> > On 15:31 Tue 11 Sep , Sascha Hauer wrote:
> > > This patch adds a I2C bus on which the I2C devices and drivers register.
> > > This makes it cleaner as I2C devices won't accidently end up probed by
> > > a platform_device driver.
> > >
> > > Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>
> > > ---
> > > drivers/i2c/i2c.c | 23 +++++++++++++++++++++++
> > > drivers/mfd/lp3972.c | 2 +-
> > > drivers/mfd/mc13xxx.c | 2 +-
> > > drivers/mfd/mc34704.c | 4 ++--
> > > drivers/mfd/mc34708.c | 2 +-
> > > drivers/mfd/mc9sdz60.c | 2 +-
> > > drivers/mfd/stmpe-i2c.c | 2 +-
> > > drivers/mfd/twl4030.c | 2 +-
> > > drivers/mfd/twl6030.c | 2 +-
> > > include/i2c/i2c.h | 8 ++++++++
> > > 10 files changed, 40 insertions(+), 9 deletions(-)
> > >
> > > diff --git a/drivers/i2c/i2c.c b/drivers/i2c/i2c.c
> > > index 3af2b3e..555722b 100644
> > > --- a/drivers/i2c/i2c.c
> > > +++ b/drivers/i2c/i2c.c
> > > @@ -251,6 +251,7 @@ struct i2c_client *i2c_new_device(struct i2c_adapter *adapter,
> > > strcpy(client->dev.name, chip->type);
> > > client->dev.type_data = client;
> > > client->dev.platform_data = chip->platform_data;
> > > + client->dev.bus = &i2c_bus;
> > > client->adapter = adapter;
> > > client->addr = chip->addr;
> > >
> > > @@ -372,3 +373,25 @@ int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
> > > return 0;
> > > }
> > > EXPORT_SYMBOL(i2c_add_numbered_adapter);
> > > +
> > > +static int i2c_match(struct device_d *dev, struct driver_d *drv)
> > > +{
> > > + return strcmp(dev->name, drv->name) ? -1 : 0;
> > can we check the address too here
>
> What do you mean?
i2c client address is valid
Best Regards,
J.
More information about the barebox
mailing list