Commit 513521ea authored by Hans Verkuil's avatar Hans Verkuil Committed by Mauro Carvalho Chehab

[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: default avatarHans Verkuil <hverkuil@xs4all.nl>
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@redhat.com>
parent 6d6a48e5
...@@ -108,7 +108,7 @@ static int cx18_try_ctrl(struct file *file, void *fh, ...@@ -108,7 +108,7 @@ static int cx18_try_ctrl(struct file *file, void *fh,
struct v4l2_ext_control *vctrl) struct v4l2_ext_control *vctrl)
{ {
struct v4l2_queryctrl qctrl; struct v4l2_queryctrl qctrl;
const char **menu_items = NULL; const char * const *menu_items = NULL;
int err; int err;
qctrl.id = vctrl->id; qctrl.id = vctrl->id;
......
...@@ -853,9 +853,9 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, ...@@ -853,9 +853,9 @@ int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
} }
EXPORT_SYMBOL(cx2341x_ctrl_query); EXPORT_SYMBOL(cx2341x_ctrl_query);
const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id) const char * const *cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id)
{ {
static const char *mpeg_stream_type_without_ts[] = { static const char * const mpeg_stream_type_without_ts[] = {
"MPEG-2 Program Stream", "MPEG-2 Program Stream",
"", "",
"MPEG-1 System Stream", "MPEG-1 System Stream",
...@@ -952,7 +952,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, ...@@ -952,7 +952,7 @@ int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
for (i = 0; i < ctrls->count; i++) { for (i = 0; i < ctrls->count; i++) {
struct v4l2_ext_control *ctrl = ctrls->controls + i; struct v4l2_ext_control *ctrl = ctrls->controls + i;
struct v4l2_queryctrl qctrl; struct v4l2_queryctrl qctrl;
const char **menu_items = NULL; const char * const *menu_items = NULL;
qctrl.id = ctrl->id; qctrl.id = ctrl->id;
err = cx2341x_ctrl_query(params, &qctrl); err = cx2341x_ctrl_query(params, &qctrl);
...@@ -1135,7 +1135,7 @@ EXPORT_SYMBOL(cx2341x_update); ...@@ -1135,7 +1135,7 @@ EXPORT_SYMBOL(cx2341x_update);
static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id) static const char *cx2341x_menu_item(const struct cx2341x_mpeg_params *p, u32 id)
{ {
const char **menu = cx2341x_ctrl_get_menu(p, id); const char * const *menu = cx2341x_ctrl_get_menu(p, id);
struct v4l2_ext_control ctrl; struct v4l2_ext_control ctrl;
if (menu == NULL) if (menu == NULL)
......
...@@ -203,7 +203,7 @@ int pvr2_ctrl_get_valname(struct pvr2_ctrl *cptr,int val, ...@@ -203,7 +203,7 @@ int pvr2_ctrl_get_valname(struct pvr2_ctrl *cptr,int val,
*blen = 0; *blen = 0;
LOCK_TAKE(cptr->hdw->big_lock); do { LOCK_TAKE(cptr->hdw->big_lock); do {
if (cptr->info->type == pvr2_ctl_enum) { if (cptr->info->type == pvr2_ctl_enum) {
const char **names; const char * const *names;
names = cptr->info->def.type_enum.value_names; names = cptr->info->def.type_enum.value_names;
if (pvr2_ctrl_range_check(cptr,val) == 0) { if (pvr2_ctrl_range_check(cptr,val) == 0) {
if (names[val]) { if (names[val]) {
...@@ -367,7 +367,7 @@ static const char *boolNames[] = { ...@@ -367,7 +367,7 @@ static const char *boolNames[] = {
static int parse_token(const char *ptr,unsigned int len, static int parse_token(const char *ptr,unsigned int len,
int *valptr, int *valptr,
const char **names,unsigned int namecnt) const char * const *names, unsigned int namecnt)
{ {
char buf[33]; char buf[33];
unsigned int slen; unsigned int slen;
...@@ -559,7 +559,7 @@ int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *cptr, ...@@ -559,7 +559,7 @@ int pvr2_ctrl_value_to_sym_internal(struct pvr2_ctrl *cptr,
*len = scnprintf(buf,maxlen,"%s",val ? "true" : "false"); *len = scnprintf(buf,maxlen,"%s",val ? "true" : "false");
ret = 0; ret = 0;
} else if (cptr->info->type == pvr2_ctl_enum) { } else if (cptr->info->type == pvr2_ctl_enum) {
const char **names; const char * const *names;
names = cptr->info->def.type_enum.value_names; names = cptr->info->def.type_enum.value_names;
if ((val >= 0) && if ((val >= 0) &&
(val < cptr->info->def.type_enum.count)) { (val < cptr->info->def.type_enum.count)) {
......
...@@ -115,7 +115,7 @@ struct pvr2_ctl_info { ...@@ -115,7 +115,7 @@ struct pvr2_ctl_info {
} type_int; } type_int;
struct { /* enumerated control */ struct { /* enumerated control */
unsigned int count; /* enum value count */ unsigned int count; /* enum value count */
const char **value_names; /* symbol names */ const char * const *value_names; /* symbol names */
} type_enum; } type_enum;
struct { /* bitmask control */ struct { /* bitmask control */
unsigned int valid_bits; /* bits in use */ unsigned int valid_bits; /* bits in use */
......
...@@ -150,7 +150,7 @@ EXPORT_SYMBOL(v4l2_prio_check); ...@@ -150,7 +150,7 @@ EXPORT_SYMBOL(v4l2_prio_check);
struct v4l2_queryctrl and the available menu items. Note that struct v4l2_queryctrl and the available menu items. Note that
menu_items may be NULL, in that case it is ignored. */ menu_items may be NULL, in that case it is ignored. */
int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
const char **menu_items) const char * const *menu_items)
{ {
if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED) if (qctrl->flags & V4L2_CTRL_FLAG_DISABLED)
return -EINVAL; return -EINVAL;
...@@ -199,7 +199,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_fill); ...@@ -199,7 +199,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_fill);
If menu_items is NULL, then the menu items are retrieved using If menu_items is NULL, then the menu items are retrieved using
v4l2_ctrl_get_menu. */ v4l2_ctrl_get_menu. */
int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl, int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, struct v4l2_queryctrl *qctrl,
const char **menu_items) const char * const *menu_items)
{ {
int i; int i;
...@@ -222,7 +222,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu); ...@@ -222,7 +222,7 @@ EXPORT_SYMBOL(v4l2_ctrl_query_menu);
Use this if there are 'holes' in the list of valid menu items. */ Use this if there are 'holes' in the list of valid menu items. */
int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids) int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids)
{ {
const char **menu_items = v4l2_ctrl_get_menu(qmenu->id); const char * const *menu_items = v4l2_ctrl_get_menu(qmenu->id);
qmenu->reserved = 0; qmenu->reserved = 0;
if (menu_items == NULL || ids == NULL) if (menu_items == NULL || ids == NULL)
......
...@@ -38,15 +38,15 @@ struct ctrl_helper { ...@@ -38,15 +38,15 @@ struct ctrl_helper {
the given control ID. The pointer array ends with a NULL pointer. the given control ID. The pointer array ends with a NULL pointer.
An empty string signifies a menu entry that is invalid. This allows An empty string signifies a menu entry that is invalid. This allows
drivers to disable certain options if it is not supported. */ drivers to disable certain options if it is not supported. */
const char **v4l2_ctrl_get_menu(u32 id) const char * const *v4l2_ctrl_get_menu(u32 id)
{ {
static const char *mpeg_audio_sampling_freq[] = { static const char * const mpeg_audio_sampling_freq[] = {
"44.1 kHz", "44.1 kHz",
"48 kHz", "48 kHz",
"32 kHz", "32 kHz",
NULL NULL
}; };
static const char *mpeg_audio_encoding[] = { static const char * const mpeg_audio_encoding[] = {
"MPEG-1/2 Layer I", "MPEG-1/2 Layer I",
"MPEG-1/2 Layer II", "MPEG-1/2 Layer II",
"MPEG-1/2 Layer III", "MPEG-1/2 Layer III",
...@@ -54,7 +54,7 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -54,7 +54,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
"AC-3", "AC-3",
NULL NULL
}; };
static const char *mpeg_audio_l1_bitrate[] = { static const char * const mpeg_audio_l1_bitrate[] = {
"32 kbps", "32 kbps",
"64 kbps", "64 kbps",
"96 kbps", "96 kbps",
...@@ -71,7 +71,7 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -71,7 +71,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
"448 kbps", "448 kbps",
NULL NULL
}; };
static const char *mpeg_audio_l2_bitrate[] = { static const char * const mpeg_audio_l2_bitrate[] = {
"32 kbps", "32 kbps",
"48 kbps", "48 kbps",
"56 kbps", "56 kbps",
...@@ -88,7 +88,7 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -88,7 +88,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
"384 kbps", "384 kbps",
NULL NULL
}; };
static const char *mpeg_audio_l3_bitrate[] = { static const char * const mpeg_audio_l3_bitrate[] = {
"32 kbps", "32 kbps",
"40 kbps", "40 kbps",
"48 kbps", "48 kbps",
...@@ -105,7 +105,7 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -105,7 +105,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
"320 kbps", "320 kbps",
NULL NULL
}; };
static const char *mpeg_audio_ac3_bitrate[] = { static const char * const mpeg_audio_ac3_bitrate[] = {
"32 kbps", "32 kbps",
"40 kbps", "40 kbps",
"48 kbps", "48 kbps",
...@@ -127,50 +127,50 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -127,50 +127,50 @@ const char **v4l2_ctrl_get_menu(u32 id)
"640 kbps", "640 kbps",
NULL NULL
}; };
static const char *mpeg_audio_mode[] = { static const char * const mpeg_audio_mode[] = {
"Stereo", "Stereo",
"Joint Stereo", "Joint Stereo",
"Dual", "Dual",
"Mono", "Mono",
NULL NULL
}; };
static const char *mpeg_audio_mode_extension[] = { static const char * const mpeg_audio_mode_extension[] = {
"Bound 4", "Bound 4",
"Bound 8", "Bound 8",
"Bound 12", "Bound 12",
"Bound 16", "Bound 16",
NULL NULL
}; };
static const char *mpeg_audio_emphasis[] = { static const char * const mpeg_audio_emphasis[] = {
"No Emphasis", "No Emphasis",
"50/15 us", "50/15 us",
"CCITT J17", "CCITT J17",
NULL NULL
}; };
static const char *mpeg_audio_crc[] = { static const char * const mpeg_audio_crc[] = {
"No CRC", "No CRC",
"16-bit CRC", "16-bit CRC",
NULL NULL
}; };
static const char *mpeg_video_encoding[] = { static const char * const mpeg_video_encoding[] = {
"MPEG-1", "MPEG-1",
"MPEG-2", "MPEG-2",
"MPEG-4 AVC", "MPEG-4 AVC",
NULL NULL
}; };
static const char *mpeg_video_aspect[] = { static const char * const mpeg_video_aspect[] = {
"1x1", "1x1",
"4x3", "4x3",
"16x9", "16x9",
"2.21x1", "2.21x1",
NULL NULL
}; };
static const char *mpeg_video_bitrate_mode[] = { static const char * const mpeg_video_bitrate_mode[] = {
"Variable Bitrate", "Variable Bitrate",
"Constant Bitrate", "Constant Bitrate",
NULL NULL
}; };
static const char *mpeg_stream_type[] = { static const char * const mpeg_stream_type[] = {
"MPEG-2 Program Stream", "MPEG-2 Program Stream",
"MPEG-2 Transport Stream", "MPEG-2 Transport Stream",
"MPEG-1 System Stream", "MPEG-1 System Stream",
...@@ -179,25 +179,25 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -179,25 +179,25 @@ const char **v4l2_ctrl_get_menu(u32 id)
"MPEG-2 SVCD-compatible Stream", "MPEG-2 SVCD-compatible Stream",
NULL NULL
}; };
static const char *mpeg_stream_vbi_fmt[] = { static const char * const mpeg_stream_vbi_fmt[] = {
"No VBI", "No VBI",
"Private packet, IVTV format", "Private packet, IVTV format",
NULL NULL
}; };
static const char *camera_power_line_frequency[] = { static const char * const camera_power_line_frequency[] = {
"Disabled", "Disabled",
"50 Hz", "50 Hz",
"60 Hz", "60 Hz",
NULL NULL
}; };
static const char *camera_exposure_auto[] = { static const char * const camera_exposure_auto[] = {
"Auto Mode", "Auto Mode",
"Manual Mode", "Manual Mode",
"Shutter Priority Mode", "Shutter Priority Mode",
"Aperture Priority Mode", "Aperture Priority Mode",
NULL NULL
}; };
static const char *colorfx[] = { static const char * const colorfx[] = {
"None", "None",
"Black & White", "Black & White",
"Sepia", "Sepia",
...@@ -210,7 +210,7 @@ const char **v4l2_ctrl_get_menu(u32 id) ...@@ -210,7 +210,7 @@ const char **v4l2_ctrl_get_menu(u32 id)
"Vivid", "Vivid",
NULL NULL
}; };
static const char *tune_preemphasis[] = { static const char * const tune_preemphasis[] = {
"No preemphasis", "No preemphasis",
"50 useconds", "50 useconds",
"75 useconds", "75 useconds",
...@@ -952,7 +952,7 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl, ...@@ -952,7 +952,7 @@ static struct v4l2_ctrl *v4l2_ctrl_new(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, const char *name, enum v4l2_ctrl_type type, u32 id, const char *name, enum v4l2_ctrl_type type,
s32 min, s32 max, u32 step, s32 def, s32 min, s32 max, u32 step, s32 def,
u32 flags, const char **qmenu, void *priv) u32 flags, const char * const *qmenu, void *priv)
{ {
struct v4l2_ctrl *ctrl; struct v4l2_ctrl *ctrl;
unsigned sz_extra = 0; unsigned sz_extra = 0;
...@@ -1019,7 +1019,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl, ...@@ -1019,7 +1019,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_custom(struct v4l2_ctrl_handler *hdl,
bool is_menu; bool is_menu;
struct v4l2_ctrl *ctrl; struct v4l2_ctrl *ctrl;
const char *name = cfg->name; const char *name = cfg->name;
const char **qmenu = cfg->qmenu; const char * const *qmenu = cfg->qmenu;
enum v4l2_ctrl_type type = cfg->type; enum v4l2_ctrl_type type = cfg->type;
u32 flags = cfg->flags; u32 flags = cfg->flags;
s32 min = cfg->min; s32 min = cfg->min;
...@@ -1075,7 +1075,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl, ...@@ -1075,7 +1075,7 @@ struct v4l2_ctrl *v4l2_ctrl_new_std_menu(struct v4l2_ctrl_handler *hdl,
const struct v4l2_ctrl_ops *ops, const struct v4l2_ctrl_ops *ops,
u32 id, s32 max, s32 mask, s32 def) u32 id, s32 max, s32 mask, s32 def)
{ {
const char **qmenu = v4l2_ctrl_get_menu(id); const char * const *qmenu = v4l2_ctrl_get_menu(id);
const char *name; const char *name;
enum v4l2_ctrl_type type; enum v4l2_ctrl_type type;
s32 min; s32 min;
......
...@@ -95,7 +95,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func, ...@@ -95,7 +95,7 @@ int cx2341x_update(void *priv, cx2341x_mbox_func func,
const struct cx2341x_mpeg_params *new); const struct cx2341x_mpeg_params *new);
int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params, int cx2341x_ctrl_query(const struct cx2341x_mpeg_params *params,
struct v4l2_queryctrl *qctrl); struct v4l2_queryctrl *qctrl);
const char **cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id); const char * const *cx2341x_ctrl_get_menu(const struct cx2341x_mpeg_params *p, u32 id);
int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy, int cx2341x_ext_ctrls(struct cx2341x_mpeg_params *params, int busy,
struct v4l2_ext_controls *ctrls, unsigned int cmd); struct v4l2_ext_controls *ctrls, unsigned int cmd);
void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p); void cx2341x_fill_defaults(struct cx2341x_mpeg_params *p);
......
...@@ -98,12 +98,12 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local); ...@@ -98,12 +98,12 @@ int v4l2_prio_check(struct v4l2_prio_state *global, enum v4l2_priority local);
/* Control helper functions */ /* Control helper functions */
int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl, int v4l2_ctrl_check(struct v4l2_ext_control *ctrl, struct v4l2_queryctrl *qctrl,
const char **menu_items); const char * const *menu_items);
const char *v4l2_ctrl_get_name(u32 id); const char *v4l2_ctrl_get_name(u32 id);
const char **v4l2_ctrl_get_menu(u32 id); const char * const *v4l2_ctrl_get_menu(u32 id);
int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def); int v4l2_ctrl_query_fill(struct v4l2_queryctrl *qctrl, s32 min, s32 max, s32 step, s32 def);
int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu, int v4l2_ctrl_query_menu(struct v4l2_querymenu *qmenu,
struct v4l2_queryctrl *qctrl, const char **menu_items); struct v4l2_queryctrl *qctrl, const char * const *menu_items);
#define V4L2_CTRL_MENU_IDS_END (0xffffffff) #define V4L2_CTRL_MENU_IDS_END (0xffffffff)
int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids); int v4l2_ctrl_query_menu_valid_items(struct v4l2_querymenu *qmenu, const u32 *ids);
......
...@@ -112,7 +112,7 @@ struct v4l2_ctrl { ...@@ -112,7 +112,7 @@ struct v4l2_ctrl {
u32 step; u32 step;
u32 menu_skip_mask; u32 menu_skip_mask;
}; };
const char **qmenu; const char * const *qmenu;
unsigned long flags; unsigned long flags;
union { union {
s32 val; s32 val;
...@@ -202,7 +202,7 @@ struct v4l2_ctrl_config { ...@@ -202,7 +202,7 @@ struct v4l2_ctrl_config {
s32 def; s32 def;
u32 flags; u32 flags;
u32 menu_skip_mask; u32 menu_skip_mask;
const char **qmenu; const char * const *qmenu;
unsigned int is_private:1; unsigned int is_private:1;
unsigned int is_volatile:1; unsigned int is_volatile:1;
}; };
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment