[1/2] mtd: rawnand: denali_dt: use dev as a shorthand of &pdev->dev

Message ID 1528799515-1356-1-git-send-email-yamada.masahiro@socionext.com
State Superseded
Headers show
Series
  • [1/2] mtd: rawnand: denali_dt: use dev as a shorthand of &pdev->dev
Related show

Commit Message

Masahiro Yamada June 12, 2018, 10:31 a.m.
Add 'dev' as a shorthand before adding more code that takes a
pointer to struce device.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
---

 drivers/mtd/nand/raw/denali_dt.c | 17 +++++++++--------
 1 file changed, 9 insertions(+), 8 deletions(-)

Comments

Miquel Raynal June 18, 2018, 11:54 a.m. | #1
Hi Masahiro,

On Tue, 12 Jun 2018 19:31:54 +0900, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:

> Add 'dev' as a shorthand before adding more code that takes a
> pointer to struce device.

s/struce/a struct/?

> 
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>

With this fixed:

Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

Thanks
Miquel Raynal June 18, 2018, 12:14 p.m. | #2
Hi Masahiro,

On Mon, 18 Jun 2018 13:54:10 +0200, Miquel Raynal
<miquel.raynal@bootlin.com> wrote:

> Hi Masahiro,
> 
> On Tue, 12 Jun 2018 19:31:54 +0900, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
> 
> > Add 'dev' as a shorthand before adding more code that takes a
> > pointer to struce device.  
> 
> s/struce/a struct/?
> 
> > 
> > Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>  
> 
> With this fixed:
> 
> Acked-by: Miquel Raynal <miquel.raynal@bootlin.com>

I missed the two next versions with Boris/Richard reviews, forget about
this one.

Sorry for the inconvenience,
Miquèl

Patch

diff --git a/drivers/mtd/nand/raw/denali_dt.c b/drivers/mtd/nand/raw/denali_dt.c
index cfd33e6..d923cfa 100644
--- a/drivers/mtd/nand/raw/denali_dt.c
+++ b/drivers/mtd/nand/raw/denali_dt.c
@@ -79,44 +79,45 @@  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);
 
-	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);
 	}
 	ret = clk_prepare_enable(dt->clk);