Linux IIO development
 help / color / mirror / Atom feed
From: Matti Vaittinen <mazziesaccount@gmail.com>
To: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>,
	Matti Vaittinen <mazziesaccount@gmail.com>
Cc: Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Jonathan Cameron <jic23@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: iio: dac: ad5624r_spi.c - use of scan_type
Date: Wed, 18 Dec 2024 10:38:26 +0200	[thread overview]
Message-ID: <3f5ff01b-8c32-423f-b3cc-a95399b69399@gmail.com> (raw)

Hi dee Ho peeps,

I started drafting a driver for a ROHM DAC. I took a quick look at the 
ad5624r_spi.c, and the use of the 'scan_type' -field in the struct 
iio_chan_spec puzzled me.

I think this field is used by the driver to convert the data from user 
to register format while performing the INDIO_DIRECT_MODE raw writes. I 
don't spot any buffer usage. Furthermore, as far as I can say the 'sign' 
and 'storagebits' are unused.

My understanding has been that the scan_type is only intended for 
parsing the buffered values, and usually when the data direction is from 
driver to user.

I suppose I shouldn't copy the ad5624r_spi.c use of scan_type to a new 
driver. I'm somewhat tempted to send a patch which drops the scan_type 
from the ad5624r_spi.c, and adds the 'realbits' and 'shift' to the 
driver's internal struct ad5624r_state. This, however, will change the 
interface to userland so maybe it's best to not do that.

I wonder if I am missing something? (That wouldn't be unheard of XD). If 
not, then at least a documentary patch with a comment "don't do this in 
new drivers" might be Ok, or how do you see this?

Yours,
	-- Matti

             reply	other threads:[~2024-12-18  8:38 UTC|newest]

Thread overview: 4+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-12-18  8:38 Matti Vaittinen [this message]
2024-12-18 20:53 ` iio: dac: ad5624r_spi.c - use of scan_type David Lechner
2024-12-19  6:05   ` Matti Vaittinen
2024-12-19 12:20     ` Jonathan Cameron

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=3f5ff01b-8c32-423f-b3cc-a95399b69399@gmail.com \
    --to=mazziesaccount@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox