Re: [PATCH v6 10/20] pwm: th1520: remove unnecessary `deref`

Daniel Almeida <[email protected]>
Newsgroups dev.linux.lists.nova-gpu,dev.linux.lists.driver-core,org.freedesktop.lists.dri-devel,org.kernel.vger.linux-kernel,org.kernel.vger.linux-pci,org.kernel.vger.linux-pwm,org.kernel.vger.rust-for-linux
Message-ID <[email protected]>

> On 6 Jul 2026, at 09:44, Gary Guo <[email protected]> wrote:
> 
> `Deref` is automatic and should normally not be used directly.
> Also, `IoMem` is going to be implementing `Io` directly, so it will no
> longer to be implementing `Deref`.
> 
> Reported-by: Andreas Hindborg <[email protected]>
> Link: https://rust-for-linux.zulipchat.com/#narrow/channel/291565-Help/topic/.E2.9C.94.20Projection.20in.20dma.20bus.20address.20space/near/606672061
> Reviewed-by: Alexandre Courbot <[email protected]>
> Signed-off-by: Gary Guo <[email protected]>
> ---
> drivers/pwm/pwm_th1520.rs | 7 ++-----
> 1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/pwm/pwm_th1520.rs b/drivers/pwm/pwm_th1520.rs
> index 3e3fa51ccef9..022338d17218 100644
> --- a/drivers/pwm/pwm_th1520.rs
> +++ b/drivers/pwm/pwm_th1520.rs
> @@ -20,7 +20,6 @@
> //!   this method is not used in this driver.
> //!
> 
> -use core::ops::Deref;
> use kernel::{
>     clk::Clk,
>     device::{Bound, Core, Device},
> @@ -213,8 +212,7 @@ fn read_waveform(
>     ) -> Result<Self::WfHw> {
>         let data = chip.drvdata();
>         let hwpwm = pwm.hwpwm();
> -        let iomem_accessor = data.iomem.access(parent_dev)?;
> -        let iomap = iomem_accessor.deref();
> +        let iomap = data.iomem.access(parent_dev)?;
> 
>         let ctrl = iomap.try_read32(th1520_pwm_ctrl(hwpwm))?;
>         let period_cycles = iomap.try_read32(th1520_pwm_per(hwpwm))?;
> @@ -248,8 +246,7 @@ fn write_waveform(
>     ) -> Result {
>         let data = chip.drvdata();
>         let hwpwm = pwm.hwpwm();
> -        let iomem_accessor = data.iomem.access(parent_dev)?;
> -        let iomap = iomem_accessor.deref();
> +        let iomap = data.iomem.access(parent_dev)?;
>         let duty_cycles = iomap.try_read32(th1520_pwm_fp(hwpwm))?;
>         let was_enabled = duty_cycles != 0;
> 
> 
> -- 
> 2.54.0
> 

Reviewed-by: Daniel Almeida <[email protected]>
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.