No need to clone the Arc for this. A simple reference is enough to get to the underlying chip pointer. Signed-off-by: Erik Schilling <erik.schilling@xxxxxxxxxx> --- bindings/rust/libgpiod/src/chip.rs | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/bindings/rust/libgpiod/src/chip.rs b/bindings/rust/libgpiod/src/chip.rs index 81e1be6..4545ddb 100644 --- a/bindings/rust/libgpiod/src/chip.rs +++ b/bindings/rust/libgpiod/src/chip.rs @@ -79,7 +79,7 @@ impl Chip { /// Get the chip name as represented in the kernel. pub fn info(&self) -> Result<Info> { - Info::new(self.ichip.clone()) + Info::new(self) } /// Get the path used to find the chip. @@ -239,9 +239,9 @@ pub struct Info { impl Info { /// Find a GPIO chip by path. - fn new(chip: Arc<Internal>) -> Result<Self> { - // SAFETY: `gpiod_chip` is guaranteed to be valid here. - let info = unsafe { gpiod::gpiod_chip_get_info(chip.chip) }; + fn new(chip: &Chip) -> Result<Self> { + // SAFETY: `chip.ichip.chip` is guaranteed to be valid here. + let info = unsafe { gpiod::gpiod_chip_get_info(chip.ichip.chip) }; if info.is_null() { return Err(Error::OperationFailed( OperationType::ChipGetInfo, -- 2.41.0