[i2c] [patch 2.6.20-rc1 3/6] other i2c code stops using i2c_adapter.dev

Jean Delvare khali at linux-fr.org
Mon Dec 18 20:02:37 CET 2006


Hi David,

On Sun, 17 Dec 2006 10:48:49 -0800, David Brownell wrote:
> Update various I2C drivers and algorithms so they stop referencing
> the soon-to-be-gone i2c_adapter.dev; they were using it for messages.
> Also does the same for the i2c core.
> 
> Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
> ---
>  i2c/algos/i2c-algo-bit.c |    8 +++--
>  i2c/algos/i2c-algo-pca.c |    3 +-
>  i2c/algos/i2c-algo-pcf.c |   17 +++++++-----
>  i2c/chips/isp1301_omap.c |    8 +++--
>  i2c/chips/tps65010.c     |    6 ++--
>  i2c/i2c-core.c           |   66 +++++++++++++++++++++++++++--------------------
>  i2c/i2c-dev.c            |   11 ++++---
>  7 files changed, 71 insertions(+), 48 deletions(-)
> 
> Index: g26/drivers/i2c/i2c-core.c
> ===================================================================
> --- g26.orig/drivers/i2c/i2c-core.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/i2c-core.c	2006-12-16 15:52:15.000000000 -0800
> @@ -145,8 +145,10 @@ static struct device_attribute dev_attr_
>   * when a new hw adapter registers. A new device is register to be
>   * available for clients.
>   */
> +

Meep meep!

