mail archive of the barebox mailing list
 help / color / mirror / Atom feed
From: Ahmad Fatoum <a.fatoum@pengutronix.de>
To: Michael Grzeschik <m.grzeschik@pengutronix.de>,
	barebox@lists.infradead.org
Subject: Re: [PATCH v2] clk: clk_set_parent: skip any operation if current and new parents are equal
Date: Mon, 13 Oct 2025 12:01:53 +0200	[thread overview]
Message-ID: <1c5a7d8c-cb1f-4559-869a-8228563e3248@pengutronix.de> (raw)
In-Reply-To: <20251013094943.1299607-1-m.grzeschik@pengutronix.de>



On 10/13/25 11:49 AM, Michael Grzeschik wrote:
> When an clk is defined with only one parent it probably has no
> set_parent function. Therefor changing the parent would return with
> -EINVAL. We check for this case and skip this function in this case.
> 
> Signed-off-by: Michael Grzeschik <m.grzeschik@pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum@pengutronix.de>

Thanks,
Ahmad

> ---
>  drivers/clk/clk.c | 3 +++
>  1 file changed, 3 insertions(+)
> 
> diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
> index 89a007a12c5..ac5b83cf8b4 100644
> --- a/drivers/clk/clk.c
> +++ b/drivers/clk/clk.c
> @@ -302,6 +302,9 @@ int clk_set_parent(struct clk *clk, struct clk *newparent)
>  	if (IS_ERR(newparent))
>  		return PTR_ERR(newparent);
>  
> +	if (newparent == curparent)
> +		return 0;
> +
>  	if (!clk->num_parents)
>  		return -EINVAL;
>  	if (!clk->ops->set_parent)

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




  reply	other threads:[~2025-10-13 10:02 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-10-03 10:37 [PATCH] " Michael Grzeschik
2025-10-06 11:43 ` Ahmad Fatoum
2025-10-06 20:53   ` Michael Grzeschik
2025-10-07 11:50     ` Sascha Hauer
2025-10-07 11:57       ` Sascha Hauer
2025-10-13  9:49         ` [PATCH v2] " Michael Grzeschik
2025-10-13 10:01           ` Ahmad Fatoum [this message]
2025-10-20 11:33           ` Sascha Hauer

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=1c5a7d8c-cb1f-4559-869a-8228563e3248@pengutronix.de \
    --to=a.fatoum@pengutronix.de \
    --cc=barebox@lists.infradead.org \
    --cc=m.grzeschik@pengutronix.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