Skip to contentSkip to conversation

pwm: fix Rust formatting

PATCH In review Miguel Ojeda 2 participants 2 messages Oct 29, 2025 – Oct 30, 2025

Subsystems (5)
lore
Share & tools
lore

Miguel Ojeda

author maintainer
#0 lore raw

PATCH 1/1 pwm: fix Rust formatting

We do our best to keep the repository rustfmt-clean [1], thus run the tool to fix the formatting issue.

A trailing empty comment [2] is added in order to preserve the wanted style for imports (otherwise the tool will compact the first two items).

Fixes a3d5a2b8da94 ("rust: pwm: Add complete abstraction layer")
Fixes 121931a7b4dc ("rust: pwm: Add Kconfig and basic data structures")
Fixes fb3957af9ec6 ("pwm: Add Rust driver for T-HEAD TH1520 SoC")

---
If you usually rebase your tree, please feel free to do so instead. Thanks!

 drivers/pwm/pwm_th1520.rs | 15 ++++++++++---
 rust/kernel/lib.rs        |  4 ++--
 rust/kernel/pwm.rs        | 46 +++++++++++++++++++++------------------
 3 files changed, 39 insertions(+), 26 deletions(-)
drivers/pwm/pwm_th1520.rs +12 -3
index 0ad38b78be85..ee2a6d573bc2 100644
@@ -200,7 +200,10 @@ fn round_waveform_fromhw(
         let rate_hz = data.clk.rate().as_hz() as u64;
 
         if wfhw.period_cycles == 0 {
-            dev_dbg!(chip.device(), "HW state has zero period, reporting as disabled.\n");
+            dev_dbg!(
+                chip.device(),
+                "HW state has zero period, reporting as disabled.\n"
+            );
             *wf = pwm::Waveform::default();
             return Ok(());
         }
@@ -277,7 +280,10 @@ fn write_waveform(
             if was_enabled {
                 iomap.try_write32(wfhw.ctrl_val, th1520_pwm_ctrl(hwpwm))?;
                 iomap.try_write32(0, th1520_pwm_fp(hwpwm))?;
-                iomap.try_write32(wfhw.ctrl_val | TH1520_PWM_CFG_UPDATE, th1520_pwm_ctrl(hwpwm))?;
+                iomap.try_write32(
+                    wfhw.ctrl_val | TH1520_PWM_CFG_UPDATE,
+                    th1520_pwm_ctrl(hwpwm),
+                )?;
             }
             return Ok(());
         }
@@ -285,7 +291,10 @@ fn write_waveform(
         iomap.try_write32(wfhw.ctrl_val, th1520_pwm_ctrl(hwpwm))?;
         iomap.try_write32(wfhw.period_cycles, th1520_pwm_per(hwpwm))?;
         iomap.try_write32(wfhw.duty_cycles, th1520_pwm_fp(hwpwm))?;
-        iomap.try_write32(wfhw.ctrl_val | TH1520_PWM_CFG_UPDATE, th1520_pwm_ctrl(hwpwm))?;
+        iomap.try_write32(
+            wfhw.ctrl_val | TH1520_PWM_CFG_UPDATE,
+            th1520_pwm_ctrl(hwpwm),
+        )?;
 
         // The `TH1520_PWM_START` bit must be written in a separate, final transaction, and
         // only when enabling the channel from a disabled state.
rust/kernel/lib.rs +2 -2
index 68c71d888fdb..584aa3282029 100644
@@ -121,6 +121,8 @@
 pub mod print;
 pub mod processor;
 pub mod ptr;
+#[cfg(CONFIG_RUST_PWM_ABSTRACTIONS)]
+pub mod pwm;
 pub mod rbtree;
 pub mod regulator;
 pub mod revocable;
@@ -129,8 +131,6 @@
 pub mod seq_file;
 pub mod sizes;
 mod static_assert;
-#[cfg(CONFIG_RUST_PWM_ABSTRACTIONS)]
-pub mod pwm;
 #[doc(hidden)]
 pub mod std_vendor;
 pub mod str;
rust/kernel/pwm.rs +25 -21

109 lines not on this page · raw message

base-commit: 04a698c800c25149f9aa379250e78f737adeb3f1 --
2.51.2

#1 lore raw

Hello,

Quoted 6 lines · Miguel Ojeda

We do our best to keep the repository rustfmt-clean [1], thus run the tool to fix the formatting issue.

A trailing empty comment [2] is added in order to preserve the wanted style for imports (otherwise the tool will compact the first two items).

Quoted 6 lines
Fixes a3d5a2b8da94 ("rust: pwm: Add complete abstraction layer")
Fixes 121931a7b4dc ("rust: pwm: Add Kconfig and basic data structures")
Fixes fb3957af9ec6 ("pwm: Add Rust driver for T-HEAD TH1520 SoC")

Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/ukleinek/linux.git pwm/for-next .

Thanks!
Uwe