Skip to contentSkip to conversation

TI clk driver cleanups

PATCH In review Stephen Boyd 2 participants 7 messages Jul 15, 2015 – Jul 16, 2015

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover TI clk driver cleanups

Some cleanups for the TI clk driver move.

Stephen Boyd (4):
clk: ti: Check kzalloc() for failures
clk: ti: Mark ti_clk_features static
clk: ti: clk-3xxx: Remove unused structures
clk: ti: Force pointer to be __iomem

 drivers/clk/ti/clk-3xxx.c | 10 ----------
 drivers/clk/ti/clk.c      |  6 ++++--
 2 files changed, 4 insertions(+), 12 deletions(-)
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#1 lore raw

PATCH 1/4 clk: ti: Check kzalloc() for failures

smatch reports a failure to check kzalloc() here:

drivers/clk/ti/clk.c:232
omap2_clk_provider_init() error: potential null dereference 'io'. (kzalloc returns null)

Check for an allocation failure and return -ENOMEM.

---
 drivers/clk/ti/clk.c | 2 ++
 1 file changed, 2 insertions(+)
drivers/clk/ti/clk.c +2 -0
index 7e037c45e459..931b44118bdf 100644
@@ -228,6 +228,8 @@ int __init omap2_clk_provider_init(struct device_node *parent, int index,
 	clocks_node_ptr[index] = clocks;
 
 	io = kzalloc(sizeof(*io), GFP_KERNEL);
+	if (!io)
+		return -ENOMEM;
 
 	io->regmap = syscon;
 	io->mem = mem;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#2 lore raw

PATCH 2/4 clk: ti: Mark ti_clk_features static

In reply to Stephen Boyd

This variable isn't exported outside of this file so mark it static. Silences the following sparse warning:

drivers/clk/ti/clk.c:36:24: warning: symbol 'ti_clk_features' was not declared. Should it be static?

---
 drivers/clk/ti/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ti/clk.c +1 -1
index 931b44118bdf..5dcc1bdfc7f4 100644
@@ -33,7 +33,7 @@
 struct ti_clk_ll_ops *ti_clk_ll_ops;
 static struct device_node *clocks_node_ptr[CLK_MAX_MEMMAPS];
 
-struct ti_clk_features ti_clk_features;
+static struct ti_clk_features ti_clk_features;
 
 struct clk_iomap {
 	struct regmap *regmap;
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#3 lore raw

PATCH 3/4 clk: ti: clk-3xxx: Remove unused structures

In reply to Stephen Boyd

Sparse complains about these structures missing static, but they also don't look to be used. Remove them.

drivers/clk/ti/clk-3xxx.c:74:30: warning: symbol 'clkhwops_omap3430es2_ssi_wait' was not declared. Should it be static? drivers/clk/ti/clk-3xxx.c:157:30: warning: symbol 'clkhwops_omap3430es2_hsotgusb_wait' was not declared. Should it be static?

---
 drivers/clk/ti/clk-3xxx.c | 10 ----------
 1 file changed, 10 deletions(-)
drivers/clk/ti/clk-3xxx.c +0 -10
index bd8291b53fd0..676ee8f6d813 100644
@@ -71,11 +71,6 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
 	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
 }
 
-const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
-	.find_idlest	= omap3430es2_clk_ssi_find_idlest,
-	.find_companion	= omap2_clk_dflt_find_companion,
-};
-
 const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
 	.allow_idle	= omap2_clkt_iclk_allow_idle,
 	.deny_idle	= omap2_clkt_iclk_deny_idle,
@@ -154,11 +149,6 @@ const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
 	.find_companion	= omap2_clk_dflt_find_companion,
 };
 
