Skip to contentSkip to conversation

i2c: Constify i2c_get_clientdata's parameter

PATCH New Jean Delvare 1 participant 2 messages Oct 18, 2008 – Oct 19, 2008 1 message not in the archive

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

PATCH 1/1 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.

---
 include/linux/device.h |    2 +-
 include/linux/i2c.h    |    2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
include/linux/i2c.h +1 -1
@@ -224,7 +224,7 @@ static inline struct i2c_client *kobj_to
 	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);
 }
include/linux/device.h +1 -1
@@ -450,7 +450,7 @@ static inline void set_dev_node(struct d
 }
 #endif
 
-static inline void *dev_get_drvdata(struct device *dev)
+static inline void *dev_get_drvdata(const struct device *dev)
 {
 	return dev->driver_data;
 }
Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c

A message that is not in the archive (sent off-list or not yet received): [email protected]

#2 lore raw

PATCH 1/1 i2c: Constify i2c_get_clientdata's parameter (v2)

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.

---
 Documentation/i2c/writing-clients |    2 +-
 include/linux/device.h            |    2 +-
 include/linux/i2c.h               |    4 ++--
 3 files changed, 4 insertions(+), 4 deletions(-)
include/linux/i2c.h +2 -2
@@ -224,7 +224,7 @@ static inline struct i2c_client *kobj_to
 	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);
 }
@@ -369,7 +369,7 @@ struct i2c_adapter {
 };
 #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);
 }
include/linux/device.h +1 -1
@@ -450,7 +450,7 @@ static inline void set_dev_node(struct d
 }
 #endif
 
-static inline void *dev_get_drvdata(struct device *dev)
+static inline void *dev_get_drvdata(const struct device *dev)
 {
 	return dev->driver_data;
 }
Documentation/i2c/writing-clients +1 -1
@@ -83,7 +83,7 @@ be very useful.
 	void i2c_set_clientdata(struct i2c_client *client, void *data);
 
 	/* 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.
 
Signature · 6 lines
Jean Delvare

_______________________________________________
i2c mailing list
[email protected]
http://lists.lm-sensors.org/mailman/listinfo/i2c