linux-arm-kernel.lists.infradead.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get()
@ 2024-01-04 22:55 Uwe Kleine-König
  2024-01-25 21:44 ` Uwe Kleine-König
  2024-02-29  1:03 ` Stephen Boyd
  0 siblings, 2 replies; 6+ messages in thread
From: Uwe Kleine-König @ 2024-01-04 22:55 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Russell King
  Cc: kernel, linux-clk, linux-arm-kernel, Maxime Ripard

This allows to simplify drivers that use clk_rate_exclusive_get()
in their probe routine as calling clk_rate_exclusive_put() is cared for
automatically.

Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
---
Changes since (implicit) v1, sent with Message-Id:
744a6371f94fe96f527eea6e52a600914e6fb6b5.1702403904.git.u.kleine-koenig@pengutronix.de:

 - rebase to todays next
 - check return value of clk_rate_exclusive_get()
 - fix a typo in clk.h (s/cal\>/call/)

 drivers/clk/clk.c   | 19 +++++++++++++++++++
 include/linux/clk.h | 12 ++++++++++++
 2 files changed, 31 insertions(+)

diff --git a/drivers/clk/clk.c b/drivers/clk/clk.c
index 2253c154a824..a3bc7fb90d0f 100644
--- a/drivers/clk/clk.c
+++ b/drivers/clk/clk.c
@@ -939,6 +939,25 @@ int clk_rate_exclusive_get(struct clk *clk)
 }
 EXPORT_SYMBOL_GPL(clk_rate_exclusive_get);
 
