mtd: nand: denali: allow to override mtd->name from label DT property
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Thu, 30 Mar 2017 06:45:48 +0000 (15:45 +0900)
committerBoris Brezillon <boris.brezillon@free-electrons.com>
Tue, 25 Apr 2017 12:18:31 +0000 (14:18 +0200)
Commit 28309572aac4 ("mtd: name the mtd device with an optional
label property") allow us to identify a chip in a user-friendly way.

If nand_set_flash_node() picks up the "label" from DT, let's respect
it.  Otherwise, let it fallback to the current name "denali-nand".

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
Suggested-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Boris Brezillon <boris.brezillon@free-electrons.com>
drivers/mtd/nand/denali.c

index 4ca75d3926efd23e2af54e864eb2df59fa94cf28..4e6d03d7a0319586c06257d15196ec77ddae1f40 100644 (file)
@@ -1462,8 +1462,10 @@ int denali_init(struct denali_nand_info *denali)
 
        /* now that our ISR is registered, we can enable interrupts */
        denali_set_intr_modes(denali, true);
-       mtd->name = "denali-nand";
        nand_set_flash_node(chip, denali->dev->of_node);
+       /* Fallback to the default name if DT did not give "label" property */
+       if (!mtd->name)
+               mtd->name = "denali-nand";
 
        /* register the driver with the NAND core subsystem */
        chip->select_chip = denali_select_chip;