-const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
-	.find_idlest	= omap3430es2_clk_hsotgusb_find_idlest,
-	.find_companion	= omap2_clk_dflt_find_companion,
-};
-
 /**
  * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS
  * @clk: struct clk * being enabled
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
#4 lore raw

Re: [PATCH 3/4] clk: ti: clk-3xxx: Remove unused structures

Quoted 5 lines · Stephen Boyd

Sparse complains about these structures missing static, but they also don't look to be used. Remove them.

drivers/clk/ti/clk-3xxx.c:74:30: warning: symbol 'clkhwops_omap3430es2_ssi_wait' was not declared. Should it be static? drivers/clk/ti/clk-3xxx.c:157:30: warning: symbol 'clkhwops_omap3430es2_hsotgusb_wait' was not declared. Should it be static?

Interesting, I wonder if the references to these have accidentally been dropped at some point, namely (in 2012?) when we converted the clocks to use common clock struct.

Anyway, I guess we can fix the ssi/usb clocks later if we find some issues with them, its been at least 3 years since these have been used.

-Tero

Quoted 36 lines
---
  drivers/clk/ti/clk-3xxx.c | 10 ----------
  1 file changed, 10 deletions(-)
drivers/clk/ti/clk-3xxx.c +0 -10
index bd8291b53fd0..676ee8f6d813 100644
@@ -71,11 +71,6 @@ static void omap3430es2_clk_ssi_find_idlest(struct clk_hw_omap *clk,
  	*idlest_val = OMAP34XX_CM_IDLEST_VAL;
  }
 
-const struct clk_hw_omap_ops clkhwops_omap3430es2_ssi_wait = {
-	.find_idlest	= omap3430es2_clk_ssi_find_idlest,
-	.find_companion	= omap2_clk_dflt_find_companion,
-};
-
  const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_ssi_wait = {
  	.allow_idle	= omap2_clkt_iclk_allow_idle,
  	.deny_idle	= omap2_clkt_iclk_deny_idle,
@@ -154,11 +149,6 @@ const struct clk_hw_omap_ops clkhwops_omap3430es2_iclk_hsotgusb_wait = {
  	.find_companion	= omap2_clk_dflt_find_companion,
  };
 
-const struct clk_hw_omap_ops clkhwops_omap3430es2_hsotgusb_wait = {
-	.find_idlest	= omap3430es2_clk_hsotgusb_find_idlest,
-	.find_companion	= omap2_clk_dflt_find_companion,
-};
-
  /**
   * am35xx_clk_find_idlest - return clock ACK info for AM35XX IPSS
   * @clk: struct clk * being enabled
#5 lore raw

PATCH 4/4 clk: ti: Force pointer to be __iomem

In reply to Stephen Boyd

Add __force here so that sparse doesn't complain about us playing tricks with __iomem.

---

This whole scheme is really ugly, hopefully it can be cleaned up soon.

 drivers/clk/ti/clk.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/clk/ti/clk.c +1 -1
index 5dcc1bdfc7f4..ace35047783b 100644
@@ -194,7 +194,7 @@ void __iomem *ti_clk_get_reg_addr(struct device_node *node, int index)
 
 	reg->offset = val;
 
-	return (void __iomem *)tmp;
+	return (__force void __iomem *)tmp;
 }
 
 /**
Signature · 2 lines
The Qualcomm Innovation Center, Inc. is a member of the Code Aurora Forum,
a Linux Foundation Collaborative Project
Acked-by on the v1 series
#6 lore raw
In reply to Stephen Boyd
Quoted 8 lines · Stephen Boyd

Some cleanups for the TI clk driver move.

Stephen Boyd (4):
clk: ti: Check kzalloc() for failures
clk: ti: Mark ti_clk_features static
clk: ti: clk-3xxx: Remove unused structures
clk: ti: Force pointer to be __iomem

Quoted 4 lines
  drivers/clk/ti/clk-3xxx.c | 10 ----------
  drivers/clk/ti/clk.c      |  6 ++++--
  2 files changed, 4 insertions(+), 12 deletions(-)

For the whole set: