linux-aspeed.lists.ozlabs.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
@ 2025-08-10 22:21 Brian Masney
  2025-09-14 11:56 ` Brian Masney
  2025-10-21 21:07 ` Winiarska, Iwona
  0 siblings, 2 replies; 13+ messages in thread
From: Brian Masney @ 2025-08-10 22:21 UTC (permalink / raw)
  To: Iwona Winiarska, Joel Stanley, Andrew Jeffery, Maxime Ripard,
	Stephen Boyd
  Cc: linux-clk, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel,
	Brian Masney

The round_rate() clk ops is deprecated, so migrate this driver from
round_rate() to determine_rate() using the Coccinelle semantic patch
appended to the "under-the-cut" portion of the patch.

Signed-off-by: Brian Masney <bmasney@redhat.com>
---
Coccinelle semantic patch is below. It's large and I don't want to
pollute the kernel changelog with the same code hundreds of times,
so that's why it's included under the cut. For subsystems with more
than one patch, I've included it on the cover letter.

    virtual patch

    // Look up the current name of the round_rate function
    @ has_round_rate @
    identifier round_rate_name =~ ".*_round_rate";
    identifier hw_param, rate_param, parent_rate_param;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    	...
    }

    // Rename the route_rate function name to determine_rate()
    @ script:python generate_name depends on has_round_rate @
    round_rate_name << has_round_rate.round_rate_name;
    new_name;
    @@

    coccinelle.new_name = round_rate_name.replace("_round_rate", "_determine_rate")

    // Change rate to req->rate; also change occurrences of 'return XXX'.
    @ chg_rate depends on generate_name @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    identifier ERR =~ "E.*";
    expression E;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    <...
    (
    -return -ERR;
    +return -ERR;
    |
    - return rate_param;
    + return 0;
    |
    - return E;
    + req->rate = E;
    +
    + return 0;
    |
    - rate_param
    + req->rate
    )
    ...>
    }

    // Coccinelle only transforms the first occurrence of the rate parameter
    // Run a second time. FIXME: Is there a better way to do this?
    @ chg_rate2 depends on generate_name @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    <...
    - rate_param
    + req->rate
    ...>
    }

    // Change parent_rate to req->best_parent_rate
    @ chg_parent_rate depends on generate_name @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    @@

    long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
                  unsigned long *parent_rate_param)
    {
    <...
    (
    - *parent_rate_param
    + req->best_parent_rate
    |
    - parent_rate_param
    + &req->best_parent_rate
    )
    ...>
    }

    // Convert the function definition from round_rate() to determine_rate()
    @ func_definition depends on chg_rate @
    identifier has_round_rate.round_rate_name;
    identifier has_round_rate.hw_param;
    identifier has_round_rate.rate_param;
    identifier has_round_rate.parent_rate_param;
    identifier generate_name.new_name;
    @@

    - long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
    -               unsigned long *parent_rate_param)
    + int new_name(struct clk_hw *hw, struct clk_rate_request *req)
    {
        ...
    }

    // Update the ops from round_rate() to determine_rate()
    @ ops depends on func_definition @
    identifier has_round_rate.round_rate_name;
    identifier generate_name.new_name;
    @@

    {
        ...,
    -   .round_rate = round_rate_name,
    +   .determine_rate = new_name,
        ...,
    }

Note that I used coccinelle 1.2 instead of 1.3 since the newer version
adds unnecessary braces as described in this post.
https://lore.kernel.org/cocci/67642477-5f3e-4b2a-914d-579a54f48cbd@intel.com/
---
 drivers/peci/controller/peci-aspeed.c | 12 +++++++-----
 1 file changed, 7 insertions(+), 5 deletions(-)

diff --git a/drivers/peci/controller/peci-aspeed.c b/drivers/peci/controller/peci-aspeed.c
index ad3a7d71ed4c61e6123dcbbad264812cb83cbb07..a0c99ecf7f3805a1cdac55a8d5db9c61ad3cf37c 100644
--- a/drivers/peci/controller/peci-aspeed.c
+++ b/drivers/peci/controller/peci-aspeed.c
@@ -362,12 +362,14 @@ static int clk_aspeed_peci_set_rate(struct clk_hw *hw, unsigned long rate,
 	return 0;
 }
 
-static long clk_aspeed_peci_round_rate(struct clk_hw *hw, unsigned long rate,
-				       unsigned long *prate)
+static int clk_aspeed_peci_determine_rate(struct clk_hw *hw,
+					  struct clk_rate_request *req)
 {
-	int div = clk_aspeed_peci_get_div(rate, prate);
+	int div = clk_aspeed_peci_get_div(req->rate, &req->best_parent_rate);
 
-	return DIV_ROUND_UP_ULL(*prate, div);
+	req->rate = DIV_ROUND_UP_ULL(req->best_parent_rate, div);
+
+	return 0;
 }
 
 static unsigned long clk_aspeed_peci_recalc_rate(struct clk_hw *hw, unsigned long prate)
