patch-2.2.0-pre8 linux/drivers/char/videodev.c
Next file: linux/drivers/net/3c523.c
Previous file: linux/drivers/char/tuner.c
Back to the patch index
Back to the overall index
- Lines: 165
- Date:
Fri Jan 15 17:46:27 1999
- Orig file:
v2.2.0-pre7/linux/drivers/char/videodev.c
- Orig date:
Mon Dec 28 15:00:52 1998
diff -u --recursive --new-file v2.2.0-pre7/linux/drivers/char/videodev.c linux/drivers/char/videodev.c
@@ -24,12 +24,12 @@
#include <linux/errno.h>
#include <linux/videodev.h>
+#if LINUX_VERSION_CODE >= 0x020100
#include <asm/uaccess.h>
+#endif
#include <asm/system.h>
-#ifdef CONFIG_KMOD
#include <linux/kmod.h>
-#endif
#define VIDEO_NUM_DEVICES 256
@@ -103,17 +103,17 @@
#endif
#ifdef CONFIG_RADIO_SF16FMI
{"SF16FMI", fmi_init},
-#endif
+#endif
#ifdef CONFIG_RADIO_MIROPCM20
{"PCM20", pcm20_init},
-#endif
+#endif
#ifdef CONFIG_RADIO_GEMTEK
- {"GemTek", gemtek_init},
-#endif
+ {"GemTek", gemtek_init},
+#endif
{"end", NULL}
};
-
+#if LINUX_VERSION_CODE >= 0x020100
/*
* Read will do some smarts later on. Buffer pin etc.
*/
@@ -129,6 +129,7 @@
}
+
/*
* Write for now does nothing. No reason it shouldnt do overlay setting
* for some boards I guess..
@@ -144,7 +145,6 @@
return 0;
}
-
/*
* Poll to see if we're readable, can probably be used for timing on incoming
* frames, etc..
@@ -159,6 +159,32 @@
return 0;
}
+
+#else
+static int video_read(struct inode *ino,struct file *file,
+ char *buf, int count)
+{
+ int err;
+ struct video_device *vfl=video_device[MINOR(ino->i_rdev)];
+ if (vfl->read)
+ return vfl->read(vfl, buf, count, file->f_flags&O_NONBLOCK);
+ else
+ return -EINVAL;
+}
+
+static int video_write(struct inode *ino,struct file *file, const char *buf,
+ int count)
+{
+ int err;
+ struct video_device *vfl=video_device[MINOR(ino->i_rdev)];
+ if (vfl->write)
+ return vfl->write(vfl, buf, count, file->f_flags&O_NONBLOCK);
+ else
+ return 0;
+}
+
+#endif
+
/*
* Open a video device.
*/
@@ -174,14 +200,12 @@
vfl=video_device[minor];
if(vfl==NULL) {
-#ifdef CONFIG_KMOD
char modname[20];
sprintf (modname, "char-major-%d-%d", VIDEO_MAJOR, minor);
request_module(modname);
vfl=video_device[minor];
if (vfl==NULL)
-#endif
return -ENODEV;
}
if(vfl->busy)
@@ -218,11 +242,19 @@
* image ?
*/
+#if LINUX_VERSION_CODE >= 0x020100
static long long video_lseek(struct file * file,
long long offset, int origin)
{
return -ESPIPE;
}
+#else
+static long long video_lseek(struct inode *inode, struct file * file,
+ long long offset, int origin)
+{
+ return -ESPIPE;
+}
+#endif
static int video_ioctl(struct inode *inode, struct file *file,
@@ -246,9 +278,16 @@
*/
+#if LINUX_VERSION_CODE >= 0x020100
int video_mmap(struct file *file, struct vm_area_struct *vma)
{
struct video_device *vfl=video_device[MINOR(file->f_dentry->d_inode->i_rdev)];
+#else
+static int video_mmap(struct inode * ino, struct file * file,
+ struct vm_area_struct * vma)
+{
+ struct video_device *vfl=video_device[MINOR(ino->i_rdev)];
+#endif
if(vfl->mmap)
return vfl->mmap(vfl, (char *)vma->vm_start,
(unsigned long)(vma->vm_end-vma->vm_start));
@@ -332,11 +371,17 @@
video_read,
video_write,
NULL, /* readdir */
+#if LINUX_VERSION_CODE >= 0x020100
video_poll, /* poll */
+#else
+ NULL,
+#endif
video_ioctl,
video_mmap,
video_open,
+#if LINUX_VERSION_CODE >= 0x020100
NULL, /* flush */
+#endif
video_release
};
@@ -380,5 +425,7 @@
#endif
+#if LINUX_VERSION_CODE >= 0x020100
EXPORT_SYMBOL(video_register_device);
EXPORT_SYMBOL(video_unregister_device);
+#endif
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen, slshen@lbl.gov