From mboxrd@z Thu Jan 1 00:00:00 1970 Received: from mail-wm1-f48.google.com (mail-wm1-f48.google.com [209.85.128.48]) (using TLSv1.2 with cipher ECDHE-RSA-AES128-GCM-SHA256 (128/128 bits)) (No client certificate requested) by smtp.subspace.kernel.org (Postfix) with ESMTPS id 0989838B12A for ; Tue, 4 Aug 2026 14:56:08 +0000 (UTC) Authentication-Results: smtp.subspace.kernel.org; arc=none smtp.client-ip=209.85.128.48 ARC-Seal:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785855370; cv=none; b=A+FDu9pIH3JBK1KlNjWdGupaHz0O+L/517d8fi0P5VGjYlI7b48qijQk86vAv5kfeFFdCsOmcZB4seDteFQjXS+rwN1rfHNjsunnJO9zQwtF1S+jCJZ56Nh43HXxmvAsbTz7KjLcMD4TQiUKBuzWCMDXPUUSJ/3YflWhKOgY0zg= ARC-Message-Signature:i=1; a=rsa-sha256; d=subspace.kernel.org; s=arc-20240116; t=1785855370; c=relaxed/simple; bh=i+H7jY0mSc+KEc7VSzDtqOTfn56oYjDd3KqE1qtHxmE=; h=Date:From:To:Cc:Subject:Message-ID:References:MIME-Version: Content-Type:Content-Disposition:In-Reply-To; b=e9BL9H62yGDpt6N+TlmoluYQA3qsOpwdRtTretqqw/85dpfEwu852wnZHP5ztL2ESnHRAfheuTqxBeUBY52pMpszIKduLBbF28MXSbHifG3Pjv9FHQLaITDp7aFZGuqt4a/KLa2CnxSgaCuBJvZn9j+OHxMq91XsHBX2z9egr4g= ARC-Authentication-Results:i=1; smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com; spf=pass smtp.mailfrom=gmail.com; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b=jNaxwrPT; arc=none smtp.client-ip=209.85.128.48 Authentication-Results: smtp.subspace.kernel.org; dmarc=pass (p=none dis=none) header.from=gmail.com Authentication-Results: smtp.subspace.kernel.org; spf=pass smtp.mailfrom=gmail.com Authentication-Results: smtp.subspace.kernel.org; dkim=pass (2048-bit key) header.d=gmail.com header.i=@gmail.com header.b="jNaxwrPT" Received: by mail-wm1-f48.google.com with SMTP id 5b1f17b1804b1-49553515a8bso50464385e9.1 for ; Tue, 04 Aug 2026 07:56:08 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20251104; t=1785855367; x=1786460167; darn=vger.kernel.org; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:from:to:cc:subject:date:message-id:reply-to:content-type; bh=dw7iJbqbHaMY2LBdW8tLp5jrEOVyIbWuPmPQ4OlZuQ4=; b=jNaxwrPTdiDg27z2uFqzTSPKHFp5tfNnhj7YWC1WHwJam18D6mO7cPGU3keJkB/3Dr KOt29CLrRPrMIn02BAd5buyshdGdlspqhbzjq15FK+3YVhqPJDAEtw6wJqJKnlZ/OL19 hIbvbI5k0shcqJtDXdpD8/+DSN6dVVUqoxT3fj9R5UyzU13Xzyckf2tWOEvEZ4RoRjEs sPPy6kM/PsUhNIr8/ziwNN1rOKi5dX1C8q2lj70Mmf9r3hSMwIm4IUNXHSEkk0akp24v V05Eswr2bUnyYmdGNFWDMIi9Pwe+KnV6OsFp5fY4P2hPFtLvHAOBl+PItPHu3Evm9e4V 1hWA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20251104; t=1785855367; x=1786460167; h=in-reply-to:content-transfer-encoding:content-disposition :content-type:mime-version:references:message-id:subject:cc:to:from :date:x-gm-gg:x-gm-message-state:from:to:cc:subject:date:message-id :reply-to:content-type; bh=dw7iJbqbHaMY2LBdW8tLp5jrEOVyIbWuPmPQ4OlZuQ4=; b=mNpjTxrRF51e/MLiV35Ijv6pEFbilxLmpAD1lziWNDj0F7507ckJGa8W5hGVBxRwr2 5LiKS3eZ35ZhD9QJfrol0dHnPt//Kd4NJE9YoD0j7DMLA8+ug1Anx8TdygFUgqwNHx16 M4h3Q4y7oxATIgNilQa7ArXYhSAq+rdE6JNNRx0SzXMFD+9mfES8lBi9JxRuYUvyHWGd 3HrSrfSq7gAzde6HQLxhd6xYPmGZ6B3sp2ASmSWEyjNkxDTyiuTjl6KWy4xhODCDVrlM 4as/ADxcnI2lqp36UI1gPPb2cwaifF6FdX+P01gJkw2/Bj53rz1DmRUHggB/0m+2DGOv rfHA== X-Forwarded-Encrypted: i=1; AHgh+RqKNZYz8sJL0m4qGYZwxaR+AxNbJehmkDpCJhp0a3qbe+z0A3OsTmhhE0lUUcW0OfQGkccNbIgACRvxSIU=@vger.kernel.org X-Gm-Message-State: AOJu0YwlIAuIqj+T4sRVN0j6R4YfX+YO+VvwWt2D3pyKB4MJHkgIRI+b BE0BgZh3vmwaCyq7ngbqe8QDyEYfPk1KCkyl/EiBnNA5y2w4hptYGaQ9FjYlXYvL X-Gm-Gg: AR+sD12lQJL85TVjwOcb/rO4+7eSyEdxBq/kc19K/X0ttT+VfiypwsLyMc5qZCZhfOU S7shmCLAz8QnxTV2G6YUEX28JukhvYsGSw32arbO8g2mG2WsMYHiGZSD5NDd1hGwBslXmWndH6B h4evRoLksim2Qtn+O2N8822jMwP5Z/0ui9X5SxGm+3K26m+rWpIiEy9BN3jaEvi6+U1pQMzu6uC vzMy1Cz0z/fsJnm0rmTz678mnl7elL/BN8dRQy3qr8uf059BI2gZpCtOTrum/cqDXiJFa9toVTW nzmaN7jBKRaD3MBZVN0fzk0oQq8X6ZQPh8lOkh5xTewopLtdEUmPrtadey5mDWK+s2Fjdknxk9a dTyySy839IdG0M8iLzVYDUCPYmYgb650oMKjQr1VU7FW8ojL/JYWO/AcZPKAxoGWoBUeG3ipnMU gK+dbf5CvG2mOW32aLBgqqX1LnLIiF2jkLwvRJY0pOB+ZRlWp1FkCJ X-Received: by 2002:a05:600c:8b16:b0:492:6447:7a7f with SMTP id 5b1f17b1804b1-4980c66c84emr273645135e9.6.1785855366892; Tue, 04 Aug 2026 07:56:06 -0700 (PDT) Received: from nsa ([148.63.225.166]) by smtp.gmail.com with ESMTPSA id 5b1f17b1804b1-4994e041b4bsm3730495e9.12.2026.08.04.07.56.05 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 04 Aug 2026 07:56:06 -0700 (PDT) Date: Tue, 4 Aug 2026 15:57:17 +0100 From: Nuno =?utf-8?B?U8Oh?= To: Muchamad Coirul Anwar Cc: jic23@kernel.org, lars@metafoo.de, linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org, linux-i2c@vger.kernel.org, andi.shyti@kernel.org, wsa+renesas@sang-engineering.com, ojeda@kernel.org, dakr@kernel.org, igor.korotin@linux.dev, branstj@gmail.com Subject: Re: [RFC PATCH v4 3/3] iio: position: add Rust driver for ams AS5600 Message-ID: References: <20260707151542.91997-1-muchamadcoirulanwar@gmail.com> <20260707151542.91997-4-muchamadcoirulanwar@gmail.com> Precedence: bulk X-Mailing-List: linux-kernel@vger.kernel.org List-Id: List-Subscribe: List-Unsubscribe: MIME-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Disposition: inline Content-Transfer-Encoding: 8bit In-Reply-To: <20260707151542.91997-4-muchamadcoirulanwar@gmail.com> Hi Coirul, Same as Jonathan on my rust capabilities (maybe now I'll have proper motivation to learn it :)). Just one question below... On Tue, Jul 07, 2026 at 10:15:42PM +0700, Muchamad Coirul Anwar wrote: > Add a Rust driver for the ams AS5600 12-bit magnetic rotary position > sensor. The driver exposes in_angl_raw and in_angl_scale via the IIO > sysfs interface. > > Features: > - ARef for safe refcounted I2C client access > - Mutex-serialized status + angle read sequence > - Static channel spec (module-level const) > - No magnet validation at probe (deferred to read_raw per IIO convention) > - Error propagation via ? operator (no recovery state machine) > > The byte order for the AS5600's big-endian registers is handled via > swap_bytes() in-driver. This is equivalent to C's > i2c_smbus_read_word_swapped(). The long-term solution is regmap-rs > where endianness is configured once at the transport level. > > Tested on BeagleBone Black (AM335x) with AS5600 on i2c-2 (0x36). > > Signed-off-by: Muchamad Coirul Anwar > --- ... > +impl IioDriver for As5600Priv { > + fn read_raw(&self, _chan: *const iio_chan_spec, mask: isize) -> Result { > + const INFO_RAW: isize = iio_chan_info_enum_IIO_CHAN_INFO_RAW as isize; > + const INFO_SCALE: isize = iio_chan_info_enum_IIO_CHAN_INFO_SCALE as isize; Likely stupid question but do we always need the above? Some drivers might have several INFO_* bits sets and we often need to nest the match if multiple channels have the same bits. For those cases having to define all of them like this and then doing the match seems not great to me. I guess we can directly have ` iio_chan_info_enum_IIO_CHAN_INFO_RAW as isize` in match but not sure if it's also that neat... So bottom line, it would be nice if we could have something nicely readable that we could directly pass to match. On another topic, I believe mask is present in several drivers for historic reasons but note that this parameter is not really a mask. So other name like 'info' is more appropriate. - Nuno Sá