summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--linux/drivers/media/video/v4l2-common.c132
-rw-r--r--linux/include/media/v4l2-common.h3
2 files changed, 71 insertions, 64 deletions
diff --git a/linux/drivers/media/video/v4l2-common.c b/linux/drivers/media/video/v4l2-common.c
index 5f4094f21..eb6286bc4 100644
--- a/linux/drivers/media/video/v4l2-common.c
+++ b/linux/drivers/media/video/v4l2-common.c
@@ -456,11 +456,13 @@ static const char *v4l2_int_ioctls[] = {
#define V4L2_INT_IOCTLS ARRAY_SIZE(v4l2_int_ioctls)
#if 0
-static void v4l_print_pix_fmt (char *s, struct v4l2_pix_format *fmt)
+static void v4l_print_pix_fmt(const char *s, const struct v4l2_pix_format *fmt)
{
- printk ("%s: width=%d, height=%d, format=%d, field=%s, "
- "bytesperline=%d sizeimage=%d, colorspace=%d\n", s,
- fmt->width,fmt->height,fmt->pixelformat,
+ printk ("%s: width=%d, height=%d, format=%c%c%c%c, field=%s, "
+ "bytesperline=%d, sizeimage=%d, colorspace=%d\n", s,
+ fmt->width,fmt->height,
+ fmt->pixelformat&0xff, (fmt->pixelformat>>8)&0xff,
+ (fmt->pixelformat>>16)&0xff, (fmt->pixelformat>>24)&0xff,
prt_names(fmt->field,v4l2_field_names),
fmt->bytesperline,fmt->sizeimage,fmt->colorspace);
};
@@ -508,28 +510,28 @@ void v4l_printk_ioctl(unsigned int cmd)
/* Common ioctl debug function. This function can be used by
external ioctl messages as well as internal V4L ioctl and its
arguments */
-void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
+void v4l_printk_ioctl_arg(const char *s, unsigned int cmd, const void *arg)
{
- printk(s);
- printk(": ");
+ printk("%s: ", s);
v4l_printk_ioctl(cmd);
switch (cmd) {
- case VIDIOC_INT_G_CHIP_IDENT:
+ case VIDIOC_G_CHIP_IDENT:
{
- enum v4l2_chip_ident *p=arg;
- printk ("%s: chip ident=%d\n", s, *p);
+ const struct v4l2_chip_ident *p=arg;
+ printk("%s: chip_ident=%u, revision = 0x%x\n", s,
+ p->ident, p->revision);
break;
}
case VIDIOC_G_PRIORITY:
case VIDIOC_S_PRIORITY:
{
- enum v4l2_priority *p=arg;
+ const enum v4l2_priority *p=arg;
printk ("%s: priority=%d\n", s, *p);
break;
}
case VIDIOC_INT_S_TUNER_MODE:
{
- enum v4l2_tuner_type *p=arg;
+ const enum v4l2_tuner_type *p=arg;
printk ("%s: tuner type=%d\n", s, *p);
break;
}
@@ -559,7 +561,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_OVERLAY:
case VIDIOC_S_INPUT:
{
- int *p=arg;
+ const int *p=arg;
printk ("%s: value=%d\n", s, *p);
break;
}
@@ -570,7 +572,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_AUDIO_OLD:
#endif
{
- struct v4l2_audio *p=arg;
+ const struct v4l2_audio *p=arg;
printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n",
s,p->index, p->name,p->capability, p->mode);
@@ -583,7 +585,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_AUDOUT_OLD:
#endif
{
- struct v4l2_audioout *p=arg;
+ const struct v4l2_audioout *p=arg;
printk ("%s: index=%d, name=%s, capability=%d, mode=%d\n", s,
p->index, p->name, p->capability,p->mode);
break;
@@ -592,8 +594,8 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_DQBUF:
case VIDIOC_QUERYBUF:
{
- struct v4l2_buffer *p=arg;
- struct v4l2_timecode *tc=&p->timecode;
+ const struct v4l2_buffer *p=arg;
+ const struct v4l2_timecode *tc=&p->timecode;
printk ("%s: %02ld:%02d:%02d.%08ld index=%d, type=%s, "
"bytesused=%d, flags=0x%08x, "
"field=%0d, sequence=%d, memory=%s, offset/userptr=0x%08lx\n",
@@ -616,7 +618,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOC_QUERYCAP:
{
- struct v4l2_capability *p=arg;
+ const struct v4l2_capability *p=arg;
printk ("%s: driver=%s, card=%s, bus=%s, version=0x%08x, "
"capabilities=0x%08x\n", s,
p->driver,p->card,p->bus_info,
@@ -630,7 +632,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_S_CTRL_OLD:
#endif
{
- struct v4l2_control *p=arg;
+ const struct v4l2_control *p=arg;
printk ("%s: id=%d, value=%d\n", s, p->id, p->value);
break;
}
@@ -638,7 +640,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_S_EXT_CTRLS:
case VIDIOC_TRY_EXT_CTRLS:
{
- struct v4l2_ext_controls *p = arg;
+ const struct v4l2_ext_controls *p = arg;
int i;
printk("%s: ctrl_class=%d, count=%d\n", s, p->ctrl_class, p->count);
@@ -654,7 +656,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_CROP:
case VIDIOC_S_CROP:
{
- struct v4l2_crop *p=arg;
+ const struct v4l2_crop *p=arg;
/*FIXME: Should also show rect structs */
printk ("%s: type=%d\n", s, p->type);
break;
@@ -664,14 +666,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_CROPCAP_OLD:
#endif
{
- struct v4l2_cropcap *p=arg;
+ const struct v4l2_cropcap *p=arg;
/*FIXME: Should also show rect structs */
printk ("%s: type=%d\n", s, p->type);
break;
}
case VIDIOC_INT_DECODE_VBI_LINE:
{
- struct v4l2_decode_vbi_line *p=arg;
+ const struct v4l2_decode_vbi_line *p=arg;
printk ("%s: is_second_field=%d, ptr=0x%08lx, line=%d, "
"type=%d\n", s,
p->is_second_field,(unsigned long)p->p,p->line,p->type);
@@ -679,7 +681,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOC_ENUM_FMT:
{
- struct v4l2_fmtdesc *p=arg;
+ const struct v4l2_fmtdesc *p=arg;
printk ("%s: index=%d, type=%d, flags=%d, description=%s,"
" pixelformat=%d\n", s,
p->index, p->type, p->flags,p->description,
@@ -691,7 +693,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_S_FMT:
case VIDIOC_TRY_FMT:
{
- struct v4l2_format *p=arg;
+ const struct v4l2_format *p=arg;
printk ("%s: type=%s\n", s,
prt_names(p->type,v4l2_type_names));
switch (p->type) {
@@ -712,11 +714,12 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
default:
break;
}
+ break;
}
case VIDIOC_G_FBUF:
case VIDIOC_S_FBUF:
{
- struct v4l2_framebuffer *p=arg;
+ const struct v4l2_framebuffer *p=arg;
printk ("%s: capability=%d, flags=%d, base=0x%08lx\n", s,
p->capability,p->flags, (unsigned long)p->base);
v4l_print_pix_fmt (s, &p->fmt);
@@ -725,14 +728,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_FREQUENCY:
case VIDIOC_S_FREQUENCY:
{
- struct v4l2_frequency *p=arg;
+ const struct v4l2_frequency *p=arg;
printk ("%s: tuner=%d, type=%d, frequency=%d\n", s,
p->tuner,p->type,p->frequency);
break;
}
case VIDIOC_ENUMINPUT:
{
- struct v4l2_input *p=arg;
+ const struct v4l2_input *p=arg;
printk ("%s: index=%d, name=%s, type=%d, audioset=%d, "
"tuner=%d, std=%Ld, status=%d\n", s,
p->index,p->name,p->type,p->audioset,
@@ -744,7 +747,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_JPEGCOMP:
case VIDIOC_S_JPEGCOMP:
{
- struct v4l2_jpegcompression *p=arg;
+ const struct v4l2_jpegcompression *p=arg;
printk ("%s: quality=%d, APPn=%d, APP_len=%d, COM_len=%d,"
" jpeg_markers=%d\n", s,
p->quality,p->APPn,p->APP_len,
@@ -754,7 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_MODULATOR:
case VIDIOC_S_MODULATOR:
{
- struct v4l2_modulator *p=arg;
+ const struct v4l2_modulator *p=arg;
printk ("%s: index=%d, name=%s, capability=%d, rangelow=%d,"
" rangehigh=%d, txsubchans=%d\n", s,
p->index, p->name,p->capability,p->rangelow,
@@ -764,7 +767,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_MPEGCOMP:
case VIDIOC_S_MPEGCOMP:
{
- struct v4l2_mpeg_compression *p=arg;
+ const struct v4l2_mpeg_compression *p=arg;
/*FIXME: Several fields not shown */
printk ("%s: ts_pid_pmt=%d, ts_pid_audio=%d, ts_pid_video=%d, "
"ts_pid_pcr=%d, ps_size=%d, au_sample_rate=%d, "
@@ -779,7 +782,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOC_ENUMOUTPUT:
{
- struct v4l2_output *p=arg;
+ const struct v4l2_output *p=arg;
printk ("%s: index=%d, name=%s,type=%d, audioset=%d, "
"modulator=%d, std=%Ld\n",
s,p->index,p->name,p->type,p->audioset,
@@ -789,7 +792,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOC_QUERYCTRL:
{
- struct v4l2_queryctrl *p=arg;
+ const struct v4l2_queryctrl *p=arg;
printk ("%s: id=%d, type=%d, name=%s, min/max=%d/%d,"
" step=%d, default=%d, flags=0x%08x\n", s,
p->id,p->type,p->name,p->minimum,p->maximum,
@@ -798,7 +801,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOC_QUERYMENU:
{
- struct v4l2_querymenu *p=arg;
+ const struct v4l2_querymenu *p=arg;
printk ("%s: id=%d, index=%d, name=%s\n", s,
p->id,p->index,p->name);
break;
@@ -807,7 +810,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_DBG_G_REGISTER:
case VIDIOC_DBG_S_REGISTER:
{
- struct v4l2_register *p=arg;
+ const struct v4l2_register *p=arg;
printk ("%s: match_type=%d, match_chip=%d, reg=%llu, val=%llu\n", s,
p->match_type, p->match_chip,
(unsigned long long)p->reg, (unsigned long long)p->val);
@@ -817,7 +820,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
#endif
case VIDIOC_REQBUFS:
{
- struct v4l2_requestbuffers *p=arg;
+ const struct v4l2_requestbuffers *p=arg;
printk ("%s: count=%d, type=%s, memory=%s\n", s,
p->count,
prt_names(p->type,v4l2_type_names),
@@ -829,19 +832,19 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_INT_G_AUDIO_ROUTING:
case VIDIOC_INT_G_VIDEO_ROUTING:
{
- struct v4l2_routing *p=arg;
+ const struct v4l2_routing *p=arg;
printk ("%s: input=0x%x, output=0x%x\n", s, p->input, p->output);
break;
}
case VIDIOC_INT_S_CRYSTAL_FREQ:
{
- struct v4l2_crystal_freq *p=arg;
+ const struct v4l2_crystal_freq *p=arg;
printk ("%s: freq=%u, flags=0x%x\n", s, p->freq, p->flags);
break;
}
case VIDIOC_G_SLICED_VBI_CAP:
{
- struct v4l2_sliced_vbi_cap *p=arg;
+ const struct v4l2_sliced_vbi_cap *p=arg;
printk ("%s: service_set=%d\n", s,
p->service_set);
break;
@@ -849,14 +852,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_INT_S_VBI_DATA:
case VIDIOC_INT_G_VBI_DATA:
{
- struct v4l2_sliced_vbi_data *p=arg;
+ const struct v4l2_sliced_vbi_data *p=arg;
printk ("%s: id=%d, field=%d, line=%d\n", s,
p->id, p->field, p->line);
break;
}
case VIDIOC_ENUMSTD:
{
- struct v4l2_standard *p=arg;
+ const struct v4l2_standard *p=arg;
printk ("%s: index=%d, id=%Ld, name=%s, fps=%d/%d, "
"framelines=%d\n", s, p->index,
(unsigned long long)p->id, p->name,
@@ -872,7 +875,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_S_PARM_OLD:
#endif
{
- struct v4l2_streamparm *p=arg;
+ const struct v4l2_streamparm *p=arg;
printk ("%s: type=%d\n", s, p->type);
break;
@@ -880,7 +883,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_G_TUNER:
case VIDIOC_S_TUNER:
{
- struct v4l2_tuner *p=arg;
+ const struct v4l2_tuner *p=arg;
printk ("%s: index=%d, name=%s, type=%d, capability=%d, "
"rangelow=%d, rangehigh=%d, signal=%d, afc=%d, "
"rxsubchans=%d, audmode=%d\n", s,
@@ -894,7 +897,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGVBIFMT:
case VIDIOCSVBIFMT:
{
- struct vbi_format *p=arg;
+ const struct vbi_format *p=arg;
printk ("%s: sampling_rate=%d, samples_per_line=%d, "
"sample_format=%d, start=%d/%d, count=%d/%d, flags=%d\n", s,
p->sampling_rate,p->samples_per_line,
@@ -905,7 +908,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGAUDIO:
case VIDIOCSAUDIO:
{
- struct video_audio *p=arg;
+ const struct video_audio *p=arg;
printk ("%s: audio=%d, volume=%d, bass=%d, treble=%d, "
"flags=%d, name=%s, mode=%d, balance=%d, step=%d\n",
s,p->audio,p->volume,p->bass, p->treble,
@@ -915,7 +918,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGFBUF:
case VIDIOCSFBUF:
{
- struct video_buffer *p=arg;
+ const struct video_buffer *p=arg;
printk ("%s: base=%08lx, height=%d, width=%d, depth=%d, "
"bytesperline=%d\n", s,
(unsigned long) p->base, p->height, p->width,
@@ -924,7 +927,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOCGCAP:
{
- struct video_capability *p=arg;
+ const struct video_capability *p=arg;
printk ("%s: name=%s, type=%d, channels=%d, audios=%d, "
"maxwidth=%d, maxheight=%d, minwidth=%d, minheight=%d\n",
s,p->name,p->type,p->channels,p->audios,
@@ -936,7 +939,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGCAPTURE:
case VIDIOCSCAPTURE:
{
- struct video_capture *p=arg;
+ const struct video_capture *p=arg;
printk ("%s: x=%d, y=%d, width=%d, height=%d, decimation=%d,"
" flags=%d\n", s,
p->x, p->y,p->width, p->height,
@@ -946,7 +949,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGCHAN:
case VIDIOCSCHAN:
{
- struct video_channel *p=arg;
+ const struct video_channel *p=arg;
printk ("%s: channel=%d, name=%s, tuners=%d, flags=%d, "
"type=%d, norm=%d\n", s,
p->channel,p->name,p->tuners,
@@ -956,27 +959,27 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOCSMICROCODE:
{
- struct video_code *p=arg;
+ const struct video_code *p=arg;
printk ("%s: loadwhat=%s, datasize=%d\n", s,
p->loadwhat,p->datasize);
break;
}
case DECODER_GET_CAPABILITIES:
{
- struct video_decoder_capability *p=arg;
+ const struct video_decoder_capability *p=arg;
printk ("%s: flags=%d, inputs=%d, outputs=%d\n", s,
p->flags,p->inputs,p->outputs);
break;
}
case DECODER_INIT:
{
- struct video_decoder_init *p=arg;
+ const struct video_decoder_init *p=arg;
printk ("%s: len=%c\n", s, p->len);
break;
}
case VIDIOCGPLAYINFO:
{
- struct video_info *p=arg;
+ const struct video_info *p=arg;
printk ("%s: frame_count=%d, h_size=%d, v_size=%d, "
"smpte_timecode=%d, picture_type=%d, "
"temporal_reference=%d, user_data=%s\n", s,
@@ -988,14 +991,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOCKEY:
{
- struct video_key *p=arg;
+ const struct video_key *p=arg;
printk ("%s: key=%s, flags=%d\n", s,
p->key, p->flags);
break;
}
case VIDIOCGMBUF:
{
- struct video_mbuf *p=arg;
+ const struct video_mbuf *p=arg;
printk ("%s: size=%d, frames=%d, offsets=0x%08lx\n", s,
p->size,
p->frames,
@@ -1004,7 +1007,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOCMCAPTURE:
{
- struct video_mmap *p=arg;
+ const struct video_mmap *p=arg;
printk ("%s: frame=%d, height=%d, width=%d, format=%d\n", s,
p->frame,
p->height, p->width,
@@ -1015,7 +1018,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCSPICT:
case DECODER_SET_PICTURE:
{
- struct video_picture *p=arg;
+ const struct video_picture *p=arg;
printk ("%s: brightness=%d, hue=%d, colour=%d, contrast=%d,"
" whiteness=%d, depth=%d, palette=%d\n", s,
@@ -1026,7 +1029,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOCSPLAYMODE:
{
- struct video_play_mode *p=arg;
+ const struct video_play_mode *p=arg;
printk ("%s: mode=%d, p1=%d, p2=%d\n", s,
p->mode,p->p1,p->p2);
break;
@@ -1034,7 +1037,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGTUNER:
case VIDIOCSTUNER:
{
- struct video_tuner *p=arg;
+ const struct video_tuner *p=arg;
printk ("%s: tuner=%d, name=%s, rangelow=%ld, rangehigh=%ld, "
"flags=%d, mode=%d, signal=%d\n", s,
p->tuner, p->name,p->rangelow, p->rangehigh,
@@ -1043,7 +1046,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
}
case VIDIOCGUNIT:
{
- struct video_unit *p=arg;
+ const struct video_unit *p=arg;
printk ("%s: video=%d, vbi=%d, radio=%d, audio=%d, "
"teletext=%d\n", s,
p->video,p->vbi,p->radio,p->audio,p->teletext);
@@ -1052,7 +1055,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGWIN:
case VIDIOCSWIN:
{
- struct video_window *p=arg;
+ const struct video_window *p=arg;
printk ("%s: x=%d, y=%d, width=%d, height=%d, chromakey=%d,"
" flags=%d, clipcount=%d\n", s,
p->x, p->y,p->width, p->height,
@@ -1063,7 +1066,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCGFREQ:
case VIDIOCSFREQ:
{
- unsigned long *p=arg;
+ const unsigned long *p=arg;
printk ("%s: value=%lu\n", s, *p);
break;
}
@@ -1073,7 +1076,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_INT_S_STANDBY:
case VIDIOC_INT_RESET:
{
- u32 *p=arg;
+ const u32 *p=arg;
printk ("%s: value=%d\n", s, *p);
break;
@@ -1082,13 +1085,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOC_S_STD:
case VIDIOC_QUERYSTD:
{
- v4l2_std_id *p=arg;
+ const v4l2_std_id *p=arg;
printk ("%s: value=%Lu\n", s, (unsigned long long)*p);
break;
}
}
}
+EXPORT_SYMBOL(v4l_printk_ioctl_arg);
#endif /* 0 */
/* ----------------------------------------------------------------- */
diff --git a/linux/include/media/v4l2-common.h b/linux/include/media/v4l2-common.h
index 579835f92..3f6e53f72 100644
--- a/linux/include/media/v4l2-common.h
+++ b/linux/include/media/v4l2-common.h
@@ -69,6 +69,9 @@
/* Prints the ioctl in a human-readable format */
extern void v4l_printk_ioctl(unsigned int cmd);
+#if 0
+extern void v4l_printk_ioctl_arg(const char *s, unsigned int cmd, const void *arg);
+#endif
/* Use this macro for non-I2C drivers. Pass the driver name as the first arg. */
#define v4l_print_ioctl(name, cmd) \