diff mbox series

[v4,3/3] pwm: th1520: remove impl Send/Sync for Th1520PwmDriverData

Message ID 20260113-clk-send-sync-v4-3-712bc7d94a79@google.com
State New
Delegated to: Michał Wilczyński
Headers show
Series Implement Send and Sync for clk | expand

Commit Message

Alice Ryhl Jan. 13, 2026, 3:12 p.m. UTC
Now that clk implements Send and Sync, we no longer need to manually
implement these traits for Th1520PwmDriverData. Thus remove the
implementations.

Reviewed-by: Gary Guo <gary@garyguo.net>
Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
Signed-off-by: Alice Ryhl <aliceryhl@google.com>
---
Cc: linux-riscv@lists.infradead.org
---
 drivers/pwm/pwm_th1520.rs | 15 ---------------
 1 file changed, 15 deletions(-)

Comments

Michal Wilczynski Jan. 19, 2026, 9:45 p.m. UTC | #1
On 1/13/26 16:12, Alice Ryhl wrote:
> Now that clk implements Send and Sync, we no longer need to manually
> implement these traits for Th1520PwmDriverData. Thus remove the
> implementations.
> 
> Reviewed-by: Gary Guo <gary@garyguo.net>
> Reviewed-by: Daniel Almeida <daniel.almeida@collabora.com>
> Signed-off-by: Alice Ryhl <aliceryhl@google.com>
> ---
> Cc: linux-riscv@lists.infradead.org
> ---
>  drivers/pwm/pwm_th1520.rs | 15 ---------------
>  1 file changed, 15 deletions(-)
> 
> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
> index e3b7e77356fc2492077c519073e861beb3e44df9..043dc4dbc6232020195c7b73fad302bbb69652df 100644
> --- a/drivers/pwm/pwm_th1520.rs
> +++ b/drivers/pwm/pwm_th1520.rs
> @@ -97,21 +97,6 @@ struct Th1520PwmDriverData {
>      clk: Clk,
>  }
>  
> -// This `unsafe` implementation is a temporary necessity because the underlying `kernel::clk::Clk`
> -// type does not yet expose `Send` and `Sync` implementations. This block should be removed
> -// as soon as the clock abstraction provides these guarantees directly.
> -// TODO: Remove those unsafe impl's when Clk will support them itself.
> -
> -// SAFETY: The `devres` framework requires the driver's private data to be `Send` and `Sync`.
> -// We can guarantee this because the PWM core synchronizes all callbacks, preventing concurrent
> -// access to the contained `iomem` and `clk` resources.
> -unsafe impl Send for Th1520PwmDriverData {}
> -
> -// SAFETY: The same reasoning applies as for `Send`. The PWM core's synchronization
> -// guarantees that it is safe for multiple threads to have shared access (`&self`)
> -// to the driver data during callbacks.
> -unsafe impl Sync for Th1520PwmDriverData {}
> -
>  impl pwm::PwmOps for Th1520PwmDriverData {
>      type WfHw = Th1520WfHw;
>  
> 

I thought this was already merged :-).

Reviewed-by: Michal Wilczynski <m.wilczynski@samsung.com>
Uwe Kleine-König Jan. 20, 2026, 8:48 a.m. UTC | #2
Hello,

On Mon, Jan 19, 2026 at 10:45:56PM +0100, Michal Wilczynski wrote:
> On 1/13/26 16:12, Alice Ryhl wrote:
> > Now that clk implements Send and Sync, we no longer need to manually
> > implement these traits for Th1520PwmDriverData. Thus remove the
> > implementations.
> 
> I thought this was already merged :-).
> 
> Reviewed-by: Michal Wilczynski <m.wilczynski@samsung.com>

If I understand correctly this patch 3 depends on the first patch of
this series so I cannot pick it up via the pwm tree *now*. There is
another patch pending for the th1520 PWM driver, but as of now git seems
to cope well when merging the pwm's tree for-next with this patch.  So
it's fine for me if the series is picked up for 6.20-rc1 via the clock
tree.

Acked-by: Uwe Kleine-König <ukleinek@kernel.org>

(Nitpick: If it was me who picked up patch 3 I would have capitalized
the "remove" in the Subject for consistency.)

Best regards
Uwe
diff mbox series

Patch

diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
index e3b7e77356fc2492077c519073e861beb3e44df9..043dc4dbc6232020195c7b73fad302bbb69652df 100644
--- a/drivers/pwm/pwm_th1520.rs
+++ b/drivers/pwm/pwm_th1520.rs
@@ -97,21 +97,6 @@  struct Th1520PwmDriverData {
     clk: Clk,
 }
 
-// This `unsafe` implementation is a temporary necessity because the underlying `kernel::clk::Clk`
-// type does not yet expose `Send` and `Sync` implementations. This block should be removed
-// as soon as the clock abstraction provides these guarantees directly.
-// TODO: Remove those unsafe impl's when Clk will support them itself.
-
-// SAFETY: The `devres` framework requires the driver's private data to be `Send` and `Sync`.
-// We can guarantee this because the PWM core synchronizes all callbacks, preventing concurrent
-// access to the contained `iomem` and `clk` resources.
-unsafe impl Send for Th1520PwmDriverData {}
-
-// SAFETY: The same reasoning applies as for `Send`. The PWM core's synchronization
-// guarantees that it is safe for multiple threads to have shared access (`&self`)
-// to the driver data during callbacks.
-unsafe impl Sync for Th1520PwmDriverData {}
-
 impl pwm::PwmOps for Th1520PwmDriverData {
     type WfHw = Th1520WfHw;