Skip to content

Commit 661803b

Browse files
Boris Brezillonmiquelraynal
authored andcommitted
mtd: rawnand: Stop using chip->state in drivers
We are about to simplify the locking in the rawnand framework, and part of this simplication is about getting rid of chip->state, so let's first patch drivers that check the state. All of them do that to get a timeout value based on the operation that is being executed. Since a timeout is, by definition, something that is here to prevent hanging on an event that might never happen, picking the maximum timeout value no matter the operation should be harmless. Signed-off-by: Boris Brezillon <[email protected]> Signed-off-by: Miquel Raynal <[email protected]>
1 parent efe5d13 commit 661803b

File tree

3 files changed

+5
-11
lines changed

3 files changed

+5
-11
lines changed

drivers/mtd/nand/raw/omap2.c

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -994,12 +994,9 @@ static int omap_wait(struct nand_chip *this)
994994
{
995995
struct omap_nand_info *info = mtd_to_omap(nand_to_mtd(this));
996996
unsigned long timeo = jiffies;
997-
int status, state = this->state;
997+
int status;
998998

999-
if (state == FL_ERASING)
1000-
timeo += msecs_to_jiffies(400);
1001-
else
1002-
timeo += msecs_to_jiffies(20);
999+
timeo += msecs_to_jiffies(400);
10031000

10041001
writeb(NAND_CMD_STATUS & 0xFF, info->reg.gpmc_nand_command);
10051002
while (time_before(jiffies, timeo)) {

drivers/mtd/nand/raw/r852.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -369,8 +369,7 @@ static int r852_wait(struct nand_chip *chip)
369369
unsigned long timeout;
370370
u8 status;
371371

372-
timeout = jiffies + (chip->state == FL_ERASING ?
373-
msecs_to_jiffies(400) : msecs_to_jiffies(20));
372+
timeout = jiffies + msecs_to_jiffies(400);
374373

375374
while (time_before(jiffies, timeout))
376375
if (chip->legacy.dev_ready(chip))

drivers/mtd/nand/raw/tmio_nand.c

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -195,15 +195,13 @@ static int tmio_nand_wait(struct nand_chip *nand_chip)
195195
reinit_completion(&tmio->comp);
196196
tmio_iowrite8(0x81, tmio->fcr + FCR_IMR);
197197

198-
timeout = nand_chip->state == FL_ERASING ? 400 : 20;
198+
timeout = 400;
199199
timeout = wait_for_completion_timeout(&tmio->comp,
200200
msecs_to_jiffies(timeout));
201201

202202
if (unlikely(!tmio_nand_dev_ready(nand_chip))) {
203203
tmio_iowrite8(0x00, tmio->fcr + FCR_IMR);
204-
dev_warn(&tmio->dev->dev, "still busy with %s after %d ms\n",
205-
nand_chip->state == FL_ERASING ? "erase" : "program",
206-
nand_chip->state == FL_ERASING ? 400 : 20);
204+
dev_warn(&tmio->dev->dev, "still busy after 400 ms\n");
207205

208206
} else if (unlikely(!timeout)) {
209207
tmio_iowrite8(0x00, tmio->fcr + FCR_IMR);

0 commit comments

Comments
 (0)