Skip to content

Commit

Permalink
i2c: Constify i2c_get_clientdata's parameter
Browse files Browse the repository at this point in the history
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 <[email protected]>
  • Loading branch information
Jean Delvare committed Oct 22, 2008
1 parent d955caf commit 7d1d899
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 4 deletions.
2 changes: 1 addition & 1 deletion Documentation/i2c/writing-clients
Original file line number Diff line number Diff line change
Expand Up @@ -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.

Expand Down
2 changes: 1 addition & 1 deletion include/linux/device.h
Original file line number Diff line number Diff line change
Expand Up @@ -450,7 +450,7 @@ static inline void set_dev_node(struct device *dev, int node)
}
#endif

static inline void *dev_get_drvdata(struct device *dev)
static inline void *dev_get_drvdata(const struct device *dev)
{
return dev->driver_data;
}
Expand Down
4 changes: 2 additions & 2 deletions include/linux/i2c.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,7 +224,7 @@ static inline struct i2c_client *kobj_to_i2c_client(struct kobject *kobj)
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);
}
Expand Down Expand Up @@ -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);
}
Expand Down

0 comments on commit 7d1d899

Please sign in to comment.