X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=drivers%2Fchar%2Ftipar.c;h=8cbf15bb51ac18093825ee679a071eb95ff9f19b;hb=5e3b93f248c98873cc843e83092bb8da92ac85a2;hp=48d7a7cc0c2bbe2b10c876ef8432f136f1d6c68b;hpb=a91482bdcc2e0f6035702e46f1b99043a0893346;p=linux-2.6.git diff --git a/drivers/char/tipar.c b/drivers/char/tipar.c index 48d7a7cc0..8cbf15bb5 100644 --- a/drivers/char/tipar.c +++ b/drivers/char/tipar.c @@ -262,7 +262,7 @@ tipar_open(struct inode *inode, struct file *file) init_ti_parallel(minor); parport_release(table[minor].dev); - return nonseekable_open(inode, file); + return 0; } static int @@ -279,7 +279,7 @@ tipar_close(struct inode *inode, struct file *file) } static ssize_t -tipar_write(struct file *file, const char __user *buf, size_t count, loff_t * ppos) +tipar_write(struct file *file, const char *buf, size_t count, loff_t * ppos) { unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR; ssize_t n; @@ -306,7 +306,7 @@ tipar_write(struct file *file, const char __user *buf, size_t count, loff_t * pp } static ssize_t -tipar_read(struct file *file, char __user *buf, size_t count, loff_t * ppos) +tipar_read(struct file *file, char *buf, size_t count, loff_t * ppos) { int b = 0; unsigned int minor = iminor(file->f_dentry->d_inode) - TIPAR_MINOR; @@ -316,6 +316,9 @@ tipar_read(struct file *file, char __user *buf, size_t count, loff_t * ppos) if (count == 0) return 0; + if (ppos != &file->f_pos) + return -ESPIPE; + parport_claim_or_block(table[minor].dev); while (n < count) { @@ -325,7 +328,7 @@ tipar_read(struct file *file, char __user *buf, size_t count, loff_t * ppos) retval = -ETIMEDOUT; goto out; } else { - if (put_user(b, buf + n)) { + if (put_user(b, ((unsigned char *) buf) + n)) { retval = -EFAULT; break; } else