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)
drivers/mtd/chips/cfi_cmdset_0001.c
drivers/mtd/chips/cfi_cmdset_0002.c
drivers/mtd/chips/cfi_cmdset_0020.c
drivers/mtd/chips/cfi_util.c
drivers/mtd/chips/sharp.c
drivers/mtd/mtd_blkdevs.c
drivers/mtd/mtdchar.c

index 0cfcd88468e0ed3c2db5da780bc3d7e428c3ab3c..1e99dffcc6ae1afd276b02dc640166ecd4446251 100644 (file)
@@ -4,7 +4,7 @@
  *
  * (C) 2000 Red Hat. GPL'd
  *
- * $Id: cfi_cmdset_0001.c,v 1.178 2005/05/19 17:05:43 nico Exp $
+ * $Id: cfi_cmdset_0001.c,v 1.180 2005/07/20 21:01:13 tpoynor Exp $
  *
  * 
  * 10/10/2000  Nicolas Pitre <nico@cam.org>
@@ -252,6 +252,15 @@ read_pri_intelext(struct map_info *map, __u16 adr)
        if (!extp)
                return NULL;
 
+       if (extp->MajorVersion != '1' ||
+           (extp->MinorVersion < '0' || extp->MinorVersion > '3')) {
+               printk(KERN_ERR "  Unknown Intel/Sharp Extended Query "
+                      "version %c.%c.\n",  extp->MajorVersion,
+                      extp->MinorVersion);
+               kfree(extp);
+               return NULL;
+       }
+
        /* Do some byteswapping if necessary */
        extp->FeatureSupport = le32_to_cpu(extp->FeatureSupport);
        extp->BlkStatusRegMask = le16_to_cpu(extp->BlkStatusRegMask);
index 8505f118f2dbfcd8d7275c3cb1af5292eaaaca0d..e3d31c749045231394fd8fe1e52358db12a3a623 100644 (file)
@@ -17,7 +17,7 @@
  *
  * This code is GPL
  *
- * $Id: cfi_cmdset_0002.c,v 1.118 2005/07/04 22:34:29 gleixner Exp $
+ * $Id: cfi_cmdset_0002.c,v 1.120 2005/07/20 21:01:13 tpoynor Exp $
  *
  */
 
@@ -253,6 +253,16 @@ struct mtd_info *cfi_cmdset_0002(struct map_info *map, int primary)
                        return NULL;
                }
 
+               if (extp->MajorVersion != '1' ||
+                   (extp->MinorVersion < '0' || extp->MinorVersion > '4')) {
+                       printk(KERN_ERR "  Unknown Amd/Fujitsu Extended Query "
+                              "version %c.%c.\n",  extp->MajorVersion,
+                              extp->MinorVersion);
+                       kfree(extp);
+                       kfree(mtd);
+                       return NULL;
+               }
+
                /* Install our own private info structure */
                cfi->cmdset_priv = extp;        
 
index c894f880157831f1d1c3524aa77d9a462d77dd60..d22df2d96788afda357105625dc987e124027597 100644 (file)
@@ -4,7 +4,7 @@
  *
  * (C) 2000 Red Hat. GPL'd
  *
- * $Id: cfi_cmdset_0020.c,v 1.19 2005/07/13 15:52:45 dwmw2 Exp $
+ * $Id: cfi_cmdset_0020.c,v 1.20 2005/07/20 21:01:14 tpoynor Exp $
  * 
  * 10/10/2000  Nicolas Pitre <nico@cam.org>
  *     - completely revamped method functions so they are aware and
@@ -133,6 +133,15 @@ struct mtd_info *cfi_cmdset_0020(struct map_info *map, int primary)
                if (!extp)
                        return NULL;
 
+               if (extp->MajorVersion != '1' ||
+                   (extp->MinorVersion < '0' || extp->MinorVersion > '3')) {
+                       printk(KERN_ERR "  Unknown ST Microelectronics"
+                              " Extended Query version %c.%c.\n",
+                              extp->MajorVersion, extp->MinorVersion);
+                       kfree(extp);
+                       return NULL;
+               }
+
                /* Do some byteswapping if necessary */
                extp->FeatureSupport = cfi32_to_cpu(extp->FeatureSupport);
                extp->BlkStatusRegMask = cfi32_to_cpu(extp->BlkStatusRegMask);
index 2b2ede2bfccaeca3f9e0e47f2869d501b1633abf..0cf183f01e493148a54ba24aa4da5c0a7e182465 100644 (file)
@@ -7,7 +7,7 @@
  *
  * This code is covered by the GPL.
  *
- * $Id: cfi_util.c,v 1.8 2004/12/14 19:55:56 nico Exp $
+ * $Id: cfi_util.c,v 1.9 2005/07/20 21:01:14 tpoynor Exp $
  *
  */
 
@@ -70,15 +70,6 @@ __xipram cfi_read_pri(struct map_info *map, __u16 adr, __u16 size, const char* n
        local_irq_enable();
 #endif
 
-       if (extp->MajorVersion != '1' || 
-           (extp->MinorVersion < '0' || extp->MinorVersion > '3')) {
-               printk(KERN_WARNING "  Unknown %s Extended Query "
-                      "version %c.%c.\n",  name, extp->MajorVersion,
-                      extp->MinorVersion);
-               kfree(extp);
-               extp = NULL;
-       }
-
  out:  return extp;
 }
 
