[i2c] [patch 2.6.18-rc] constify i2c_algorithm

Jean Delvare khali at linux-fr.org
Sun Sep 3 18:07:25 CEST 2006


Hi David,

Please Cc the i2c list when sending i2c patches (added.)

> Let drivers constify I2C algorithm method operations tables,
> moving them from ".data" to ".rodata".
> 
> Signed-off-by: David Brownell <dbrownell at users.sourceforge.net>
> 
> Index: at91/include/linux/i2c.h
> ===================================================================
> --- at91.orig/include/linux/i2c.h	2006-08-05 12:14:27.000000000 -0700
> +++ at91/include/linux/i2c.h	2006-09-03 05:24:43.000000000 -0700
> @@ -220,7 +220,7 @@ struct i2c_adapter {
>  	struct module *owner;
>  	unsigned int id;
>  	unsigned int class;
> -	struct i2c_algorithm *algo;/* the algorithm to access the bus	*/
> +	const struct i2c_algorithm *algo;/* the algorithm to access the bus	*/
>  	void *algo_data;
>  
>  	/* --- administration stuff. */

Looks good. Is there any performance benefit in marking a driver's
struct i2c_algorithm const?

I've applied your patch, I also added a fix to one occurence in the
documentation. I'll push two patches on top of that, one adding const
to all i2c algorithm drivers and one adding const to all i2c bus
drivers (where possible, of course.)

Thanks,
-- 
Jean Delvare



More information about the i2c mailing list