Re: [PATCH libgpiod 3/3] bindings: rust: tests: disable device before dropping the resources

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 03-02-25, 14:25, Bartosz Golaszewski wrote:
> From: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> 
> Linux kernel commit 8bd76b3d3f3a ("gpio: sim: lock up configfs that an
> instantiated device depends on") uncovered an issue in Rust bindings
> tests where the GPIO simulator device is not disabled before removing its
> configfs entries. Implenent Drop for the Sim struct in order to disable
> the simulator first before dropping its bank and device objects.
> 
> Signed-off-by: Bartosz Golaszewski <bartosz.golaszewski@xxxxxxxxxx>
> ---
>  bindings/rust/gpiosim-sys/src/sim.rs | 6 ++++++
>  1 file changed, 6 insertions(+)
> 
> diff --git a/bindings/rust/gpiosim-sys/src/sim.rs b/bindings/rust/gpiosim-sys/src/sim.rs
> index 71b9453..e3cc95c 100644
> --- a/bindings/rust/gpiosim-sys/src/sim.rs
> +++ b/bindings/rust/gpiosim-sys/src/sim.rs
> @@ -328,3 +328,9 @@ impl Sim {
>          self.dev.disable()
>      }
>  }
> +
> +impl Drop for Sim {
> +    fn drop(&mut self) {
> +        self.dev.disable().unwrap()

Maybe self.disable().unwrap(), since we already have a method ?

Acked-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>

-- 
viresh




[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux