From: Sean Anderson <seanga2@gmail.com>
To: u-boot@lists.denx.de
Cc: Simon Glass <sjg@chromium.org>, Lukasz Majewski <lukma@denx.de>,
Sean Anderson <seanga2@gmail.com>
Subject: [PATCH 7/7] clk: Make clk_free return void
Date: Sat, 15 Jan 2022 17:25:04 -0500 [thread overview]
Message-ID: <20220115222504.617013-8-seanga2@gmail.com> (raw)
In-Reply-To: <20220115222504.617013-1-seanga2@gmail.com>
Most callers of this function do not check the return value, and it is
unclear what action they should take if it fails. If a function is freeing
multiple clocks, it should not stop just because the first one failed.
Since the callbacks can no longer fail, just convert the return type to
void.
Signed-off-by: Sean Anderson <seanga2@gmail.com>
---
drivers/clk/clk-uclass.c | 10 ++++------
drivers/clk/clk_sandbox_test.c | 9 +++------
include/clk.h | 8 ++++----
3 files changed, 11 insertions(+), 16 deletions(-)
diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 61f977b661..5641709244 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -447,9 +447,7 @@ int clk_release_all(struct clk *clk, int count)
if (ret && ret != -ENOSYS)
return ret;
- ret = clk_free(&clk[i]);
- if (ret && ret != -ENOSYS)
- return ret;
+ clk_free(&clk[i]);
}
return 0;
@@ -472,18 +470,18 @@ int clk_request(struct udevice *dev, struct clk *clk)
return ops->request(clk);
}
-int clk_free(struct clk *clk)
+void clk_free(struct clk *clk)
{
const struct clk_ops *ops;
debug("%s(clk=%p)\n", __func__, clk);
if (!clk_valid(clk))
- return 0;
+ return;
ops = clk_dev_ops(clk->dev);
if (ops->rfree)
ops->rfree(clk);
- return 0;
+ return;
}
ulong clk_get_rate(struct clk *clk)
diff --git a/drivers/clk/clk_sandbox_test.c b/drivers/clk/clk_sandbox_test.c
index f665fd3cc4..5807a454f3 100644
--- a/drivers/clk/clk_sandbox_test.c
+++ b/drivers/clk/clk_sandbox_test.c
@@ -137,14 +137,11 @@ int sandbox_clk_test_disable_bulk(struct udevice *dev)
int sandbox_clk_test_free(struct udevice *dev)
{
struct sandbox_clk_test *sbct = dev_get_priv(dev);
- int i, ret;
+ int i;
devm_clk_put(dev, sbct->clkps[SANDBOX_CLK_TEST_ID_DEVM1]);
- for (i = 0; i < SANDBOX_CLK_TEST_NON_DEVM_COUNT; i++) {
- ret = clk_free(&sbct->clks[i]);
- if (ret)
- return ret;
- }
+ for (i = 0; i < SANDBOX_CLK_TEST_NON_DEVM_COUNT; i++)
+ clk_free(&sbct->clks[i]);
return 0;
}
diff --git a/include/clk.h b/include/clk.h
index 33f448eb89..79e7a9551f 100644
--- a/include/clk.h
+++ b/include/clk.h
@@ -396,9 +396,9 @@ int clk_request(struct udevice *dev, struct clk *clk);
* @clk: A clock struct that was previously successfully requested by
* clk_request/get_by_*().
*
- * Return: 0 if OK, or a negative error code.
+ * Free resources allocated by clk_request() (or any clk_get_* function).
*/
-int clk_free(struct clk *clk);
+void clk_free(struct clk *clk);
/**
* clk_get_rate() - Get current clock rate.
@@ -545,9 +545,9 @@ static inline int clk_request(struct udevice *dev, struct clk *clk)
return -ENOSYS;
}
-static inline int clk_free(struct clk *clk)
+static inline void clk_free(struct clk *clk)
{
- return 0;
+ return;
}
static inline ulong clk_get_rate(struct clk *clk)
--
2.34.1
next prev parent reply other threads:[~2022-01-15 22:26 UTC|newest]
Thread overview: 20+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-01-15 22:24 [PATCH 0/7] clk: Make clk_free return void Sean Anderson
2022-01-15 22:24 ` [PATCH 1/7] clk: Make rfree " Sean Anderson
2022-01-27 15:05 ` Simon Glass
2022-01-27 15:42 ` Sean Anderson
2022-01-27 21:35 ` Simon Glass
2022-02-01 14:49 ` Sean Anderson
2022-02-02 3:59 ` Simon Glass
2022-02-02 4:24 ` Sean Anderson
2022-02-26 18:36 ` Simon Glass
2022-02-27 19:38 ` Sean Anderson
2022-03-01 14:58 ` Simon Glass
2022-03-16 16:18 ` Sean Anderson
2022-03-16 19:23 ` Simon Glass
2022-01-15 22:24 ` [PATCH 2/7] dma: bcm6348: Don't check clk_free Sean Anderson
2022-01-15 22:25 ` [PATCH 3/7] net: bcm63xx: " Sean Anderson
2022-01-15 22:25 ` [PATCH 4/7] phy: " Sean Anderson
2022-01-15 22:25 ` [PATCH 5/7] spi: " Sean Anderson
2022-01-15 22:25 ` [PATCH 6/7] spi: dw: " Sean Anderson
2022-01-15 22:25 ` Sean Anderson [this message]
2022-03-30 19:21 ` [PATCH 0/7] clk: Make clk_free return void Sean Anderson
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=20220115222504.617013-8-seanga2@gmail.com \
--to=seanga2@gmail.com \
--cc=lukma@denx.de \
--cc=sjg@chromium.org \
--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 a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox