mtd: nand: convert to nand_get_flash_node()
authorBoris BREZILLON <boris.brezillon@free-electrons.com>
Sun, 1 Nov 2015 23:03:38 +0000 (00:03 +0100)
committerBrian Norris <computersforpeace@gmail.com>
Wed, 11 Nov 2015 23:54:15 +0000 (15:54 -0800)
Used semantic patch with 'make coccicheck MODE=patch COCCI=script.cocci':

---8<----
virtual patch

@@
struct nand_chip c;
struct nand_chip *cp;
@@
(
-(cp)->flash_node
+nand_get_flash_node(cp)
|
-(c).flash_node
+nand_get_flash_node(&c)
)
---8<----

Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Brian Norris <computersforpeace@gmail.com>
drivers/mtd/nand/brcmnand/brcmnand.c
drivers/mtd/nand/nand_base.c
drivers/mtd/nand/vf610_nfc.c

index a37659de025c255c32717e64c06b4fa1a56bd195..2a437c7ed175936aa8c1035a07413058a153ca3f 100644 (file)
@@ -1816,7 +1816,7 @@ static int brcmnand_setup_dev(struct brcmnand_host *host)
 
        memset(cfg, 0, sizeof(*cfg));
 
-       ret = of_property_read_u32(chip->flash_node,
+       ret = of_property_read_u32(nand_get_flash_node(chip),
                                   "brcm,nand-oob-sector-size",
                                   &oob_sector);
        if (ret) {
index 939ab3d5acc2bec1ec7fa7b7f199227d78d8bae3..4ac4efe65c62ed3ac7b968711980640286726d3a 100644 (file)
@@ -3989,11 +3989,11 @@ int nand_scan_ident(struct mtd_info *mtd, int maxchips,
        struct nand_flash_dev *type;
        int ret;
 
-       if (chip->flash_node) {
+       if (nand_get_flash_node(chip)) {
                /* MTD can automatically handle DT partitions, etc. */
-               mtd_set_of_node(mtd, chip->flash_node);
+               mtd_set_of_node(mtd, nand_get_flash_node(chip));
 
-               ret = nand_dt_init(mtd, chip, chip->flash_node);
+               ret = nand_dt_init(mtd, chip, nand_get_flash_node(chip));
                if (ret)
                        return ret;
        }
index b6df4c6d60ca9f7ee38252127da3f286772b12bc..1c86c6b42515ae5457b481f5c7eb28a2ea52c251 100644 (file)
@@ -707,7 +707,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
        for_each_available_child_of_node(nfc->dev->of_node, child) {
                if (of_device_is_compatible(child, "fsl,vf610-nfc-nandcs")) {
 
-                       if (chip->flash_node) {
+                       if (nand_get_flash_node(chip)) {
                                dev_err(nfc->dev,
                                        "Only one NAND chip supported!\n");
                                err = -EINVAL;
@@ -718,7 +718,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
                }
        }
 
-       if (!chip->flash_node) {
+       if (!nand_get_flash_node(chip)) {
                dev_err(nfc->dev, "NAND chip sub-node missing!\n");
                err = -ENODEV;
                goto err_clk;
@@ -814,7 +814,7 @@ static int vf610_nfc_probe(struct platform_device *pdev)
        return mtd_device_register(mtd, NULL, 0);
 
 error:
-       of_node_put(chip->flash_node);
+       of_node_put(nand_get_flash_node(chip));
 err_clk:
        clk_disable_unprepare(nfc->clk);
        return err;