Skip to content

Commit

Permalink
mtd: rawnand: Pass a nand_chip object to nand_wait_ready()
Browse files Browse the repository at this point in the history
Let's make the raw NAND API consistent by patching all helpers to
take a nand_chip object instead of an mtd_info one.

Now is nand_wait_ready()'s turn.

Signed-off-by: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
  • Loading branch information
Boris Brezillon authored and Miquel Raynal committed Oct 3, 2018
1 parent 59ac276 commit 2b356ab
Show file tree
Hide file tree
Showing 4 changed files with 9 additions and 9 deletions.
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/bcm47xxnflash/ops_bcm4706.c
Original file line number Diff line number Diff line change
Expand Up @@ -232,7 +232,7 @@ static void bcm47xxnflash_ops_bcm4706_cmdfunc(struct mtd_info *mtd,
nand_chip->cmd_ctrl(mtd, command, NAND_CTRL_CLE);

ndelay(100);
nand_wait_ready(mtd);
nand_wait_ready(nand_chip);
break;
case NAND_CMD_READID:
ctlcode = NCTL_CSA | 0x01000000 | NCTL_CMD1W | NCTL_CMD0;
Expand Down
2 changes: 1 addition & 1 deletion drivers/mtd/nand/raw/cafe_nand.c
Original file line number Diff line number Diff line change
Expand Up @@ -313,7 +313,7 @@ static void cafe_nand_cmdfunc(struct mtd_info *mtd, unsigned command,
cafe_writel(cafe, cafe->ctl2, NAND_CTRL2);
return;
}
nand_wait_ready(mtd);
nand_wait_ready(chip);
cafe_writel(cafe, cafe->ctl2, NAND_CTRL2);
}

Expand Down
12 changes: 6 additions & 6 deletions drivers/mtd/nand/raw/nand_base.c
Original file line number Diff line number Diff line change
Expand Up @@ -624,13 +624,13 @@ static void panic_nand_wait_ready(struct mtd_info *mtd, unsigned long timeo)

/**
* nand_wait_ready - [GENERIC] Wait for the ready pin after commands.
* @mtd: MTD device structure
* @chip: NAND chip object
*
* Wait for the ready pin after a command, and warn if a timeout occurs.
*/
void nand_wait_ready(struct mtd_info *mtd)
void nand_wait_ready(struct nand_chip *chip)
{
struct nand_chip *chip = mtd_to_nand(mtd);
struct mtd_info *mtd = nand_to_mtd(chip);
unsigned long timeo = 400;

if (in_interrupt() || oops_in_progress)
Expand Down Expand Up @@ -852,7 +852,7 @@ static void nand_command(struct mtd_info *mtd, unsigned int command,
*/
ndelay(100);

nand_wait_ready(mtd);
nand_wait_ready(chip);
}

static void nand_ccs_delay(struct nand_chip *chip)
Expand Down Expand Up @@ -1004,7 +1004,7 @@ static void nand_command_lp(struct mtd_info *mtd, unsigned int command,
*/
ndelay(100);

nand_wait_ready(mtd);
nand_wait_ready(chip);
}

/**
Expand Down Expand Up @@ -2251,7 +2251,7 @@ static int nand_wait_rdy_op(struct nand_chip *chip, unsigned int timeout_ms,
if (!chip->dev_ready)
udelay(chip->chip_delay);
else
nand_wait_ready(nand_to_mtd(chip));
nand_wait_ready(chip);

return 0;
}
Expand Down
2 changes: 1 addition & 1 deletion include/linux/mtd/rawnand.h
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ static inline int nand_scan(struct nand_chip *chip, int max_chips)
}

/* Internal helper for board drivers which need to override command function */
void nand_wait_ready(struct mtd_info *mtd);
void nand_wait_ready(struct nand_chip *chip);

/* The maximum number of NAND chips in an array */
#define NAND_MAX_CHIPS 8
Expand Down

0 comments on commit 2b356ab

Please sign in to comment.