summaryrefslogtreecommitdiffstats
path: root/drivers/sbus/char/bpp.c
diff options
context:
space:
mode:
authorRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
committerRalf Baechle <ralf@linux-mips.org>1999-06-13 16:29:25 +0000
commitdb7d4daea91e105e3859cf461d7e53b9b77454b2 (patch)
tree9bb65b95440af09e8aca63abe56970dd3360cc57 /drivers/sbus/char/bpp.c
parent9c1c01ead627bdda9211c9abd5b758d6c687d8ac (diff)
Merge with Linux 2.2.8.
Diffstat (limited to 'drivers/sbus/char/bpp.c')
-rw-r--r--drivers/sbus/char/bpp.c24
1 files changed, 15 insertions, 9 deletions
diff --git a/drivers/sbus/char/bpp.c b/drivers/sbus/char/bpp.c
index 0121a03e7..de9321d40 100644
--- a/drivers/sbus/char/bpp.c
+++ b/drivers/sbus/char/bpp.c
@@ -337,7 +337,7 @@ static int wait_for(unsigned short set, unsigned short clr,
* 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 @@ static int bpp_open(struct inode *inode, struct file *f)
* 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 @@ static long read_ecp(unsigned minor, char *c, unsigned long cnt)
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 @@ static long write_compat(unsigned minor, const char *c, unsigned long cnt)
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 @@ static long write_ecp(unsigned minor, const char *c, unsigned long cnt)
* 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 @@ static struct file_operations bpp_fops = {
bpp_open,
NULL, /* flush */
bpp_release,
+ NULL, /* fsync */
+ NULL, /* fasync */
+ NULL, /* check media change */
+ NULL, /* revalidate */
+ NULL, /* lock */
};
#if defined(__i386__)