[PATCH v14 1/7] pwm: Export `pwmchip_release` for external use

Uwe Kleine-König ukleinek at kernel.org
Mon Sep 15 03:00:14 PDT 2025


Hello,

On Wed, Aug 20, 2025 at 10:35:36AM +0200, Michal Wilczynski wrote:
> The upcoming Rust abstraction layer for the PWM subsystem uses a custom
> `dev->release` handler to safely manage the lifetime of its driver
> data.
> 
> To prevent leaking the memory of the `struct pwm_chip` (allocated by
> `pwmchip_alloc`), this custom handler must also call the original
> `pwmchip_release` function to complete the cleanup.
> 
> Make `pwmchip_release` a global, exported function so that it can be
> called from the Rust FFI bridge. This involves removing the `static`
> keyword, adding a prototype to the public header, and exporting the
> symbol.
> 
> Signed-off-by: Michal Wilczynski <m.wilczynski at samsung.com>

I still somewhat dislike this patch. Isn't it possible to make the rust
abstraction use the pointer that .release is set to when it calls
pwmchip_alloc()?

(I wouldn't further delay this series for this discussion, this can be
handled just fine at a later point in time.)

Best regards
Uwe
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 488 bytes
Desc: not available
URL: <http://lists.infradead.org/pipermail/linux-riscv/attachments/20250915/0fae8446/attachment.sig>


More information about the linux-riscv mailing list