aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/media/video/ivtv/ivtv-ioctl.c
diff options
context:
space:
mode:
authorHans Verkuil <hverkuil@xs4all.nl>2008-06-25 05:00:17 -0400
committerMauro Carvalho Chehab <mchehab@infradead.org>2008-07-20 06:12:14 -0400
commit36ecd4955a5ebee6135e2bcc997712fad4ac9b69 (patch)
tree5dc74287b93145aa2cb20d051d057634c17435a2 /drivers/media/video/ivtv/ivtv-ioctl.c
parent1d0a436256dc1aecfad901bcd4432dac1cabe6b2 (diff)
V4L/DVB (8111): ivtv/cx18: fix compile error when CONFIG_VIDEO_ADV_DEBUG is not defined.
Thanks to Randy Dunlap for reporting this. Signed-off-by: Hans Verkuil <hverkuil@xs4all.nl> Signed-off-by: Mauro Carvalho Chehab <mchehab@infradead.org>
Diffstat (limited to 'drivers/media/video/ivtv/ivtv-ioctl.c')
-rw-r--r--drivers/media/video/ivtv/ivtv-ioctl.c59
1 files changed, 31 insertions, 28 deletions
diff --git a/drivers/media/video/ivtv/ivtv-ioctl.c b/drivers/media/video/ivtv/ivtv-ioctl.c
index 8d602cb6ba68..42443b42336d 100644
--- a/drivers/media/video/ivtv/ivtv-ioctl.c
+++ b/drivers/media/video/ivtv/ivtv-ioctl.c
@@ -314,34 +314,6 @@ static int ivtv_video_command(struct ivtv *itv, struct ivtv_open_id *id,
314 return 0; 314 return 0;
315} 315}
316 316
317static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
318{
319 struct v4l2_register *regs = arg;
320 unsigned long flags;
321 volatile u8 __iomem *reg_start;
322
323 if (!capable(CAP_SYS_ADMIN))
324 return -EPERM;
325 if (regs->reg >= IVTV_REG_OFFSET && regs->reg < IVTV_REG_OFFSET + IVTV_REG_SIZE)
326 reg_start = itv->reg_mem - IVTV_REG_OFFSET;
327 else if (itv->has_cx23415 && regs->reg >= IVTV_DECODER_OFFSET &&
328 regs->reg < IVTV_DECODER_OFFSET + IVTV_DECODER_SIZE)
329 reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
330 else if (regs->reg >= 0 && regs->reg < IVTV_ENCODER_SIZE)
331 reg_start = itv->enc_mem;
332 else
333 return -EINVAL;
334
335 spin_lock_irqsave(&ivtv_cards_lock, flags);
336 if (cmd == VIDIOC_DBG_G_REGISTER) {
337 regs->val = readl(regs->reg + reg_start);
338 } else {
339 writel(regs->val, regs->reg + reg_start);
340 }
341 spin_unlock_irqrestore(&ivtv_cards_lock, flags);
342 return 0;
343}
344
345static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_format *fmt) 317static int ivtv_g_fmt_sliced_vbi_out(struct file *file, void *fh, struct v4l2_format *fmt)
346{ 318{
347 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 319 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
@@ -715,6 +687,34 @@ static int ivtv_g_chip_ident(struct file *file, void *fh, struct v4l2_chip_ident
715 return -EINVAL; 687 return -EINVAL;
716} 688}
717 689
690#ifdef CONFIG_VIDEO_ADV_DEBUG
691static int ivtv_itvc(struct ivtv *itv, unsigned int cmd, void *arg)
692{
693 struct v4l2_register *regs = arg;
694 unsigned long flags;
695 u8 __iomem *reg_start;
696
697 if (!capable(CAP_SYS_ADMIN))
698 return -EPERM;
699 if (regs->reg >= IVTV_REG_OFFSET && regs->reg < IVTV_REG_OFFSET + IVTV_REG_SIZE)
700 reg_start = itv->reg_mem - IVTV_REG_OFFSET;
701 else if (itv->has_cx23415 && regs->reg >= IVTV_DECODER_OFFSET &&
702 regs->reg < IVTV_DECODER_OFFSET + IVTV_DECODER_SIZE)
703 reg_start = itv->dec_mem - IVTV_DECODER_OFFSET;
704 else if (regs->reg >= 0 && regs->reg < IVTV_ENCODER_SIZE)
705 reg_start = itv->enc_mem;
706 else
707 return -EINVAL;
708
709 spin_lock_irqsave(&ivtv_cards_lock, flags);
710 if (cmd == VIDIOC_DBG_G_REGISTER)
711 regs->val = readl(regs->reg + reg_start);
712 else
713 writel(regs->val, regs->reg + reg_start);
714 spin_unlock_irqrestore(&ivtv_cards_lock, flags);
715 return 0;
716}
717
718static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg) 718static int ivtv_g_register(struct file *file, void *fh, struct v4l2_register *reg)
719{ 719{
720 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv; 720 struct ivtv *itv = ((struct ivtv_open_id *)fh)->itv;
@@ -736,6 +736,7 @@ static int ivtv_s_register(struct file *file, void *fh, struct v4l2_register *re
736 return ivtv_i2c_id(itv, reg->match_chip, VIDIOC_DBG_S_REGISTER, reg); 736 return ivtv_i2c_id(itv, reg->match_chip, VIDIOC_DBG_S_REGISTER, reg);
737 return ivtv_call_i2c_client(itv, reg->match_chip, VIDIOC_DBG_S_REGISTER, reg); 737 return ivtv_call_i2c_client(itv, reg->match_chip, VIDIOC_DBG_S_REGISTER, reg);
738} 738}
739#endif
739 740
740static int ivtv_g_priority(struct file *file, void *fh, enum v4l2_priority *p) 741static int ivtv_g_priority(struct file *file, void *fh, enum v4l2_priority *p)
741{ 742{
@@ -1896,8 +1897,10 @@ void ivtv_set_funcs(struct video_device *vdev)
1896 vdev->vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out; 1897 vdev->vidioc_try_fmt_sliced_vbi_out = ivtv_try_fmt_sliced_vbi_out;
1897 vdev->vidioc_g_sliced_vbi_cap = ivtv_g_sliced_vbi_cap; 1898 vdev->vidioc_g_sliced_vbi_cap = ivtv_g_sliced_vbi_cap;
1898 vdev->vidioc_g_chip_ident = ivtv_g_chip_ident; 1899 vdev->vidioc_g_chip_ident = ivtv_g_chip_ident;
1900#ifdef CONFIG_VIDEO_ADV_DEBUG
1899 vdev->vidioc_g_register = ivtv_g_register; 1901 vdev->vidioc_g_register = ivtv_g_register;
1900 vdev->vidioc_s_register = ivtv_s_register; 1902 vdev->vidioc_s_register = ivtv_s_register;
1903#endif
1901 vdev->vidioc_default = ivtv_default; 1904 vdev->vidioc_default = ivtv_default;
1902 vdev->vidioc_queryctrl = ivtv_queryctrl; 1905 vdev->vidioc_queryctrl = ivtv_queryctrl;
1903 vdev->vidioc_querymenu = ivtv_querymenu; 1906 vdev->vidioc_querymenu = ivtv_querymenu;