From: Richard Weinberger <richard@nod.at>
To: Masahiro Yamada <yamada.masahiro@socionext.com>
Cc: linux-mtd@lists.infradead.org,
Boris Brezillon <boris.brezillon@bootlin.com>,
Rob Herring <robh+dt@kernel.org>,
linux-kbuild@vger.kernel.org,
Miquel Raynal <miquel.raynal@bootlin.com>,
linux-kernel@vger.kernel.org, Marek Vasut <marek.vasut@gmail.com>,
Brian Norris <computersforpeace@gmail.com>,
David Woodhouse <dwmw2@infradead.org>
Subject: Re: [PATCH v3 2/3] mtd: rawnand: denali_dt: use dev as a shorthand of &pdev->dev
Date: Tue, 19 Jun 2018 13:17:14 +0200 [thread overview]
Message-ID: <4803088.H75MTUDLH6@blindfold> (raw)
In-Reply-To: <1529025532-22087-3-git-send-email-yamada.masahiro@socionext.com>
Am Freitag, 15. Juni 2018, 03:18:51 CEST schrieb Masahiro Yamada:
> The probe function references &pdev->dev many times. Add 'dev' as
> a shorthand.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
> Changes in v3: None
> Changes in v2: None
>
> drivers/mtd/nand/raw/denali_dt.c | 25 +++++++++++++------------
> 1 file changed, 13 insertions(+), 12 deletions(-)
>
> diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
> index ce6239d..afaae37 100644
> --- a/drivers/mtd/nand/raw/denali_dt.c
> +++ b/drivers/mtd/nand/raw/denali_dt.c
> @@ -81,38 +81,39 @@ MODULE_DEVICE_TABLE(of, denali_nand_dt_ids);
>
> static int denali_dt_probe(struct platform_device *pdev)
> {
> + struct device *dev = &pdev->dev;
> struct resource *res;
> struct denali_dt *dt;
> const struct denali_dt_data *data;
> struct denali_nand_info *denali;
> int ret;
>
> - dt = devm_kzalloc(&pdev->dev, sizeof(*dt), GFP_KERNEL);
> + dt = devm_kzalloc(dev, sizeof(*dt), GFP_KERNEL);
> if (!dt)
> return -ENOMEM;
> denali = &dt->denali;
>
> - data = of_device_get_match_data(&pdev->dev);
> + data = of_device_get_match_data(dev);
> if (data) {
> denali->revision = data->revision;
> denali->caps = data->caps;
> denali->ecc_caps = data->ecc_caps;
> }
>
> - denali->dev = &pdev->dev;
> + denali->dev = dev;
> denali->irq = platform_get_irq(pdev, 0);
> if (denali->irq < 0) {
> - dev_err(&pdev->dev, "no irq defined\n");
> + dev_err(dev, "no irq defined\n");
> return denali->irq;
> }
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "denali_reg");
> - denali->reg = devm_ioremap_resource(&pdev->dev, res);
> + denali->reg = devm_ioremap_resource(dev, res);
> if (IS_ERR(denali->reg))
> return PTR_ERR(denali->reg);
>
> res = platform_get_resource_byname(pdev, IORESOURCE_MEM, "nand_data");
> - denali->host = devm_ioremap_resource(&pdev->dev, res);
> + denali->host = devm_ioremap_resource(dev, res);
> if (IS_ERR(denali->host))
> return PTR_ERR(denali->host);
>
> @@ -120,19 +121,19 @@ static int denali_dt_probe(struct platform_device *pdev)
> * A single anonymous clock is supported for the backward compatibility.
> * New platforms should support all the named clocks.
> */
> - dt->clk = devm_clk_get(&pdev->dev, "nand");
> + dt->clk = devm_clk_get(dev, "nand");
> if (IS_ERR(dt->clk))
> - dt->clk = devm_clk_get(&pdev->dev, NULL);
> + dt->clk = devm_clk_get(dev, NULL);
> if (IS_ERR(dt->clk)) {
> - dev_err(&pdev->dev, "no clk available\n");
> + dev_err(dev, "no clk available\n");
> return PTR_ERR(dt->clk);
> }
>
> - dt->clk_x = devm_clk_get(&pdev->dev, "nand_x");
> + dt->clk_x = devm_clk_get(dev, "nand_x");
> if (IS_ERR(dt->clk_x))
> dt->clk_x = NULL;
>
> - dt->clk_ecc = devm_clk_get(&pdev->dev, "ecc");
> + dt->clk_ecc = devm_clk_get(dev, "ecc");
> if (IS_ERR(dt->clk_ecc))
> dt->clk_ecc = NULL;
>
> @@ -155,7 +156,7 @@ static int denali_dt_probe(struct platform_device *pdev)
> * Hardcode the clock rates for the backward compatibility.
> * This works for both SOCFPGA and UniPhier.
> */
> - dev_notice(&pdev->dev,
> + dev_notice(dev,
> "necessary clock is missing. default clock rates are used.\n");
> denali->clk_x_rate = 200000000;
> }
>
Tested-by: Richard Weinberger <richard@nod.at>
Thanks,
//richard
next prev parent reply other threads:[~2018-06-19 11:17 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2018-06-15 1:18 [PATCH v3 0/3] mtd: rawnand: denali: add new clocks and improve setup_data_interface Masahiro Yamada
2018-06-15 1:18 ` [PATCH v3 1/3] mtd: rawnand: denali_dt: add more clocks based on IP datasheet Masahiro Yamada
2018-06-18 7:09 ` Richard Weinberger
2018-06-18 7:46 ` Boris Brezillon
2018-06-18 12:18 ` Miquel Raynal
2018-06-19 8:07 ` Masahiro Yamada
2018-06-19 10:46 ` Richard Weinberger
2018-06-19 9:14 ` Miquel Raynal
2018-06-19 11:28 ` Boris Brezillon
2018-06-22 11:42 ` Boris Brezillon
2018-06-22 13:24 ` Masahiro Yamada
2018-06-20 18:12 ` Rob Herring
2018-06-15 1:18 ` [PATCH v3 2/3] mtd: rawnand: denali_dt: use dev as a shorthand of &pdev->dev Masahiro Yamada
2018-06-18 7:10 ` Richard Weinberger
2018-06-18 7:47 ` Boris Brezillon
2018-06-19 11:17 ` Richard Weinberger [this message]
2018-06-15 1:18 ` [PATCH v3 3/3] mtd: rawnand: denali: optimize timing parameters for data interface Masahiro Yamada
2018-06-18 7:22 ` Richard Weinberger
2018-06-18 13:53 ` Masahiro Yamada
2018-06-19 11:17 ` Richard Weinberger
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=4803088.H75MTUDLH6@blindfold \
--to=richard@nod.at \
--cc=boris.brezillon@bootlin.com \
--cc=computersforpeace@gmail.com \
--cc=dwmw2@infradead.org \
--cc=linux-kbuild@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-mtd@lists.infradead.org \
--cc=marek.vasut@gmail.com \
--cc=miquel.raynal@bootlin.com \
--cc=robh+dt@kernel.org \
--cc=yamada.masahiro@socionext.com \
/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 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).