media: fimc-is: constify local pointers to fimc_frame
authorKrzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Sun, 24 Dec 2023 11:49:16 +0000 (12:49 +0100)
committerHans Verkuil <hverkuil-cisco@xs4all.nl>
Mon, 22 Jan 2024 11:16:43 +0000 (12:16 +0100)
Constify the local variables pointing to "struct fimc_frame" to annotate
the function is not modifying pointed data.

Signed-off-by: Krzysztof Kozlowski <krzysztof.kozlowski@linaro.org>
Signed-off-by: Hans Verkuil <hverkuil-cisco@xs4all.nl>
drivers/media/platform/samsung/exynos4-is/fimc-capture.c
drivers/media/platform/samsung/exynos4-is/fimc-core.c
drivers/media/platform/samsung/exynos4-is/fimc-m2m.c
drivers/media/platform/samsung/exynos4-is/fimc-reg.c

index 7c2bcd5be9339899f49a2bde0912d4a93f76658e..ffa4ea21387da39136d9dcfdb02a6a7cfe6edebc 100644 (file)
@@ -180,7 +180,7 @@ void fimc_capture_irq_handler(struct fimc_dev *fimc, int deq_buf)
        struct fimc_vid_cap *cap = &fimc->vid_cap;
        struct fimc_pipeline *p = to_fimc_pipeline(cap->ve.pipe);
        struct v4l2_subdev *csis = p->subdevs[IDX_CSIS];
