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

Jean Delvare khali at linux-fr.org
Tue Dec 19 13:15:24 CET 2006


David,

On Mon, 18 Dec 2006 13:20:00 -0800, David Brownell wrote:
> --- g26.orig/drivers/i2c/i2c-core.c	2006-12-18 12:15:52.000000000 -0800
> +++ g26/drivers/i2c/i2c-core.c	2006-12-18 12:48:50.000000000 -0800
> @@ -147,6 +147,7 @@ static struct device_attribute dev_attr_
>   */
>  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 +197,8 @@ 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 [%s] registered\n",
> +			adap->class_dev.class_id, adap->name);
>  
>  	/* inform drivers of new adapters */
>  	list_for_each(item,&drivers) {

I just figured out this one is incorrect (causes a oops here...) At the
beginning of i2c_add_adapter(), adap->class_dev.dev is NULL right now,
it is only set properly later in the function. So let's just use
adap->class_dev.dev in dev_dbg() for now.

Thanks,
-- 
Jean Delvare



More information about the i2c mailing list