Commit 985bc96e authored by Mauro Carvalho Chehab's avatar Mauro Carvalho Chehab

V4L/DVB (4343): Fix for compilation without V4L1 or V4L1_COMPAT

Removed usage of HAVE_V4L1
Including videodev.h will just include videodev2.h if V4L1 is not supported
V4L1 code at core drivers will honor CONFIG_V4L1_COMPAT stuff
Signed-off-by: default avatarMauro Carvalho Chehab <mchehab@infradead.org>
parent f251d23e
...@@ -1226,7 +1226,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -1226,7 +1226,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_format *f = arg; struct v4l2_format *f = arg;
return cx8800_try_fmt(dev,fh,f); return cx8800_try_fmt(dev,fh,f);
} }
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
/* --- streaming capture ------------------------------------- */ /* --- streaming capture ------------------------------------- */
case VIDIOCGMBUF: case VIDIOCGMBUF:
{ {
...@@ -1585,7 +1585,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file, ...@@ -1585,7 +1585,7 @@ static int radio_do_ioctl(struct inode *inode, struct file *file,
*id = 0; *id = 0;
return 0; return 0;
} }
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
case VIDIOCSTUNER: case VIDIOCSTUNER:
{ {
struct video_tuner *v = arg; struct video_tuner *v = arg;
......
...@@ -362,7 +362,7 @@ int msp_sleep(struct msp_state *state, int timeout) ...@@ -362,7 +362,7 @@ int msp_sleep(struct msp_state *state, int timeout)
} }
/* ------------------------------------------------------------------------ */ /* ------------------------------------------------------------------------ */
#ifdef CONFIG_VIDEO_V4L1
static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode) static int msp_mode_v4l2_to_v4l1(int rxsubchans, int audmode)
{ {
if (rxsubchans == V4L2_TUNER_SUB_MONO) if (rxsubchans == V4L2_TUNER_SUB_MONO)
...@@ -384,6 +384,7 @@ static int msp_mode_v4l1_to_v4l2(int mode) ...@@ -384,6 +384,7 @@ static int msp_mode_v4l1_to_v4l2(int mode)
return V4L2_TUNER_MODE_LANG1; return V4L2_TUNER_MODE_LANG1;
return V4L2_TUNER_MODE_MONO; return V4L2_TUNER_MODE_MONO;
} }
#endif
static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl) static int msp_get_ctrl(struct i2c_client *client, struct v4l2_control *ctrl)
{ {
...@@ -509,6 +510,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -509,6 +510,7 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* --- v4l ioctls --- */ /* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a /* take care: bttv does userspace copying, we'll get a
kernel pointer here... */ kernel pointer here... */
#ifdef CONFIG_VIDEO_V4L1
case VIDIOCGAUDIO: case VIDIOCGAUDIO:
{ {
struct video_audio *va = arg; struct video_audio *va = arg;
...@@ -577,6 +579,12 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -577,6 +579,12 @@ static int msp_command(struct i2c_client *client, unsigned int cmd, void *arg)
} }
case VIDIOCSFREQ: case VIDIOCSFREQ:
{
/* new channel -- kick audio carrier scan */
msp_wake_thread(client);
break;
}
#endif
case VIDIOC_S_FREQUENCY: case VIDIOC_S_FREQUENCY:
{ {
/* new channel -- kick audio carrier scan */ /* new channel -- kick audio carrier scan */
......
...@@ -2087,7 +2087,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file, ...@@ -2087,7 +2087,7 @@ static int video_do_ioctl(struct inode *inode, struct file *file,
struct v4l2_format *f = arg; struct v4l2_format *f = arg;
return saa7134_try_fmt(dev,fh,f); return saa7134_try_fmt(dev,fh,f);
} }
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
case VIDIOCGMBUF: case VIDIOCGMBUF:
{ {
struct video_mbuf *mbuf = arg; struct video_mbuf *mbuf = arg;
......
...@@ -590,6 +590,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -590,6 +590,7 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
if (t->standby) if (t->standby)
t->standby (client); t->standby (client);
break; break;
#ifdef CONFIG_VIDEO_V4L1
case VIDIOCSAUDIO: case VIDIOCSAUDIO:
if (check_mode(t, "VIDIOCSAUDIO") == EINVAL) if (check_mode(t, "VIDIOCSAUDIO") == EINVAL)
return 0; return 0;
...@@ -599,17 +600,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -599,17 +600,6 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
/* Should be implemented, since bttv calls it */ /* Should be implemented, since bttv calls it */
tuner_dbg("VIDIOCSAUDIO not implemented.\n"); tuner_dbg("VIDIOCSAUDIO not implemented.\n");
break; break;
case TDA9887_SET_CONFIG:
if (t->type == TUNER_TDA9887) {
int *i = arg;
t->tda9887_config = *i;
set_freq(client, t->tv_freq);
}
break;
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
kernel pointer here... */
case VIDIOCSCHAN: case VIDIOCSCHAN:
{ {
static const v4l2_std_id map[] = { static const v4l2_std_id map[] = {
...@@ -693,7 +683,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg) ...@@ -693,7 +683,18 @@ static int tuner_command(struct i2c_client *client, unsigned int cmd, void *arg)
? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO; ? VIDEO_SOUND_STEREO : VIDEO_SOUND_MONO;
return 0; return 0;
} }
#endif
case TDA9887_SET_CONFIG:
if (t->type == TUNER_TDA9887) {
int *i = arg;
t->tda9887_config = *i;
set_freq(client, t->tv_freq);
}
break;
/* --- v4l ioctls --- */
/* take care: bttv does userspace copying, we'll get a
kernel pointer here... */
case VIDIOC_S_STD: case VIDIOC_S_STD:
{ {
v4l2_std_id *id = arg; v4l2_std_id *id = arg;
......
...@@ -202,7 +202,7 @@ static char *v4l2_memory_names[] = { ...@@ -202,7 +202,7 @@ static char *v4l2_memory_names[] = {
/* ------------------------------------------------------------------ */ /* ------------------------------------------------------------------ */
/* debug help functions */ /* debug help functions */
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
static const char *v4l1_ioctls[] = { static const char *v4l1_ioctls[] = {
[_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP", [_IOC_NR(VIDIOCGCAP)] = "VIDIOCGCAP",
[_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN", [_IOC_NR(VIDIOCGCHAN)] = "VIDIOCGCHAN",
...@@ -301,7 +301,7 @@ static const char *v4l2_ioctls[] = { ...@@ -301,7 +301,7 @@ static const char *v4l2_ioctls[] = {
#define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls) #define V4L2_IOCTLS ARRAY_SIZE(v4l2_ioctls)
static const char *v4l2_int_ioctls[] = { static const char *v4l2_int_ioctls[] = {
#ifdef HAVE_VIDEO_DECODER #ifdef CONFIG_V4L1_COMPAT
[_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES", [_IOC_NR(DECODER_GET_CAPABILITIES)] = "DECODER_GET_CAPABILITIES",
[_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS", [_IOC_NR(DECODER_GET_STATUS)] = "DECODER_GET_STATUS",
[_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM", [_IOC_NR(DECODER_SET_NORM)] = "DECODER_SET_NORM",
...@@ -367,7 +367,7 @@ void v4l_printk_ioctl(unsigned int cmd) ...@@ -367,7 +367,7 @@ void v4l_printk_ioctl(unsigned int cmd)
(_IOC_NR(cmd) < V4L2_INT_IOCTLS) ? (_IOC_NR(cmd) < V4L2_INT_IOCTLS) ?
v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd); v4l2_int_ioctls[_IOC_NR(cmd)] : "UNKNOWN", dir, cmd);
break; break;
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
case 'v': case 'v':
printk("v4l1 ioctl %s, dir=%s (0x%08x)\n", printk("v4l1 ioctl %s, dir=%s (0x%08x)\n",
(_IOC_NR(cmd) < V4L1_IOCTLS) ? (_IOC_NR(cmd) < V4L1_IOCTLS) ?
...@@ -414,6 +414,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) ...@@ -414,6 +414,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
printk ("%s: tuner type=%d\n", s, *p); printk ("%s: tuner type=%d\n", s, *p);
break; break;
} }
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case DECODER_SET_VBI_BYPASS: case DECODER_SET_VBI_BYPASS:
case DECODER_ENABLE_OUTPUT: case DECODER_ENABLE_OUTPUT:
case DECODER_GET_STATUS: case DECODER_GET_STATUS:
...@@ -424,6 +425,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) ...@@ -424,6 +425,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
case VIDIOCCAPTURE: case VIDIOCCAPTURE:
case VIDIOCSYNC: case VIDIOCSYNC:
case VIDIOCSWRITEMODE: case VIDIOCSWRITEMODE:
#endif
case TUNER_SET_TYPE_ADDR: case TUNER_SET_TYPE_ADDR:
case TUNER_SET_STANDBY: case TUNER_SET_STANDBY:
case TDA9887_SET_CONFIG: case TDA9887_SET_CONFIG:
...@@ -755,6 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) ...@@ -755,6 +757,7 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
p->afc); p->afc);
break; break;
} }
#ifdef CONFIG_VIDEO_V4L1_COMPAT
case VIDIOCGVBIFMT: case VIDIOCGVBIFMT:
case VIDIOCSVBIFMT: case VIDIOCSVBIFMT:
{ {
...@@ -924,6 +927,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) ...@@ -924,6 +927,14 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
p->clipcount); p->clipcount);
break; break;
} }
case VIDIOCGFREQ:
case VIDIOCSFREQ:
{
unsigned long *p=arg;
printk ("%s: value=%lu\n", s, *p);
break;
}
#endif
case VIDIOC_INT_AUDIO_CLOCK_FREQ: case VIDIOC_INT_AUDIO_CLOCK_FREQ:
case VIDIOC_INT_I2S_CLOCK_FREQ: case VIDIOC_INT_I2S_CLOCK_FREQ:
case VIDIOC_INT_S_STANDBY: case VIDIOC_INT_S_STANDBY:
...@@ -933,13 +944,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg) ...@@ -933,13 +944,6 @@ void v4l_printk_ioctl_arg(char *s,unsigned int cmd, void *arg)
printk ("%s: value=%d\n", s, *p); printk ("%s: value=%d\n", s, *p);
break; break;
} }
case VIDIOCGFREQ:
case VIDIOCSFREQ:
{
unsigned long *p=arg;
printk ("%s: value=%lu\n", s, *p);
break;
}
case VIDIOC_G_STD: case VIDIOC_G_STD:
case VIDIOC_S_STD: case VIDIOC_S_STD:
case VIDIOC_QUERYSTD: case VIDIOC_QUERYSTD:
......
...@@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file, ...@@ -760,7 +760,7 @@ static int __video_do_ioctl(struct inode *inode, struct file *file,
ret=vfd->vidioc_overlay(file, fh, *i); ret=vfd->vidioc_overlay(file, fh, *i);
break; break;
} }
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
/* --- streaming capture ------------------------------------- */ /* --- streaming capture ------------------------------------- */
case VIDIOCGMBUF: case VIDIOCGMBUF:
{ {
...@@ -1578,7 +1578,11 @@ int video_register_device(struct video_device *vfd, int type, int nr) ...@@ -1578,7 +1578,11 @@ int video_register_device(struct video_device *vfd, int type, int nr)
__FUNCTION__); __FUNCTION__);
return ret; return ret;
} }
video_device_create_file(vfd, &class_device_attr_name); ret = class_device_create_file(&vfd->class_dev, &class_device_attr_name);
if (ret < 0) {
printk(KERN_WARNING "%s error: %d\n", __FUNCTION__, ret);
return ret;
}
#if 1 #if 1
/* needed until all drivers are fixed */ /* needed until all drivers are fixed */
......
...@@ -986,7 +986,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *p) ...@@ -986,7 +986,7 @@ static int vidioc_dqbuf (struct file *file, void *priv, struct v4l2_buffer *p)
file->f_flags & O_NONBLOCK)); file->f_flags & O_NONBLOCK));
} }
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf) static int vidiocgmbuf (struct file *file, void *priv, struct video_mbuf *mbuf)
{ {
struct vivi_fh *fh=priv; struct vivi_fh *fh=priv;
...@@ -1328,7 +1328,7 @@ static struct video_device vivi = { ...@@ -1328,7 +1328,7 @@ static struct video_device vivi = {
.vidioc_s_ctrl = vidioc_s_ctrl, .vidioc_s_ctrl = vidioc_s_ctrl,
.vidioc_streamon = vidioc_streamon, .vidioc_streamon = vidioc_streamon,
.vidioc_streamoff = vidioc_streamoff, .vidioc_streamoff = vidioc_streamoff,
#ifdef HAVE_V4L1 #ifdef CONFIG_V4L1_COMPAT
.vidiocgmbuf = vidiocgmbuf, .vidiocgmbuf = vidiocgmbuf,
#endif #endif
.tvnorms = tvnorms, .tvnorms = tvnorms,
......
...@@ -12,10 +12,11 @@ ...@@ -12,10 +12,11 @@
#ifndef __LINUX_VIDEODEV_H #ifndef __LINUX_VIDEODEV_H
#define __LINUX_VIDEODEV_H #define __LINUX_VIDEODEV_H
#define HAVE_V4L1 1
#include <linux/videodev2.h> #include <linux/videodev2.h>
#ifdef CONFIG_VIDEO_V4L1_COMPAT
#define HAVE_V4L1 1
struct video_capability struct video_capability
{ {
char name[32]; char name[32];
...@@ -336,6 +337,8 @@ struct video_code ...@@ -336,6 +337,8 @@ struct video_code
#define VID_HARDWARE_SN9C102 38 #define VID_HARDWARE_SN9C102 38
#define VID_HARDWARE_ARV 39 #define VID_HARDWARE_ARV 39
#endif /* CONFIG_VIDEO_V4L1_COMPAT */
#endif /* __LINUX_VIDEODEV_H */ #endif /* __LINUX_VIDEODEV_H */
/* /*
......
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