mtd: nand: denali: allow to override mtd->name from label DT property

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Wed May 10 19:59:11 PDT 2017


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=8aabdf376f2baafbaaceeee1f3f7f7dca70f8e0b
Commit:     8aabdf376f2baafbaaceeee1f3f7f7dca70f8e0b
Parent:     07604686e808cd93d352172806a7828860f048f5
Author:     Masahiro Yamada <yamada.masahiro at socionext.com>
AuthorDate: Thu Mar 30 15:45:48 2017 +0900
Committer:  Boris Brezillon <boris.brezillon at free-electrons.com>
CommitDate: Tue Apr 25 14:18:31 2017 +0200

    mtd: nand: denali: allow to override mtd->name from label DT property
    
    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 at socionext.com>
    Suggested-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Boris Brezillon <boris.brezillon at free-electrons.com>
---
 drivers/mtd/nand/denali.c | 4 +++-
 1 file changed, 3 insertions(+), 1 deletion(-)

diff --git a/drivers/mtd/nand/denali.c b/drivers/mtd/nand/denali.c
index 4ca75d3..4e6d03d 100644
--- a/drivers/mtd/nand/denali.c
+++ b/drivers/mtd/nand/denali.c
@@ -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;



More information about the linux-mtd-cvs mailing list