Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

i2c: Constify i2c_get_clientdata's parameter

i2c_get_clientdata doesn't change the i2c_client it is passed as a
parameter, so it can be constified. Same for i2c_get_adapdata.

Signed-off-by: Jean Delvare <khali@linux-fr.org>

+4 -4
+1 -1
Documentation/i2c/writing-clients
··· 83 83 void i2c_set_clientdata(struct i2c_client *client, void *data); 84 84 85 85 /* retrieve the value */ 86 - void *i2c_get_clientdata(struct i2c_client *client); 86 + void *i2c_get_clientdata(const struct i2c_client *client); 87 87 88 88 An example structure is below. 89 89
+1 -1
include/linux/device.h
··· 450 450 } 451 451 #endif 452 452 453 - static inline void *dev_get_drvdata(struct device *dev) 453 + static inline void *dev_get_drvdata(const struct device *dev) 454 454 { 455 455 return dev->driver_data; 456 456 }
+2 -2
include/linux/i2c.h
··· 224 224 return to_i2c_client(dev); 225 225 } 226 226 227 - static inline void *i2c_get_clientdata (struct i2c_client *dev) 227 + static inline void *i2c_get_clientdata(const struct i2c_client *dev) 228 228 { 229 229 return dev_get_drvdata (&dev->dev); 230 230 } ··· 369 369 }; 370 370 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev) 371 371 372 - static inline void *i2c_get_adapdata (struct i2c_adapter *dev) 372 + static inline void *i2c_get_adapdata(const struct i2c_adapter *dev) 373 373 { 374 374 return dev_get_drvdata (&dev->dev); 375 375 }