Преглед на файлове

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>
Jean Delvare преди 16 години
родител
ревизия
7d1d8999b4
променени са 3 файла, в които са добавени 4 реда и са изтрити 4 реда
  1. 1 1
      Documentation/i2c/writing-clients
  2. 1 1
      include/linux/device.h
  3. 2 2
      include/linux/i2c.h

+ 1 - 1
Documentation/i2c/writing-clients

@@ -83,7 +83,7 @@ be very useful.
 	void i2c_set_clientdata(struct i2c_client *client, void *data);
 	void i2c_set_clientdata(struct i2c_client *client, void *data);
 
 
 	/* retrieve the value */
 	/* retrieve the value */
-	void *i2c_get_clientdata(struct i2c_client *client);
+	void *i2c_get_clientdata(const struct i2c_client *client);
 
 
 An example structure is below.
 An example structure is below.
 
 

+ 1 - 1
include/linux/device.h

@@ -450,7 +450,7 @@ static inline void set_dev_node(struct device *dev, int node)
 }
 }
 #endif
 #endif
 
 
-static inline void *dev_get_drvdata(struct device *dev)
+static inline void *dev_get_drvdata(const struct device *dev)
 {
 {
 	return dev->driver_data;
 	return dev->driver_data;
 }
 }

+ 2 - 2
include/linux/i2c.h

@@ -224,7 +224,7 @@ static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
 	return to_i2c_client(dev);
 	return to_i2c_client(dev);
 }
 }
 
 
-static inline void *i2c_get_clientdata (struct i2c_client *dev)
+static inline void *i2c_get_clientdata(const struct i2c_client *dev)
 {
 {
 	return dev_get_drvdata (&dev->dev);
 	return dev_get_drvdata (&dev->dev);
 }
 }
@@ -369,7 +369,7 @@ struct i2c_adapter {
 };
 };
 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
 #define to_i2c_adapter(d) container_of(d, struct i2c_adapter, dev)
 
 
-static inline void *i2c_get_adapdata (struct i2c_adapter *dev)
+static inline void *i2c_get_adapdata(const struct i2c_adapter *dev)
 {
 {
 	return dev_get_drvdata (&dev->dev);
 	return dev_get_drvdata (&dev->dev);
 }
 }