All of lore.kernel.org
 help / color / mirror / Atom feed
From: Masahiro Yamada <yamada.masahiro@socionext.com>
To: u-boot@lists.denx.de
Subject: [U-Boot] [PATCH 2/2] clk: change the type of return value to long
Date: Tue, 12 Jan 2016 16:40:28 +0900	[thread overview]
Message-ID: <1452584428-11227-2-git-send-email-yamada.masahiro@socionext.com> (raw)
In-Reply-To: <1452584428-11227-1-git-send-email-yamada.masahiro@socionext.com>

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

  reply	other threads:[~2016-01-12  7:40 UTC|newest]

Thread overview: 5+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
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 [this message]
2016-01-13 20:10   ` [U-Boot] [PATCH 2/2] clk: change the type of return value to long 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

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=1452584428-11227-2-git-send-email-yamada.masahiro@socionext.com \
    --to=yamada.masahiro@socionext.com \
    --cc=u-boot@lists.denx.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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.