]> git.hungrycats.org Git - linux/commitdiff
Fix up a couple of drivers - notable sg - for nonseekability.
authorLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 7 Aug 2004 12:11:39 +0000 (05:11 -0700)
committerLinus Torvalds <torvalds@ppc970.osdl.org>
Sat, 7 Aug 2004 12:11:39 +0000 (05:11 -0700)
drivers/char/ds1620.c
drivers/char/dtlk.c
drivers/scsi/sg.c

index 4171ca18b62981c49f705a0058bbd91d1b7e780a..8e290a3e7fdde79de35925aeacfbebc0a487f162 100644 (file)
@@ -218,10 +218,6 @@ ds1620_read(struct file *file, char *buf, size_t count, loff_t *ptr)
        signed int cur_temp;
        signed char cur_temp_degF;
 
-       /* Can't seek (pread) on this device */
-       if (ptr != &file->f_pos)
-               return -ESPIPE;
-
        cur_temp = cvt_9_to_int(ds1620_in(THERM_READ_TEMP, 9)) >> 1;
 
        /* convert to Fahrenheit, as per wdt.c */
@@ -338,6 +334,7 @@ static struct proc_dir_entry *proc_therm_ds1620;
 
 static struct file_operations ds1620_fops = {
        .owner          = THIS_MODULE,
+       .open           = nonseekable_open,
        .read           = ds1620_read,
        .ioctl          = ds1620_ioctl,
 };
index e6ad246b9527cafaf2be692efc7dbaad3240b9d3..22c6a921e6bb31ab34449be833c78b8d612042cb 100644 (file)
@@ -128,10 +128,6 @@ static ssize_t dtlk_read(struct file *file, char __user *buf,
        char ch;
        int i = 0, retries;
 
-       /* Can't seek (pread) on the DoubleTalk.  */
-       if (ppos != &file->f_pos)
-               return -ESPIPE;
-
        TRACE_TEXT("(dtlk_read");
        /*  printk("DoubleTalk PC - dtlk_read()\n"); */
 
@@ -303,6 +299,7 @@ static int dtlk_open(struct inode *inode, struct file *file)
 {
        TRACE_TEXT("(dtlk_open");
 
+       nonseekable_open(inode, file);
        switch (iminor(inode)) {
        case DTLK_MINOR:
                if (dtlk_busy)
index 8ccc7d9142c91e55bb5040fd72c32333172ae5eb..7b0665d8ba1e09f39d2ea68881bccbf5acce4363 100644 (file)
@@ -234,6 +234,7 @@ sg_open(struct inode *inode, struct file *filp)
        int res;
        int retval;
 
+       nonseekable_open(inode, filp);
        SCSI_LOG_TIMEOUT(3, printk("sg_open: dev=%d, flags=0x%x\n", dev, flags));
        sdp = sg_get_dev(dev);
        if ((!sdp) || (!sdp->device))
@@ -343,7 +344,6 @@ sg_read(struct file *filp, char __user *buf, size_t count, loff_t * ppos)
                return -ENXIO;
        SCSI_LOG_TIMEOUT(3, printk("sg_read: %s, count=%d\n",
                                   sdp->disk->disk_name, (int) count));
-       if (ppos != &filp->f_pos) ;     /* FIXME: Hmm.  Seek to the right place, or fail?  */
        if ((k = verify_area(VERIFY_WRITE, buf, count)))
                return k;
        if (sfp->force_packid && (count >= SZ_SG_HEADER)) {
@@ -501,7 +501,6 @@ sg_write(struct file *filp, const char __user *buf, size_t count, loff_t * ppos)
        if (!((filp->f_flags & O_NONBLOCK) ||
              scsi_block_when_processing_errors(sdp->device)))
                return -ENXIO;
-       if (ppos != &filp->f_pos) ;     /* FIXME: Hmm.  Seek to the right place, or fail?  */
 
        if ((k = verify_area(VERIFY_READ, buf, count)))
                return k;       /* protects following copy_from_user()s + get_user()s */