From: Sean Anderson <seanga2@gmail.com>
To: Maksim Kiselev <bigunclemax@gmail.com>, u-boot@lists.denx.de
Cc: Lukasz Majewski <lukma@denx.de>
Subject: Re: [PATCH v1] clk: use private clk struct in CLK_CCF's enable/disable functions
Date: Wed, 1 Nov 2023 14:52:24 -0400 [thread overview]
Message-ID: <35cbad91-485e-5d8d-0b37-688813bb3628@gmail.com> (raw)
In-Reply-To: <20230905221649.3577929-1-bigunclemax@gmail.com>
On 9/5/23 18:16, Maksim Kiselev wrote:
> In clk_enable()/clk_disable() functions, when CCF is activated,
> we must pass a private clk struct to enable()/disable() ops functions.
> Otherwise, the use of a container_of() construction within these ops
> should be banned. Because passing a non-private clk struct to
> container_of() results in an out of range error.
Yeah...
This is a big problem in the CCF code, where `struct clk` in U-Boot is
both `struct clk` from Linux (a "thick" pointer) and `struct clk_core`
(all the clock private data).
> At the moment, clk-mux, clk-fixed-factor, clk-gate and possibly other
> clocks use container_of() in their enable()/disable() functions.
> Therefore, for these functions to work correclty, private clk struct
correctly
> must be passed.
>
> Signed-off-by: Maksim Kiselev <bigunclemax@gmail.com>
> ---
> drivers/clk/clk-uclass.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/clk/clk-uclass.c b/drivers/clk/clk-uclass.c
> index dc3e9d6a26..542ec41cba 100644
> --- a/drivers/clk/clk-uclass.c
> +++ b/drivers/clk/clk-uclass.c
> @@ -649,7 +649,7 @@ int clk_enable(struct clk *clk)
> }
>
> if (ops->enable) {
> - ret = ops->enable(clk);
> + ret = ops->enable(clkp ? clkp : clk);
> if (ret) {
> printf("Enable %s failed\n", clk->dev->name);
> return ret;
> @@ -706,7 +706,7 @@ int clk_disable(struct clk *clk)
> }
>
> if (ops->disable) {
> - ret = ops->disable(clk);
> + ret = ops->disable(clkp ? clkp : clk);
> if (ret)
> return ret;
> }
Reviewed-by: Sean Anderson <seanga2@gmail.com>
next prev parent reply other threads:[~2023-11-01 18:52 UTC|newest]
Thread overview: 3+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-09-05 22:16 [PATCH v1] clk: use private clk struct in CLK_CCF's enable/disable functions Maksim Kiselev
2023-11-01 18:52 ` Sean Anderson [this message]
2023-11-01 21:03 ` 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=35cbad91-485e-5d8d-0b37-688813bb3628@gmail.com \
--to=seanga2@gmail.com \
--cc=bigunclemax@gmail.com \
--cc=lukma@denx.de \
--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