mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code

Linux-MTD Mailing List linux-mtd at lists.infradead.org
Thu Mar 24 11:59:01 PDT 2016


Gitweb:     http://git.infradead.org/?p=mtd-2.6.git;a=commit;h=23819f2eaab87080b0190ed94a0728fc8ea84711
Commit:     23819f2eaab87080b0190ed94a0728fc8ea84711
Parent:     f9bdbd6c46c8ce0bb95f5b708a4a4a4b6b9a5917
Author:     Christophe Jaillet <christophe.jaillet at wanadoo.fr>
AuthorDate: Sun Jan 10 07:46:39 2016 +0100
Committer:  Brian Norris <computersforpeace at gmail.com>
CommitDate: Fri Jan 22 16:35:25 2016 -0800

    mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code
    
    The current code is the same as 'of_machine_is_compatible'.
    So use it in order to remove a few lines of code and to be more
    consistent with other parts of the kernel.
    
    Signed-off-by: Christophe JAILLET <christophe.jaillet at wanadoo.fr>
    Reviewed-by: Boris Brezillon <boris.brezillon at free-electrons.com>
    Signed-off-by: Brian Norris <computersforpeace at gmail.com>
---
 drivers/mtd/nand/mpc5121_nfc.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/mtd/nand/mpc5121_nfc.c b/drivers/mtd/nand/mpc5121_nfc.c
index 6b93e89..5d7843f 100644
--- a/drivers/mtd/nand/mpc5121_nfc.c
+++ b/drivers/mtd/nand/mpc5121_nfc.c
@@ -626,7 +626,7 @@ static void mpc5121_nfc_free(struct device *dev, struct mtd_info *mtd)
 
 static int mpc5121_nfc_probe(struct platform_device *op)
 {
-	struct device_node *rootnode, *dn = op->dev.of_node;
+	struct device_node *dn = op->dev.of_node;
 	struct clk *clk;
 	struct device *dev = &op->dev;
 	struct mpc5121_nfc_prv *prv;
@@ -712,18 +712,15 @@ static int mpc5121_nfc_probe(struct platform_device *op)
 	chip->ecc.mode = NAND_ECC_SOFT;
 
 	/* Support external chip-select logic on ADS5121 board */
-	rootnode = of_find_node_by_path("/");
-	if (of_device_is_compatible(rootnode, "fsl,mpc5121ads")) {
+	if (of_machine_is_compatible("fsl,mpc5121ads")) {
 		retval = ads5121_chipselect_init(mtd);
 		if (retval) {
 			dev_err(dev, "Chipselect init error!\n");
-			of_node_put(rootnode);
 			return retval;
 		}
 
 		chip->select_chip = ads5121_select_chip;
 	}
-	of_node_put(rootnode);
 
 	/* Enable NFC clock */
 	clk = devm_clk_get(dev, "ipg");



More information about the linux-mtd-cvs mailing list