@@ -394,7 +396,7 @@ static unsigned long clk_aspeed_peci_recalc_rate(struct clk_hw *hw, unsigned lon
 
 static const struct clk_ops clk_aspeed_peci_ops = {
 	.set_rate = clk_aspeed_peci_set_rate,
-	.round_rate = clk_aspeed_peci_round_rate,
+	.determine_rate = clk_aspeed_peci_determine_rate,
 	.recalc_rate = clk_aspeed_peci_recalc_rate,
 };
 

---
base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
change-id: 20250729-peci-round-rate-543639297ec6

Best regards,
-- 
Brian Masney <bmasney@redhat.com>



^ permalink raw reply related	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-08-10 22:21 [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate() Brian Masney
@ 2025-09-14 11:56 ` Brian Masney
  2025-09-15  5:06   ` Andrew Jeffery
  2025-10-21 21:07 ` Winiarska, Iwona
  1 sibling, 1 reply; 13+ messages in thread
From: Brian Masney @ 2025-09-14 11:56 UTC (permalink / raw)
  To: Iwona Winiarska, Joel Stanley, Andrew Jeffery, Maxime Ripard,
	Stephen Boyd
  Cc: linux-clk, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel

Hi Iwona, Joel, and Andrew,

On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> The round_rate() clk ops is deprecated, so migrate this driver from
> round_rate() to determine_rate() using the Coccinelle semantic patch
> appended to the "under-the-cut" portion of the patch.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>

Would it be possible to get this picked up for v6.18? I'd like to remove
this API from drivers/clk in v6.19.

Thanks,

Brian



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-09-14 11:56 ` Brian Masney
@ 2025-09-15  5:06   ` Andrew Jeffery
  2025-10-16 16:11     ` Brian Masney
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Jeffery @ 2025-09-15  5:06 UTC (permalink / raw)
  To: Brian Masney, Iwona Winiarska, Joel Stanley, Maxime Ripard,
	Stephen Boyd
  Cc: linux-clk, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel

Hi Brian,

On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> Hi Iwona, Joel, and Andrew,
> 
> On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > The round_rate() clk ops is deprecated, so migrate this driver from
> > round_rate() to determine_rate() using the Coccinelle semantic patch
> > appended to the "under-the-cut" portion of the patch.
> > 
> > Signed-off-by: Brian Masney <bmasney@redhat.com>
> 
> Would it be possible to get this picked up for v6.18? I'd like to remove
> this API from drivers/clk in v6.19.

My (strong) preference is that Iwona applies it, but I'll keep an eye
out for any unusual delays.

Andrew


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-09-15  5:06   ` Andrew Jeffery
@ 2025-10-16 16:11     ` Brian Masney
  2025-10-17  6:22       ` Andrew Jeffery
  0 siblings, 1 reply; 13+ messages in thread
From: Brian Masney @ 2025-10-16 16:11 UTC (permalink / raw)
  To: Andrew Jeffery
  Cc: Iwona Winiarska, Joel Stanley, Maxime Ripard, Stephen Boyd,
	linux-clk, linux-aspeed, openbmc, linux-arm-kernel, linux-kernel

Hi Andrew and Iwona,

On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> Hi Brian,
> 
> On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > Hi Iwona, Joel, and Andrew,
> > 
> > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > The round_rate() clk ops is deprecated, so migrate this driver from
> > > round_rate() to determine_rate() using the Coccinelle semantic patch
> > > appended to the "under-the-cut" portion of the patch.
> > > 
> > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > 
> > Would it be possible to get this picked up for v6.18? I'd like to remove
> > this API from drivers/clk in v6.19.
> 
> My (strong) preference is that Iwona applies it, but I'll keep an eye
> out for any unusual delays.

This patch wasn't picked up for v6.18. Any chance this can get picked up
now for v6.19?

I'm hoping to get this merged so that we can remove the round_rate() clk
op from the clk core. The clk maintainer (Stephen) mentioned this work
in his last pull to Linus.

https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/

Thanks,

Brian



^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-16 16:11     ` Brian Masney
@ 2025-10-17  6:22       ` Andrew Jeffery
  2025-10-17  6:41         ` Greg Kroah-Hartman
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Jeffery @ 2025-10-17  6:22 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Brian Masney, Iwona Winiarska, Joel Stanley, Maxime Ripard,
	Stephen Boyd, linux-clk, linux-aspeed, openbmc, linux-arm-kernel,
	linux-kernel

Hi Greg,

On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> Hi Andrew and Iwona,
> 
> On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > Hi Brian,
> > 
> > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > Hi Iwona, Joel, and Andrew,
> > > 
> > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > The round_rate() clk ops is deprecated, so migrate this driver from
> > > > round_rate() to determine_rate() using the Coccinelle semantic patch
> > > > appended to the "under-the-cut" portion of the patch.
> > > > 
> > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > 
> > > Would it be possible to get this picked up for v6.18? I'd like to remove
> > > this API from drivers/clk in v6.19.
> > 
> > My (strong) preference is that Iwona applies it, but I'll keep an eye
> > out for any unusual delays.
> 
> This patch wasn't picked up for v6.18. Any chance this can get picked up
> now for v6.19?
> 
> I'm hoping to get this merged so that we can remove the round_rate() clk
> op from the clk core. The clk maintainer (Stephen) mentioned this work
> in his last pull to Linus.
> 
> https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/

Are you happy to pick this up directly in Iwona's absence?

Andrew


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-17  6:22       ` Andrew Jeffery
@ 2025-10-17  6:41         ` Greg Kroah-Hartman
  2025-10-17  7:27           ` Andrew Jeffery
  0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2025-10-17  6:41 UTC (permalink / raw)
  To: Andrew Jeffery
  Cc: Brian Masney, Iwona Winiarska, Joel Stanley, Maxime Ripard,
	Stephen Boyd, linux-clk, linux-aspeed, openbmc, linux-arm-kernel,
	linux-kernel

On Fri, Oct 17, 2025 at 04:52:37PM +1030, Andrew Jeffery wrote:
> Hi Greg,
> 
> On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> > Hi Andrew and Iwona,
> > 
> > On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > > Hi Brian,
> > > 
> > > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > > Hi Iwona, Joel, and Andrew,
> > > > 
> > > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > > The round_rate() clk ops is deprecated, so migrate this driver from
> > > > > round_rate() to determine_rate() using the Coccinelle semantic patch
> > > > > appended to the "under-the-cut" portion of the patch.
> > > > > 
> > > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > > 
> > > > Would it be possible to get this picked up for v6.18? I'd like to remove
> > > > this API from drivers/clk in v6.19.
> > > 
> > > My (strong) preference is that Iwona applies it, but I'll keep an eye
> > > out for any unusual delays.
> > 
> > This patch wasn't picked up for v6.18. Any chance this can get picked up
> > now for v6.19?
> > 
> > I'm hoping to get this merged so that we can remove the round_rate() clk
> > op from the clk core. The clk maintainer (Stephen) mentioned this work
> > in his last pull to Linus.
> > 
> > https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/
> 
> Are you happy to pick this up directly in Iwona's absence?

Why me?

confused,

greg k-h


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-17  6:41         ` Greg Kroah-Hartman
@ 2025-10-17  7:27           ` Andrew Jeffery
  2025-10-17  7:43             ` Greg Kroah-Hartman
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Jeffery @ 2025-10-17  7:27 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Brian Masney, Iwona Winiarska, Joel Stanley, Maxime Ripard,
	Stephen Boyd, linux-clk, linux-aspeed, openbmc, linux-arm-kernel,
	linux-kernel

On Fri, 2025-10-17 at 08:41 +0200, Greg Kroah-Hartman wrote:
> On Fri, Oct 17, 2025 at 04:52:37PM +1030, Andrew Jeffery wrote:
> > Hi Greg,
> > 
> > On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> > > Hi Andrew and Iwona,
> > > 
> > > On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > > > Hi Brian,
> > > > 
> > > > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > > > Hi Iwona, Joel, and Andrew,
> > > > > 
> > > > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > > > The round_rate() clk ops is deprecated, so migrate this
> > > > > > driver from
> > > > > > round_rate() to determine_rate() using the Coccinelle
> > > > > > semantic patch
> > > > > > appended to the "under-the-cut" portion of the patch.
> > > > > > 
> > > > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > > > 
> > > > > Would it be possible to get this picked up for v6.18? I'd
> > > > > like to remove
> > > > > this API from drivers/clk in v6.19.
> > > > 
> > > > My (strong) preference is that Iwona applies it, but I'll keep
> > > > an eye
> > > > out for any unusual delays.
> > > 
> > > This patch wasn't picked up for v6.18. Any chance this can get
> > > picked up
> > > now for v6.19?
> > > 
> > > I'm hoping to get this merged so that we can remove the
> > > round_rate() clk
> > > op from the clk core. The clk maintainer (Stephen) mentioned this
> > > work
> > > in his last pull to Linus.
> > > 
> > > https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/
> > 
> > Are you happy to pick this up directly in Iwona's absence?
> 
> Why me?

I figured that would be sensible since Iwona historically sent you PRs
for the PECI subsystem.

I'm open to other approaches though.

Andrew


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-17  7:27           ` Andrew Jeffery
@ 2025-10-17  7:43             ` Greg Kroah-Hartman
  2025-10-19 23:00               ` Andrew Jeffery
  0 siblings, 1 reply; 13+ messages in thread
From: Greg Kroah-Hartman @ 2025-10-17  7:43 UTC (permalink / raw)
  To: Andrew Jeffery
  Cc: Brian Masney, Iwona Winiarska, Joel Stanley, Maxime Ripard,
	Stephen Boyd, linux-clk, linux-aspeed, openbmc, linux-arm-kernel,
	linux-kernel

On Fri, Oct 17, 2025 at 05:57:44PM +1030, Andrew Jeffery wrote:
> On Fri, 2025-10-17 at 08:41 +0200, Greg Kroah-Hartman wrote:
> > On Fri, Oct 17, 2025 at 04:52:37PM +1030, Andrew Jeffery wrote:
> > > Hi Greg,
> > > 
> > > On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> > > > Hi Andrew and Iwona,
> > > > 
> > > > On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > > > > Hi Brian,
> > > > > 
> > > > > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > > > > Hi Iwona, Joel, and Andrew,
> > > > > > 
> > > > > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > > > > The round_rate() clk ops is deprecated, so migrate this
> > > > > > > driver from
> > > > > > > round_rate() to determine_rate() using the Coccinelle
> > > > > > > semantic patch
> > > > > > > appended to the "under-the-cut" portion of the patch.
> > > > > > > 
> > > > > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > > > > 
> > > > > > Would it be possible to get this picked up for v6.18? I'd
> > > > > > like to remove
> > > > > > this API from drivers/clk in v6.19.
> > > > > 
> > > > > My (strong) preference is that Iwona applies it, but I'll keep
> > > > > an eye
> > > > > out for any unusual delays.
> > > > 
> > > > This patch wasn't picked up for v6.18. Any chance this can get
> > > > picked up
> > > > now for v6.19?
> > > > 
> > > > I'm hoping to get this merged so that we can remove the
> > > > round_rate() clk
> > > > op from the clk core. The clk maintainer (Stephen) mentioned this
> > > > work
> > > > in his last pull to Linus.
> > > > 
> > > > https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/
> > > 
> > > Are you happy to pick this up directly in Iwona's absence?
> > 
> > Why me?
> 
> I figured that would be sensible since Iwona historically sent you PRs
> for the PECI subsystem.

I did not remember that, sorry.  The MAINTAINERS file does not mention
this at all, and it lists many other maintainers that should be able to
take this patch:
	$ ./scripts/get_maintainer.pl  drivers/peci/controller/peci-aspeed.c
	Iwona Winiarska <iwona.winiarska@intel.com> (maintainer:ASPEED PECI CONTROLLER)
	Joel Stanley <joel@jms.id.au> (maintainer:ARM/ASPEED MACHINE SUPPORT)
	Andrew Jeffery <andrew@codeconstruct.com.au> (maintainer:ARM/ASPEED MACHINE SUPPORT)
	linux-aspeed@lists.ozlabs.org (moderated list:ASPEED PECI CONTROLLER)
	openbmc@lists.ozlabs.org (moderated list:ASPEED PECI CONTROLLER)
	linux-arm-kernel@lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT)
	linux-kernel@vger.kernel.org (open list)
	ASPEED PECI CONTROLLER status: Supported
	PECI SUBSYSTEM status: Supported
	ARM/ASPEED MACHINE SUPPORT status: Supported

thanks,

greg k-h


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-17  7:43             ` Greg Kroah-Hartman
@ 2025-10-19 23:00               ` Andrew Jeffery
  2025-10-21 21:01                 ` Winiarska, Iwona
  0 siblings, 1 reply; 13+ messages in thread
From: Andrew Jeffery @ 2025-10-19 23:00 UTC (permalink / raw)
  To: Greg Kroah-Hartman
  Cc: Brian Masney, Iwona Winiarska, Joel Stanley, Maxime Ripard,
	Stephen Boyd, linux-clk, linux-aspeed, openbmc, linux-arm-kernel,
	linux-kernel

On Fri, 2025-10-17 at 09:43 +0200, Greg Kroah-Hartman wrote:
> On Fri, Oct 17, 2025 at 05:57:44PM +1030, Andrew Jeffery wrote:
> > On Fri, 2025-10-17 at 08:41 +0200, Greg Kroah-Hartman wrote:
> > > On Fri, Oct 17, 2025 at 04:52:37PM +1030, Andrew Jeffery wrote:
> > > > Hi Greg,
> > > > 
> > > > On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> > > > > Hi Andrew and Iwona,
> > > > > 
> > > > > On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > > > > > Hi Brian,
> > > > > > 
> > > > > > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > > > > > Hi Iwona, Joel, and Andrew,
> > > > > > > 
> > > > > > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > > > > > The round_rate() clk ops is deprecated, so migrate this
> > > > > > > > driver from
> > > > > > > > round_rate() to determine_rate() using the Coccinelle
> > > > > > > > semantic patch
> > > > > > > > appended to the "under-the-cut" portion of the patch.
> > > > > > > > 
> > > > > > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > > > > > 
> > > > > > > Would it be possible to get this picked up for v6.18? I'd
> > > > > > > like to remove
> > > > > > > this API from drivers/clk in v6.19.
> > > > > > 
> > > > > > My (strong) preference is that Iwona applies it, but I'll keep
> > > > > > an eye
> > > > > > out for any unusual delays.
> > > > > 
> > > > > This patch wasn't picked up for v6.18. Any chance this can get
> > > > > picked up
> > > > > now for v6.19?
> > > > > 
> > > > > I'm hoping to get this merged so that we can remove the
> > > > > round_rate() clk
> > > > > op from the clk core. The clk maintainer (Stephen) mentioned this
> > > > > work
> > > > > in his last pull to Linus.
> > > > > 
> > > > > https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/
> > > > 
> > > > Are you happy to pick this up directly in Iwona's absence?
> > > 
> > > Why me?
> > 
> > I figured that would be sensible since Iwona historically sent you PRs
> > for the PECI subsystem.
> 
> I did not remember that, sorry.
> 

No worries.

>   The MAINTAINERS file does not mention
> this at all, and it lists many other maintainers that should be able to
> take this patch:
> 	$ ./scripts/get_maintainer.pl  drivers/peci/controller/peci-aspeed.c
> 	Iwona Winiarska <iwona.winiarska@intel.com> (maintainer:ASPEED PECI CONTROLLER)
> 	Joel Stanley <joel@jms.id.au> (maintainer:ARM/ASPEED MACHINE SUPPORT)
> 	Andrew Jeffery <andrew@codeconstruct.com.au> (maintainer:ARM/ASPEED MACHINE SUPPORT)

Iwona currently appears unresponsive, as mentioned. Joel's stepped back
from maintaining the ASPEED bits as of earlier this year; I worked with
him to add myself as a maintainer there, hence the last entry, and now
getting in touch with you.

I can apply the patch and send you a PR if that helps, if Iwona doesn't
respond in the mean time.

Andrew

> 	linux-aspeed@lists.ozlabs.org (moderated list:ASPEED PECI CONTROLLER)
> 	openbmc@lists.ozlabs.org (moderated list:ASPEED PECI CONTROLLER)
> 	linux-arm-kernel@lists.infradead.org (moderated list:ARM/ASPEED MACHINE SUPPORT)
> 	linux-kernel@vger.kernel.org (open list)
> 	ASPEED PECI CONTROLLER status: Supported
> 	PECI SUBSYSTEM status: Supported
> 	ARM/ASPEED MACHINE SUPPORT status: Supported
> 
> thanks,
> 
> greg k-h


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-19 23:00               ` Andrew Jeffery
@ 2025-10-21 21:01                 ` Winiarska, Iwona
  2025-10-21 22:35                   ` Andrew Jeffery
  2025-11-06 23:11                   ` Brian Masney
  0 siblings, 2 replies; 13+ messages in thread
From: Winiarska, Iwona @ 2025-10-21 21:01 UTC (permalink / raw)
  To: gregkh@linuxfoundation.org, bmasney@redhat.com,
	andrew@codeconstruct.com.au
  Cc: joel@jms.id.au, linux-aspeed@lists.ozlabs.org, sboyd@kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	openbmc@lists.ozlabs.org, mripard@kernel.org

On Mon, 2025-10-20 at 09:30 +1030, Andrew Jeffery wrote:
> On Fri, 2025-10-17 at 09:43 +0200, Greg Kroah-Hartman wrote:
> > On Fri, Oct 17, 2025 at 05:57:44PM +1030, Andrew Jeffery wrote:
> > > On Fri, 2025-10-17 at 08:41 +0200, Greg Kroah-Hartman wrote:
> > > > On Fri, Oct 17, 2025 at 04:52:37PM +1030, Andrew Jeffery wrote:
> > > > > Hi Greg,
> > > > > 
> > > > > On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> > > > > > Hi Andrew and Iwona,
> > > > > > 
> > > > > > On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > > > > > > Hi Brian,
> > > > > > > 
> > > > > > > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > > > > > > Hi Iwona, Joel, and Andrew,
> > > > > > > > 
> > > > > > > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > > > > > > The round_rate() clk ops is deprecated, so migrate this
> > > > > > > > > driver from
> > > > > > > > > round_rate() to determine_rate() using the Coccinelle
> > > > > > > > > semantic patch
> > > > > > > > > appended to the "under-the-cut" portion of the patch.
> > > > > > > > > 
> > > > > > > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > > > > > > 
> > > > > > > > Would it be possible to get this picked up for v6.18? I'd
> > > > > > > > like to remove
> > > > > > > > this API from drivers/clk in v6.19.
> > > > > > > 
> > > > > > > My (strong) preference is that Iwona applies it, but I'll keep
> > > > > > > an eye
> > > > > > > out for any unusual delays.
> > > > > > 
> > > > > > This patch wasn't picked up for v6.18. Any chance this can get
> > > > > > picked up
> > > > > > now for v6.19?
> > > > > > 
> > > > > > I'm hoping to get this merged so that we can remove the
> > > > > > round_rate() clk
> > > > > > op from the clk core. The clk maintainer (Stephen) mentioned this
> > > > > > work
> > > > > > in his last pull to Linus.
> > > > > > 
> > > > > > https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/
> > > > > 
> > > > > Are you happy to pick this up directly in Iwona's absence?
> > > > 
> > > > Why me?
> > > 
> > > I figured that would be sensible since Iwona historically sent you PRs
> > > for the PECI subsystem.
> > 
> > I did not remember that, sorry.
> > 
> 
> No worries.
> 
> >   The MAINTAINERS file does not mention
> > this at all, and it lists many other maintainers that should be able to
> > take this patch:
> > 	$ ./scripts/get_maintainer.pl  drivers/peci/controller/peci-
> > aspeed.c
> > 	Iwona Winiarska <iwona.winiarska@intel.com> (maintainer:ASPEED PECI
> > CONTROLLER)
> > 	Joel Stanley <joel@jms.id.au> (maintainer:ARM/ASPEED MACHINE
> > SUPPORT)
> > 	Andrew Jeffery <andrew@codeconstruct.com.au> (maintainer:ARM/ASPEED
> > MACHINE SUPPORT)
> 
> Iwona currently appears unresponsive, as mentioned. Joel's stepped back
> from maintaining the ASPEED bits as of earlier this year; I worked with
> him to add myself as a maintainer there, hence the last entry, and now
> getting in touch with you.
> 
> I can apply the patch and send you a PR if that helps, if Iwona doesn't
> respond in the mean time.

Hi!

Sorry for the delay - for some reason this entire thread didn't land in my inbox
and I just found it now, randomly browsing mailing list :/

I will sent it as a PR for v6.19.

-Iwona

> 
> Andrew
> 
> > 	linux-aspeed@lists.ozlabs.org (moderated list:ASPEED PECI
> > CONTROLLER)
> > 	openbmc@lists.ozlabs.org (moderated list:ASPEED PECI CONTROLLER)
> > 	linux-arm-kernel@lists.infradead.org (moderated list:ARM/ASPEED
> > MACHINE SUPPORT)
> > 	linux-kernel@vger.kernel.org (open list)
> > 	ASPEED PECI CONTROLLER status: Supported
> > 	PECI SUBSYSTEM status: Supported
> > 	ARM/ASPEED MACHINE SUPPORT status: Supported
> > 
> > thanks,
> > 
> > greg k-h


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-08-10 22:21 [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate() Brian Masney
  2025-09-14 11:56 ` Brian Masney
@ 2025-10-21 21:07 ` Winiarska, Iwona
  1 sibling, 0 replies; 13+ messages in thread
From: Winiarska, Iwona @ 2025-10-21 21:07 UTC (permalink / raw)
  To: andrew@codeconstruct.com.au, mripard@kernel.org, sboyd@kernel.org,
	bmasney@redhat.com, joel@jms.id.au
  Cc: linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	openbmc@lists.ozlabs.org, linux-aspeed@lists.ozlabs.org,
	linux-kernel@vger.kernel.org

On Sun, 2025-08-10 at 18:21 -0400, Brian Masney wrote:
> The round_rate() clk ops is deprecated, so migrate this driver from
> round_rate() to determine_rate() using the Coccinelle semantic patch
> appended to the "under-the-cut" portion of the patch.
> 
> Signed-off-by: Brian Masney <bmasney@redhat.com>

Reviewed-by: Iwona Winiarska <iwona.winiarska@intel.com>

Thanks
-Iwona

> ---
> Coccinelle semantic patch is below. It's large and I don't want to
> pollute the kernel changelog with the same code hundreds of times,
> so that's why it's included under the cut. For subsystems with more
> than one patch, I've included it on the cover letter.
> 
>     virtual patch
> 
>     // Look up the current name of the round_rate function
>     @ has_round_rate @
>     identifier round_rate_name =~ ".*_round_rate";
>     identifier hw_param, rate_param, parent_rate_param;
>     @@
> 
>     long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                   unsigned long *parent_rate_param)
>     {
>     	...
>     }
> 
>     // Rename the route_rate function name to determine_rate()
>     @ script:python generate_name depends on has_round_rate @
>     round_rate_name << has_round_rate.round_rate_name;
>     new_name;
>     @@
> 
>     coccinelle.new_name = round_rate_name.replace("_round_rate",
> "_determine_rate")
> 
>     // Change rate to req->rate; also change occurrences of 'return XXX'.
>     @ chg_rate depends on generate_name @
>     identifier has_round_rate.round_rate_name;
>     identifier has_round_rate.hw_param;
>     identifier has_round_rate.rate_param;
>     identifier has_round_rate.parent_rate_param;
>     identifier ERR =~ "E.*";
>     expression E;
>     @@
> 
>     long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                   unsigned long *parent_rate_param)
>     {
>     <...
>     (
>     -return -ERR;
>     +return -ERR;
>     |
>     - return rate_param;
>     + return 0;
>     |
>     - return E;
>     + req->rate = E;
>     +
>     + return 0;
>     |
>     - rate_param
>     + req->rate
>     )
>     ...>
>     }
> 
>     // Coccinelle only transforms the first occurrence of the rate parameter
>     // Run a second time. FIXME: Is there a better way to do this?
>     @ chg_rate2 depends on generate_name @
>     identifier has_round_rate.round_rate_name;
>     identifier has_round_rate.hw_param;
>     identifier has_round_rate.rate_param;
>     identifier has_round_rate.parent_rate_param;
>     @@
> 
>     long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                   unsigned long *parent_rate_param)
>     {
>     <...
>     - rate_param
>     + req->rate
>     ...>
>     }
> 
>     // Change parent_rate to req->best_parent_rate
>     @ chg_parent_rate depends on generate_name @
>     identifier has_round_rate.round_rate_name;
>     identifier has_round_rate.hw_param;
>     identifier has_round_rate.rate_param;
>     identifier has_round_rate.parent_rate_param;
>     @@
> 
>     long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>                   unsigned long *parent_rate_param)
>     {
>     <...
>     (
>     - *parent_rate_param
>     + req->best_parent_rate
>     |
>     - parent_rate_param
>     + &req->best_parent_rate
>     )
>     ...>
>     }
> 
>     // Convert the function definition from round_rate() to determine_rate()
>     @ func_definition depends on chg_rate @
>     identifier has_round_rate.round_rate_name;
>     identifier has_round_rate.hw_param;
>     identifier has_round_rate.rate_param;
>     identifier has_round_rate.parent_rate_param;
>     identifier generate_name.new_name;
>     @@
> 
>     - long round_rate_name(struct clk_hw *hw_param, unsigned long rate_param,
>     -               unsigned long *parent_rate_param)
>     + int new_name(struct clk_hw *hw, struct clk_rate_request *req)
>     {
>         ...
>     }
> 
>     // Update the ops from round_rate() to determine_rate()
>     @ ops depends on func_definition @
>     identifier has_round_rate.round_rate_name;
>     identifier generate_name.new_name;
>     @@
> 
>     {
>         ...,
>     -   .round_rate = round_rate_name,
>     +   .determine_rate = new_name,
>         ...,
>     }
> 
> Note that I used coccinelle 1.2 instead of 1.3 since the newer version
> adds unnecessary braces as described in this post.
> https://lore.kernel.org/cocci/67642477-5f3e-4b2a-914d-579a54f48cbd@intel.com/
> ---
>  drivers/peci/controller/peci-aspeed.c | 12 +++++++-----
>  1 file changed, 7 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/peci/controller/peci-aspeed.c
> b/drivers/peci/controller/peci-aspeed.c
> index
> ad3a7d71ed4c61e6123dcbbad264812cb83cbb07..a0c99ecf7f3805a1cdac55a8d5db9c61ad3c
> f37c 100644
> --- a/drivers/peci/controller/peci-aspeed.c
> +++ b/drivers/peci/controller/peci-aspeed.c
> @@ -362,12 +362,14 @@ static int clk_aspeed_peci_set_rate(struct clk_hw *hw,
> unsigned long rate,
>  	return 0;
>  }
>  
> -static long clk_aspeed_peci_round_rate(struct clk_hw *hw, unsigned long rate,
> -				       unsigned long *prate)
> +static int clk_aspeed_peci_determine_rate(struct clk_hw *hw,
> +					  struct clk_rate_request *req)
>  {
> -	int div = clk_aspeed_peci_get_div(rate, prate);
> +	int div = clk_aspeed_peci_get_div(req->rate, &req->best_parent_rate);
>  
> -	return DIV_ROUND_UP_ULL(*prate, div);
> +	req->rate = DIV_ROUND_UP_ULL(req->best_parent_rate, div);
> +
> +	return 0;
>  }
>  
>  static unsigned long clk_aspeed_peci_recalc_rate(struct clk_hw *hw, unsigned
> long prate)
> @@ -394,7 +396,7 @@ static unsigned long clk_aspeed_peci_recalc_rate(struct
> clk_hw *hw, unsigned lon
>  
>  static const struct clk_ops clk_aspeed_peci_ops = {
>  	.set_rate = clk_aspeed_peci_set_rate,
> -	.round_rate = clk_aspeed_peci_round_rate,
> +	.determine_rate = clk_aspeed_peci_determine_rate,
>  	.recalc_rate = clk_aspeed_peci_recalc_rate,
>  };
>  
> 
> ---
> base-commit: 8f5ae30d69d7543eee0d70083daf4de8fe15d585
> change-id: 20250729-peci-round-rate-543639297ec6
> 
> Best regards,


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-21 21:01                 ` Winiarska, Iwona
@ 2025-10-21 22:35                   ` Andrew Jeffery
  2025-11-06 23:11                   ` Brian Masney
  1 sibling, 0 replies; 13+ messages in thread
From: Andrew Jeffery @ 2025-10-21 22:35 UTC (permalink / raw)
  To: Winiarska, Iwona, gregkh@linuxfoundation.org, bmasney@redhat.com
  Cc: joel@jms.id.au, linux-aspeed@lists.ozlabs.org, sboyd@kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	openbmc@lists.ozlabs.org, mripard@kernel.org

On Tue, 2025-10-21 at 21:01 +0000, Winiarska, Iwona wrote:
> On Mon, 2025-10-20 at 09:30 +1030, Andrew Jeffery wrote:
> > On Fri, 2025-10-17 at 09:43 +0200, Greg Kroah-Hartman wrote:
> > > On Fri, Oct 17, 2025 at 05:57:44PM +1030, Andrew Jeffery wrote:
> > > > On Fri, 2025-10-17 at 08:41 +0200, Greg Kroah-Hartman wrote:
> > > > > On Fri, Oct 17, 2025 at 04:52:37PM +1030, Andrew Jeffery wrote:
> > > > > > Hi Greg,
> > > > > > 
> > > > > > On Thu, 2025-10-16 at 12:11 -0400, Brian Masney wrote:
> > > > > > > Hi Andrew and Iwona,
> > > > > > > 
> > > > > > > On Mon, Sep 15, 2025 at 02:36:48PM +0930, Andrew Jeffery wrote:
> > > > > > > > Hi Brian,
> > > > > > > > 
> > > > > > > > On Sun, 2025-09-14 at 07:56 -0400, Brian Masney wrote:
> > > > > > > > > Hi Iwona, Joel, and Andrew,
> > > > > > > > > 
> > > > > > > > > On Sun, Aug 10, 2025 at 06:21:51PM -0400, Brian Masney wrote:
> > > > > > > > > > The round_rate() clk ops is deprecated, so migrate this
> > > > > > > > > > driver from
> > > > > > > > > > round_rate() to determine_rate() using the Coccinelle
> > > > > > > > > > semantic patch
> > > > > > > > > > appended to the "under-the-cut" portion of the patch.
> > > > > > > > > > 
> > > > > > > > > > Signed-off-by: Brian Masney <bmasney@redhat.com>
> > > > > > > > > 
> > > > > > > > > Would it be possible to get this picked up for v6.18? I'd
> > > > > > > > > like to remove
> > > > > > > > > this API from drivers/clk in v6.19.
> > > > > > > > 
> > > > > > > > My (strong) preference is that Iwona applies it, but I'll keep
> > > > > > > > an eye
> > > > > > > > out for any unusual delays.
> > > > > > > 
> > > > > > > This patch wasn't picked up for v6.18. Any chance this can get
> > > > > > > picked up
> > > > > > > now for v6.19?
> > > > > > > 
> > > > > > > I'm hoping to get this merged so that we can remove the
> > > > > > > round_rate() clk
> > > > > > > op from the clk core. The clk maintainer (Stephen) mentioned this
> > > > > > > work
> > > > > > > in his last pull to Linus.
> > > > > > > 
> > > > > > > https://lore.kernel.org/linux-clk/20251007051720.11386-1-sboyd@kernel.org/
> > > > > > 
> > > > > > Are you happy to pick this up directly in Iwona's absence?
> > > > > 
> > > > > Why me?
> > > > 
> > > > I figured that would be sensible since Iwona historically sent you PRs
> > > > for the PECI subsystem.
> > > 
> > > I did not remember that, sorry.
> > > 
> > 
> > No worries.
> > 
> > >   The MAINTAINERS file does not mention
> > > this at all, and it lists many other maintainers that should be able to
> > > take this patch:
> > > 	$ ./scripts/get_maintainer.pl  drivers/peci/controller/peci-
> > > aspeed.c
> > > 	Iwona Winiarska <iwona.winiarska@intel.com> (maintainer:ASPEED PECI
> > > CONTROLLER)
> > > 	Joel Stanley <joel@jms.id.au> (maintainer:ARM/ASPEED MACHINE
> > > SUPPORT)
> > > 	Andrew Jeffery <andrew@codeconstruct.com.au> (maintainer:ARM/ASPEED
> > > MACHINE SUPPORT)
> > 
> > Iwona currently appears unresponsive, as mentioned. Joel's stepped back
> > from maintaining the ASPEED bits as of earlier this year; I worked with
> > him to add myself as a maintainer there, hence the last entry, and now
> > getting in touch with you.
> > 
> > I can apply the patch and send you a PR if that helps, if Iwona doesn't
> > respond in the mean time.
> 
> Hi!
> 
> Sorry for the delay - for some reason this entire thread didn't land in my inbox
> and I just found it now, randomly browsing mailing list :/
> 
> I will sent it as a PR for v6.19.

Ah, super! Thanks Iwona.

Andrew


^ permalink raw reply	[flat|nested] 13+ messages in thread

* Re: [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate()
  2025-10-21 21:01                 ` Winiarska, Iwona
  2025-10-21 22:35                   ` Andrew Jeffery
@ 2025-11-06 23:11                   ` Brian Masney
  1 sibling, 0 replies; 13+ messages in thread
From: Brian Masney @ 2025-11-06 23:11 UTC (permalink / raw)
  To: Winiarska, Iwona
  Cc: gregkh@linuxfoundation.org, andrew@codeconstruct.com.au,
	joel@jms.id.au, linux-aspeed@lists.ozlabs.org, sboyd@kernel.org,
	linux-kernel@vger.kernel.org,
	linux-arm-kernel@lists.infradead.org, linux-clk@vger.kernel.org,
	openbmc@lists.ozlabs.org, mripard@kernel.org

Hi Iwona,

On Tue, Oct 21, 2025 at 09:01:23PM +0000, Winiarska, Iwona wrote:
> Sorry for the delay - for some reason this entire thread didn't land in my inbox
> and I just found it now, randomly browsing mailing list :/
> 
> I will sent it as a PR for v6.19.

I'm just checking if this patch should show up in linux-next by now?

Sorry to be a pest. This patch, and one other series in another
subsystem is all that's holding me back from removing a legacy API in
the clk subsystem. I'd really like to get these dependencies merged for
v6.19 so that I can do that cleanup work in v6.20.

Thanks,

Brian



^ permalink raw reply	[flat|nested] 13+ messages in thread

end of thread, other threads:[~2025-11-08  4:41 UTC | newest]

Thread overview: 13+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2025-08-10 22:21 [PATCH] peci: controller: peci-aspeed: convert from round_rate() to determine_rate() Brian Masney
2025-09-14 11:56 ` Brian Masney
2025-09-15  5:06   ` Andrew Jeffery
2025-10-16 16:11     ` Brian Masney
2025-10-17  6:22       ` Andrew Jeffery
2025-10-17  6:41         ` Greg Kroah-Hartman
2025-10-17  7:27           ` Andrew Jeffery
2025-10-17  7:43             ` Greg Kroah-Hartman
2025-10-19 23:00               ` Andrew Jeffery
2025-10-21 21:01                 ` Winiarska, Iwona
2025-10-21 22:35                   ` Andrew Jeffery
2025-11-06 23:11                   ` Brian Masney
2025-10-21 21:07 ` Winiarska, Iwona

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).