c1e5bb355b55eea3d8b3331a2114e28c0ad6881b
[oweals/openwrt.git] /
1 From 8c420772ef0f15ebbc3f13ebcc340d34bbdfad71 Mon Sep 17 00:00:00 2001
2 From: Dave Stevenson <dave.stevenson@raspberrypi.org>
3 Date: Thu, 24 Jan 2019 16:20:38 +0000
4 Subject: [PATCH] staging: bcm2835-camera: Correct ctrl
5  min/max/step/def to 64bit
6
7 The V4L2 control API was expanded to take 64 bit values in commit
8 0ba2aeb6dab (Apr 16 2014), but as this driver wasn't in the mainline
9 kernel at that point this was overlooked.
10
11 Update to use 64 bit values. This also fixes a couple of warnings
12 in 64 bit builds.
13
14 Signed-off-by: Dave Stevenson <dave.stevenson@raspberrypi.org>
15 ---
16  .../vc04_services/bcm2835-camera/controls.c        | 14 +++++++-------
17  1 file changed, 7 insertions(+), 7 deletions(-)
18
19 --- a/drivers/staging/vc04_services/bcm2835-camera/controls.c
20 +++ b/drivers/staging/vc04_services/bcm2835-camera/controls.c
21 @@ -78,10 +78,10 @@ struct bm2835_mmal_v4l2_ctrl {
22         /* control minimum value or
23          * mask for MMAL_CONTROL_TYPE_STD_MENU
24          */
25 -       s32 min;
26 -       s32 max; /* maximum value of control */
27 -       s32 def;  /* default value of control */
28 -       s32 step; /* step size of the control */
29 +       s64 min;
30 +       s64 max; /* maximum value of control */
31 +       s64 def;  /* default value of control */
32 +       u64 step; /* step size of the control */
33         const s64 *imenu; /* integer menu array */
34         u32 mmal_id; /* mmal parameter id */
35         bm2835_mmal_v4l2_ctrl_cb *setter;
36 @@ -1244,7 +1244,7 @@ int bm2835_mmal_init_controls(struct bm2
37  
38                 case MMAL_CONTROL_TYPE_STD_MENU:
39                 {
40 -                       int mask = ctrl->min;
41 +                       u64 mask = ctrl->min;
42  
43                         if (ctrl->id == V4L2_CID_SCENE_MODE) {
44                                 /* Special handling to work out the mask
45 @@ -1254,11 +1254,11 @@ int bm2835_mmal_init_controls(struct bm2
46                                  */
47                                 int i;
48  
49 -                               mask = 1 << V4L2_SCENE_MODE_NONE;
50 +                               mask = BIT(V4L2_SCENE_MODE_NONE);
51                                 for (i = 0;
52                                      i < ARRAY_SIZE(scene_configs);
53                                      i++) {
54 -                                       mask |= 1 << scene_configs[i].v4l2_scene;
55 +                                       mask |= BIT(scene_configs[i].v4l2_scene);
56                                 }
57                                 mask = ~mask;
58                         }