diff options
author | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-07-25 15:31:45 +0200 |
---|---|---|
committer | Miquel Raynal <miquel.raynal@bootlin.com> | 2018-07-31 09:46:11 +0200 |
commit | 2f2173449b0350a206faf0d1aa71595602a40c98 (patch) | |
tree | d10242293d4d566945ec9c88c18c0e3f325f6260 /drivers/mtd | |
parent | f57bbfb9e3f47b6d4eecb1d8037dab1cda9996a4 (diff) | |
download | linux-2f2173449b0350a206faf0d1aa71595602a40c98.tar.gz linux-2f2173449b0350a206faf0d1aa71595602a40c98.tar.bz2 linux-2f2173449b0350a206faf0d1aa71595602a40c98.zip |
mtd: rawnand: jz4740: group nand_scan_{ident, tail} calls
Prepare the migration to nand_scan() by moving both calls to
nand_scan_ident() and nand_scan_tail() in a single spot.
Signed-off-by: Miquel Raynal <miquel.raynal@bootlin.com>
Reviewed-by: Boris Brezillon <boris.brezillon@bootlin.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r-- | drivers/mtd/nand/raw/jz4740_nand.c | 23 |
1 files changed, 11 insertions, 12 deletions
diff --git a/drivers/mtd/nand/raw/jz4740_nand.c b/drivers/mtd/nand/raw/jz4740_nand.c index 3abf87420c10..ccd8f897db7c 100644 --- a/drivers/mtd/nand/raw/jz4740_nand.c +++ b/drivers/mtd/nand/raw/jz4740_nand.c @@ -309,6 +309,7 @@ static int jz_nand_detect_bank(struct platform_device *pdev, size_t chipnr, uint8_t *nand_maf_id, uint8_t *nand_dev_id) { + struct jz_nand_platform_data *pdata = dev_get_platdata(&pdev->dev); int ret; char res_name[6]; uint32_t ctrl; @@ -335,6 +336,16 @@ static int jz_nand_detect_bank(struct platform_device *pdev, if (ret) goto notfound_id; + if (pdata && pdata->ident_callback) + pdata->ident_callback(pdev, mtd, &pdata->partitions, + &pdata->num_partitions); + + ret = nand_scan_tail(mtd); + if (ret) { + dev_err(&pdev->dev, "Failed to scan NAND\n"); + goto notfound_id; + } + /* Retrieve the IDs from the first chip. */ chip->select_chip(mtd, 0); nand_reset_op(chip); @@ -456,17 +467,6 @@ static int jz_nand_probe(struct platform_device *pdev) goto err_iounmap_mmio; } - if (pdata && pdata->ident_callback) { - pdata->ident_callback(pdev, mtd, &pdata->partitions, - &pdata->num_partitions); - } - - ret = nand_scan_tail(mtd); - if (ret) { - dev_err(&pdev->dev, "Failed to scan NAND\n"); - goto err_unclaim_banks; - } - ret = mtd_device_register(mtd, pdata ? pdata->partitions : NULL, pdata ? pdata->num_partitions : 0); @@ -481,7 +481,6 @@ static int jz_nand_probe(struct platform_device *pdev) err_cleanup_nand: nand_cleanup(chip); -err_unclaim_banks: while (chipnr--) { unsigned char bank = nand->banks[chipnr]; jz_nand_iounmap_resource(nand->bank_mem[bank - 1], |