-       struct fimc_frame *f = &cap->ctx->d_frame;
+       const struct fimc_frame *f = &cap->ctx->d_frame;
        struct fimc_vid_buffer *v_buf;
 
        if (test_and_clear_bit(ST_CAPT_SHUT, &fimc->state)) {
@@ -342,7 +342,7 @@ static int queue_setup(struct vb2_queue *vq,
                       unsigned int sizes[], struct device *alloc_devs[])
 {
        struct fimc_ctx *ctx = vq->drv_priv;
-       struct fimc_frame *frame = &ctx->d_frame;
+       const struct fimc_frame *frame = &ctx->d_frame;
        const struct fimc_fmt *fmt = frame->fmt;
        unsigned long wh = frame->f_width * frame->f_height;
        int i;
@@ -567,7 +567,7 @@ static const struct fimc_fmt *fimc_capture_try_format(struct fimc_ctx *ctx,
        struct fimc_dev *fimc = ctx->fimc_dev;
        const struct fimc_variant *var = fimc->variant;
        const struct fimc_pix_limit *pl = var->pix_limit;
-       struct fimc_frame *dst = &ctx->d_frame;
+       const struct fimc_frame *dst = &ctx->d_frame;
        u32 depth, min_w, max_w, min_h, align_h = 3;
        const struct fimc_fmt *ffmt;
        u32 mask = FMT_FLAGS_CAM;
@@ -644,7 +644,7 @@ static void fimc_capture_try_selection(struct fimc_ctx *ctx,
        struct fimc_dev *fimc = ctx->fimc_dev;
        const struct fimc_variant *var = fimc->variant;
        const struct fimc_pix_limit *pl = var->pix_limit;
-       struct fimc_frame *sink = &ctx->s_frame;
+       const struct fimc_frame *sink = &ctx->s_frame;
        u32 max_w, max_h, min_w = 0, min_h = 0, min_sz;
        u32 align_sz = 0, align_h = 4;
        u32 max_sc_h, max_sc_v;
@@ -1132,7 +1132,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
 
                /* Don't call FIMC subdev operation to avoid nested locking */
                if (sd == &vc->subdev) {
-                       struct fimc_frame *ff = &vc->ctx->s_frame;
+                       const struct fimc_frame *ff = &vc->ctx->s_frame;
                        sink_fmt.format.width = ff->f_width;
                        sink_fmt.format.height = ff->f_height;
                        sink_fmt.format.code = ff->fmt ? ff->fmt->mbus_code : 0;
@@ -1158,7 +1158,7 @@ static int fimc_pipeline_validate(struct fimc_dev *fimc)
                if (sd == p->subdevs[IDX_SENSOR] &&
                    fimc_user_defined_mbus_fmt(src_fmt.format.code)) {
                        struct v4l2_plane_pix_format plane_fmt[FIMC_MAX_PLANES];
-                       struct fimc_frame *frame = &vc->ctx->d_frame;
+                       const struct fimc_frame *frame = &vc->ctx->d_frame;
                        unsigned int i;
 
                        ret = fimc_get_sensor_frame_desc(sd, plane_fmt,
@@ -1263,7 +1263,7 @@ static int fimc_cap_g_selection(struct file *file, void *fh,
 {
        struct fimc_dev *fimc = video_drvdata(file);
        struct fimc_ctx *ctx = fimc->vid_cap.ctx;
-       struct fimc_frame *f = &ctx->s_frame;
+       const struct fimc_frame *f = &ctx->s_frame;
 
        if (s->type != V4L2_BUF_TYPE_VIDEO_CAPTURE)
                return -EINVAL;
@@ -1475,7 +1475,7 @@ static int fimc_subdev_get_fmt(struct v4l2_subdev *sd,
 {
        struct fimc_dev *fimc = v4l2_get_subdevdata(sd);
        struct fimc_ctx *ctx = fimc->vid_cap.ctx;
-       struct fimc_frame *ff = &ctx->s_frame;
+       const struct fimc_frame *ff = &ctx->s_frame;
        struct v4l2_mbus_framefmt *mf;
 
        if (fmt->which == V4L2_SUBDEV_FORMAT_TRY) {
@@ -1582,7 +1582,7 @@ static int fimc_subdev_get_selection(struct v4l2_subdev *sd,
 {
        struct fimc_dev *fimc = v4l2_get_subdevdata(sd);
        struct fimc_ctx *ctx = fimc->vid_cap.ctx;
-       struct fimc_frame *f = &ctx->s_frame;
+       const struct fimc_frame *f = &ctx->s_frame;
        struct v4l2_rect *r = &sel->r;
        struct v4l2_rect *try_sel;
 
index 2a881bc770cf7b614a2b5a6bb7e81532f76a488b..aae74b501a42d2d1591d65b1820f02696f409223 100644 (file)
@@ -228,8 +228,8 @@ int fimc_set_scaler_info(struct fimc_ctx *ctx)
        const struct fimc_variant *variant = ctx->fimc_dev->variant;
        struct device *dev = &ctx->fimc_dev->pdev->dev;
        struct fimc_scaler *sc = &ctx->scaler;
-       struct fimc_frame *s_frame = &ctx->s_frame;
-       struct fimc_frame *d_frame = &ctx->d_frame;
+       const struct fimc_frame *s_frame = &ctx->s_frame;
+       const struct fimc_frame *d_frame = &ctx->d_frame;
        int tx, ty, sx, sy;
        int ret;
 
index e5829a457f3db531f094f2713bf7e73f44014f29..199997eec1cc25bbc3872c960e323128fac430d2 100644 (file)
@@ -170,7 +170,7 @@ static int fimc_queue_setup(struct vb2_queue *vq,
                            unsigned int sizes[], struct device *alloc_devs[])
 {
        struct fimc_ctx *ctx = vb2_get_drv_priv(vq);
-       struct fimc_frame *f;
+       const struct fimc_frame *f;
        int i;
 
        f = ctx_get_frame(ctx, vq->type);
@@ -192,7 +192,7 @@ static int fimc_queue_setup(struct vb2_queue *vq,
 static int fimc_buf_prepare(struct vb2_buffer *vb)
 {
        struct fimc_ctx *ctx = vb2_get_drv_priv(vb->vb2_queue);
-       struct fimc_frame *frame;
+       const struct fimc_frame *frame;
        int i;
 
        frame = ctx_get_frame(ctx, vb->vb2_queue->type);
@@ -252,7 +252,7 @@ static int fimc_m2m_g_fmt_mplane(struct file *file, void *fh,
                                 struct v4l2_format *f)
 {
        struct fimc_ctx *ctx = fh_to_ctx(fh);
-       struct fimc_frame *frame = ctx_get_frame(ctx, f->type);
+       const struct fimc_frame *frame = ctx_get_frame(ctx, f->type);
 
        if (IS_ERR(frame))
                return PTR_ERR(frame);
@@ -379,7 +379,7 @@ static int fimc_m2m_g_selection(struct file *file, void *fh,
                                struct v4l2_selection *s)
 {
        struct fimc_ctx *ctx = fh_to_ctx(fh);
-       struct fimc_frame *frame;
+       const struct fimc_frame *frame;
 
        frame = ctx_get_frame(ctx, s->type);
        if (IS_ERR(frame))
@@ -429,7 +429,7 @@ static int fimc_m2m_try_selection(struct fimc_ctx *ctx,
                                  struct v4l2_selection *s)
 {
        struct fimc_dev *fimc = ctx->fimc_dev;
-       struct fimc_frame *f;
+       const struct fimc_frame *f;
        u32 min_size, halign, depth = 0;
        int i;
 
index edff6e5179cf1484b453ca3bec811deb6ecf6753..b4ee39e471e71bfecbd05c8bf51f540de6ed75ce 100644 (file)
@@ -105,7 +105,7 @@ void fimc_hw_set_target_format(struct fimc_ctx *ctx)
 {
        u32 cfg;
        struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_frame *frame = &ctx->d_frame;
+       const struct fimc_frame *frame = &ctx->d_frame;
 
        dbg("w= %d, h= %d color: %d", frame->width,
            frame->height, frame->fmt->color);
@@ -147,7 +147,7 @@ void fimc_hw_set_target_format(struct fimc_ctx *ctx)
 static void fimc_hw_set_out_dma_size(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_frame *frame = &ctx->d_frame;
+       const struct fimc_frame *frame = &ctx->d_frame;
        u32 cfg;
 
        cfg = (frame->f_height << 16) | frame->f_width;
@@ -166,7 +166,7 @@ static void fimc_hw_set_out_dma_size(struct fimc_ctx *ctx)
 void fimc_hw_set_out_dma(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_frame *frame = &ctx->d_frame;
+       const struct fimc_frame *frame = &ctx->d_frame;
        const struct fimc_dma_offset *offset = &frame->dma_offset;
        const struct fimc_fmt *fmt = frame->fmt;
        u32 cfg;
@@ -248,8 +248,8 @@ static void fimc_hw_set_scaler(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
        struct fimc_scaler *sc = &ctx->scaler;
-       struct fimc_frame *src_frame = &ctx->s_frame;
-       struct fimc_frame *dst_frame = &ctx->d_frame;
+       const struct fimc_frame *src_frame = &ctx->s_frame;
+       const struct fimc_frame *dst_frame = &ctx->d_frame;
 
        u32 cfg = readl(dev->regs + FIMC_REG_CISCCTRL);
 
@@ -388,7 +388,7 @@ void fimc_hw_set_effect(struct fimc_ctx *ctx)
 void fimc_hw_set_rgb_alpha(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_frame *frame = &ctx->d_frame;
+       const struct fimc_frame *frame = &ctx->d_frame;
        u32 cfg;
 
        if (!(frame->fmt->flags & FMT_HAS_ALPHA))
@@ -403,7 +403,7 @@ void fimc_hw_set_rgb_alpha(struct fimc_ctx *ctx)
 static void fimc_hw_set_in_dma_size(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_frame *frame = &ctx->s_frame;
+       const struct fimc_frame *frame = &ctx->s_frame;
        u32 cfg_o = 0;
        u32 cfg_r = 0;
 
@@ -420,7 +420,7 @@ static void fimc_hw_set_in_dma_size(struct fimc_ctx *ctx)
 void fimc_hw_set_in_dma(struct fimc_ctx *ctx)
 {
        struct fimc_dev *dev = ctx->fimc_dev;
-       struct fimc_frame *frame = &ctx->s_frame;
+       const struct fimc_frame *frame = &ctx->s_frame;
        const struct fimc_dma_offset *offset = &frame->dma_offset;
        u32 cfg;
 
@@ -599,7 +599,7 @@ int fimc_hw_set_camera_source(struct fimc_dev *fimc,
                              struct fimc_source_info *source)
 {
        const struct fimc_vid_cap *vc = &fimc->vid_cap;
-       struct fimc_frame *f = &vc->ctx->s_frame;
+       const struct fimc_frame *f = &vc->ctx->s_frame;
        u32 bus_width, cfg = 0;
        int i;