u32 pix_size;
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;
if (!buf)
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,
struct videobuf_buffer *vb)
struct fimc_ctx *ctx = vq->priv_data;
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;
if (0 == *count)
struct fimc_frame *frame;
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->bsize < frame->size) {
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_prepare = fimc_buf_prepare,
.buf_queue = fimc_buf_queue,
struct fimc_ctx *ctx = priv;
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.height = frame->height;
struct fimc_frame *frame;
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.top = 0;
struct fimc_frame *frame;
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.top = frame->offs_v;
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. */
min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ?
#define dbg(fmt, args...)
#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 MODULE_NAME "s5p-fimc"
#define FIMC_MAX_DEVS 3
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 */
void fimc_hw_reset(struct fimc_dev *dev);