kernel-janitors.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code
@ 2016-01-10  6:46 Christophe JAILLET
  2016-01-11 12:55 ` Boris Brezillon
  0 siblings, 1 reply; 3+ messages in thread
From: Christophe JAILLET @ 2016-01-10  6:46 UTC (permalink / raw)
  To: dwmw2, computersforpeace
  Cc: linux-mtd, linux-kernel, kernel-janitors, Christophe JAILLET

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@wanadoo.fr>
---
 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");
-- 
2.5.0


^ permalink raw reply related	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code
  2016-01-10  6:46 [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code Christophe JAILLET
@ 2016-01-11 12:55 ` Boris Brezillon
  2016-01-23  0:36   ` Brian Norris
  0 siblings, 1 reply; 3+ messages in thread
From: Boris Brezillon @ 2016-01-11 12:55 UTC (permalink / raw)
  To: Christophe JAILLET
  Cc: dwmw2, computersforpeace, kernel-janitors, linux-mtd,
	linux-kernel

Hi Christophe,

On Sun, 10 Jan 2016 07:46:39 +0100
Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:

> 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@wanadoo.fr>

Your patch looks good from a functional POV, but what is this board
detection hack doing in the NAND driver code in the first place?

Let's say I didn't see that :-).

Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.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");



-- 
Boris Brezillon, Free Electrons
Embedded Linux and Kernel engineering
http://free-electrons.com

^ permalink raw reply	[flat|nested] 3+ messages in thread

* Re: [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code
  2016-01-11 12:55 ` Boris Brezillon
@ 2016-01-23  0:36   ` Brian Norris
  0 siblings, 0 replies; 3+ messages in thread
From: Brian Norris @ 2016-01-23  0:36 UTC (permalink / raw)
  To: Boris Brezillon
  Cc: Christophe JAILLET, dwmw2, kernel-janitors, linux-mtd,
	linux-kernel

On Mon, Jan 11, 2016 at 01:55:58PM +0100, Boris Brezillon wrote:
> On Sun, 10 Jan 2016 07:46:39 +0100
> Christophe JAILLET <christophe.jaillet@wanadoo.fr> wrote:
> 
> > 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@wanadoo.fr>
> 
> Your patch looks good from a functional POV, but what is this board
> detection hack doing in the NAND driver code in the first place?
> 
> Let's say I didn't see that :-).

:)

> Reviewed-by: Boris Brezillon <boris.brezillon@free-electrons.com>

Applied to l2-mtd.git/next

^ permalink raw reply	[flat|nested] 3+ messages in thread

end of thread, other threads:[~2016-01-23  0:36 UTC | newest]

Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2016-01-10  6:46 [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code Christophe JAILLET
2016-01-11 12:55 ` Boris Brezillon
2016-01-23  0:36   ` Brian Norris

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).