[PATCH v3 23/29] media: exynos4-is: Use v4l2_subdev_get_frame_desc()
Sakari Ailus <[email protected]>
| Newsgroups | org.kernel.vger.linux-media |
|---|---|
| Organization | Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo |
| Message-ID | <[email protected]> |
Call v4l2_subdev_get_frame_desc() to obtain the frame descriptor. This is preferred over calling the get_frame_desc() pad operation directly. Signed-off-by: Sakari Ailus <[email protected]> --- .../platform/samsung/exynos4-is/fimc-capture.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/drivers/media/platform/samsung/exynos4-is/fimc-capture.c b/drivers/media/platform/samsung/exynos4-is/fimc-capture.c index d85811f4b8c5..b5749f9cba39 100644 --- a/drivers/media/platform/samsung/exynos4-is/fimc-capture.c +++ b/drivers/media/platform/samsung/exynos4-is/fimc-capture.c @@ -6,6 +6,7 @@ * Sylwester Nawrocki <[email protected]> */ +#include <linux/cleanup.h> #include <linux/module.h> #include <linux/kernel.h> #include <linux/types.h> @@ -853,7 +854,8 @@ static int fimc_get_sensor_frame_desc(struct v4l2_subdev *sensor, struct v4l2_plane_pix_format *plane_fmt, unsigned int num_planes, bool try) { - struct v4l2_mbus_frame_desc fd = { }; + struct v4l2_mbus_frame_desc *alloc_fd + __free(v4l2_subdev_free_frame_desc) = NULL, fd = { }; int i, ret; int pad; @@ -861,10 +863,18 @@ static int fimc_get_sensor_frame_desc(struct v4l2_subdev *sensor, fd.entry[i].length = plane_fmt[i].sizeimage; pad = sensor->entity.num_pads - 1; - if (try) + if (try) { ret = v4l2_subdev_call(sensor, pad, set_frame_desc, pad, &fd); - else - ret = v4l2_subdev_call(sensor, pad, get_frame_desc, pad, &fd); + } else { + alloc_fd = v4l2_subdev_get_frame_desc(sensor, pad, + V4L2_MBUS_FRAME_DESC_TYPE_CSI2); + if (IS_ERR(alloc_fd)) { + ret = PTR_ERR(alloc_fd); + } else { + fd = *alloc_fd; + ret = 0; + } + } if (ret < 0) return ret; -- 2.47.3