Commit 492b99c2 authored by Ming Qian's avatar Ming Qian Committed by Mauro Carvalho Chehab

media: imx-jpeg: Refine the function mxc_jpeg_find_format

remove the unused parameter ctx
Signed-off-by: default avatarMing Qian <ming.qian@nxp.com>
Signed-off-by: default avatarHans Verkuil <hverkuil-cisco@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@kernel.org>
parent 302b988c
...@@ -420,8 +420,7 @@ static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n, ...@@ -420,8 +420,7 @@ static int enum_fmt(const struct mxc_jpeg_fmt *mxc_formats, int n,
return 0; return 0;
} }
static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(struct mxc_jpeg_ctx *ctx, static const struct mxc_jpeg_fmt *mxc_jpeg_find_format(u32 pixelformat)
u32 pixelformat)
{ {
unsigned int k; unsigned int k;
...@@ -1566,7 +1565,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb) ...@@ -1566,7 +1565,7 @@ static int mxc_jpeg_parse(struct mxc_jpeg_ctx *ctx, struct vb2_buffer *vb)
if (fourcc == 0) if (fourcc == 0)
return -EINVAL; return -EINVAL;
jpeg_src_buf->fmt = mxc_jpeg_find_format(ctx, fourcc); jpeg_src_buf->fmt = mxc_jpeg_find_format(fourcc);
jpeg_src_buf->w = header.frame.width; jpeg_src_buf->w = header.frame.width;
jpeg_src_buf->h = header.frame.height; jpeg_src_buf->h = header.frame.height;
ctx->header_parsed = true; ctx->header_parsed = true;
...@@ -1706,11 +1705,11 @@ static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx *ctx) ...@@ -1706,11 +1705,11 @@ static void mxc_jpeg_set_default_params(struct mxc_jpeg_ctx *ctx)
int i; int i;
if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) { if (ctx->mxc_jpeg->mode == MXC_JPEG_ENCODE) {
out_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); out_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT);
cap_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); cap_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG);
} else { } else {
out_q->fmt = mxc_jpeg_find_format(ctx, V4L2_PIX_FMT_JPEG); out_q->fmt = mxc_jpeg_find_format(V4L2_PIX_FMT_JPEG);
cap_q->fmt = mxc_jpeg_find_format(ctx, MXC_JPEG_DEFAULT_PFMT); cap_q->fmt = mxc_jpeg_find_format(MXC_JPEG_DEFAULT_PFMT);
} }
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
...@@ -1954,7 +1953,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, ...@@ -1954,7 +1953,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f,
pix_mp->height : MXC_JPEG_MAX_HEIGHT; pix_mp->height : MXC_JPEG_MAX_HEIGHT;
int i; int i;
fmt = mxc_jpeg_find_format(ctx, fourcc); fmt = mxc_jpeg_find_format(fourcc);
if (!fmt || fmt->flags != mxc_jpeg_get_fmt_type(ctx, f->type)) { if (!fmt || fmt->flags != mxc_jpeg_get_fmt_type(ctx, f->type)) {
dev_warn(ctx->mxc_jpeg->dev, "Format not supported: %c%c%c%c, use the default.\n", dev_warn(ctx->mxc_jpeg->dev, "Format not supported: %c%c%c%c, use the default.\n",
(fourcc & 0xff), (fourcc & 0xff),
...@@ -1962,7 +1961,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f, ...@@ -1962,7 +1961,7 @@ static int mxc_jpeg_try_fmt(struct v4l2_format *f,
(fourcc >> 16) & 0xff, (fourcc >> 16) & 0xff,
(fourcc >> 24) & 0xff); (fourcc >> 24) & 0xff);
fourcc = mxc_jpeg_get_default_fourcc(ctx, f->type); fourcc = mxc_jpeg_get_default_fourcc(ctx, f->type);
fmt = mxc_jpeg_find_format(ctx, fourcc); fmt = mxc_jpeg_find_format(fourcc);
if (!fmt) if (!fmt)
return -EINVAL; return -EINVAL;
f->fmt.pix_mp.pixelformat = fourcc; f->fmt.pix_mp.pixelformat = fourcc;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment