[PATCH] drivers: pwm: replace `kernel::c_str!` with C-Strings

Uwe Kleine-König ukleinek at kernel.org
Mon Jan 19 08:53:08 PST 2026


Hello,

On Sat, Jan 03, 2026 at 09:30:31PM -0500, Tamir Duberstein wrote:
> On Mon, Dec 22, 2025 at 7:24 AM Tamir Duberstein <tamird at kernel.org> wrote:
> >
> > From: Tamir Duberstein <tamird at gmail.com>
> >
> > C-String literals were added in Rust 1.77. Replace instances of
> > `kernel::c_str!` with C-String literals where possible.
> >
> > Signed-off-by: Tamir Duberstein <tamird at gmail.com>
> > ---
> >  drivers/pwm/pwm_th1520.rs | 3 +--
> >  1 file changed, 1 insertion(+), 2 deletions(-)
> >
> > diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
> > index e3b7e77356fc..8ae8f852ec02 100644
> > --- a/drivers/pwm/pwm_th1520.rs
> > +++ b/drivers/pwm/pwm_th1520.rs
> > @@ -22,7 +22,6 @@
> >
> >  use core::ops::Deref;
> >  use kernel::{
> > -    c_str,
> >      clk::Clk,
> >      device::{Bound, Core, Device},
> >      devres,
> > @@ -327,7 +326,7 @@ fn drop(self: Pin<&mut Self>) {
> >      OF_TABLE,
> >      MODULE_OF_TABLE,
> >      <Th1520PwmPlatformDriver as platform::Driver>::IdInfo,
> > -    [(of::DeviceId::new(c_str!("thead,th1520-pwm")), ())]
> > +    [(of::DeviceId::new(c"thead,th1520-pwm"), ())]
> >  );
> >
> >  impl platform::Driver for Th1520PwmPlatformDriver {
> >
> > ---
> > base-commit: 8f0b4cce4481fb22653697cced8d0d04027cb1e8
> > change-id: 20251222-cstr-pwm-c9b9a4701157
> >
> > Best regards,
> > --
> > Tamir Duberstein <tamird at gmail.com>
> >
> 
> @Uwe could you please have a look?

I did, but given I'm more or less rust illiterate I would welcome
feedback by Michal Wilczynski. I only now notice that he wasn't on Cc:
up to now.

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/20260119/8c2cc4e8/attachment.sig>


More information about the linux-riscv mailing list