Hi Jacopo, Thank you for the patch. On Wed, Feb 23, 2022 at 11:40:18AM +0100, Jacopo Mondi wrote: > Provide a function to shortcut access to the correct timings definition > to avoid repeating the same pattern when accessing the sensor timings. > > Signed-off-by: Jacopo Mondi <jacopo@xxxxxxxxxx> > --- > drivers/media/i2c/ov5640.c | 16 +++++++++++----- > 1 file changed, 11 insertions(+), 5 deletions(-) > > diff --git a/drivers/media/i2c/ov5640.c b/drivers/media/i2c/ov5640.c > index 4040ace2fd55..ace956b7cdfc 100644 > --- a/drivers/media/i2c/ov5640.c > +++ b/drivers/media/i2c/ov5640.c > @@ -1123,6 +1123,16 @@ static const struct ov5640_mode_info ov5640_mode_data[OV5640_NUM_MODES] = { > }, > }; > > +static inline const > +struct ov5640_timings *ov5640_timings(const struct ov5640_dev *sensor, > + const struct ov5640_mode_info *mode) The usual line split would be static inline const struct ov5640_timings * ov5640_timings(const struct ov5640_dev *sensor, const struct ov5640_mode_info *mode) I'd also drop the inline, the compiler will figure out what is best by itself. Reviewed-by: Laurent Pinchart <laurent.pinchart@xxxxxxxxxxxxxxxx> > +{ > + if (ov5640_is_csi2(sensor)) > + return &mode->csi2_timings; > + > + return &mode->dvp_timings; > +} > + > static int ov5640_init_slave_id(struct ov5640_dev *sensor) > { > struct i2c_client *client = sensor->i2c_client; > @@ -1630,11 +1640,7 @@ static int ov5640_set_timings(struct ov5640_dev *sensor, > return ret; > } > > - if (ov5640_is_csi2(sensor)) > - timings = &mode->csi2_timings; > - else > - timings = &mode->dvp_timings; > - > + timings = ov5640_timings(sensor, mode); > analog_crop = &timings->analog_crop; > crop = &timings->crop; > -- Regards, Laurent Pinchart