From mboxrd@z Thu Jan 1 00:00:00 1970 Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.remote-ip=198.175.65.9 ARC-Seal: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; cv=none; t=1796295220; b=LQ2kT3dhjdGjnETJsGmoHluA/zu57lXyYX0mBrIr0XcGOT9CGvCZqPabt04TlNJDLxF0 aPvEc59QZQ1Mk5xdmgcv0K1rHQJcvYnD8xied6V1GrwLgO8kb3qCVfIVr1eK8spi3UyIY nXBJ/bW8wtg73txfxiCsJTip3exBjmoKSo93Z8XIDmSpUPR30agSRp8jRSJ++aDe9BljB fqLDRYxybpg5NkwLDJHYC/nkTSrn8U5Src5Guyb0YTxutR2rkuqsMJynuILkyHGMD+L9S Huiyi/t8xvU7kt5hBAMR2Dj/BR6Q6xX99wc/Kh5jmxUmsGVwwUQ6/oPqleCL8hs5l9Q== ARC-Message-Signature: i=1; d=subspace.kernel.org; s=arc20261015; a=rsa-sha256; c=relaxed/relaxed; t=1796295220; h=DMARC-Filter:DKIM-Signature:X-CSE-ConnectionGUID:X-CSE-MsgGUID: X-IronPort-AV:X-IronPort-AV:Received:X-CSE-ConnectionGUID: X-CSE-MsgGUID:X-ExtLoop1:X-IronPort-AV:Received:Date:From:To:Cc: Subject:Message-ID:References:MIME-Version:Content-Type: Content-Disposition:In-Reply-To:Organization; bh=NM29Oe9t+uesIgTgWUigtrCbxj7SO+U8sg61jgWTob4=; b=D1GnU3FE9yyh15ahxZM1a1/23ILu4EjgfQCIE3/1L/yXit6tl5VaqFzmrsqIlwjLRVE+ gLUTW+8x1vhBTPqMMCOezZA1y62HwYTNfecOMivKZN+Z1kSSIifMjuqY76o0+9Wm75qr5 bJzysrk6E/YQK9zF/HfSFpWcp6v/kSR6ijU0SxmOVu0HJXV6dwNsUg6OsgwZ2+JNmplNC guG087CAY8WysNnDwKlk62fUFPotvq9yCDLdjXPe7Ms2k4YZ5pjWqOnn0aDHSzFCeorHY jfjEM3i6TmwRtpNbhwrxU/DzWRf/fTztaQ0ReT8TXoLAyrMORt9xKuoewi1gpOP3E5g== ARC-Authentication-Results: i=1; smtp.subspace.kernel.org; dmarc=pass header.from=intel.com; spf=pass smtp.mailfrom=intel.com; dkim=pass header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=TmXfaDSd; arc=none smtp.remote-ip=198.175.65.9 Received: from mgamail.intel.com (mgamail.intel.com [198.175.65.9]) (using TLSv1.2 with cipher ECDHE-ECDSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 5A5D6606A330; Thu, 3 Dec 2026 10:53:40 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.4.2 smtp.subspace.kernel.org 5A5D6606A330 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=intel.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=intel.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=intel.com header.i=@intel.com header.a=rsa-sha256 header.s=Intel header.b=TmXfaDSd DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1796295221; x=1827831221; h=date:from:to:cc:subject:message-id:references: mime-version:in-reply-to; bh=NM29Oe9t+uesIgTgWUigtrCbxj7SO+U8sg61jgWTob4=; b=TmXfaDSdBgEAL8mDZ/6wy/nZZsuSRKtG22GpsvGCbb1f4you8SK2d46E mYF2tgY1q2FxpQVwS54ahLn3W/nJ7OmS1pj+LXyIfs0AyvGJ9IgaHVu5Y r2/ja8jx3TyYxtxo/yDt+M02CzatlwtEBouO9Fc8szNaOsN7Im9wtncgK lIxMc1/0SVWlnfl7/WIHymT6UoUQHhv4Gzs7qHjNLGv1WcloVIbr+czsD daAAnDHs98o+CueoMgX0sXokpK4f9l+/JvTtb3sa2/OPd7NOdR7HAvgQ5 4lHBiF8vMMRD1eoC9knx5B1iFmerweSU44B2Du7TDPIUnujdiU1QwxIe2 w==; X-CSE-ConnectionGUID: 1UbUJb1EQLCrkKjCfq9GYg== X-CSE-MsgGUID: UDGCzFONTFOPRyMrJiuCGA== X-IronPort-AV: E=McAfee;i="6800,10657,11984"; a="5161781" X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="5161781" Received: from orviesa004.jf.intel.com ([10.64.159.144]) by orvoesa101.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:53:40 -0800 X-CSE-ConnectionGUID: 8IOnUxEHSBaBZlX7Rk3V8w== X-CSE-MsgGUID: 67QdlHD8Ta2BOs9EYjXb+g== X-ExtLoop1: 1 X-IronPort-AV: E=Sophos;i="6.27,248,1787036400"; d="scan'208";a="13616410" Received: from inaky-mobl1.amr.corp.intel.com (HELO localhost) ([10.245.244.115]) by smtpauth.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 03 Dec 2026 02:53:36 -0800 Date: Thu, 3 Dec 2026 12:53:33 +0200 From: Andy Shevchenko To: Muchamad Coirul Anwar Cc: Jonathan Cameron , Miguel Ojeda , Igor Korotin , Danilo Krummrich , David Lechner , Nuno =?iso-8859-1?Q?S=E1?= , Andy Shevchenko , Andi Shyti , Daniel Almeida , Alice Ryhl , Mark Brown , Joshua Crofts , Markus Probst , Shuai Liu <847807867@qq.com>, linux-iio@vger.kernel.org, linux-i2c@vger.kernel.org, rust-for-linux@vger.kernel.org, driver-core@lists.linux.dev, linux-kernel@vger.kernel.org Subject: Re: [RFC PATCH v8 3/4] rust: add minimal IIO subsystem abstractions Message-ID: References: <20261201165508.39336-1-muchamadcoirulanwar@gmail.com> <20261201165508.39336-4-muchamadcoirulanwar@gmail.com> X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Post: List-Help: List-Subscribe: List-Unsubscribe: List-Owner: Precedence: list MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20261201165508.39336-4-muchamadcoirulanwar@gmail.com> Organization: Intel Finland Oy - BIC 0357606-4 - c/o Alberga Business Park, 6 krs, Bertel Jungin Aukio 5, 02600 Espoo On Tue, Dec 01, 2026 at 11:55:07PM +0700, Muchamad Coirul Anwar wrote: > Add minimal Rust abstractions needed to register direct-mode IIO > devices exposing read_raw channel information. > > Provide a type-safe IioChanInfo selector, IioVal return types, and an > IioDriver trait. Add a C callback trampoline that validates the channel > information selector, invokes the Rust driver, and converts IioVal into > the representation expected by the IIO core. > > Use typestate to distinguish unregistered and registered devices. > Registration is unsafe because callers must not leak the returned device > (e.g. via mem::forget). It returns an owned registered device bound to > the parent lifetime, whose destructor unregisters it before destroying > its Rust private data and releasing the allocation reference. > > Allow private data to borrow resources tied to the bound parent > lifetime. This lets drivers capture bus-specific resources during probe > and use them directly from subsystem callbacks without recovering them > from a generic parent device. > > Accept only INDIO_DIRECT_MODE. Other modes require additional state and > teardown handling not provided by this initial abstraction. > > The initial abstraction intentionally supports read_raw only. It does > not expose write_raw, buffers, triggers, events, extended attributes, or > available-value attributes. ... > --- a/rust/bindings/bindings_helper.h > +++ b/rust/bindings/bindings_helper.h > @@ -64,6 +64,8 @@ > #include > #include > #include > +#include > +#include No need, this is separated header, but it's rarely needed standalone. iio.h guarantees that it will provide necessary types. > #include > #include > #include I would like somebody to revisit this rather cumbersome list of headers here and try to balance them for not including implied ones (yes, this is more a guesswork, but feel free to Cc Joshua Crofts and me on the discussion mail you can start with this matter). -- With Best Regards, Andy Shevchenko