Hi Niklas, On Fri, Apr 28, 2017 at 12:41:48AM +0200, Niklas Söderlund wrote: > Instead of caching the subdevice format each time the video device > format is set read it directly when its needed. As it turns out the > format is only needed when figuring out the max rectangle for cropping. > > This simplify the code and makes it clearer what the source format is > used for. > > Signed-off-by: Niklas Söderlund <niklas.soderlund+renesas@xxxxxxxxxxxx> > --- > drivers/media/platform/rcar-vin/rcar-v4l2.c | 76 ++++++++++++++++------------- > drivers/media/platform/rcar-vin/rcar-vin.h | 12 ----- > 2 files changed, 42 insertions(+), 46 deletions(-) > > diff --git a/drivers/media/platform/rcar-vin/rcar-v4l2.c b/drivers/media/platform/rcar-vin/rcar-v4l2.c > index 919040e40aec60f6..80421421625e6f6f 100644 > --- a/drivers/media/platform/rcar-vin/rcar-v4l2.c > +++ b/drivers/media/platform/rcar-vin/rcar-v4l2.c > @@ -90,6 +90,24 @@ static u32 rvin_format_sizeimage(struct v4l2_pix_format *pix) > * V4L2 > */ > > +static int rvin_get_sd_format(struct rvin_dev *vin, struct v4l2_pix_format *pix) > +{ > + struct v4l2_subdev_format fmt = { > + .which = V4L2_SUBDEV_FORMAT_ACTIVE, > + }; > + int ret; > + > + fmt.pad = vin->digital.source_pad; You can assign .pad in declaration, too. > + > + ret = v4l2_subdev_call(vin_to_source(vin), pad, get_fmt, NULL, &fmt); > + if (ret) > + return ret; > + > + v4l2_fill_pix_format(pix, &fmt.format); > + > + return 0; > +} -- Regards, Sakari Ailus e-mail: sakari.ailus@xxxxxx XMPP: sailus@xxxxxxxxxxxxxx