>  int i2c_add_adapter(struct i2c_adapter *adap)
>  {
> +	struct device *dev = adap->class_dev.dev;
>  	int id, res = 0;
>  	struct list_head   *item;
>  	struct i2c_driver  *driver;
> @@ -196,7 +198,7 @@ int i2c_add_adapter(struct i2c_adapter *
>  	if (res)
>  		goto out_remove_name;
>  
> -	dev_dbg(&adap->dev, "adapter [%s] registered\n", adap->name);
> +	dev_dbg(dev, "adapter [%s] registered\n", adap->name);
>  
>  	/* inform drivers of new adapters */
>  	list_for_each(item,&drivers) {
> @@ -225,6 +227,7 @@ out_list:
>  
>  int i2c_del_adapter(struct i2c_adapter *adap)
>  {
> +	struct device *dev = adap->class_dev.dev;
>  	struct list_head  *item, *_n;
>  	struct i2c_adapter *adap_from_list;
>  	struct i2c_driver *driver;
> @@ -249,7 +252,7 @@ int i2c_del_adapter(struct i2c_adapter *
>  		driver = list_entry(item, struct i2c_driver, list);
>  		if (driver->detach_adapter)
>  			if ((res = driver->detach_adapter(adap))) {
> -				dev_err(&adap->dev, "detach_adapter failed "
> +				dev_err(dev, "detach_adapter failed "
>  					"for driver [%s]\n",
>  					driver->driver.name);
>  				goto out_unlock;
> @@ -262,7 +265,7 @@ int i2c_del_adapter(struct i2c_adapter *
>  		client = list_entry(item, struct i2c_client, list);
>  
>  		if ((res=client->driver->detach_client(client))) {
> -			dev_err(&adap->dev, "detach_client failed for client "
> +			dev_err(dev, "detach_client failed for client "
>  				"[%s] at address 0x%02x\n", client->name,
>  				client->addr);
>  			goto out_unlock;
> @@ -284,7 +287,8 @@ int i2c_del_adapter(struct i2c_adapter *
>  	/* free dynamically allocated bus id */
>  	idr_remove(&i2c_adapter_idr, adap->nr);
>  
> -	dev_dbg(&adap->dev, "adapter [%s] unregistered\n", adap->name);
> +	dev_dbg(dev, "adapter %s [%s] unregistered\n",
> +			adap->class_dev.class_id, adap->name);

You modify the format slightly here, and I am fine with that change,
but you should do the same at registration time for consistency.

>  
>   out_unlock:
>  	mutex_unlock(&core_lists);
> @@ -345,10 +349,13 @@ int i2c_del_driver(struct i2c_driver *dr
>  	 * afterwards.
>  	 */
>  	list_for_each(item1,&adapters) {
> +		struct device *dev;
> +
>  		adap = list_entry(item1, struct i2c_adapter, list);
> +		dev = adap->class_dev.dev;
>  		if (driver->detach_adapter) {
>  			if ((res = driver->detach_adapter(adap))) {
> -				dev_err(&adap->dev, "detach_adapter failed "
> +				dev_err(dev, "detach_adapter failed "
>  					"for driver [%s]\n",
>  					driver->driver.name);
>  				goto out_unlock;
> @@ -358,11 +365,11 @@ int i2c_del_driver(struct i2c_driver *dr
>  				client = list_entry(item2, struct i2c_client, list);
>  				if (client->driver != driver)
>  					continue;
> -				dev_dbg(&adap->dev, "detaching client [%s] "
> +				dev_dbg(dev, "detaching client [%s] "
>  					"at 0x%02x\n", client->name,
>  					client->addr);
>  				if ((res = driver->detach_client(client))) {
> -					dev_err(&adap->dev, "detach_client "
> +					dev_err(dev, "detach_client "
>  						"failed for client [%s] at "
>  						"0x%02x\n", client->name,
>  						client->addr);
> @@ -426,9 +433,9 @@ int i2c_attach_client(struct i2c_client 
>  
>  	snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
>  		"%d-%04x", i2c_adapter_id(adapter), client->addr);
> -	dev_dbg(&adapter->dev, "client [%s] registered with bus id %s\n",
> -		client->name, client->dev.bus_id);
>  	res = device_register(&client->dev);
> +	dev_dbg(&client->dev, "attach client [%s] --> %d\n",
> +		client->name, res);

This change doesn't belong here. I agree that the debugging messages in
i2c-core are far from optimal, but we'd rather improve them after
fixing the i2c core rather before.

>  	if (res)
>  		goto out_list;
>  	res = device_create_file(&client->dev, &dev_attr_client_name);
> @@ -438,7 +445,7 @@ int i2c_attach_client(struct i2c_client 
>  
>  	if (adapter->client_register)  {
>  		if (adapter->client_register(client)) {
> -			dev_dbg(&adapter->dev, "client_register "
> +			dev_dbg(&client->dev, "client_register "
>  				"failed for client [%s] at 0x%02x\n",
>  				client->name, client->addr);
>  		}
> @@ -452,7 +459,7 @@ out_unregister:
>  	wait_for_completion(&client->released);
>  out_list:
>  	list_del(&client->list);
> -	dev_err(&adapter->dev, "Failed to attach i2c client %s at 0x%02x "
> +	dev_err(&client->dev, "Failed to attach i2c client %s at 0x%02x "
>  		"(%d)\n", client->name, client->addr, res);
>  out_unlock:
>  	mutex_unlock(&adapter->clist_lock);

What's the rationale for changing the adapter-based messages above to
client-based ones? I don't see this change belonging to this patch
either. If you want to do that properly, you'd need to also drop the
client address from the message as it is redundant then.

> @@ -589,12 +596,13 @@ module_exit(i2c_exit);
>  
>  int i2c_transfer(struct i2c_adapter * adap, struct i2c_msg *msgs, int num)
>  {
> +	struct device *dev = adap->class_dev.dev;
>  	int ret;
>  
>  	if (adap->algo->master_xfer) {
>  #ifdef DEBUG
>  		for (ret = 0; ret < num; ret++) {
> -			dev_dbg(&adap->dev, "master_xfer[%d] %c, addr=0x%02x, "
> +			dev_dbg(dev, "master_xfer[%d] %c, addr=0x%02x, "
>  				"len=%d\n", ret, msgs[ret].flags & I2C_M_RD ?
>  				'R' : 'W', msgs[ret].addr, msgs[ret].len);
>  		}
> @@ -606,7 +614,7 @@ int i2c_transfer(struct i2c_adapter * ad
>  
>  		return ret;
>  	} else {
> -		dev_dbg(&adap->dev, "I2C level transfers not supported\n");
> +		dev_dbg(dev, "I2C transfers not supported\n");
>  		return -ENOSYS;
>  	}
>  }
> @@ -655,7 +663,7 @@ int i2c_control(struct i2c_client *clien
>  	int ret = 0;
>  	struct i2c_adapter *adap = client->adapter;
>  
> -	dev_dbg(&client->adapter->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg);
> +	dev_dbg(&client->dev, "i2c ioctl, cmd: 0x%x, arg: %#lx\n", cmd, arg);

Here again, I wouldn't change that. i2c_control is adapter-based
despite its misleading prototype.

>  	switch (cmd) {
>  		case I2C_RETRIES:
>  			adap->retries = arg;
> @@ -678,12 +686,12 @@ int i2c_control(struct i2c_client *clien
>  static int i2c_probe_address(struct i2c_adapter *adapter, int addr, int kind,
>  			     int (*found_proc) (struct i2c_adapter *, int, int))
>  {
> +	struct device *dev = adapter->class_dev.dev;
>  	int err;
>  
>  	/* Make sure the address is valid */
>  	if (addr < 0x03 || addr > 0x77) {
> -		dev_warn(&adapter->dev, "Invalid probe address 0x%02x\n",
> -			 addr);
> +		dev_warn(dev, "Invalid probe address 0x%02x\n", addr);
>  		return -EINVAL;
>  	}
>  
> @@ -712,8 +720,8 @@ static int i2c_probe_address(struct i2c_
>  		err = 0;
>  
>  	if (err)
> -		dev_warn(&adapter->dev, "Client creation failed at 0x%x (%d)\n",
> -			 addr, err);
> +		dev_warn(dev, "found_proc %p failed at 0x%x (%d)\n",
> +			 found_proc, addr, err);
>  	return err;
>  }
>  
> @@ -721,6 +729,7 @@ int i2c_probe(struct i2c_adapter *adapte
>  	      struct i2c_client_address_data *address_data,
>  	      int (*found_proc) (struct i2c_adapter *, int, int))
>  {
> +	struct device *dev = adapter->class_dev.dev;
>  	int i, err;
>  	int adap_id = i2c_adapter_id(adapter);
>  
> @@ -735,7 +744,7 @@ int i2c_probe(struct i2c_adapter *adapte
>  			     i += 2) {
>  				if (forces[kind][i] == adap_id
>  				 || forces[kind][i] == ANY_I2C_BUS) {
> -					dev_dbg(&adapter->dev, "found force "
> +					dev_dbg(dev, "found force "
>  						"parameter for adapter %d, "
>  						"addr 0x%02x, kind %d\n",
>  						adap_id, forces[kind][i + 1],
> @@ -756,7 +765,7 @@ int i2c_probe(struct i2c_adapter *adapte
>  		 && address_data->normal_i2c[0] == I2C_CLIENT_END)
>  			return 0;
>  
> -		dev_warn(&adapter->dev, "SMBus Quick command not supported, "
> +		dev_warn(dev, "SMBus Quick command not supported, "
>  			 "can't probe for chips\n");
>  		return -1;
>  	}
> @@ -766,7 +775,7 @@ int i2c_probe(struct i2c_adapter *adapte
>  	for (i = 0; address_data->probe[i] != I2C_CLIENT_END; i += 2) {
>  		if (address_data->probe[i] == adap_id
>  		 || address_data->probe[i] == ANY_I2C_BUS) {
> -			dev_dbg(&adapter->dev, "found probe parameter for "
> +			dev_dbg(dev, "found probe parameter for "
>  				"adapter %d, addr 0x%02x\n", adap_id,
>  				address_data->probe[i + 1]);
>  			err = i2c_probe_address(adapter,
> @@ -788,7 +797,7 @@ int i2c_probe(struct i2c_adapter *adapte
>  			     address_data->ignore[j] == ANY_I2C_BUS)
>  			 && address_data->ignore[j + 1]
>  			    == address_data->normal_i2c[i]) {
> -				dev_dbg(&adapter->dev, "found ignore "
> +				dev_dbg(dev, "found ignore "
>  					"parameter for adapter %d, "
>  					"addr 0x%02x\n", adap_id,
>  					address_data->ignore[j + 1]);
> @@ -799,7 +808,7 @@ int i2c_probe(struct i2c_adapter *adapte
>  		if (ignore)
>  			continue;
>  
> -		dev_dbg(&adapter->dev, "found normal entry for adapter %d, "
> +		dev_dbg(dev, "found normal entry for adapter %d, "
>  			"addr 0x%02x\n", adap_id,
>  			address_data->normal_i2c[i]);
>  		err = i2c_probe_address(adapter, address_data->normal_i2c[i],
> @@ -1012,6 +1021,7 @@ static s32 i2c_smbus_xfer_emulated(struc
>  	                        };
>  	int i;
>  	u8 partial_pec = 0;
> +	struct device *dev = adapter->class_dev.dev;
>  
>  	msgbuf0[0] = command;
>  	switch(size) {
> @@ -1055,13 +1065,13 @@ static s32 i2c_smbus_xfer_emulated(struc
>  		break;
>  	case I2C_SMBUS_BLOCK_DATA:
>  		if (read_write == I2C_SMBUS_READ) {
> -			dev_err(&adapter->dev, "Block read not supported "
> +			dev_err(dev, "Block read not supported "
>  			       "under I2C emulation!\n");
>  			return -1;
>  		} else {
>  			msg[0].len = data->block[0] + 2;
>  			if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 2) {
> -				dev_err(&adapter->dev, "smbus_access called with "
> +				dev_err(dev, "smbus_access called with "
>  				       "invalid block write size (%d)\n",
>  				       data->block[0]);
>  				return -1;
> @@ -1071,7 +1081,7 @@ static s32 i2c_smbus_xfer_emulated(struc
>  		}
>  		break;
>  	case I2C_SMBUS_BLOCK_PROC_CALL:
> -		dev_dbg(&adapter->dev, "Block process call not supported "
> +		dev_dbg(dev, "Block process call not supported "
>  		       "under I2C emulation!\n");
>  		return -1;
>  	case I2C_SMBUS_I2C_BLOCK_DATA:
> @@ -1080,7 +1090,7 @@ static s32 i2c_smbus_xfer_emulated(struc
>  		} else {
>  			msg[0].len = data->block[0] + 1;
>  			if (msg[0].len > I2C_SMBUS_BLOCK_MAX + 1) {
> -				dev_err(&adapter->dev, "i2c_smbus_xfer_emulated called with "
> +				dev_err(dev, "i2c_smbus_xfer_emulated called with "
>  				       "invalid block write size (%d)\n",
>  				       data->block[0]);
>  				return -1;
> @@ -1090,7 +1100,7 @@ static s32 i2c_smbus_xfer_emulated(struc
>  		}
>  		break;
>  	default:
> -		dev_err(&adapter->dev, "smbus_access called with invalid size (%d)\n",
> +		dev_err(dev, "smbus_access called with invalid size (%d)\n",
>  		       size);
>  		return -1;
>  	}
> Index: g26/drivers/i2c/i2c-dev.c
> ===================================================================
> --- g26.orig/drivers/i2c/i2c-dev.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/i2c-dev.c	2006-12-16 15:52:15.000000000 -0800
> @@ -166,8 +166,9 @@ static int i2cdev_ioctl(struct inode *in
>  	u8 __user **data_ptrs;
>  	int i,datasize,res;
>  	unsigned long funcs;
> +	struct device *dev = client->adapter->class_dev.dev;
>  
> -	dev_dbg(&client->adapter->dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n",
> +	dev_dbg(dev, "ioctl, cmd=0x%02x, arg=0x%02lx\n",
>  		cmd, arg);
>  
>  	switch ( cmd ) {
> @@ -286,7 +287,7 @@ static int i2cdev_ioctl(struct inode *in
>  		    (data_arg.size != I2C_SMBUS_BLOCK_DATA) &&
>  		    (data_arg.size != I2C_SMBUS_I2C_BLOCK_DATA) &&
>  		    (data_arg.size != I2C_SMBUS_BLOCK_PROC_CALL)) {
> -			dev_dbg(&client->adapter->dev,
> +			dev_dbg(dev,
>  				"size out of range (%x) in ioctl I2C_SMBUS.\n",
>  				data_arg.size);
>  			return -EINVAL;
> @@ -295,7 +296,7 @@ static int i2cdev_ioctl(struct inode *in
>  		   so the check is valid if size==I2C_SMBUS_QUICK too. */
>  		if ((data_arg.read_write != I2C_SMBUS_READ) &&
>  		    (data_arg.read_write != I2C_SMBUS_WRITE)) {
> -			dev_dbg(&client->adapter->dev,
> +			dev_dbg(dev,
>  				"read_write out of range (%x) in ioctl I2C_SMBUS.\n",
>  				data_arg.read_write);
>  			return -EINVAL;
> @@ -314,7 +315,7 @@ static int i2cdev_ioctl(struct inode *in
>  					      data_arg.size, NULL);
>  
>  		if (data_arg.data == NULL) {
> -			dev_dbg(&client->adapter->dev,
> +			dev_dbg(dev,
>  				"data is NULL pointer in ioctl I2C_SMBUS.\n");
>  			return -EINVAL;
>  		}
> @@ -414,7 +415,7 @@ static int i2cdev_attach_adapter(struct 
>  		return PTR_ERR(i2c_dev);
>  
>  	/* register this i2c device with the driver core */
> -	i2c_dev->dev = device_create(i2c_dev_class, &adap->dev,
> +	i2c_dev->dev = device_create(i2c_dev_class, adap->class_dev.dev,
>  				     MKDEV(I2C_MAJOR, adap->nr),
>  				     "i2c-%d", adap->nr);
>  	if (IS_ERR(i2c_dev->dev)) {
> Index: g26/drivers/i2c/chips/tps65010.c
> ===================================================================
> --- g26.orig/drivers/i2c/chips/tps65010.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/chips/tps65010.c	2006-12-16 15:52:15.000000000 -0800
> @@ -499,7 +499,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;
>  	}
>  
> @@ -517,7 +518,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: g26/drivers/i2c/chips/isp1301_omap.c
> ===================================================================
> --- g26.orig/drivers/i2c/chips/isp1301_omap.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/chips/isp1301_omap.c	2006-12-16 15:52:15.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);

Looks like a bug to me, should be bus->class_dev.dev?

>  			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);

Ditto. Maybe you can introduce a local variable.

>  fail1:
>  		kfree(isp);
> Index: g26/drivers/i2c/algos/i2c-algo-bit.c
> ===================================================================
> --- g26.orig/drivers/i2c/algos/i2c-algo-bit.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/algos/i2c-algo-bit.c	2006-12-16 15:52:15.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--; 
>  			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: g26/drivers/i2c/algos/i2c-algo-pcf.c
> ===================================================================
> --- g26.orig/drivers/i2c/algos/i2c-algo-pcf.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/algos/i2c-algo-pcf.c	2006-12-16 15:52:15.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: g26/drivers/i2c/algos/i2c-algo-pca.c
> ===================================================================
> --- g26.orig/drivers/i2c/algos/i2c-algo-pca.c	2006-12-16 15:51:13.000000000 -0800
> +++ g26/drivers/i2c/algos/i2c-algo-pca.c	2006-12-16 15:52:15.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;
>  	}
>  


-- 
Jean Delvare



More information about the i2c mailing list