patch-2.2.4 linux/drivers/sbus/char/bpp.c

Next file: linux/drivers/sbus/char/flash.c
Previous file: linux/drivers/sbus/audio/dummy.h
Back to the patch index
Back to the overall index

diff -u --recursive --new-file v2.2.3/linux/drivers/sbus/char/bpp.c linux/drivers/sbus/char/bpp.c
@@ -337,7 +337,7 @@
        * responds real good. The first while loop guesses an expire
        * time accounting for possible wraparound of jiffies.
        */
-      while (time_after_eq(jiffies, extime) extime = jiffies + 1;
+      while (time_after_eq(jiffies, extime)) extime = jiffies + 1;
       while ( (time_before(jiffies, extime))
               && (((pins & set) != set) || ((pins & clr) != 0)) ) {
             pins = get_pins(minor);
@@ -470,13 +470,14 @@
  * mode as this is a reasonable place to clean up from messes made by
  * ioctls, or other mayhem.
  */
-static void bpp_release(struct inode *inode, struct file *f)
+static int bpp_release(struct inode *inode, struct file *f)
 {
       unsigned minor = MINOR(inode->i_rdev);
       instances[minor].opened = 0;
 
       if (instances[minor].mode != COMPATIBILITY)
       terminate(minor);
+      return 0;
 }
 
 static long read_nibble(unsigned minor, char *c, unsigned long cnt)
@@ -624,11 +625,10 @@
       return cnt - remaining;
 }
 
-static long bpp_read(struct inode *inode, struct file *f,
-		 char *c, unsigned long cnt)
+static ssize_t bpp_read(struct file *f, char *c, size_t cnt, loff_t * ppos)
 {
       long rc;
-      const unsigned minor = MINOR(inode->i_rdev);
+      const unsigned minor = MINOR(f->f_dentry->d_inode->i_rdev);
       if (minor >= BPP_NO) return -ENODEV;
       if (!instances[minor].present) return -ENODEV;
 
@@ -694,10 +694,12 @@
 
       unsigned long remaining = cnt;
 
+
       while (remaining > 0) {
             unsigned char byte;
-            c += 1;
+
             get_user_ret(byte, c, -EFAULT);
+            c += 1;
 
             rc = wait_for(BPP_GP_nAck, BPP_GP_Busy, TIME_IDLE_LIMIT, minor);
             if (rc == -1) return -ETIMEDOUT;
@@ -774,11 +776,10 @@
  * that. Otherwise, terminate and do my writing in compat mode. This
  * is the safest course as any device can handle it.
  */
-static long bpp_write(struct inode *inode, struct file *f,
-		  const char *c, unsigned long cnt)
+static ssize_t bpp_write(struct file *f, const char *c, size_t cnt, loff_t * ppos)
 {
       long errno = 0;
-      unsigned minor = MINOR(inode->i_rdev);
+      const unsigned minor = MINOR(f->f_dentry->d_inode->i_rdev);
       if (minor >= BPP_NO) return -ENODEV;
       if (!instances[minor].present) return -ENODEV;
 
@@ -861,6 +862,11 @@
 	bpp_open,
 	NULL,		/* flush */
 	bpp_release,
+  NULL,   /* fsync */
+  NULL,   /* fasync */
+  NULL,   /* check media change */
+  NULL,   /* revalidate */
+  NULL,   /* lock */
 };
 
 #if defined(__i386__)

FUNET's LINUX-ADM group, linux-adm@nic.funet.fi
TCL-scripts by Sam Shen (who was at: slshen@lbl.gov)