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

David Brownell david-b at pacbell.net
Tue Jun 19 18:24:18 CEST 2007


On Tuesday 19 June 2007, Rodolfo Giometti wrote:
> Signed-off-by: Rodolfo Giometti <giometti at linux.it>
> ---
>  drivers/i2c/busses/i2c-pxa.c |    7 ++++++-
>  1 files changed, 6 insertions(+), 1 deletions(-)
> 
> diff --git a/drivers/i2c/busses/i2c-pxa.c b/drivers/i2c/busses/i2c-pxa.c
> index 8a0a99b..f29c3e6 100644
> --- a/drivers/i2c/busses/i2c-pxa.c
> +++ b/drivers/i2c/busses/i2c-pxa.c
> @@ -926,7 +926,12 @@ static int i2c_pxa_probe(struct platform_device *dev)
>  		i2c->adap.class = plat->class;
>  	}
>  
> -	ret = i2c_add_adapter(&i2c->adap);
> +	if (dev->id >= 0) {

I suggest you just always use the add_numbered() call.

Not only does nothing actually use negative IDs in the
current kernel ... but if they did, the right way to
handle it would be as bus number zero.  The reason to
do so is to avoid sysfs names that only make sense when
there are multiple adapters.


> +		i2c->adap.nr = dev->id;
> +		ret = i2c_add_numbered_adapter(&i2c->adap);
> +	}
> +	else
> +		ret = i2c_add_adapter(&i2c->adap);
>  	if (ret < 0) {
>  		printk(KERN_INFO "I2C: Failed to add bus\n");
>  		goto eadapt;
> -- 
> 1.5.1.1
> 
> 
> -------------------------------------------------------------------
> List admin: http://lists.arm.linux.org.uk/mailman/listinfo/linux-arm-kernel
> FAQ:        http://www.arm.linux.org.uk/mailinglists/faq.php
> Etiquette:  http://www.arm.linux.org.uk/mailinglists/etiquette.php
> 





More information about the i2c mailing list