summaryrefslogtreecommitdiffstats
path: root/drivers/mtd
diff options
context:
space:
mode:
authorBoris BREZILLON <boris.brezillon@free-electrons.com>2015-12-10 09:00:37 +0100
committerBrian Norris <computersforpeace@gmail.com>2015-12-18 13:22:50 -0800
commit7194a29a9bf1e5abcda8b181bba771fbe0e95b6c (patch)
tree90c70be3a9445ffcc5737554c6e75587e71ee972 /drivers/mtd
parentf12d86afc5594c89492fb7c78fce07a4e94b2384 (diff)
downloadblackbird-op-linux-7194a29a9bf1e5abcda8b181bba771fbe0e95b6c.tar.gz
blackbird-op-linux-7194a29a9bf1e5abcda8b181bba771fbe0e95b6c.zip
mtd: nand: simplify nand_dt_init() usage
nand_dt_init() function requires 3 arguments where it actually needs one (dn and mtd can both be retrieved from chip). Drop these parameters. Testing for dn != NULL inside nand_dt_init() also helps simplifying the caller code. Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com> Signed-off-by: Brian Norris <computersforpeace@gmail.com>
Diffstat (limited to 'drivers/mtd')
-rw-r--r--drivers/mtd/nand/nand_base.c21
1 files changed, 11 insertions, 10 deletions
diff --git a/drivers/mtd/nand/nand_base.c b/drivers/mtd/nand/nand_base.c
index 5aec1545cd39..ae3fd2a8c2f5 100644
--- a/drivers/mtd/nand/nand_base.c
+++ b/drivers/mtd/nand/nand_base.c
@@ -3937,11 +3937,17 @@ ident_done:
return type;
}
-static int nand_dt_init(struct mtd_info *mtd, struct nand_chip *chip,
- struct device_node *dn)
+static int nand_dt_init(struct nand_chip *chip)
{
+ struct device_node *dn = nand_get_flash_node(chip);
int ecc_mode, ecc_strength, ecc_step;
+ if (!dn)
+ return 0;
+
+ /* MTD can automatically handle DT partitions, etc. */
+ mtd_set_of_node(nand_to_mtd(chip), dn);
+
if (of_get_nand_bus_width(dn) == 16)
chip->options |= NAND_BUSWIDTH_16;
@@ -3989,14 +3995,9 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
struct nand_flash_dev *type;
int ret;
- if (nand_get_flash_node(chip)) {
- /* MTD can automatically handle DT partitions, etc. */
- mtd_set_of_node(mtd, nand_get_flash_node(chip));
-
- ret = nand_dt_init(mtd, chip, nand_get_flash_node(chip));
- if (ret)
- return ret;
- }
+ ret = nand_dt_init(chip);
+ if (ret)
+ return ret;
/* Set the default functions */
nand_set_defaults(chip, chip->options & NAND_BUSWIDTH_16);
OpenPOWER on IntegriCloud