[PATCHv6 38/45] ARM: OMAP2+: omap_device: use dev pointer to optimize code

Tero Kristo t-kristo at ti.com
Thu Aug 29 09:16:30 EDT 2013


From: Nishanth Menon <nm at ti.com>

_add_clkdev uses &od->pdev->dev for all reference of device struct.

Simplify the usage with a variable.

Signed-off-by: Nishanth Menon <nm at ti.com>
Signed-off-by: Tero Kristo <t-kristo at ti.com>
---
 arch/arm/mach-omap2/omap_device.c |   16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index f99f68e..070d17b 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -47,31 +47,29 @@ static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 {
 	struct clk *r;
 	struct clk_lookup *l;
+	struct device *dev = &od->pdev->dev;
 
 	if (!clk_alias || !clk_name)
 		return;
 
-	dev_dbg(&od->pdev->dev, "Creating %s -> %s\n", clk_alias, clk_name);
+	dev_dbg(dev, "Creating %s -> %s\n", clk_alias, clk_name);
 
-	r = clk_get_sys(dev_name(&od->pdev->dev), clk_alias);
+	r = clk_get_sys(dev_name(dev), clk_alias);
 	if (!IS_ERR(r)) {
-		dev_warn(&od->pdev->dev,
-			 "alias %s already exists\n", clk_alias);
+		dev_warn(dev, "alias %s already exists\n", clk_alias);
 		clk_put(r);
 		return;
 	}
 
 	r = clk_get(NULL, clk_name);
 	if (IS_ERR(r)) {
-		dev_err(&od->pdev->dev,
-			"clk_get for %s failed\n", clk_name);
+		dev_err(dev, "clk_get for %s failed\n", clk_name);
 		return;
 	}
 
-	l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev));
+	l = clkdev_alloc(r, clk_alias, dev_name(dev));
 	if (!l) {
-		dev_err(&od->pdev->dev,
-			"clkdev_alloc for %s failed\n", clk_alias);
+		dev_err(dev, "clkdev_alloc for %s failed\n", clk_alias);
 		return;
 	}
 
-- 
1.7.9.5




More information about the linux-arm-kernel mailing list