[i2c] [PATCH] PXA I2C: Update PXA platforms to support new-style I2C drivers.

Jean Delvare khali at linux-fr.org
Sat Jun 23 12:52:18 CEST 2007


Hi Atsushi,

On Fri, 22 Jun 2007 13:08:33 +0900 (JST), Atsushi Nemoto wrote:
> On Thu, 21 Jun 2007 20:46:26 +0200, Jean Delvare <khali at linux-fr.org> wrote:
> > OK. Atsushi, can you please update your i2c-gpio patch to do the same
> > as this i2c-pxa patch?
> > 
> > http://lists.lm-sensors.org/pipermail/i2c/2007-June/001499.html
> > 
> > Thanks,
> 
> OK, here it is.
> 
> 
> Subject: [PATCH] i2c-gpio: Add support for new-style clients (take 3)
> 
> Use i2c_bit_add_numbered_bus() so that the i2c-gpio adapter works well
> with new-style pre-declared devices.
> 
> Signed-off-by: Atsushi Nemoto <anemo at mba.ocn.ne.jp>
> ---
> diff --git a/drivers/i2c/busses/i2c-gpio.c b/drivers/i2c/busses/i2c-gpio.c
> index a7dd546..d6dbd6a 100644
> --- a/drivers/i2c/busses/i2c-gpio.c
> +++ b/drivers/i2c/busses/i2c-gpio.c
> @@ -142,7 +142,13 @@ 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 "dev->id" is negative we consider it as zero.
> +	 * The reason to do so is to avoid sysfs names that only make
> +	 * sense when there are multiple adapters.
> +	 */
> +	adap->nr = pdev->id >= 0 ? pdev->id : 0;
> +	ret = i2c_bit_add_numbered_bus(adap);
>  	if (ret)
>  		goto err_add_bus;
>  

Perfect, thanks.

-- 
Jean Delvare



More information about the i2c mailing list