[i2c] [patch 2.6.19-rc6 4/11] more i2c drivers don't use i2c_adapter.dev

Jean Delvare khali at linux-fr.org
Fri Dec 15 18:21:39 CET 2006


David,

On Sat, 25 Nov 2006 14:59:00 -0800, David Brownell wrote:
> Update various I2C drivers and algorithms so they stop referencing
> the now-gone i2c_adapter.dev; they were using it for messages.
> 
> Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
> 
> ---
>  drivers/i2c/algos/i2c-algo-bit.c |   10 ++++++----
>  drivers/i2c/algos/i2c-algo-pca.c |    3 ++-
>  drivers/i2c/algos/i2c-algo-pcf.c |   17 +++++++++++------
>  drivers/i2c/chips/isp1301_omap.c |    8 +++++---
>  drivers/i2c/chips/tps65010.c     |    6 ++++--
>  5 files changed, 28 insertions(+), 16 deletions(-)
> 
> Index: at91/drivers/i2c/chips/tps65010.c
> ===================================================================
> --- at91.orig/drivers/i2c/chips/tps65010.c	2006-11-25 08:04:57.000000000 -0800
> +++ at91/drivers/i2c/chips/tps65010.c	2006-11-25 08:05:55.000000000 -0800
> @@ -496,7 +496,8 @@ tps65010_probe(struct i2c_adapter *bus, 
>  	unsigned long		irqflags;
>  
>  	if (the_tps) {
> -		dev_dbg(&bus->dev, "only one %s for now\n", DRIVER_NAME);
> +		dev_dbg(bus->class_dev.dev, "only one %s for now\n",
> +				DRIVER_NAME);
>  		return 0;
>  	}
>  
> @@ -514,7 +515,8 @@ tps65010_probe(struct i2c_adapter *bus, 
>  
>  	status = i2c_attach_client(&tps->client);
>  	if (status < 0) {
> -		dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",
> +		dev_dbg(bus->class_dev.dev,
> +				"can't attach %s to device %d, err %d\n",
>  				DRIVER_NAME, address, status);
>  		goto fail1;
>  	}
> Index: at91/drivers/i2c/chips/isp1301_omap.c
> ===================================================================
> --- at91.orig/drivers/i2c/chips/isp1301_omap.c	2006-11-25 08:04:57.000000000 -0800
> +++ at91/drivers/i2c/chips/isp1301_omap.c	2006-11-25 08:05:55.000000000 -0800
> @@ -1511,13 +1511,14 @@ static int isp1301_probe(struct i2c_adap
>  	if (kind < 0) {
>  		status = isp1301_get_u16(isp, ISP1301_VENDOR_ID);
>  		if (status != I2C_VENDOR_ID_PHILIPS) {
> -			dev_dbg(&bus->dev, "addr %d not philips id: %d\n",
> +			dev_dbg(bus->class_dev.dev,
> +				"addr %d not philips id: %d\n",
>  				address, status);
>  			goto fail1;
>  		}
>  		status = isp1301_get_u16(isp, ISP1301_PRODUCT_ID);
>  		if (status != I2C_PRODUCT_ID_PHILIPS_1301) {
> -			dev_dbg(&bus->dev, "%d not isp1301, %d\n",
> +			dev_dbg(bus->class_dev, "%d not isp1301, %d\n",
>  				address, status);
>  			goto fail1;
>  		}
> @@ -1525,7 +1526,8 @@ static int isp1301_probe(struct i2c_adap
>  
>  	status = i2c_attach_client(i2c);
>  	if (status < 0) {
> -		dev_dbg(&bus->dev, "can't attach %s to device %d, err %d\n",
> +		dev_dbg(bus->class_dev,
> +				"can't attach %s to device %d, err %d\n",
>  				DRIVER_NAME, address, status);
>  fail1:
>  		kfree(isp);
> Index: at91/drivers/i2c/algos/i2c-algo-bit.c
> ===================================================================
> --- at91.orig/drivers/i2c/algos/i2c-algo-bit.c	2006-11-25 08:04:57.000000000 -0800
> +++ at91/drivers/i2c/algos/i2c-algo-bit.c	2006-11-25 08:05:55.000000000 -0800
> @@ -341,14 +341,16 @@ static int sendbytes(struct i2c_adapter 
>  
>  	while (count > 0) {
>  		c = *temp;
> -		DEB2(dev_dbg(&i2c_adap->dev, "sendbytes: writing %2.2X\n", c&0xff));
> +		DEB2(dev_dbg(i2c_adap->class_dev.dev,
> +			"sendbytes: writing %2.2X\n", c&0xff));
>  		retval = i2c_outb(i2c_adap,c);
>  		if ((retval>0) || (nak_ok && (retval==0)))  { /* ok or ignored NAK */
> -			count--; 
> +			count--;

Please back out this whitespace change.

>  			temp++;
>  			wrcount++;
>  		} else { /* arbitration or no acknowledge */
> -			dev_err(&i2c_adap->dev, "sendbytes: error - bailout.\n");
> +			dev_err(i2c_adap->class_dev.dev,
> +				"sendbytes: error - bailout.\n");
>  			i2c_stop(adap);
>  			return (retval<0)? retval : -EFAULT;
>  			        /* got a better one ?? */
> @@ -530,7 +532,7 @@ int i2c_bit_add_bus(struct i2c_adapter *
>  			return -ENODEV;
>  	}
>  
> -	DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));
> +	DEB2(dev_dbg(adap->class_dev.dev, "hw routines registered.\n"));
>  
>  	/* register new adapter to i2c module... */
>  	adap->algo = &i2c_bit_algo;
> Index: at91/drivers/i2c/algos/i2c-algo-pcf.c
> ===================================================================
> --- at91.orig/drivers/i2c/algos/i2c-algo-pcf.c	2006-11-25 08:04:57.000000000 -0800
> +++ at91/drivers/i2c/algos/i2c-algo-pcf.c	2006-11-25 08:05:55.000000000 -0800
> @@ -239,7 +239,8 @@ static int pcf_sendbytes(struct i2c_adap
>  	int wrcount, status, timeout;
>      
>  	for (wrcount=0; wrcount<count; ++wrcount) {
> -		DEB2(dev_dbg(&i2c_adap->dev, "i2c_write: writing %2.2X\n",
> +		DEB2(dev_dbg(i2c_adap->class_dev.dev,
> +				"i2c_write: writing %2.2X\n",
>  				buf[wrcount]&0xff));
>  		i2c_outb(adap, buf[wrcount]);
>  		timeout = wait_for_pin(adap, &status);
> @@ -249,13 +250,15 @@ static int pcf_sendbytes(struct i2c_adap
>  				return -EINTR;
>  			}
>  			i2c_stop(adap);
> -			dev_err(&i2c_adap->dev, "i2c_write: error - timeout.\n");
> +			dev_err(i2c_adap->class_dev.dev,
> +				"i2c_write: error - timeout.\n");
>  			return -EREMOTEIO; /* got a better one ?? */
>  		}
>  #ifndef STUB_I2C
>  		if (status & I2C_PCF_LRB) {
>  			i2c_stop(adap);
> -			dev_err(&i2c_adap->dev, "i2c_write: error - no ack.\n");
> +			dev_err(i2c_adap->class_dev.dev,
> +				"i2c_write: error - no ack.\n");
>  			return -EREMOTEIO; /* got a better one ?? */
>  		}
>  #endif
> @@ -287,14 +290,16 @@ static int pcf_readbytes(struct i2c_adap
>  				return -EINTR;
>  			}
>  			i2c_stop(adap);
> -			dev_err(&i2c_adap->dev, "pcf_readbytes timed out.\n");
> +			dev_err(i2c_adap->class_dev.dev,
> +				"pcf_readbytes timed out.\n");
>  			return (-1);
>  		}
>  
>  #ifndef STUB_I2C
>  		if ((status & I2C_PCF_LRB) && (i != count)) {
>  			i2c_stop(adap);
> -			dev_err(&i2c_adap->dev, "i2c_read: i2c_inb, No ack.\n");
> +			dev_err(i2c_adap->class_dev.dev,
> +				"i2c_read: i2c_inb, No ack.\n");
>  			return (-1);
>  		}
>  #endif
> @@ -471,7 +476,7 @@ int i2c_pcf_add_bus(struct i2c_adapter *
>  	struct i2c_algo_pcf_data *pcf_adap = adap->algo_data;
>  	int rval;
>  
> -	DEB2(dev_dbg(&adap->dev, "hw routines registered.\n"));
> +	DEB2(dev_dbg(adap->class_dev.dev, "hw routines registered.\n"));
>  
>  	/* register new adapter to i2c module... */
>  	adap->algo = &pcf_algo;
> Index: at91/drivers/i2c/algos/i2c-algo-pca.c
> ===================================================================
> --- at91.orig/drivers/i2c/algos/i2c-algo-pca.c	2006-11-25 08:04:57.000000000 -0800
> +++ at91/drivers/i2c/algos/i2c-algo-pca.c	2006-11-25 08:05:55.000000000 -0800
> @@ -193,7 +193,8 @@ static int pca_xfer(struct i2c_adapter *
>  		msleep(10);
>  	}
>  	if (state != 0xf8) {
> -		dev_dbg(&i2c_adap->dev, "bus is not idle. status is %#04x\n", state);
> +		dev_dbg(i2c_adap->class_dev.dev,
> +			"bus is not idle. status is %#04x\n", state);
>  		return -EIO;
>  	}

Otherwise that patch looks OK to me.

Thanks,
-- 
Jean Delvare



More information about the i2c mailing list