-+
-+/* wait until the flash chip is ready and grab a lock */
-+static int spiflash_wait_ready(struct spiflash_priv *priv, int state)
-+{
-+ DECLARE_WAITQUEUE(wait, current);
-+
-+retry:
-+ spin_lock_bh(&priv->lock);
-+ if (priv->state != FL_READY) {
-+ set_current_state(TASK_UNINTERRUPTIBLE);
-+ add_wait_queue(&priv->wq, &wait);
-+ spin_unlock_bh(&priv->lock);
-+ schedule();
-+ remove_wait_queue(&priv->wq, &wait);
-+
-+ if (signal_pending(current))
-+ return 0;
-+
-+ goto retry;
-+ }
-+ priv->state = state;
-+
-+ return 1;
-+}
-+
-+static inline void spiflash_done(struct spiflash_priv *priv)
-+{
-+ priv->state = FL_READY;
-+ spin_unlock_bh(&priv->lock);
-+ wake_up(&priv->wq);
-+}
-+