From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: dwmw2@infradead.org, computersforpeace@gmail.com,
kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code
Date: Mon, 11 Jan 2016 12:55:58 +0000 [thread overview]
Message-ID: <20160111135558.6ebd1165@bbrezillon> (raw)
In-Reply-To: <1452408399-5840-1-git-send-email-christophe.jaillet@wanadoo.fr>
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
WARNING: multiple messages have this Message-ID (diff)
From: Boris Brezillon <boris.brezillon@free-electrons.com>
To: Christophe JAILLET <christophe.jaillet@wanadoo.fr>
Cc: dwmw2@infradead.org, computersforpeace@gmail.com,
kernel-janitors@vger.kernel.org, linux-mtd@lists.infradead.org,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code
Date: Mon, 11 Jan 2016 13:55:58 +0100 [thread overview]
Message-ID: <20160111135558.6ebd1165@bbrezillon> (raw)
In-Reply-To: <1452408399-5840-1-git-send-email-christophe.jaillet@wanadoo.fr>
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
next prev parent reply other threads:[~2016-01-11 12:55 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2016-01-10 6:46 [PATCH] mtd: nand: mpc5121: use 'of_machine_is_compatible' to simplify code Christophe JAILLET
2016-01-10 6:46 ` Christophe JAILLET
2016-01-11 12:55 ` Boris Brezillon [this message]
2016-01-11 12:55 ` Boris Brezillon
2016-01-23 0:36 ` Brian Norris
2016-01-23 0:36 ` Brian Norris
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20160111135558.6ebd1165@bbrezillon \
--to=boris.brezillon@free-electrons.com \
--cc=christophe.jaillet@wanadoo.fr \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=kernel-janitors@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.