diff options
Diffstat (limited to 'drivers/mtd/chips')
-rw-r--r-- | drivers/mtd/chips/cfi_cmdset_0001.c | 15 |
1 files changed, 15 insertions, 0 deletions
diff --git a/drivers/mtd/chips/cfi_cmdset_0001.c b/drivers/mtd/chips/cfi_cmdset_0001.c index ed5ce41d1377..350671ec5226 100644 --- a/drivers/mtd/chips/cfi_cmdset_0001.c +++ b/drivers/mtd/chips/cfi_cmdset_0001.c | |||
@@ -795,6 +795,7 @@ static int chip_ready (struct map_info *map, struct flchip *chip, unsigned long | |||
795 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode) | 795 | static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr, int mode) |
796 | { | 796 | { |
797 | int ret; | 797 | int ret; |
798 | DECLARE_WAITQUEUE(wait, current); | ||
798 | 799 | ||
799 | retry: | 800 | retry: |
800 | if (chip->priv && (mode == FL_WRITING || mode == FL_ERASING | 801 | if (chip->priv && (mode == FL_WRITING || mode == FL_ERASING |
@@ -851,6 +852,20 @@ static int get_chip(struct map_info *map, struct flchip *chip, unsigned long adr | |||
851 | spin_unlock(contender->mutex); | 852 | spin_unlock(contender->mutex); |
852 | } | 853 | } |
853 | 854 | ||
855 | /* Check if we already have suspended erase | ||
856 | * on this chip. Sleep. */ | ||
857 | if (mode == FL_ERASING && shared->erasing | ||
858 | && shared->erasing->oldstate == FL_ERASING) { | ||
859 | spin_unlock(&shared->lock); | ||
860 | set_current_state(TASK_UNINTERRUPTIBLE); | ||
861 | add_wait_queue(&chip->wq, &wait); | ||
862 | spin_unlock(chip->mutex); | ||
863 | schedule(); | ||
864 | remove_wait_queue(&chip->wq, &wait); | ||
865 | spin_lock(chip->mutex); | ||
866 | goto retry; | ||
867 | } | ||
868 | |||
854 | /* We now own it */ | 869 | /* We now own it */ |
855 | shared->writing = chip; | 870 | shared->writing = chip; |
856 | if (mode == FL_ERASING) | 871 | if (mode == FL_ERASING) |