diff options
| author | Pawel Osciak <p.osciak@samsung.com> | 2010-08-06 09:50:46 -0400 |
|---|---|---|
| committer | Mauro Carvalho Chehab <mchehab@redhat.com> | 2010-08-08 22:43:03 -0400 |
| commit | 03e30ca5f08e0f9c629204e537ff96b789e6e703 (patch) | |
| tree | 4dfb2d2728d55b2ed3f00bdf19e68b4695adc814 | |
| parent | 175bad921c75ab3b7d11a9fffc0e8d9a4a179e61 (diff) | |
V4L/DVB: v4l: s5p-fimc: Fix coding style issues
Signed-off-by: Pawel Osciak <p.osciak@samsung.com>
Signed-off-by: Kyungmin Park <kyungmin.park@samsung.com>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>
| -rw-r--r-- | drivers/media/video/s5p-fimc/fimc-core.c | 36 | ||||
| -rw-r--r-- | drivers/media/video/s5p-fimc/fimc-core.h | 30 |
2 files changed, 44 insertions, 22 deletions
diff --git a/drivers/media/video/s5p-fimc/fimc-core.c b/drivers/media/video/s5p-fimc/fimc-core.c index 6558a2ea9ffd..b151c7be8a50 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.c +++ b/drivers/media/video/s5p-fimc/fimc-core.c | |||
| @@ -303,7 +303,9 @@ static int fimc_prepare_addr(struct fimc_ctx *ctx, | |||
| 303 | u32 pix_size; | 303 | u32 pix_size; |
| 304 | int ret = 0; | 304 | int ret = 0; |
| 305 | 305 | ||
| 306 | ctx_m2m_get_frame(frame, ctx, type); | 306 | frame = ctx_m2m_get_frame(ctx, type); |
| 307 | if (IS_ERR(frame)) | ||
| 308 | return PTR_ERR(frame); | ||
| 307 | paddr = &frame->paddr; | 309 | paddr = &frame->paddr; |
| 308 | 310 | ||
| 309 | if (!buf) | 311 | if (!buf) |
| @@ -555,8 +557,10 @@ dma_unlock: | |||
| 555 | spin_unlock_irqrestore(&ctx->slock, flags); | 557 | spin_unlock_irqrestore(&ctx->slock, flags); |
| 556 | } | 558 | } |
| 557 | 559 | ||
| 558 | /* Nothing done in job_abort. */ | 560 | static void fimc_job_abort(void *priv) |
| 559 | static void fimc_job_abort(void *priv) {} | 561 | { |
| 562 | /* Nothing done in job_abort. */ | ||
| 563 | } | ||
| 560 | 564 | ||
| 561 | static void fimc_buf_release(struct videobuf_queue *vq, | 565 | static void fimc_buf_release(struct videobuf_queue *vq, |
| 562 | struct videobuf_buffer *vb) | 566 | struct videobuf_buffer *vb) |
| @@ -571,7 +575,9 @@ static int fimc_buf_setup(struct videobuf_queue *vq, unsigned int *count, | |||
| 571 | struct fimc_ctx *ctx = vq->priv_data; | 575 | struct fimc_ctx *ctx = vq->priv_data; |
| 572 | struct fimc_frame *frame; | 576 | struct fimc_frame *frame; |
| 573 | 577 | ||
| 574 | ctx_m2m_get_frame(frame, ctx, vq->type); | 578 | frame = ctx_m2m_get_frame(ctx, vq->type); |
| 579 | if (IS_ERR(frame)) | ||
| 580 | return PTR_ERR(frame); | ||
| 575 | 581 | ||
| 576 | *size = (frame->width * frame->height * frame->fmt->depth) >> 3; | 582 | *size = (frame->width * frame->height * frame->fmt->depth) >> 3; |
| 577 | if (0 == *count) | 583 | if (0 == *count) |
| @@ -587,7 +593,9 @@ static int fimc_buf_prepare(struct videobuf_queue *vq, | |||
| 587 | struct fimc_frame *frame; | 593 | struct fimc_frame *frame; |
| 588 | int ret; | 594 | int ret; |
| 589 | 595 | ||
| 590 | ctx_m2m_get_frame(frame, ctx, vq->type); | 596 | frame = ctx_m2m_get_frame(ctx, vq->type); |
| 597 | if (IS_ERR(frame)) | ||
| 598 | return PTR_ERR(frame); | ||
| 591 | 599 | ||
| 592 | if (vb->baddr) { | 600 | if (vb->baddr) { |
| 593 | if (vb->bsize < frame->size) { | 601 | if (vb->bsize < frame->size) { |
| @@ -628,7 +636,7 @@ static void fimc_buf_queue(struct videobuf_queue *vq, | |||
| 628 | v4l2_m2m_buf_queue(ctx->m2m_ctx, vq, vb); | 636 | v4l2_m2m_buf_queue(ctx->m2m_ctx, vq, vb); |
| 629 | } | 637 | } |
| 630 | 638 | ||
| 631 | struct videobuf_queue_ops fimc_qops = { | 639 | static struct videobuf_queue_ops fimc_qops = { |
| 632 | .buf_setup = fimc_buf_setup, | 640 | .buf_setup = fimc_buf_setup, |
| 633 | .buf_prepare = fimc_buf_prepare, | 641 | .buf_prepare = fimc_buf_prepare, |
| 634 | .buf_queue = fimc_buf_queue, | 642 | .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 | struct fimc_ctx *ctx = priv; | 678 | struct fimc_ctx *ctx = priv; |
| 671 | struct fimc_frame *frame; | 679 | struct fimc_frame *frame; |
| 672 | 680 | ||
| 673 | ctx_m2m_get_frame(frame, ctx, f->type); | 681 | frame = ctx_m2m_get_frame(ctx, f->type); |
| 682 | if (IS_ERR(frame)) | ||
| 683 | return PTR_ERR(frame); | ||
| 674 | 684 | ||
| 675 | f->fmt.pix.width = frame->width; | 685 | f->fmt.pix.width = frame->width; |
| 676 | f->fmt.pix.height = frame->height; | 686 | f->fmt.pix.height = frame->height; |
| @@ -1003,7 +1013,9 @@ static int fimc_m2m_cropcap(struct file *file, void *fh, | |||
| 1003 | struct fimc_frame *frame; | 1013 | struct fimc_frame *frame; |
| 1004 | struct fimc_ctx *ctx = fh; | 1014 | struct fimc_ctx *ctx = fh; |
| 1005 | 1015 | ||
| 1006 | ctx_m2m_get_frame(frame, ctx, cr->type); | 1016 | frame = ctx_m2m_get_frame(ctx, cr->type); |
| 1017 | if (IS_ERR(frame)) | ||
| 1018 | return PTR_ERR(frame); | ||
| 1007 | 1019 | ||
| 1008 | cr->bounds.left = 0; | 1020 | cr->bounds.left = 0; |
| 1009 | cr->bounds.top = 0; | 1021 | cr->bounds.top = 0; |
| @@ -1021,7 +1033,9 @@ static int fimc_m2m_g_crop(struct file *file, void *fh, struct v4l2_crop *cr) | |||
| 1021 | struct fimc_frame *frame; | 1033 | struct fimc_frame *frame; |
| 1022 | struct fimc_ctx *ctx = file->private_data; | 1034 | struct fimc_ctx *ctx = file->private_data; |
| 1023 | 1035 | ||
| 1024 | ctx_m2m_get_frame(frame, ctx, cr->type); | 1036 | frame = ctx_m2m_get_frame(ctx, cr->type); |
| 1037 | if (IS_ERR(frame)) | ||
| 1038 | return PTR_ERR(frame); | ||
| 1025 | 1039 | ||
| 1026 | cr->c.left = frame->offs_h; | 1040 | cr->c.left = frame->offs_h; |
| 1027 | cr->c.top = frame->offs_v; | 1041 | 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 | return -EINVAL; | 1066 | return -EINVAL; |
| 1053 | } | 1067 | } |
| 1054 | 1068 | ||
| 1055 | ctx_m2m_get_frame(f, ctx, cr->type); | 1069 | f = ctx_m2m_get_frame(ctx, cr->type); |
| 1070 | if (IS_ERR(f)) | ||
| 1071 | return PTR_ERR(f); | ||
| 1056 | 1072 | ||
| 1057 | /* Adjust to required pixel boundary. */ | 1073 | /* Adjust to required pixel boundary. */ |
| 1058 | min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? | 1074 | min_size = (cr->type == V4L2_BUF_TYPE_VIDEO_OUTPUT) ? |
diff --git a/drivers/media/video/s5p-fimc/fimc-core.h b/drivers/media/video/s5p-fimc/fimc-core.h index f121b939626a..6b3e0cd73cdd 100644 --- a/drivers/media/video/s5p-fimc/fimc-core.h +++ b/drivers/media/video/s5p-fimc/fimc-core.h | |||
| @@ -28,18 +28,6 @@ | |||
| 28 | #define dbg(fmt, args...) | 28 | #define dbg(fmt, args...) |
| 29 | #endif | 29 | #endif |
| 30 | 30 | ||
| 31 | #define ctx_m2m_get_frame(frame, ctx, type) do { \ | ||
| 32 | if (V4L2_BUF_TYPE_VIDEO_OUTPUT == (type)) { \ | ||
| 33 | frame = &(ctx)->s_frame; \ | ||
| 34 | } else if (V4L2_BUF_TYPE_VIDEO_CAPTURE == (type)) { \ | ||
| 35 | frame = &(ctx)->d_frame; \ | ||
| 36 | } else { \ | ||
| 37 | v4l2_err(&(ctx)->fimc_dev->m2m.v4l2_dev,\ | ||
| 38 | "Wrong buffer/video queue type (%d)\n", type); \ | ||
| 39 | return -EINVAL; \ | ||
| 40 | } \ | ||
| 41 | } while (0) | ||
| 42 | |||
| 43 | #define NUM_FIMC_CLOCKS 2 | 31 | #define NUM_FIMC_CLOCKS 2 |
| 44 | #define MODULE_NAME "s5p-fimc" | 32 | #define MODULE_NAME "s5p-fimc" |
| 45 | #define FIMC_MAX_DEVS 3 | 33 | #define FIMC_MAX_DEVS 3 |
| @@ -444,6 +432,24 @@ static inline void fimc_hw_stop_in_dma(struct fimc_dev *dev) | |||
| 444 | writel(cfg, dev->regs + S5P_MSCTRL); | 432 | writel(cfg, dev->regs + S5P_MSCTRL); |
| 445 | } | 433 | } |
| 446 | 434 | ||
| 435 | static inline struct fimc_frame *ctx_m2m_get_frame(struct fimc_ctx *ctx, | ||
| 436 | enum v4l2_buf_type type) | ||
| 437 | { | ||
| 438 | struct fimc_frame *frame; | ||
| 439 | |||
| 440 | if (V4L2_BUF_TYPE_VIDEO_OUTPUT == type) { | ||
| 441 | frame = &ctx->s_frame; | ||
| 442 | } else if (V4L2_BUF_TYPE_VIDEO_CAPTURE == type) { | ||
| 443 | frame = &ctx->d_frame; | ||
| 444 | } else { | ||
| 445 | v4l2_err(&ctx->fimc_dev->m2m.v4l2_dev, | ||
| 446 | "Wrong buffer/video queue type (%d)\n", type); | ||
| 447 | return ERR_PTR(-EINVAL); | ||
| 448 | } | ||
| 449 | |||
| 450 | return frame; | ||
| 451 | } | ||
| 452 | |||
| 447 | /* -----------------------------------------------------*/ | 453 | /* -----------------------------------------------------*/ |
| 448 | /* fimc-reg.c */ | 454 | /* fimc-reg.c */ |
| 449 | void fimc_hw_reset(struct fimc_dev *dev); | 455 | void fimc_hw_reset(struct fimc_dev *dev); |
