mtd: unify status enum from three headers
authorAlessandro Rubini <rubini@unipv.it>
Sun, 20 Sep 2009 21:28:14 +0000 (23:28 +0200)
committerDavid Woodhouse <David.Woodhouse@intel.com>
Thu, 24 Sep 2009 19:55:07 +0000 (12:55 -0700)
nand.h, onenand.h and flashchip.h defined enumeration types
for chip status using the same symbolic names. This prevented
a board file to include more than one of them. In particular,
no nand and onenand platform devices could live in the same file.
This patch augments flashchip.h with a few status values in order
to cover all cases, so nand.h and onenand.h can use flstate_t
without declaring their own status enum.

Signed-off-by: Alessandro Rubini <rubini@unipv.it>
Signed-off-by: David Woodhouse <David.Woodhouse@intel.com>
include/linux/mtd/flashchip.h
include/linux/mtd/nand.h
include/linux/mtd/onenand.h

index d4f38c5fd44ec1d1affcc5876e23dfaadc727fd8..f350a4879f7576bb9c599111f7a86ed71feace06 100644 (file)
@@ -38,6 +38,13 @@ typedef enum {
        FL_XIP_WHILE_ERASING,
        FL_XIP_WHILE_WRITING,
        FL_SHUTDOWN,
+       /* These 2 come from nand_state_t, which has been unified here */
+       FL_READING,
+       FL_CACHEDPRG,
+       /* These 2 come from onenand_state_t, which has been unified here */
+       FL_RESETING,
+       FL_OTPING,
+
        FL_UNKNOWN
 } flstate_t;
 
index d87ada538d170af687f4ea05a708bde9597f22d3..2476078a032f67459a636aac175c4c04ecf8f100 100644 (file)
@@ -21,6 +21,7 @@
 #include <linux/wait.h>
 #include <linux/spinlock.h>
 #include <linux/mtd/mtd.h>
+#include <linux/mtd/flashchip.h>
 #include <linux/mtd/bbm.h>
 
 struct mtd_info;
@@ -203,20 +204,6 @@ typedef enum {
 #define NAND_CI_CHIPNR_MSK     0x03
 #define NAND_CI_CELLTYPE_MSK   0x0C
 
-/*
- * nand_state_t - chip states
- * Enumeration for NAND flash chip state
- */
-typedef enum {
-       FL_READY,
-       FL_READING,
-       FL_WRITING,
-       FL_ERASING,
-       FL_SYNCING,
-       FL_CACHEDPRG,
-       FL_PM_SUSPENDED,
-} nand_state_t;
-
 /* Keep gcc happy */
 struct nand_chip;
 
@@ -403,7 +390,7 @@ struct nand_chip {
        uint8_t         cellinfo;
        int             badblockpos;
 
-       nand_state_t    state;
+       flstate_t       state;
 
        uint8_t         *oob_poi;
        struct nand_hw_control  *controller;
index 4e49f3350678c63ee2b1c48908498bee0cdb6ffc..f57e29e17bb0264ecf74b43bb35c5ad47a81631c 100644 (file)
@@ -14,6 +14,7 @@
 
 #include <linux/spinlock.h>
 #include <linux/completion.h>
+#include <linux/mtd/flashchip.h>
 #include <linux/mtd/onenand_regs.h>
 #include <linux/mtd/bbm.h>
 
@@ -25,22 +26,6 @@ extern int onenand_scan(struct mtd_info *mtd, int max_chips);
 /* Free resources held by the OneNAND device */
 extern void onenand_release(struct mtd_info *mtd);
 
-/*
- * onenand_state_t - chip states
- * Enumeration for OneNAND flash chip state
- */
-typedef enum {
-       FL_READY,
-       FL_READING,
-       FL_WRITING,
-       FL_ERASING,
-       FL_SYNCING,
-       FL_LOCKING,
-       FL_RESETING,
-       FL_OTPING,
-       FL_PM_SUSPENDED,
-} onenand_state_t;
-
 /**
  * struct onenand_bufferram - OneNAND BufferRAM Data
  * @blockpage:         block & page address in BufferRAM
@@ -137,7 +122,7 @@ struct onenand_chip {
 
        spinlock_t              chip_lock;
        wait_queue_head_t       wq;
-       onenand_state_t         state;
+       flstate_t               state;
        unsigned char           *page_buf;
        unsigned char           *oob_buf;