[i2c] [patch 2.6.21-rc3-git +i2c 4/5] i2c board_info and i2c_new_device()

Jean Delvare khali at linux-fr.org
Thu Mar 15 10:29:01 CET 2007


Hi David,

On Wed, 14 Mar 2007 13:16:11 -0700, David Brownell wrote:
> UPDATED by fixing device unregister refcount issues to match
> standard driver model usage with "new style" devices and drivers.
> (...)
> @@ -541,9 +616,14 @@ int i2c_attach_client(struct i2c_client 
>  	client->usage_count = 0;
>  
>  	client->dev.parent = &client->adapter->dev;
> -	client->dev.driver = &client->driver->driver;
>  	client->dev.bus = &i2c_bus_type;
> -	client->dev.release = &i2c_client_release;
> +
> +	if (client->driver) {
> +		client->dev.driver = &client->driver->driver;
> +		if (!is_newstyle_driver(client->driver))
> +			client->dev.release = i2c_client_release;
> +	} else
> +		client->dev.release = i2c_client_dev_release;
>  
>  	snprintf(&client->dev.bus_id[0], sizeof(client->dev.bus_id),
>  		"%d-%04x", i2c_adapter_id(adapter), client->addr);

I'm surprised by this. It means that in some cases client->dev.release
would not be set at all. Is this intended? That being said, is the case
client->driver && is_newstyle_driver(client->driver) possible at all in
i2c_attach_client()? I thought not.

-- 
Jean Delvare



More information about the i2c mailing list