index c3cf0f63bc93639ad151a35b8867e554452548a7..08376dbf5d62ae77d7f08ff7e800d77361340b69 100644 (file)
@@ -4,7 +4,7 @@
  * Copyright 2000,2001 David A. Schleef <ds@schleef.org>
  *           2000,2001 Lineo, Inc.
  *
- * $Id: sharp.c,v 1.14 2004/08/09 13:19:43 dwmw2 Exp $
+ * $Id: sharp.c,v 1.15 2005/08/02 20:36:05 tpoynor Exp $
  *
  * Devices supported:
  *   LH28F016SCT Symmetrical block flash memory, 2Mx8
@@ -31,6 +31,7 @@
 #include <linux/mtd/cfi.h>
 #include <linux/delay.h>
 #include <linux/init.h>
+#include <linux/slab.h>
 
 #define CMD_RESET              0xffffffff
 #define CMD_READ_ID            0x90909090
@@ -214,7 +215,7 @@ static int sharp_probe_map(struct map_info *map,struct mtd_info *mtd)
 /* This function returns with the chip->mutex lock held. */
 static int sharp_wait(struct map_info *map, struct flchip *chip)
 {
-       __u16 status;
+       int status, i;
        unsigned long timeo = jiffies + HZ;
        DECLARE_WAITQUEUE(wait, current);
        int adr = 0;
@@ -227,13 +228,11 @@ retry:
                map_write32(map,CMD_READ_STATUS,adr);
                chip->state = FL_STATUS;
        case FL_STATUS:
-               status = map_read32(map,adr);
-//printk("status=%08x\n",status);
-
-               udelay(100);
-               if((status & SR_READY)!=SR_READY){
-//printk(".status=%08x\n",status);
-                       udelay(100);
+               for(i=0;i<100;i++){
+                       status = map_read32(map,adr);
+                       if((status & SR_READY)==SR_READY)
+                               break;
+                       udelay(1);
                }
                break;
        default:
index f8d2185819e7e2e17348b0c3fd8b0c2b41208d44..d6cb3d194efbf8f871ea0e7608a8c66cd7bebc28 100644 (file)
@@ -1,5 +1,5 @@
 /*
- * $Id: mtd_blkdevs.c,v 1.24 2004/11/16 18:28:59 dwmw2 Exp $
+ * $Id: mtd_blkdevs.c,v 1.26 2005/07/29 19:42:04 tpoynor Exp $
  *
  * (C) 2003 David Woodhouse <dwmw2@infradead.org>
  *
@@ -21,7 +21,6 @@
 #include <linux/init.h>
 #include <asm/semaphore.h>
 #include <asm/uaccess.h>
-#include <linux/devfs_fs_kernel.h>
 
 static LIST_HEAD(blktrans_majors);
 
@@ -290,10 +289,18 @@ int add_mtd_blktrans_dev(struct mtd_blktrans_dev *new)
        gd->first_minor = (new->devnum) << tr->part_bits;
        gd->fops = &mtd_blktrans_ops;
        
-       snprintf(gd->disk_name, sizeof(gd->disk_name),
-                "%s%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
-       snprintf(gd->devfs_name, sizeof(gd->devfs_name),
-                "%s/%c", tr->name, (tr->part_bits?'a':'0') + new->devnum);
+       if (tr->part_bits)
+               if (new->devnum < 26)
+                       snprintf(gd->disk_name, sizeof(gd->disk_name),
+                                "%s%c", tr->name, 'a' + new->devnum);
+               else
+                       snprintf(gd->disk_name, sizeof(gd->disk_name),
+                                "%s%c%c", tr->name,
+                                'a' - 1 + new->devnum / 26,
+                                'a' + new->devnum % 26);
+       else
+               snprintf(gd->disk_name, sizeof(gd->disk_name),
+                        "%s%d", tr->name, new->devnum);
 
        /* 2.5 has capacity in units of 512 bytes while still
           having BLOCK_SIZE_BITS set to 10. Just to keep us amused. */
@@ -411,8 +418,6 @@ int register_mtd_blktrans(struct mtd_blktrans_ops *tr)
                return ret;
        } 
 
-       devfs_mk_dir(tr->name);
-
        INIT_LIST_HEAD(&tr->devs);
        list_add(&tr->list, &blktrans_majors);
 
@@ -445,7 +450,6 @@ int deregister_mtd_blktrans(struct mtd_blktrans_ops *tr)
                tr->remove_dev(dev);
        }
 
-       devfs_remove(tr->name);
        blk_cleanup_queue(tr->blkcore_priv->rq);
        unregister_blkdev(tr->major, tr->name);
 
index 16df1e4fb0e94d2efec9542e6114f0593c3ad3bf..8c0d94b72b63671cae6c1aa51ab30bfa9957da96 100644 (file)
@@ -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.
  *
@@ -70,26 +70,23 @@ static loff_t mtd_lseek (struct file *file, loff_t offset, int orig)
        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;
 }