All of lore.kernel.org
 help / color / mirror / Atom feed
* [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions
@ 2016-01-12  7:40 Masahiro Yamada
  2016-01-12  7:40 ` [U-Boot] [PATCH 2/2] clk: change the type of return value to long Masahiro Yamada
  2016-01-13 20:10 ` [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions Simon Glass
  0 siblings, 2 replies; 5+ messages in thread
From: Masahiro Yamada @ 2016-01-12  7:40 UTC (permalink / raw)
  To: u-boot

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

 drivers/clk/clk_rk3036.c  | 2 +-
 drivers/clk/clk_rk3288.c  | 2 +-
 drivers/clk/clk_sandbox.c | 5 +++--
 3 files changed, 5 insertions(+), 4 deletions(-)

diff --git a/drivers/clk/clk_rk3036.c b/drivers/clk/clk_rk3036.c
index 6c802b6..f650810 100644
--- a/drivers/clk/clk_rk3036.c
+++ b/drivers/clk/clk_rk3036.c
@@ -314,7 +314,7 @@ static ulong rk3036_clk_set_rate(struct udevice *dev, ulong rate)
 	return 0;
 }
 
-ulong rk3036_set_periph_rate(struct udevice *dev, int periph, ulong rate)
+static ulong rk3036_set_periph_rate(struct udevice *dev, int periph, ulong rate)
 {
 	struct rk3036_clk_priv *priv = dev_get_priv(dev);
 	ulong new_rate;
diff --git a/drivers/clk/clk_rk3288.c b/drivers/clk/clk_rk3288.c
index 54d4930..0172ad1 100644
--- a/drivers/clk/clk_rk3288.c
+++ b/drivers/clk/clk_rk3288.c
@@ -508,7 +508,7 @@ static ulong rockchip_spi_set_clk(struct rk3288_cru *cru, uint clk_general_rate,
 	return rockchip_spi_get_clk(cru, clk_general_rate, periph);
 }
 
-ulong rk3288_set_periph_rate(struct udevice *dev, int periph, ulong rate)
+static ulong rk3288_set_periph_rate(struct udevice *dev, int periph, ulong rate)
 {
 	struct rk3288_clk_priv *priv = dev_get_priv(dev);
 	ulong new_rate;
diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c
index 058225a..367130f 100644
--- a/drivers/clk/clk_sandbox.c
+++ b/drivers/clk/clk_sandbox.c
@@ -32,7 +32,7 @@ static ulong sandbox_clk_set_rate(struct udevice *dev, ulong rate)
 	return 0;
 }
 
-ulong sandbox_get_periph_rate(struct udevice *dev, int periph)
+static ulong sandbox_get_periph_rate(struct udevice *dev, int periph)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(dev);
 
@@ -41,7 +41,8 @@ ulong sandbox_get_periph_rate(struct udevice *dev, int periph)
 	return priv->periph_rate[periph];
 }
 
-ulong sandbox_set_periph_rate(struct udevice *dev, int periph, ulong rate)
+static ulong sandbox_set_periph_rate(struct udevice *dev, int periph,
+				     ulong rate)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(dev);
 	ulong old_rate;
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] clk: change the type of return value to long
  2016-01-12  7:40 [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions Masahiro Yamada
@ 2016-01-12  7:40 ` Masahiro Yamada
  2016-01-13 20:10   ` Simon Glass
  2016-01-13 20:10 ` [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions Simon Glass
  1 sibling, 1 reply; 5+ messages in thread
From: Masahiro Yamada @ 2016-01-12  7:40 UTC (permalink / raw)
  To: u-boot

The comments in include/clk.h state "or -ve error code" for these
functions, and actually the functions return negative error code
here and there.  Returning unsigned value is not suitable.

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

 drivers/clk/clk-uclass.c  |  8 ++++----
 drivers/clk/clk_rk3036.c  |  6 +++---
 drivers/clk/clk_rk3288.c  |  6 +++---
 drivers/clk/clk_sandbox.c |  9 ++++-----
 include/clk.h             | 16 ++++++++--------
 5 files changed, 22 insertions(+), 23 deletions(-)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 73dfd7d..a5bef59 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -12,7 +12,7 @@
 #include <dm/lists.h>
 #include <dm/root.h>
 
-ulong clk_get_rate(struct udevice *dev)
+long clk_get_rate(struct udevice *dev)
 {
 	struct clk_ops *ops = clk_get_ops(dev);
 
@@ -22,7 +22,7 @@ ulong clk_get_rate(struct udevice *dev)
 	return ops->get_rate(dev);
 }
 
-ulong clk_set_rate(struct udevice *dev, ulong rate)
+long clk_set_rate(struct udevice *dev, ulong rate)
 {
 	struct clk_ops *ops = clk_get_ops(dev);
 
@@ -32,7 +32,7 @@ ulong clk_set_rate(struct udevice *dev, ulong rate)
 	return ops->set_rate(dev, rate);
 }
 
-ulong clk_get_periph_rate(struct udevice *dev, int periph)
+long clk_get_periph_rate(struct udevice *dev, int periph)
 {
 	struct clk_ops *ops = clk_get_ops(dev);
 
@@ -42,7 +42,7 @@ ulong clk_get_periph_rate(struct udevice *dev, int periph)
 	return ops->get_periph_rate(dev, periph);
 }
 
-ulong clk_set_periph_rate(struct udevice *dev, int periph, ulong rate)
+long clk_set_periph_rate(struct udevice *dev, int periph, ulong rate)
 {
 	struct clk_ops *ops = clk_get_ops(dev);
 
diff --git a/drivers/clk/clk_rk3036.c b/drivers/clk/clk_rk3036.c
index f650810..8613123 100644
--- a/drivers/clk/clk_rk3036.c
+++ b/drivers/clk/clk_rk3036.c
@@ -298,7 +298,7 @@ static ulong rockchip_mmc_set_clk(struct rk3036_cru *cru, uint clk_general_rate,
 	return rockchip_mmc_get_clk(cru, clk_general_rate, periph);
 }
 
-static ulong rk3036_clk_get_rate(struct udevice *dev)
+static long rk3036_clk_get_rate(struct udevice *dev)
 {
 	struct rk3036_clk_plat *plat = dev_get_platdata(dev);
 	struct rk3036_clk_priv *priv = dev_get_priv(dev);
@@ -307,14 +307,14 @@ static ulong rk3036_clk_get_rate(struct udevice *dev)
 	return rkclk_pll_get_rate(priv->cru, plat->clk_id);
 }
 
-static ulong rk3036_clk_set_rate(struct udevice *dev, ulong rate)
+static long rk3036_clk_set_rate(struct udevice *dev, ulong rate)
 {
 	debug("%s\n", dev->name);
 
 	return 0;
 }
 
-static ulong rk3036_set_periph_rate(struct udevice *dev, int periph, ulong rate)
+static long rk3036_set_periph_rate(struct udevice *dev, int periph, ulong rate)
 {
 	struct rk3036_clk_priv *priv = dev_get_priv(dev);
 	ulong new_rate;
diff --git a/drivers/clk/clk_rk3288.c b/drivers/clk/clk_rk3288.c
index 0172ad1..8ed0bff 100644
--- a/drivers/clk/clk_rk3288.c
+++ b/drivers/clk/clk_rk3288.c
@@ -337,7 +337,7 @@ static uint32_t rkclk_pll_get_rate(struct rk3288_cru *cru,
 	}
 }
 
-static ulong rk3288_clk_get_rate(struct udevice *dev)
+static long rk3288_clk_get_rate(struct udevice *dev)
 {
 	struct rk3288_clk_plat *plat = dev_get_platdata(dev);
 	struct rk3288_clk_priv *priv = dev_get_priv(dev);
@@ -346,7 +346,7 @@ static ulong rk3288_clk_get_rate(struct udevice *dev)
 	return rkclk_pll_get_rate(priv->cru, plat->clk_id);
 }
 
-static ulong rk3288_clk_set_rate(struct udevice *dev, ulong rate)
+static long rk3288_clk_set_rate(struct udevice *dev, ulong rate)
 {
 	struct rk3288_clk_plat *plat = dev_get_platdata(dev);
 	struct rk3288_clk_priv *priv = dev_get_priv(dev);
@@ -508,7 +508,7 @@ static ulong rockchip_spi_set_clk(struct rk3288_cru *cru, uint clk_general_rate,
 	return rockchip_spi_get_clk(cru, clk_general_rate, periph);
 }
 
-static ulong rk3288_set_periph_rate(struct udevice *dev, int periph, ulong rate)
+static long rk3288_set_periph_rate(struct udevice *dev, int periph, ulong rate)
 {
 	struct rk3288_clk_priv *priv = dev_get_priv(dev);
 	ulong new_rate;
diff --git a/drivers/clk/clk_sandbox.c b/drivers/clk/clk_sandbox.c
index 367130f..0ff4605 100644
--- a/drivers/clk/clk_sandbox.c
+++ b/drivers/clk/clk_sandbox.c
@@ -15,14 +15,14 @@ struct sandbox_clk_priv {
 	ulong periph_rate[PERIPH_ID_COUNT];
 };
 
-static ulong sandbox_clk_get_rate(struct udevice *dev)
+static long sandbox_clk_get_rate(struct udevice *dev)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(dev);
 
 	return priv->rate;
 }
 
-static ulong sandbox_clk_set_rate(struct udevice *dev, ulong rate)
+static long sandbox_clk_set_rate(struct udevice *dev, ulong rate)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(dev);
 
@@ -32,7 +32,7 @@ static ulong sandbox_clk_set_rate(struct udevice *dev, ulong rate)
 	return 0;
 }
 
-static ulong sandbox_get_periph_rate(struct udevice *dev, int periph)
+static long sandbox_get_periph_rate(struct udevice *dev, int periph)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(dev);
 
@@ -41,8 +41,7 @@ static ulong sandbox_get_periph_rate(struct udevice *dev, int periph)
 	return priv->periph_rate[periph];
 }
 
-static ulong sandbox_set_periph_rate(struct udevice *dev, int periph,
-				     ulong rate)
+static long sandbox_set_periph_rate(struct udevice *dev, int periph, ulong rate)
 {
 	struct sandbox_clk_priv *priv = dev_get_priv(dev);
 	ulong old_rate;
diff --git a/include/clk.h b/include/clk.h
index 371784a..61bb468 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -21,7 +21,7 @@ struct clk_ops {
 	 * @dev:	Device to check (UCLASS_CLK)
 	 * @return clock rate in Hz, or -ve error code
 	 */
-	ulong (*get_rate)(struct udevice *dev);
+	long (*get_rate)(struct udevice *dev);
 
 	/**
 	 * set_rate() - Set current clock rate
@@ -30,7 +30,7 @@ struct clk_ops {
 	 * @rate:	New clock rate in Hz
 	 * @return new rate, or -ve error code
 	 */
-	ulong (*set_rate)(struct udevice *dev, ulong rate);
+	long (*set_rate)(struct udevice *dev, ulong rate);
 
 	/**
 	 * get_periph_rate() - Get clock rate for a peripheral
@@ -39,7 +39,7 @@ struct clk_ops {
 	 * @periph:	Peripheral ID to check
 	 * @return clock rate in Hz, or -ve error code
 	 */
-	ulong (*get_periph_rate)(struct udevice *dev, int periph);
+	long (*get_periph_rate)(struct udevice *dev, int periph);
 
 	/**
 	 * set_periph_rate() - Set current clock rate for a peripheral
@@ -48,7 +48,7 @@ struct clk_ops {
 	 * @periph:	Peripheral ID to update
 	 * @return new clock rate in Hz, or -ve error code
 	 */
-	ulong (*set_periph_rate)(struct udevice *dev, int periph, ulong rate);
+	long (*set_periph_rate)(struct udevice *dev, int periph, ulong rate);
 };
 
 #define clk_get_ops(dev)	((struct clk_ops *)(dev)->driver->ops)
@@ -59,7 +59,7 @@ struct clk_ops {
  * @dev:	Device to check (UCLASS_CLK)
  * @return clock rate in Hz, or -ve error code
  */
-ulong clk_get_rate(struct udevice *dev);
+long clk_get_rate(struct udevice *dev);
 
 /**
  * clk_set_rate() - Set current clock rate
@@ -68,7 +68,7 @@ ulong clk_get_rate(struct udevice *dev);
  * @rate:	New clock rate in Hz
  * @return new rate, or -ve error code
  */
-ulong clk_set_rate(struct udevice *dev, ulong rate);
+long clk_set_rate(struct udevice *dev, ulong rate);
 
 /**
  * clk_get_periph_rate() - Get current clock rate for a peripheral
@@ -76,7 +76,7 @@ ulong clk_set_rate(struct udevice *dev, ulong rate);
  * @dev:	Device to check (UCLASS_CLK)
  * @return clock rate in Hz, -ve error code
  */
-ulong clk_get_periph_rate(struct udevice *dev, int periph);
+long clk_get_periph_rate(struct udevice *dev, int periph);
 
 /**
  * clk_set_periph_rate() - Set current clock rate for a peripheral
@@ -85,6 +85,6 @@ ulong clk_get_periph_rate(struct udevice *dev, int periph);
  * @periph:	Peripheral ID to update
  * @return new clock rate in Hz, or -ve error code
  */
-ulong clk_set_periph_rate(struct udevice *dev, int periph, ulong rate);
+long clk_set_periph_rate(struct udevice *dev, int periph, ulong rate);
 
 #endif /* _CLK_H_ */
-- 
1.9.1

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions
  2016-01-12  7:40 [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions Masahiro Yamada
  2016-01-12  7:40 ` [U-Boot] [PATCH 2/2] clk: change the type of return value to long Masahiro Yamada
@ 2016-01-13 20:10 ` Simon Glass
  1 sibling, 0 replies; 5+ messages in thread
From: Simon Glass @ 2016-01-13 20:10 UTC (permalink / raw)
  To: u-boot

On 12 January 2016 at 00:40, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---

Commit message?

>
>  drivers/clk/clk_rk3036.c  | 2 +-
>  drivers/clk/clk_rk3288.c  | 2 +-
>  drivers/clk/clk_sandbox.c | 5 +++--
>  3 files changed, 5 insertions(+), 4 deletions(-)

Acked-by: Simon Glass <sjg@chromium.org>

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] clk: change the type of return value to long
  2016-01-12  7:40 ` [U-Boot] [PATCH 2/2] clk: change the type of return value to long Masahiro Yamada
@ 2016-01-13 20:10   ` Simon Glass
  2016-01-14 11:36     ` Masahiro Yamada
  0 siblings, 1 reply; 5+ messages in thread
From: Simon Glass @ 2016-01-13 20:10 UTC (permalink / raw)
  To: u-boot

Hi Masahiro,

On 12 January 2016 at 00:40, Masahiro Yamada
<yamada.masahiro@socionext.com> wrote:
> The comments in include/clk.h state "or -ve error code" for these
> functions, and actually the functions return negative error code
> here and there.  Returning unsigned value is not suitable.
>
> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
> ---
>
>  drivers/clk/clk-uclass.c  |  8 ++++----
>  drivers/clk/clk_rk3036.c  |  6 +++---
>  drivers/clk/clk_rk3288.c  |  6 +++---
>  drivers/clk/clk_sandbox.c |  9 ++++-----
>  include/clk.h             | 16 ++++++++--------
>  5 files changed, 22 insertions(+), 23 deletions(-)

This limits us to about 2GHz which seems a bit dangerous. We are
starting to see things around that level. We can use IS_ERR_VALUE().

Regards,
Simon

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [U-Boot] [PATCH 2/2] clk: change the type of return value to long
  2016-01-13 20:10   ` Simon Glass
@ 2016-01-14 11:36     ` Masahiro Yamada
  0 siblings, 0 replies; 5+ messages in thread
From: Masahiro Yamada @ 2016-01-14 11:36 UTC (permalink / raw)
  To: u-boot

2016-01-14 5:10 GMT+09:00 Simon Glass <sjg@chromium.org>:
> Hi Masahiro,
>
> On 12 January 2016 at 00:40, Masahiro Yamada
> <yamada.masahiro@socionext.com> wrote:
>> The comments in include/clk.h state "or -ve error code" for these
>> functions, and actually the functions return negative error code
>> here and there.  Returning unsigned value is not suitable.
>>
>> Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
>> ---
>>
>>  drivers/clk/clk-uclass.c  |  8 ++++----
>>  drivers/clk/clk_rk3036.c  |  6 +++---
>>  drivers/clk/clk_rk3288.c  |  6 +++---
>>  drivers/clk/clk_sandbox.c |  9 ++++-----
>>  include/clk.h             | 16 ++++++++--------
>>  5 files changed, 22 insertions(+), 23 deletions(-)
>
> This limits us to about 2GHz which seems a bit dangerous. We are
> starting to see things around that level. We can use IS_ERR_VALUE().
>

OK, please disregard this patch.



-- 
Best Regards
Masahiro Yamada

^ permalink raw reply	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-01-14 11:36 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-01-12  7:40 [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions Masahiro Yamada
2016-01-12  7:40 ` [U-Boot] [PATCH 2/2] clk: change the type of return value to long Masahiro Yamada
2016-01-13 20:10   ` Simon Glass
2016-01-14 11:36     ` Masahiro Yamada
2016-01-13 20:10 ` [U-Boot] [PATCH 1/2] clk: add static qualifier to local functions Simon Glass

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.