[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <20070615175942.3d2d65b7@hyperion.delvare>
Date: Fri, 15 Jun 2007 17:59:42 +0200
From: Jean Delvare <khali@...ux-fr.org>
To: Atsushi Nemoto <anemo@....ocn.ne.jp>
Cc: hskinnemoen@...el.com, linux-kernel@...r.kernel.org,
i2c@...sensors.org
Subject: Re: [PATCH] i2c-gpio: Add support for new-style clients
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@...ux-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@....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
-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists