Merge branch 'master' of /home/tglx/work/mtd/git/linux-2.6.git/
authorThomas Gleixner <tglx@mtd.linutronix.de>
Sun, 6 Nov 2005 14:36:37 +0000 (15:36 +0100)
committerThomas Gleixner <tglx@mtd.linutronix.de>
Sun, 6 Nov 2005 14:36:37 +0000 (15:36 +0100)
1  2 
drivers/mtd/mtdchar.c

diff --combined drivers/mtd/mtdchar.c
@@@ -1,5 -1,5 +1,5 @@@
  /*
 - * $Id: mtdchar.c,v 1.73 2005/07/04 17:36:41 gleixner Exp $
 + * $Id: mtdchar.c,v 1.74 2005/08/04 01:05:48 tpoynor Exp $
   *
   * Character-device access to raw MTD devices.
   *
@@@ -13,6 -13,7 +13,7 @@@
  #include <linux/slab.h>
  #include <linux/init.h>
  #include <linux/fs.h>
+ #include <linux/sched.h>      /* TASK_* */
  #include <asm/uaccess.h>
  
  #include <linux/device.h>
@@@ -24,10 -25,10 +25,10 @@@ static void mtd_notify_add(struct mtd_i
        if (!mtd)
                return;
  
-       class_device_create(mtd_class, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
+       class_device_create(mtd_class, NULL, MKDEV(MTD_CHAR_MAJOR, mtd->index*2),
                            NULL, "mtd%d", mtd->index);
        
-       class_device_create(mtd_class, 
+       class_device_create(mtd_class, NULL,
                            MKDEV(MTD_CHAR_MAJOR, mtd->index*2+1),
                            NULL, "mtd%dro", mtd->index);
  }
@@@ -69,23 -70,26 +70,23 @@@ static loff_t mtd_lseek (struct file *f
        switch (orig) {
        case 0:
                /* SEEK_SET */
 -              file->f_pos = offset;
                break;
        case 1:
                /* SEEK_CUR */
 -              file->f_pos += offset;
 +              offset += file->f_pos;
                break;
        case 2:
                /* SEEK_END */
 -              file->f_pos =mtd->size + offset;
 +              offset += mtd->size;
                break;
        default:
                return -EINVAL;
        }
  
 -      if (file->f_pos < 0)
 -              file->f_pos = 0;
 -      else if (file->f_pos >= mtd->size)
 -              file->f_pos = mtd->size - 1;
 +      if (offset >= 0 && offset < mtd->size)
 +              return file->f_pos = offset;
  
 -      return file->f_pos;
 +      return -EINVAL;
  }