Commit 513521eaee4375a1a0da0b73c7131a165a9fe4d9

Authored by Hans Verkuil
Committed by Mauro Carvalho Chehab
1 parent 6d6a48e51f

[media] v4l2-ctrls: use const char * const * for the menu arrays

This prevents checkpatch warnings generated when defining
'static const char *foo[]' arrays. It makes sense to use
const char * const * anyway since the pointers in the array
are indeed const.

Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: Mauro Carvalho Chehab <mchehab@redhat.com>

Showing 9 changed files with 41 additions and 41 deletions Side-by-side Diff

drivers/media/video/cx18/cx18-controls.c
... ... @@ -108,7 +108,7 @@
108 108 struct v4l2_ext_control *vctrl)
109 109 {
110 110 struct v4l2_queryctrl qctrl;
111   - const char **menu_items = NULL;
  111 + const char * const *menu_items = NULL;
112 112 int err;
113 113  
114 114 qctrl.id = vctrl->id;
drivers/media/video/cx2341x.c
... ... @@ -853,9 +853,9 @@
853 853 }
854 854 EXPORT_SYMBOL(cx2341x_ctrl_query);
855 855  
856   -const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
  856 +const char * const *cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
857 857 {
858   - static const char *mpeg_stream_type_without_ts[] = {
  858 + static const char * const mpeg_stream_type_without_ts[] = {
859 859 "MPEG-2 Program Stream",
860 860 "",
861 861 "MPEG-1 System Stream",
... ... @@ -952,7 +952,7 @@
952 952 for (i = 0; i < ctrls->count; i++) {
953 953 struct v4l2_ext_control *ctrl = ctrls->controls + i;
954 954 struct v4l2_queryctrl qctrl;
955   - const char **menu_items = NULL;
  955 + const char * const *menu_items = NULL;
956 956  
957 957 qctrl.id = ctrl->id;
958 958 err = cx2341x_ctrl_query(params, &qctrl);
... ... @@ -1135,7 +1135,7 @@
1135 1135  
1136 1136 static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id)
1137 1137 {
1138   - const char **menu = cx2341x_ctrl_get_menu(p, id);
  1138 + const char * const *menu = cx2341x_ctrl_get_menu(p, id);
1139 1139 struct v4l2_ext_control ctrl;
1140 1140  
1141 1141 if (menu == NULL)
drivers/media/video/pvrusb2/pvrusb2-ctrl.c
... ... @@ -203,7 +203,7 @@
203 203 *blen = 0;
204 204 LOCK_TAKE(cptr->hdw->big_lock); do {
205 205 if (cptr->info->type == pvr2_ctl_enum) {
206   - const char **names;
  206 + const char * const *names;
207 207 names = cptr->info->def.type_enum.value_names;
208 208 if (pvr2_ctrl_range_check(cptr,val) == 0) {
209 209 if (names[val]) {
... ... @@ -367,7 +367,7 @@
367 367  
368 368 static int parse_token(const char *ptr,unsigned int len,
369 369 int *valptr,
370   - const char **names,unsigned int namecnt)
  370 + const char * const *names, unsigned int namecnt)
371 371 {
372 372 char buf[33];
373 373 unsigned int slen;
... ... @@ -559,7 +559,7 @@
559 559 *len = scnprintf(buf,maxlen,"%s",val ? "true" : "false");
560 560 ret = 0;
561 561 } else if (cptr->info->type == pvr2_ctl_enum) {
562   - const char **names;
  562 + const char * const *names;
563 563 names = cptr->info->def.type_enum.value_names;
564 564 if ((val >= 0) &&
565 565 (val < cptr->info->def.type_enum.count)) {
drivers/media/video/pvrusb2/pvrusb2-hdw-internal.h
... ... @@ -115,7 +115,7 @@
115 115 } type_int;
116 116 struct { /* enumerated control */
117 117 unsigned int count; /* enum value count */
118   - const char **value_names; /* symbol names */
  118 + const char * const *value_names; /* symbol names */
119 119 } type_enum;
120 120 struct { /* bitmask control */
121 121 unsigned int valid_bits; /* bits in use */
drivers/media/video/v4l2-common.c
... ... @@ -150,7 +150,7 @@
150 150 struct v4l2_queryctrl and the available menu items. Note that
151 151 menu_items may be NULL, in that case it is ignored. */
152 152 int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
153   - const char **menu_items)
  153 + const char * const *menu_items)
154 154 {
155 155 if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED)
156 156 return -EINVAL;
... ... @@ -199,7 +199,7 @@
199 199 If menu_items is NULL, then the menu items are retrieved using
200 200 v4l2_ctrl_get_menu. */
201 201 int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl,
202   - const char **menu_items)
  202 + const char * const *menu_items)
203 203 {
204 204 int i;
205 205  
... ... @@ -222,7 +222,7 @@
222 222 Use this if there are 'holes' in the list of valid menu items. */
223 223 int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids)
224 224 {
225   - const char **menu_items = v4l2_ctrl_get_menu(qmenu->id);
  225 + const char * const *menu_items = v4l2_ctrl_get_menu(qmenu->id);
226 226  
227 227 qmenu->reserved = 0;
228 228 if (menu_items == NULL || ids == NULL)
drivers/media/video/v4l2-ctrls.c
... ... @@ -38,15 +38,15 @@
38 38 the given control ID. The pointer array ends with a NULL pointer.
39 39 An empty string signifies a menu entry that is invalid. This allows
40 40 drivers to disable certain options if it is not supported. */
41   -const char **v4l2_ctrl_get_menu(u32 id)
  41 +const char * const *v4l2_ctrl_get_menu(u32 id)
42 42 {
43   - static const char *mpeg_audio_sampling_freq[] = {
  43 + static const char * const mpeg_audio_sampling_freq[] = {
44 44 "44.1 kHz",
45 45 "48 kHz",
46 46 "32 kHz",
47 47 NULL
48 48 };
49   - static const char *mpeg_audio_encoding[] = {
  49 + static const char * const mpeg_audio_encoding[] = {
50 50 "MPEG-1/2 Layer I",
51 51 "MPEG-1/2 Layer II",
52 52 "MPEG-1/2 Layer III",
... ... @@ -54,7 +54,7 @@
54 54 "AC-3",
55 55 NULL
56 56 };
57   - static const char *mpeg_audio_l1_bitrate[] = {
  57 + static const char * const mpeg_audio_l1_bitrate[] = {
58 58 "32 kbps",
59 59 "64 kbps",
60 60 "96 kbps",
... ... @@ -71,7 +71,7 @@
71 71 "448 kbps",
72 72 NULL
73 73 };
74   - static const char *mpeg_audio_l2_bitrate[] = {
  74 + static const char * const mpeg_audio_l2_bitrate[] = {
75 75 "32 kbps",
76 76 "48 kbps",
77 77 "56 kbps",
... ... @@ -88,7 +88,7 @@
88 88 "384 kbps",
89 89 NULL
90 90 };
91   - static const char *mpeg_audio_l3_bitrate[] = {
  91 + static const char * const mpeg_audio_l3_bitrate[] = {
92 92 "32 kbps",
93 93 "40 kbps",
94 94 "48 kbps",
... ... @@ -105,7 +105,7 @@
105 105 "320 kbps",
106 106 NULL
107 107 };
108   - static const char *mpeg_audio_ac3_bitrate[] = {
  108 + static const char * const mpeg_audio_ac3_bitrate[] = {
109 109 "32 kbps",
110 110 "40 kbps",
111 111 "48 kbps",
112 112  
113 113  
114 114  
115 115  
116 116  
117 117  
118 118  
... ... @@ -127,50 +127,50 @@
127 127 "640 kbps",
128 128 NULL
129 129 };
130   - static const char *mpeg_audio_mode[] = {
  130 + static const char * const mpeg_audio_mode[] = {
131 131 "Stereo",
132 132 "Joint Stereo",
133 133 "Dual",
134 134 "Mono",
135 135 NULL
136 136 };
137   - static const char *mpeg_audio_mode_extension[] = {
  137 + static const char * const mpeg_audio_mode_extension[] = {
138 138 "Bound 4",
139 139 "Bound 8",
140 140 "Bound 12",
141 141 "Bound 16",
142 142 NULL
143 143 };
144   - static const char *mpeg_audio_emphasis[] = {
  144 + static const char * const mpeg_audio_emphasis[] = {
145 145 "No Emphasis",
146 146 "50/15 us",
147 147 "CCITT J17",
148 148 NULL
149 149 };
150   - static const char *mpeg_audio_crc[] = {
  150 + static const char * const mpeg_audio_crc[] = {
151 151 "No CRC",
152 152 "16-bit CRC",
153 153 NULL
154 154 };
155   - static const char *mpeg_video_encoding[] = {
  155 + static const char * const mpeg_video_encoding[] = {
156 156 "MPEG-1",
157 157 "MPEG-2",
158 158 "MPEG-4 AVC",
159 159 NULL
160 160 };
161   - static const char *mpeg_video_aspect[] = {
  161 + static const char * const mpeg_video_aspect[] = {
162 162 "1x1",
163 163 "4x3",
164 164 "16x9",
165 165 "2.21x1",
166 166 NULL
167 167 };
168   - static const char *mpeg_video_bitrate_mode[] = {
  168 + static const char * const mpeg_video_bitrate_mode[] = {
169 169 "Variable Bitrate",
170 170 "Constant Bitrate",
171 171 NULL
172 172 };
173   - static const char *mpeg_stream_type[] = {
  173 + static const char * const mpeg_stream_type[] = {
174 174 "MPEG-2 Program Stream",
175 175 "MPEG-2 Transport Stream",
176 176 "MPEG-1 System Stream",
177 177  
178 178  
179 179  
... ... @@ -179,25 +179,25 @@
179 179 "MPEG-2 SVCD-compatible Stream",
180 180 NULL
181 181 };
182   - static const char *mpeg_stream_vbi_fmt[] = {
  182 + static const char * const mpeg_stream_vbi_fmt[] = {
183 183 "No VBI",
184 184 "Private packet, IVTV format",
185 185 NULL
186 186 };
187   - static const char *camera_power_line_frequency[] = {
  187 + static const char * const camera_power_line_frequency[] = {
188 188 "Disabled",
189 189 "50 Hz",
190 190 "60 Hz",
191 191 NULL
192 192 };
193   - static const char *camera_exposure_auto[] = {
  193 + static const char * const camera_exposure_auto[] = {
194 194 "Auto Mode",
195 195 "Manual Mode",
196 196 "Shutter Priority Mode",
197 197 "Aperture Priority Mode",
198 198 NULL
199 199 };
200   - static const char *colorfx[] = {
  200 + static const char * const colorfx[] = {
201 201 "None",
202 202 "Black & White",
203 203 "Sepia",
... ... @@ -210,7 +210,7 @@
210 210 "Vivid",
211 211 NULL
212 212 };
213   - static const char *tune_preemphasis[] = {
  213 + static const char * const tune_preemphasis[] = {
214 214 "No preemphasis",
215 215 "50 useconds",
216 216 "75 useconds",
... ... @@ -952,7 +952,7 @@
952 952 const struct v4l2_ctrl_ops *ops,
953 953 u32 id, const char *name, enum v4l2_ctrl_type type,
954 954 s32 min, s32 max, u32 step, s32 def,
955   - u32 flags, const char **qmenu, void *priv)
  955 + u32 flags, const char * const *qmenu, void *priv)
956 956 {
957 957 struct v4l2_ctrl *ctrl;
958 958 unsigned sz_extra = 0;
... ... @@ -1019,7 +1019,7 @@
1019 1019 bool is_menu;
1020 1020 struct v4l2_ctrl *ctrl;
1021 1021 const char *name = cfg->name;
1022   - const char **qmenu = cfg->qmenu;
  1022 + const char * const *qmenu = cfg->qmenu;
1023 1023 enum v4l2_ctrl_type type = cfg->type;
1024 1024 u32 flags = cfg->flags;
1025 1025 s32 min = cfg->min;
... ... @@ -1075,7 +1075,7 @@
1075 1075 const struct v4l2_ctrl_ops *ops,
1076 1076 u32 id, s32 max, s32 mask, s32 def)
1077 1077 {
1078   - const char **qmenu = v4l2_ctrl_get_menu(id);
  1078 + const char * const *qmenu = v4l2_ctrl_get_menu(id);
1079 1079 const char *name;
1080 1080 enum v4l2_ctrl_type type;
1081 1081 s32 min;
include/media/cx2341x.h
... ... @@ -95,7 +95,7 @@
95 95 const struct cx2341x_mpeg_params *new);
96 96 int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
97 97 struct v4l2_queryctrl *qctrl);
98   -const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id);
  98 +const char * const *cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id);
99 99 int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
100 100 struct v4l2_ext_controls *ctrls, unsigned int cmd);
101 101 void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
include/media/v4l2-common.h
... ... @@ -98,12 +98,12 @@
98 98 /* Control helper functions */
99 99  
100 100 int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
101   - const char **menu_items);
  101 + const char * const *menu_items);
102 102 const char *v4l2_ctrl_get_name(u32 id);
103   -const char **v4l2_ctrl_get_menu(u32 id);
  103 +const char * const *v4l2_ctrl_get_menu(u32 id);
104 104 int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
105 105 int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
106   - struct v4l2_queryctrl *qctrl, const char **menu_items);
  106 + struct v4l2_queryctrl *qctrl, const char * const *menu_items);
107 107 #define V4L2_CTRL_MENU_IDS_END (0xffffffff)
108 108 int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
109 109  
include/media/v4l2-ctrls.h
... ... @@ -112,7 +112,7 @@
112 112 u32 step;
113 113 u32 menu_skip_mask;
114 114 };
115   - const char **qmenu;
  115 + const char * const *qmenu;
116 116 unsigned long flags;
117 117 union {
118 118 s32 val;
... ... @@ -202,7 +202,7 @@
202 202 s32 def;
203 203 u32 flags;
204 204 u32 menu_skip_mask;
205   - const char **qmenu;
  205 + const char * const *qmenu;
206 206 unsigned int is_private:1;
207 207 unsigned int is_volatile:1;
208 208 };