diff mbox

[10/10] ARM: omap2: use clkdev_add_alias()

Message ID E1YSTnw-0001K5-IQ@rmk-PC.arm.linux.org.uk (mailing list archive)
State New, archived
Headers show

Commit Message

Russell King March 2, 2015, 5:06 p.m. UTC
When creating aliases of existing clkdev clocks, use clkdev_add_alias()
isntead of open coding the lookup and clk_lookup creation.

Signed-off-by: Russell King <rmk+kernel@arm.linux.org.uk>
---
 arch/arm/mach-omap2/omap_device.c | 24 +++++++++---------------
 1 file changed, 9 insertions(+), 15 deletions(-)

Comments

Tony Lindgren March 3, 2015, 12:13 a.m. UTC | #1
* Russell King <rmk+kernel@arm.linux.org.uk> [150302 09:10]:
> When creating aliases of existing clkdev clocks, use clkdev_add_alias()
> isntead of open coding the lookup and clk_lookup creation.

Gave this series a quick try but I get these build errors:

arch/arm/mach-omap2/omap_device.c: In function ‘_add_clkdev’:
arch/arm/mach-omap2/omap_device.c:65:58: warning: passing argument 3 of ‘clk_add_alias’ discards ‘const’ qualifier from pointer target type
  rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
                                                          ^
In file included from arch/arm/mach-omap2/omap_device.c:34:0:
include/linux/clkdev.h:44:5: note: expected ‘char *’ but argument is of type ‘const char *’
 int clk_add_alias(const char *, const char *, char *, struct device *);
     ^
drivers/clk/clkdev.c:298:16: error: expected declaration specifiers or ‘...’ before ‘(’ token
 vclkdev_create((struct clk *clk, const char *con_id, const char *dev_fmt,
                ^
drivers/clk/clkdev.c:322:92: error: storage class specified for parameter ‘__crc_clkdev_alloc’
 EXPORT_SYMBOL(clkdev_alloc);
                                                                                            ^
drivers/clk/clkdev.c:322:1: warning: ‘weak’ attribute ignored [-Wattributes]
 EXPORT_SYMBOL(clkdev_alloc);
 ^
drivers/clk/clkdev.c:322:1: warning: ‘externally_visible’ attribute ignored [-Wattributes]
drivers/clk/clkdev.c:322:161: error: storage class specified for parameter ‘__kcrctab_clkdev_alloc’
 EXPORT_SYMBOL(clkdev_alloc);
                                                                                                                                                                 ^
drivers/clk/clkdev.c:322:1: warning: ‘__used__’ attribute ignored [-Wattributes]
 EXPORT_SYMBOL(clkdev_alloc);
 ^
drivers/clk/clkdev.c:322:161: error: section attribute not allowed for ‘__kcrctab_clkdev_alloc’
 EXPORT_SYMBOL(clkdev_alloc);
                                                                                                                                                                 ^
drivers/clk/clkdev.c:322:279: error: expected ‘;’, ‘,’ or ‘)’ before ‘=’ token
 EXPORT_SYMBOL(clkdev_alloc);

drivers/clk/clkdev.c:274:1: warning: ‘vclkdev_alloc’ defined but not used [-Wunused-function]
 vclkdev_alloc(struct clk *clk, const char *con_id, const char *dev_fmt,

Regards,

Tony
diff mbox

Patch

diff --git a/arch/arm/mach-omap2/omap_device.c b/arch/arm/mach-omap2/omap_device.c
index be9541e18650..521c32e7778e 100644
--- a/arch/arm/mach-omap2/omap_device.c
+++ b/arch/arm/mach-omap2/omap_device.c
@@ -47,7 +47,7 @@  static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 		       const char *clk_name)
 {
 	struct clk *r;
-	struct clk_lookup *l;
+	int rc;
 
 	if (!clk_alias || !clk_name)
 		return;
@@ -62,21 +62,15 @@  static void _add_clkdev(struct omap_device *od, const char *clk_alias,
 		return;
 	}
 
-	r = clk_get(NULL, clk_name);
-	if (IS_ERR(r)) {
-		dev_err(&od->pdev->dev,
-			"clk_get for %s failed\n", clk_name);
-		return;
+	rc = clk_add_alias(clk_alias, dev_name(&od->pdev->dev), clk_name, NULL);
+	if (rc) {
+		if (rc == -ENODEV || rc == -ENOMEM)
+			dev_err(&od->pdev->dev,
+				"clkdev_alloc for %s failed\n", clk_alias);
+		else
+			dev_err(&od->pdev->dev,
+				"clk_get for %s failed\n", clk_name);
 	}
-
-	l = clkdev_alloc(r, clk_alias, dev_name(&od->pdev->dev));
-	if (!l) {
-		dev_err(&od->pdev->dev,
-			"clkdev_alloc for %s failed\n", clk_alias);
-		return;
-	}
-
-	clkdev_add(l);
 }
 
 /**