Use a inline function instead of a macro for the container_of helper for getting the driver's state struct from a control. A inline function has the advantage that it is more typesafe and nicer in general. Signed-off-by: Lars-Peter Clausen <lars@xxxxxxxxxx> --- drivers/media/i2c/adv7180.c | 13 +++++++------ 1 file changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/media/i2c/adv7180.c b/drivers/media/i2c/adv7180.c index f424a4d..f2508abe 100644 --- a/drivers/media/i2c/adv7180.c +++ b/drivers/media/i2c/adv7180.c @@ -130,9 +130,11 @@ struct adv7180_state { bool powered; u8 input; }; -#define to_adv7180_sd(_ctrl) (&container_of(_ctrl->handler, \ - struct adv7180_state, \ - ctrl_hdl)->sd) + +static struct adv7180_state *ctrl_to_adv7180(struct v4l2_ctrl *ctrl) +{ + return container_of(ctrl->handler, struct adv7180_state, ctrl_hdl); +} static v4l2_std_id adv7180_std_to_v4l2(u8 status1) { @@ -345,9 +347,8 @@ static int adv7180_s_power(struct v4l2_subdev *sd, int on) static int adv7180_s_ctrl(struct v4l2_ctrl *ctrl) { - struct v4l2_subdev *sd = to_adv7180_sd(ctrl); - struct adv7180_state *state = to_state(sd); - struct i2c_client *client = v4l2_get_subdevdata(sd); + struct adv7180_state *state = ctrl_to_adv7180(ctrl); + struct i2c_client *client = v4l2_get_subdevdata(&state->sd); int ret = mutex_lock_interruptible(&state->mutex); int val; -- 1.8.0 -- To unsubscribe from this list: send the line "unsubscribe linux-media" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html