mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
To: Sascha Hauer <s.hauer@pengutronix.de>
Cc: barebox@lists.infradead.org
Subject: Re: [PATCH 1/4] i2c: adapter: register it's own device
Date: Fri, 2 Nov 2012 10:24:19 +0100	[thread overview]
Message-ID: <20121102092419.GN29599@game.jcrosoft.org> (raw)
In-Reply-To: <20121102072940.GB1641@pengutronix.de>

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 <plagnioj@jcrosoft.com>
> > ---
> >  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
barebox@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/barebox

  reply	other threads:[~2012-11-02  9:26 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2012-11-01  9:42 [PATCH 0/4] i2c: add algo-bit support with gpio and versatile support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01  9:44 ` [PATCH 1/4] i2c: adapter: register it's own device Jean-Christophe PLAGNIOL-VILLARD
2012-11-01  9:44   ` [PATCH 2/4] i2c: add i2c algo bit support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01  9:44   ` [PATCH 3/4] i2c: add i2c-gpio support Jean-Christophe PLAGNIOL-VILLARD
2012-11-01  9:44   ` [PATCH 4/4] i2c: add versatile support Jean-Christophe PLAGNIOL-VILLARD
2012-11-02  7:29   ` [PATCH 1/4] i2c: adapter: register it's own device Sascha Hauer
2012-11-02  9:24     ` Jean-Christophe PLAGNIOL-VILLARD [this message]
2012-11-02  9:27 [PATCH 0/4 v2] i2c: add algo-bit support with gpio and versatile support Jean-Christophe PLAGNIOL-VILLARD
2012-11-02  9:36 ` [PATCH 1/4] i2c: adapter: register it's own device Jean-Christophe PLAGNIOL-VILLARD

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=20121102092419.GN29599@game.jcrosoft.org \
    --to=plagnioj@jcrosoft.com \
    --cc=barebox@lists.infradead.org \
    --cc=s.hauer@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