From: Jean Delvare <khali@linux-fr.org>
To: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
Cc: hskinnemoen@atmel.com, linux-kernel@vger.kernel.org, i2c@lm-sensors.org
Subject: Re: [PATCH] i2c-gpio: Add support for new-style clients
Date: Fri, 15 Jun 2007 17:59:42 +0200 [thread overview]
Message-ID: <20070615175942.3d2d65b7@hyperion.delvare> (raw)
In-Reply-To: <20070614.154046.96688009.nemoto@toshiba-tops.co.jp>
On Thu, 14 Jun 2007 15:40:46 +0900 (JST), Atsushi Nemoto wrote:
> On Thu, 14 Jun 2007 08:24:17 +0200, Jean Delvare <khali@linux-fr.org> wrote:
> > > + if (pdev->id == -1)
> > > + ret = i2c_bit_add_bus(adap);
> > > + else
> > > + ret = i2c_bit_add_numbered_bus(adap);
> > > if (ret)
> > > goto err_add_bus;
> > >
> >
> > This isn't sufficient. Before you call i2c_bit_add_numbered_bus(adap),
> > you are supposed to set adap->nr to the desired i2c adapter number.
>
> Oh, indeed. That worked for me just I only used bus number 0.
> Here is a revised patch.
>
>
> Subject: [PATCH] i2c-gpio: Add support for new-style clients (take 2)
>
> Use i2c_bit_add_numbered_bus() if platform_device id specified, so
> that the i2c-gpio adapter works well with new-style pre-declared
> devices.
>
> Signed-off-by: Atsushi Nemoto <anemo@mba.ocn.ne.jp>
> ---
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index a7dd546..88c5735 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -142,7 +142,12 @@ static int __init i2c_gpio_probe(struct platform_device *pdev)
> adap->algo_data = bit_data;
> adap->dev.parent = &pdev->dev;
>
> - ret = i2c_bit_add_bus(adap);
> + if (pdev->id == -1)
> + ret = i2c_bit_add_bus(adap);
> + else {
> + adap->nr = pdev->id;
> + ret = i2c_bit_add_numbered_bus(adap);
> + }
> if (ret)
> goto err_add_bus;
>
That's better. Patch applied, thanks.
--
Jean Delvare
prev parent reply other threads:[~2007-06-15 15:59 UTC|newest]
Thread overview: 5+ messages / expand[flat|nested] mbox.gz Atom feed top
2007-06-12 15:43 Atsushi Nemoto
2007-06-13 11:15 ` Haavard Skinnemoen
2007-06-14 6:24 ` Jean Delvare
2007-06-14 6:40 ` Atsushi Nemoto
2007-06-15 15:59 ` Jean Delvare [this message]
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=20070615175942.3d2d65b7@hyperion.delvare \
--to=khali@linux-fr.org \
--cc=anemo@mba.ocn.ne.jp \
--cc=hskinnemoen@atmel.com \
--cc=i2c@lm-sensors.org \
--cc=linux-kernel@vger.kernel.org \
/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
all inboxes | Powered by JetHome®