mtd: change struct flchip_shared spinlock locking into mutex
[linux-2.6.git] / include / linux / mtd / flashchip.h
index a293a3b..23cc10f 100644 (file)
@@ -5,9 +5,6 @@
  * Contains information about the location and state of a given flash device
  *
  * (C) 2000 Red Hat. GPLd.
- *
- * $Id: flashchip.h,v 1.18 2005/11/07 11:14:54 gleixner Exp $
- *
  */
 
 #ifndef __MTD_FLASHCHIP_H__
@@ -18,6 +15,7 @@
  * has asm/spinlock.h, or 2.4, which has linux/spinlock.h
  */
 #include <linux/sched.h>
+#include <linux/mutex.h>
 
 typedef enum {
        FL_READY,
@@ -40,6 +38,16 @@ typedef enum {
        FL_POINT,
        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 4 come from onenand_state_t, which has been unified here */
+       FL_RESETING,
+       FL_OTPING,
+       FL_PREPARING_ERASE,
+       FL_VERIFYING_ERASE,
+
        FL_UNKNOWN
 } flstate_t;
 
@@ -67,21 +75,24 @@ struct flchip {
        unsigned int erase_suspended:1;
        unsigned long in_progress_block_addr;
 
-       spinlock_t *mutex;
-       spinlock_t _spinlock; /* We do it like this because sometimes they'll be shared. */
+       struct mutex mutex;
        wait_queue_head_t wq; /* Wait on here when we're waiting for the chip
                             to be ready */
        int word_write_time;
        int buffer_write_time;
        int erase_time;
 
+       int word_write_time_max;
+       int buffer_write_time_max;
+       int erase_time_max;
+
        void *priv;
 };
 
 /* This is used to handle contention on write/erase operations
    between partitions of the same physical chip. */
 struct flchip_shared {
-       spinlock_t lock;
+       struct mutex lock;
        struct flchip *writing;
        struct flchip *erasing;
 };