On 08:29 Fri 02 Nov     , Sascha Hauer wrote:
> On Thu, Nov 01, 2012 at 10:44:49AM +0100, Jean-Christophe PLAGNIOL-VILLARD 
> wrote:
> > so we can show the this of i2c busses
> > set the bus device as parent of all devices.
> > 
> > Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <[email protected]>
> > ---
> >  drivers/i2c/busses/i2c-imx.c  |   20 ++++++++++----------
> >  drivers/i2c/busses/i2c-omap.c |   30 +++++++++++++++---------------
> >  drivers/i2c/i2c.c             |   18 +++++++++++++++---
> >  include/i2c/i2c.h             |    2 +-
> >  4 files changed, 41 insertions(+), 29 deletions(-)
> > 
> >  int i2c_add_numbered_adapter(struct i2c_adapter *adapter)
> >  {
> > -   if (i2c_get_adapter(adapter->nr))
> > -           return -EBUSY;
> 
> If you remove this and instead depend on register_device bailing out
> later then you should change the error value register_device returns
> to -EBUSY. Currently it returns -EINVAL, -EBUSY seems much better here.
> 
> 
> > +   int ret;
> > +
> > +   adapter->dev.id = adapter->nr;
> > +   strcpy(adapter->dev.name, "i2c");
> > +
> > +   if (adapter->dev.parent)
> > +           dev_add_child(adapter->dev.parent, &adapter->dev);
> 
> We should push the dev_add_child to the driver core. Doing this here
> means that...
> 
> > +
> > +   ret = register_device(&adapter->dev);
> > +   if (ret)
> > +           return ret;
> 
> ... the parents child list will be corrupted when register_device fails.
> At least w1 and mdiobus have the same problem. But ok, we can fix that
> later.

ok I'll take a look after the whole sam9x5 stuff will merged

Best Regards,
J.

_______________________________________________
barebox mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/barebox

Reply via email to