patch-2.4.13 linux/drivers/i2c/i2c-dev.c
Next file: linux/drivers/i2c/i2c-elektor.c
Previous file: linux/drivers/i2c/i2c-core.c
Back to the patch index
Back to the overall index
- Lines: 71
- Date:
Thu Oct 11 08:05:47 2001
- Orig file:
v2.4.12/linux/drivers/i2c/i2c-dev.c
- Orig date:
Tue Oct 9 17:06:51 2001
diff -u --recursive --new-file v2.4.12/linux/drivers/i2c/i2c-dev.c linux/drivers/i2c/i2c-dev.c
@@ -28,7 +28,7 @@
/* The devfs code is contributed by Philipp Matthias Hahn
<pmhahn@titan.lahn.de> */
-/* $Id: i2c-dev.c,v 1.36 2000/09/22 02:19:35 mds Exp $ */
+/* $Id: i2c-dev.c,v 1.40 2001/08/25 01:28:01 mds Exp $ */
#include <linux/config.h>
#include <linux/kernel.h>
@@ -60,6 +60,9 @@
/* struct file_operations changed too often in the 2.1 series for nice code */
+#if LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,9)
+static loff_t i2cdev_lseek (struct file *file, loff_t offset, int origin);
+#endif
static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
loff_t *offset);
static ssize_t i2cdev_write (struct file *file, const char *buf, size_t count,
@@ -88,7 +91,11 @@
#if LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,0)
owner: THIS_MODULE,
#endif /* LINUX_KERNEL_VERSION >= KERNEL_VERSION(2,4,0) */
+#if LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,9)
+ llseek: i2cdev_lseek,
+#else
llseek: no_llseek,
+#endif
read: i2cdev_read,
write: i2cdev_write,
ioctl: i2cdev_ioctl,
@@ -126,6 +133,20 @@
static int i2cdev_initialized;
+#if LINUX_KERNEL_VERSION < KERNEL_VERSION(2,4,9)
+/* Note that the lseek function is called llseek in 2.1 kernels. But things
+ are complicated enough as is. */
+loff_t i2cdev_lseek (struct file *file, loff_t offset, int origin)
+{
+#ifdef DEBUG
+ struct inode *inode = file->f_dentry->d_inode;
+ printk("i2c-dev.o: i2c-%d lseek to %ld bytes relative to %d.\n",
+ MINOR(inode->i_rdev),(long) offset,origin);
+#endif /* DEBUG */
+ return -ESPIPE;
+}
+#endif
+
static ssize_t i2cdev_read (struct file *file, char *buf, size_t count,
loff_t *offset)
{
@@ -227,9 +248,6 @@
sizeof(rdwr_arg)))
return -EFAULT;
- if(rdwr_arg.nmsgs > 2048)
- return -EINVAL;
-
rdwr_pa = (struct i2c_msg *)
kmalloc(rdwr_arg.nmsgs * sizeof(struct i2c_msg),
GFP_KERNEL);
@@ -505,7 +523,7 @@
"module not removed.\n");
return res;
}
- i2cdev_initialized ++;
+ i2cdev_initialized --;
}
if (i2cdev_initialized >= 1) {
FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)