All of lore.kernel.org
 help / color / mirror / Atom feed
From: Yang Xiwen via B4 Relay <devnull+forbidden405.outlook.com@kernel.org>
To: Simon Glass <sjg@chromium.org>, Lukasz Majewski <lukma@denx.de>,
	 Sean Anderson <seanga2@gmail.com>
Cc: u-boot@lists.denx.de, Yang Xiwen <forbidden405@outlook.com>
Subject: [PATCH v2 2/4] clk: get correct ops for clk_enable() and clk_disable()
Date: Sun, 19 Nov 2023 06:10:06 +0800	[thread overview]
Message-ID: <20231111-enable_count-v2-2-20e3728600b5@outlook.com> (raw)
In-Reply-To: <20231111-enable_count-v2-0-20e3728600b5@outlook.com>

From: Yang Xiwen <forbidden405@outlook.com>

assign clk_dev_ops(clkp->dev) to ops to ensure correct clk operations
are called on clocks.

This fixes the incorrect enable_count issue as described in [1].

[1]: https://lore.kernel.org/all/SEZPR06MB695927A6DEEEF8489A06897396A7A@SEZPR06MB6959.apcprd06.prod.outlook.com/

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
 drivers/clk/clk-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 3b5e3f9c86..3e9d68feb3 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -640,6 +640,7 @@ int clk_enable(struct clk *clk)
 	if (CONFIG_IS_ENABLED(CLK_CCF)) {
 		/* Take id 0 as a non-valid clk, such as dummy */
 		if (clk->id && !clk_get_by_id(clk->id, &clkp)) {
+			ops = clk_dev_ops(clkp->dev);
 			if (clkp->enable_count) {
 				clkp->enable_count++;
 				return 0;
@@ -699,6 +700,7 @@ int clk_disable(struct clk *clk)
 
 	if (CONFIG_IS_ENABLED(CLK_CCF)) {
 		if (clk->id && !clk_get_by_id(clk->id, &clkp)) {
+			ops = clk_dev_ops(clkp->dev);
 			if (clkp->flags & CLK_IS_CRITICAL)
 				return 0;
 

-- 
2.39.2


WARNING: multiple messages have this Message-ID (diff)
From: Yang Xiwen <forbidden405@outlook.com>
To: Simon Glass <sjg@chromium.org>, Lukasz Majewski <lukma@denx.de>,
	 Sean Anderson <seanga2@gmail.com>
Cc: u-boot@lists.denx.de, Yang Xiwen <forbidden405@outlook.com>
Subject: [PATCH v2 2/4] clk: get correct ops for clk_enable() and clk_disable()
Date: Sun, 19 Nov 2023 06:10:06 +0800	[thread overview]
Message-ID: <20231111-enable_count-v2-2-20e3728600b5@outlook.com> (raw)
In-Reply-To: <20231111-enable_count-v2-0-20e3728600b5@outlook.com>

assign clk_dev_ops(clkp->dev) to ops to ensure correct clk operations
are called on clocks.

This fixes the incorrect enable_count issue as described in [1].

[1]: https://lore.kernel.org/all/SEZPR06MB695927A6DEEEF8489A06897396A7A@SEZPR06MB6959.apcprd06.prod.outlook.com/

Signed-off-by: Yang Xiwen <forbidden405@outlook.com>
---
 drivers/clk/clk-uclass.c | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
index 3b5e3f9c86..3e9d68feb3 100644
--- a/drivers/clk/clk-uclass.c
+++ b/drivers/clk/clk-uclass.c
@@ -640,6 +640,7 @@ int clk_enable(struct clk *clk)
 	if (CONFIG_IS_ENABLED(CLK_CCF)) {
 		/* Take id 0 as a non-valid clk, such as dummy */
 		if (clk->id && !clk_get_by_id(clk->id, &clkp)) {
+			ops = clk_dev_ops(clkp->dev);
 			if (clkp->enable_count) {
 				clkp->enable_count++;
 				return 0;
@@ -699,6 +700,7 @@ int clk_disable(struct clk *clk)
 
 	if (CONFIG_IS_ENABLED(CLK_CCF)) {
 		if (clk->id && !clk_get_by_id(clk->id, &clkp)) {
+			ops = clk_dev_ops(clkp->dev);
 			if (clkp->flags & CLK_IS_CRITICAL)
 				return 0;
 

-- 
2.39.2


  parent reply	other threads:[~2023-11-18 22:11 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2023-11-18 22:10 [PATCH v2 0/4] clk: ccf: fix enable_count mismatch Yang Xiwen via B4 Relay
2023-11-18 22:10 ` Yang Xiwen
2023-11-18 22:10 ` [PATCH v2 1/4] clk: clk_sandbox_ccf: assign ccf_clk_ops to .ops of the driver Yang Xiwen via B4 Relay
2023-11-18 22:10   ` Yang Xiwen
2023-11-18 22:10 ` Yang Xiwen via B4 Relay [this message]
2023-11-18 22:10   ` [PATCH v2 2/4] clk: get correct ops for clk_enable() and clk_disable() Yang Xiwen
2023-12-15 17:07   ` Sean Anderson
2023-12-15 18:37   ` (subset) " Sean Anderson
2023-11-18 22:10 ` [PATCH v2 3/4] clk: clk_sandbox: get devm clock i2c_root Yang Xiwen via B4 Relay
2023-11-18 22:10   ` Yang Xiwen
2023-11-18 22:10 ` [PATCH v2 4/4] test: dm: clk_ccf: get "i2c_root" clock from &clk_ccf Yang Xiwen via B4 Relay
2023-11-18 22:10   ` Yang Xiwen
2023-12-15 17:14   ` 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=20231111-enable_count-v2-2-20e3728600b5@outlook.com \
    --to=devnull+forbidden405.outlook.com@kernel.org \
    --cc=forbidden405@outlook.com \
    --cc=lukma@denx.de \
    --cc=seanga2@gmail.com \
    --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 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.