+static void devm_clk_rate_exclusive_put(void *data)
+{
+	struct clk *clk = data;
+
+	clk_rate_exclusive_put(clk);
+}
+
+int devm_clk_rate_exclusive_get(struct device *dev, struct clk *clk)
+{
+	int ret;
+
+	ret = clk_rate_exclusive_get(clk);
+	if (ret)
+		return ret;
+
+	return devm_add_action_or_reset(dev, devm_clk_rate_exclusive_put, clk);
+}
+EXPORT_SYMBOL_GPL(devm_clk_rate_exclusive_get);
+
 static void clk_core_unprepare(struct clk_core *core)
 {
 	lockdep_assert_held(&prepare_lock);
diff --git a/include/linux/clk.h b/include/linux/clk.h
index 06f1b292f8a0..24c49b01c25d 100644
--- a/include/linux/clk.h
+++ b/include/linux/clk.h
@@ -201,6 +201,18 @@ bool clk_is_match(const struct clk *p, const struct clk *q);
  */
 int clk_rate_exclusive_get(struct clk *clk);
 
+/**
+ * devm_clk_rate_exclusive_get - devm variant of clk_rate_exclusive_get
+ * @dev: device the exclusivity is bound to
+ * @clk: clock source
+ *
+ * Calls clk_rate_exclusive_get() on @clk and registers a devm cleanup handler
+ * on @dev to call clk_rate_exclusive_put().
+ *
+ * Must not be called from within atomic context.
+ */
+int devm_clk_rate_exclusive_get(struct device *dev, struct clk *clk);
+
 /**
  * clk_rate_exclusive_put - release exclusivity over the rate control of a
  *                          producer

base-commit: d0b3c8aa5e37775cd7c3ac07b256218df0fd6678
-- 
2.43.0


_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get()
  2024-01-04 22:55 [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get() Uwe Kleine-König
@ 2024-01-25 21:44 ` Uwe Kleine-König
  2024-02-15  9:39   ` Uwe Kleine-König
  2024-02-29  1:03 ` Stephen Boyd
  1 sibling, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-01-25 21:44 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Russell King
  Cc: linux-arm-kernel, linux-clk, kernel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 914 bytes --]

Hello Stephen,

On Thu, Jan 04, 2024 at 11:55:11PM +0100, Uwe Kleine-König wrote:
> This allows to simplify drivers that use clk_rate_exclusive_get()
> in their probe routine as calling clk_rate_exclusive_put() is cared for
> automatically.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---
> Changes since (implicit) v1, sent with Message-Id:
> 744a6371f94fe96f527eea6e52a600914e6fb6b5.1702403904.git.u.kleine-koenig@pengutronix.de:

Given that I'm not the only one waiting for this change (see
https://lore.kernel.org/linux-i2c/20240119072223.3986183-1-alexander.stein@ew.tq-group.com)
here comes a gentil ping. It would be great to get this patch into next
now the merge window is closed.

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get()
  2024-01-25 21:44 ` Uwe Kleine-König
@ 2024-02-15  9:39   ` Uwe Kleine-König
  2024-02-27  7:38     ` Uwe Kleine-König
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-02-15  9:39 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Russell King
  Cc: kernel, linux-clk, linux-arm-kernel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 1063 bytes --]

Hello,

On Thu, Jan 25, 2024 at 10:44:45PM +0100, Uwe Kleine-König wrote:
> On Thu, Jan 04, 2024 at 11:55:11PM +0100, Uwe Kleine-König wrote:
> > This allows to simplify drivers that use clk_rate_exclusive_get()
> > in their probe routine as calling clk_rate_exclusive_put() is cared for
> > automatically.
> > 
> > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > ---
> > Changes since (implicit) v1, sent with Message-Id:
> > 744a6371f94fe96f527eea6e52a600914e6fb6b5.1702403904.git.u.kleine-koenig@pengutronix.de:
> 
> Given that I'm not the only one waiting for this change (see
> https://lore.kernel.org/linux-i2c/20240119072223.3986183-1-alexander.stein@ew.tq-group.com)
> here comes a gentil ping. It would be great to get this patch into next
> now the merge window is closed.

Is there a chance to get this into next and then v6.9-rc1?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get()
  2024-02-15  9:39   ` Uwe Kleine-König
@ 2024-02-27  7:38     ` Uwe Kleine-König
  2024-02-27 10:31       ` Russell King (Oracle)
  0 siblings, 1 reply; 6+ messages in thread
From: Uwe Kleine-König @ 2024-02-27  7:38 UTC (permalink / raw)
  To: Michael Turquette, Stephen Boyd, Russell King
  Cc: linux-arm-kernel, linux-clk, kernel, Maxime Ripard


[-- Attachment #1.1: Type: text/plain, Size: 1417 bytes --]

Hello,

On Thu, Feb 15, 2024 at 10:39:00AM +0100, Uwe Kleine-König wrote:
> On Thu, Jan 25, 2024 at 10:44:45PM +0100, Uwe Kleine-König wrote:
> > On Thu, Jan 04, 2024 at 11:55:11PM +0100, Uwe Kleine-König wrote:
> > > This allows to simplify drivers that use clk_rate_exclusive_get()
> > > in their probe routine as calling clk_rate_exclusive_put() is cared for
> > > automatically.
> > > 
> > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > ---
> > > Changes since (implicit) v1, sent with Message-Id:
> > > 744a6371f94fe96f527eea6e52a600914e6fb6b5.1702403904.git.u.kleine-koenig@pengutronix.de:
> > 
> > Given that I'm not the only one waiting for this change (see
> > https://lore.kernel.org/linux-i2c/20240119072223.3986183-1-alexander.stein@ew.tq-group.com)
> > here comes a gentil ping. It would be great to get this patch into next
> > now the merge window is closed.
> 
> Is there a chance to get this into next and then v6.9-rc1?

I wonder if this patch is still on someone's radar and why it wasn't
applied yet. Does it need an ack by Russell before Stephen picks it up?
Is it too complicated and needs more time to review? Can someone please
comment what the stopper is here?

Best regards
Uwe

-- 
Pengutronix e.K.                           | Uwe Kleine-König            |
Industrial Linux Solutions                 | https://www.pengutronix.de/ |

[-- Attachment #1.2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

[-- Attachment #2: Type: text/plain, Size: 176 bytes --]

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get()
  2024-02-27  7:38     ` Uwe Kleine-König
@ 2024-02-27 10:31       ` Russell King (Oracle)
  0 siblings, 0 replies; 6+ messages in thread
From: Russell King (Oracle) @ 2024-02-27 10:31 UTC (permalink / raw)
  To: Uwe Kleine-König
  Cc: Michael Turquette, Stephen Boyd, linux-arm-kernel, linux-clk,
	kernel, Maxime Ripard

On Tue, Feb 27, 2024 at 08:38:54AM +0100, Uwe Kleine-König wrote:
> Hello,
> 
> On Thu, Feb 15, 2024 at 10:39:00AM +0100, Uwe Kleine-König wrote:
> > On Thu, Jan 25, 2024 at 10:44:45PM +0100, Uwe Kleine-König wrote:
> > > On Thu, Jan 04, 2024 at 11:55:11PM +0100, Uwe Kleine-König wrote:
> > > > This allows to simplify drivers that use clk_rate_exclusive_get()
> > > > in their probe routine as calling clk_rate_exclusive_put() is cared for
> > > > automatically.
> > > > 
> > > > Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> > > > ---
> > > > Changes since (implicit) v1, sent with Message-Id:
> > > > 744a6371f94fe96f527eea6e52a600914e6fb6b5.1702403904.git.u.kleine-koenig@pengutronix.de:
> > > 
> > > Given that I'm not the only one waiting for this change (see
> > > https://lore.kernel.org/linux-i2c/20240119072223.3986183-1-alexander.stein@ew.tq-group.com)
> > > here comes a gentil ping. It would be great to get this patch into next
> > > now the merge window is closed.
> > 
> > Is there a chance to get this into next and then v6.9-rc1?
> 
> I wonder if this patch is still on someone's radar and why it wasn't
> applied yet. Does it need an ack by Russell before Stephen picks it up?
> Is it too complicated and needs more time to review? Can someone please
> comment what the stopper is here?

Well, if it does, then the simple way to solve that is:

Acked-by: Russell King (Oracle) <rmk+kernel@armlinux.org.uk>

Thanks!

-- 
RMK's Patch system: https://www.armlinux.org.uk/developer/patches/
FTTP is here! 80Mbps down 10Mbps up. Decent connectivity at last!

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

* Re: [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get()
  2024-01-04 22:55 [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get() Uwe Kleine-König
  2024-01-25 21:44 ` Uwe Kleine-König
@ 2024-02-29  1:03 ` Stephen Boyd
  1 sibling, 0 replies; 6+ messages in thread
From: Stephen Boyd @ 2024-02-29  1:03 UTC (permalink / raw)
  To: Michael Turquette, Russell King, Uwe Kleine-König
  Cc: kernel, linux-clk, linux-arm-kernel, Maxime Ripard

Quoting Uwe Kleine-König (2024-01-04 14:55:11)
> This allows to simplify drivers that use clk_rate_exclusive_get()
> in their probe routine as calling clk_rate_exclusive_put() is cared for
> automatically.
> 
> Signed-off-by: Uwe Kleine-König <u.kleine-koenig@pengutronix.de>
> ---

Applied to clk-next

_______________________________________________
linux-arm-kernel mailing list
linux-arm-kernel@lists.infradead.org
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel

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

end of thread, other threads:[~2024-02-29  1:04 UTC | newest]

Thread overview: 6+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2024-01-04 22:55 [PATCH v2] clk: Add a devm variant of clk_rate_exclusive_get() Uwe Kleine-König
2024-01-25 21:44 ` Uwe Kleine-König
2024-02-15  9:39   ` Uwe Kleine-König
2024-02-27  7:38     ` Uwe Kleine-König
2024-02-27 10:31       ` Russell King (Oracle)
2024-02-29  1:03 ` Stephen Boyd

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).