From 717fd5b4907ada90ceb069d484068aaa01c58bb0 Mon Sep 17 00:00:00 2001 From: Hans Verkuil Date: Thu, 9 Apr 2015 06:24:36 -0300 Subject: [media] v4l2: replace try_mbus_fmt by set_fmt The try_mbus_fmt video op is a duplicate of the pad op. Replace all uses in sub-devices by the set_fmt() pad op. Since try_mbus_fmt and s_mbus_fmt both map to the set_fmt pad op (but with a different 'which' argument), this patch will replace both try_mbus_fmt and s_mbus_fmt by set_fmt. Signed-off-by: Hans Verkuil Cc: Guennadi Liakhovetski Cc: Jonathan Corbet Cc: Kamil Debski Signed-off-by: Mauro Carvalho Chehab --- drivers/media/i2c/adv7183.c | 36 ++++++++++++++++++------------------ 1 file changed, 18 insertions(+), 18 deletions(-) (limited to 'drivers/media/i2c/adv7183.c') diff --git a/drivers/media/i2c/adv7183.c b/drivers/media/i2c/adv7183.c index 9d58b75..e2dd161 100644 --- a/drivers/media/i2c/adv7183.c +++ b/drivers/media/i2c/adv7183.c @@ -431,10 +431,15 @@ static int adv7183_enum_mbus_code(struct v4l2_subdev *sd, return 0; } -static int adv7183_try_mbus_fmt(struct v4l2_subdev *sd, - struct v4l2_mbus_framefmt *fmt) +static int adv7183_set_fmt(struct v4l2_subdev *sd, + struct v4l2_subdev_pad_config *cfg, + struct v4l2_subdev_format *format) { struct adv7183 *decoder = to_adv7183(sd); + struct v4l2_mbus_framefmt *fmt = &format->format; + + if (format->pad) + return -EINVAL; fmt->code = MEDIA_BUS_FMT_UYVY8_2X8; fmt->colorspace = V4L2_COLORSPACE_SMPTE170M; @@ -447,16 +452,10 @@ static int adv7183_try_mbus_fmt(struct v4l2_subdev *sd, fmt->width = 720; fmt->height = 576; } - return 0; -} - -static int adv7183_s_mbus_fmt(struct v4l2_subdev *sd, - struct v4l2_mbus_framefmt *fmt) -{ - struct adv7183 *decoder = to_adv7183(sd); - - adv7183_try_mbus_fmt(sd, fmt); - decoder->fmt = *fmt; + if (format->which == V4L2_SUBDEV_FORMAT_ACTIVE) + decoder->fmt = *fmt; + else + cfg->try_fmt = *fmt; return 0; } @@ -519,14 +518,13 @@ static const struct v4l2_subdev_video_ops adv7183_video_ops = { .s_routing = adv7183_s_routing, .querystd = adv7183_querystd, .g_input_status = adv7183_g_input_status, - .try_mbus_fmt = adv7183_try_mbus_fmt, - .s_mbus_fmt = adv7183_s_mbus_fmt, .s_stream = adv7183_s_stream, }; static const struct v4l2_subdev_pad_ops adv7183_pad_ops = { .enum_mbus_code = adv7183_enum_mbus_code, .get_fmt = adv7183_get_fmt, + .set_fmt = adv7183_set_fmt, }; static const struct v4l2_subdev_ops adv7183_ops = { @@ -542,7 +540,9 @@ static int adv7183_probe(struct i2c_client *client, struct v4l2_subdev *sd; struct v4l2_ctrl_handler *hdl; int ret; - struct v4l2_mbus_framefmt fmt; + struct v4l2_subdev_format fmt = { + .which = V4L2_SUBDEV_FORMAT_ACTIVE, + }; const unsigned *pin_array; /* Check if the adapter supports the needed features */ @@ -612,9 +612,9 @@ static int adv7183_probe(struct i2c_client *client, adv7183_writeregs(sd, adv7183_init_regs, ARRAY_SIZE(adv7183_init_regs)); adv7183_s_std(sd, decoder->std); - fmt.width = 720; - fmt.height = 576; - adv7183_s_mbus_fmt(sd, &fmt); + fmt.format.width = 720; + fmt.format.height = 576; + adv7183_set_fmt(sd, NULL, &fmt); /* initialize the hardware to the default control values */ ret = v4l2_ctrl_handler_setup(hdl); -- cgit v1.1