Commit 03e30ca5 authored by Pawel Osciak's avatar Pawel Osciak Committed by Mauro Carvalho Chehab

V4L/DVB: v4l: s5p-fimc: Fix coding style issues

Signed-off-by: default avatarPawel Osciak <p.osciak@samsung.com>
Signed-off-by: default avatarKyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 175bad92
...@@ -303,7 +303,9 @@ static int fimc_prepare_addr(struct fimc_ctx *ctx, ...@@ -303,7 +303,9 @@ static int fimc_prepare_addr(struct fimc_ctx *ctx,
u32 pix_size; u32 pix_size;
int ret = 0; int ret = 0;
ctx_m2m_get_frame(frame, ctx, type); frame = ctx_m2m_get_frame(ctx, type);
if (IS_ERR(frame))
return PTR_ERR(frame);
paddr = &frame->paddr; paddr = &frame->paddr;
if (!buf) if (!buf)
...@@ -555,8 +557,10 @@ static void fimc_dma_run(void *priv) ...@@ -555,8 +557,10 @@ static void fimc_dma_run(void *priv)
spin_unlock_irqrestore(&ctx->slock, flags); spin_unlock_irqrestore(&ctx->slock, flags);
} }
/* Nothing done in job_abort. */ static void fimc_job_abort(void *priv)
static void fimc_job_abort(void *priv) {} {
/* Nothing done in job_abort. */
}
static void fimc_buf_release(struct videobuf_queue *vq, static void fimc_buf_release(struct videobuf_queue *vq,
struct videobuf_buffer *vb) struct videobuf_buffer *vb)
...@@ -571,7 +575,9 @@ static int fimc_buf_setup(struct videobuf_queue *vq, unsigned int *count, ...@@ -571,7 +575,9 @@ static int fimc_buf_setup(struct videobuf_queue *vq, unsigned int *count,
struct fimc_ctx *ctx = vq->priv_data; struct fimc_ctx *ctx = vq->priv_data;
struct fimc_frame *frame; struct fimc_frame *frame;
ctx_m2m_get_frame(frame, ctx, vq->type); frame = ctx_m2m_get_frame(ctx, vq->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
*size = (frame->width * frame->height * frame->fmt->depth) >> 3; *size = (frame->width * frame->height * frame->fmt->depth) >> 3;
if (0 == *count) if (0 == *count)
...@@ -587,7 +593,9 @@ static int fimc_buf_prepare(struct videobuf_queue *vq, ...@@ -587,7 +593,9 @@ static int fimc_buf_prepare(struct videobuf_queue *vq,
struct fimc_frame *frame; struct fimc_frame *frame;
int ret; int ret;
ctx_m2m_get_frame(frame, ctx, vq->type); frame = ctx_m2m_get_frame(ctx, vq->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
if (vb->baddr) { if (vb->baddr) {
if (vb->bsize < frame->size) { if (vb->bsize < frame->size) {
...@@ -628,7 +636,7 @@ static void fimc_buf_queue(struct videobuf_queue *vq, ...@@ -628,7 +636,7 @@ static void fimc_buf_queue(struct videobuf_queue *vq,
v4l2_m2m_buf_queue(ctx->m2m_ctx, vq, vb); v4l2_m2m_buf_queue(ctx->m2m_ctx, vq, vb);
} }
struct videobuf_queue_ops fimc_qops = { static struct videobuf_queue_ops fimc_qops = {
.buf_setup = fimc_buf_setup, .buf_setup = fimc_buf_setup,
.buf_prepare = fimc_buf_prepare, .buf_prepare = fimc_buf_prepare,
.buf_queue = fimc_buf_queue, .buf_queue = fimc_buf_queue,
...@@ -670,7 +678,9 @@ static int fimc_m2m_g_fmt(struct file *file, void *priv, struct v4l2_format *f) ...@@ -670,7 +678,9 @@ static int fimc_m2m_g_fmt(struct file *file, void *priv, struct v4l2_format *f)
struct fimc_ctx *ctx = priv; struct fimc_ctx *ctx = priv;
struct fimc_frame *frame; struct fimc_frame *frame;
ctx_m2m_get_frame(frame, ctx, f->type); frame = ctx_m2m_get_frame(ctx, f->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
f->fmt.pix.width = frame->width; f->fmt.pix.width = frame->width;
f->fmt.pix.height = frame->height; f->fmt.pix.height = frame->height;
...@@ -1003,7 +1013,9 @@ static int fimc_m2m_cropcap(struct file *file, void *fh, ...@@ -1003,7 +1013,9 @@ static int fimc_m2m_cropcap(struct file *file, void *fh,
struct fimc_frame *frame; struct fimc_frame *frame;
struct fimc_ctx *ctx = fh; struct fimc_ctx *ctx = fh;
ctx_m2m_get_frame(frame, ctx, cr->type); frame = ctx_m2m_get_frame(ctx, cr->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
cr->bounds.left = 0; cr->bounds.left = 0;
cr->bounds.top = 0; cr->bounds.top = 0;
...@@ -1021,7 +1033,9 @@ static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) ...@@ -1021,7 +1033,9 @@ static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr)
struct fimc_frame *frame; struct fimc_frame *frame;
struct fimc_ctx *ctx = file->private_data; struct fimc_ctx *ctx = file->private_data;
ctx_m2m_get_frame(frame, ctx, cr->type); frame = ctx_m2m_get_frame(ctx, cr->type);
if (IS_ERR(frame))
return PTR_ERR(frame);
cr->c.left = frame->offs_h; cr->c.left = frame->offs_h;
cr->c.top = frame->offs_v; cr->c.top = frame->offs_v;
...@@ -1052,7 +1066,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr) ...@@ -1052,7 +1066,9 @@ static int fimc_m2m_s_crop(struct file *file, void *fh, struct v4l2_crop *cr)
return -EINVAL; return -EINVAL;
} }
ctx_m2m_get_frame(f, ctx, cr->type); f = ctx_m2m_get_frame(ctx, cr->type);
if (IS_ERR(f))
return PTR_ERR(f);
/* Adjust to required pixel boundary. */ /* Adjust to required pixel boundary. */
min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ?
......
...@@ -28,18 +28,6 @@ ...@@ -28,18 +28,6 @@
#define dbg(fmt, args...) #define dbg(fmt, args...)
#endif #endif
#define ctx_m2m_get_frame(frame, ctx, type) do { \
if (V4L2_BUF_TYPE_VIDEO_OUTPUT == (type)) { \
frame = &(ctx)->s_frame; \
} else if (V4L2_BUF_TYPE_VIDEO_CAPTURE == (type)) { \
frame = &(ctx)->d_frame; \
} else { \
v4l2_err(&(ctx)->fimc_dev->m2m.v4l2_dev,\
"Wrong buffer/video queue type (%d)\n", type); \
return -EINVAL; \
} \
} while (0)
#define NUM_FIMC_CLOCKS 2 #define NUM_FIMC_CLOCKS 2
#define MODULE_NAME "s5p-fimc" #define MODULE_NAME "s5p-fimc"
#define FIMC_MAX_DEVS 3 #define FIMC_MAX_DEVS 3
...@@ -444,6 +432,24 @@ static inline void fimc_hw_stop_in_dma(struct fimc_dev *dev) ...@@ -444,6 +432,24 @@ static inline void fimc_hw_stop_in_dma(struct fimc_dev *dev)
writel(cfg, dev->regs + S5P_MSCTRL); writel(cfg, dev->regs + S5P_MSCTRL);
} }
static inline struct fimc_frame *ctx_m2m_get_frame(struct fimc_ctx *ctx,
enum v4l2_buf_type type)
{
struct fimc_frame *frame;
if (V4L2_BUF_TYPE_VIDEO_OUTPUT == type) {
frame = &ctx->s_frame;
} else if (V4L2_BUF_TYPE_VIDEO_CAPTURE == type) {
frame = &ctx->d_frame;
} else {
v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev,
"Wrong buffer/video queue type (%d)\n", type);
return ERR_PTR(-EINVAL);
}
return frame;
}
/* -----------------------------------------------------*/ /* -----------------------------------------------------*/
/* fimc-reg.c */ /* fimc-reg.c */
void fimc_hw_reset(struct fimc_dev *dev); void fimc_hw_reset(struct fimc_dev *dev);
......
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