From 52172e9ecf2b1137b250be79df26f9fbf106df92 Mon Sep 17 00:00:00 2001 From: Hans de Goede Date: Sun, 5 Mar 2023 17:52:23 +0000 Subject: media: atomisp: Remove snr_mbus_fmt local var from atomisp_try_fmt() snr_mbus_fmt is a local variable pointing to a substruct of another local variable which really just makes the code harder to read / follow, so drop it. And likewise also drop the stream_info local variable. Reviewed-by: Andy Shevchenko Signed-off-by: Hans de Goede Signed-off-by: Mauro Carvalho Chehab --- drivers/staging/media/atomisp/pci/atomisp_cmd.c | 33 +++++++++++-------------- 1 file changed, 15 insertions(+), 18 deletions(-) (limited to 'drivers/staging') diff --git a/drivers/staging/media/atomisp/pci/atomisp_cmd.c b/drivers/staging/media/atomisp/pci/atomisp_cmd.c index 70790eb55d63..f9a942639703 100644 --- a/drivers/staging/media/atomisp/pci/atomisp_cmd.c +++ b/drivers/staging/media/atomisp/pci/atomisp_cmd.c @@ -3967,11 +3967,7 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f, struct v4l2_subdev_format format = { .which = V4L2_SUBDEV_FORMAT_TRY, }; - - struct v4l2_mbus_framefmt *snr_mbus_fmt = &format.format; const struct atomisp_format_bridge *fmt; - struct atomisp_input_stream_info *stream_info = - (struct atomisp_input_stream_info *)snr_mbus_fmt->reserved; int ret; if (!asd) { @@ -3992,14 +3988,15 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f, if (f->width <= 0 || f->height <= 0) return -EINVAL; - snr_mbus_fmt->code = fmt->mbus_code; - snr_mbus_fmt->width = f->width; - snr_mbus_fmt->height = f->height; + format.format.code = fmt->mbus_code; + format.format.width = f->width; + format.format.height = f->height; - __atomisp_init_stream_info(ATOMISP_INPUT_STREAM_GENERAL, stream_info); + __atomisp_init_stream_info(ATOMISP_INPUT_STREAM_GENERAL, + (struct atomisp_input_stream_info *)format.format.reserved); dev_dbg(isp->dev, "try_mbus_fmt: asking for %ux%u\n", - snr_mbus_fmt->width, snr_mbus_fmt->height); + format.format.width, format.format.height); ret = v4l2_subdev_call(isp->inputs[asd->input_curr].camera, pad, set_fmt, &pad_state, &format); @@ -4007,12 +4004,12 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f, return ret; dev_dbg(isp->dev, "try_mbus_fmt: got %ux%u\n", - snr_mbus_fmt->width, snr_mbus_fmt->height); + format.format.width, format.format.height); - fmt = atomisp_get_format_bridge_from_mbus(snr_mbus_fmt->code); + fmt = atomisp_get_format_bridge_from_mbus(format.format.code); if (!fmt) { dev_err(isp->dev, "unknown sensor format 0x%8.8x\n", - snr_mbus_fmt->code); + format.format.code); return -EINVAL; } @@ -4026,15 +4023,15 @@ int atomisp_try_fmt(struct video_device *vdev, struct v4l2_pix_format *f, */ if (f->pixelformat == V4L2_PIX_FMT_JPEG || f->pixelformat == V4L2_PIX_FMT_CUSTOM_M10MO_RAW) { - f->width = snr_mbus_fmt->width; - f->height = snr_mbus_fmt->height; + f->width = format.format.width; + f->height = format.format.height; return 0; } - if (!res_overflow || (snr_mbus_fmt->width < f->width && - snr_mbus_fmt->height < f->height)) { - f->width = snr_mbus_fmt->width; - f->height = snr_mbus_fmt->height; + if (!res_overflow || (format.format.width < f->width && + format.format.height < f->height)) { + f->width = format.format.width; + f->height = format.format.height; /* Set the flag when resolution requested is * beyond the max value supported by sensor */ -- cgit v1.2.3