Linux IIO development
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Matti Vaittinen <mazziesaccount@gmail.com>
Cc: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Matti Vaittinen" <matti.vaittinen@fi.rohmeurope.com>,
	"David Lechner" <dlechner@baylibre.com>,
	"Nuno Sá" <nuno.sa@analog.com>,
	"Andy Shevchenko" <andy@kernel.org>,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org
Subject: Re: [PATCH] iio: ti-adc128s052: Drop variable vref
Date: Mon, 5 May 2025 17:31:57 +0100	[thread overview]
Message-ID: <20250505173157.57aa16f9@jic23-huawei> (raw)
In-Reply-To: <4085fd58-c92c-406b-842b-ecda2fb3c895@gmail.com>

On Mon, 28 Apr 2025 12:45:13 +0300
Matti Vaittinen <mazziesaccount@gmail.com> wrote:

> On 28/04/2025 10:08, Andy Shevchenko wrote:
> > On Mon, Apr 28, 2025 at 10:02 AM Matti Vaittinen
> > <mazziesaccount@gmail.com> wrote:  
> >>
> >> According to Jonathan, variable reference voltages are very rare. It is
> >> unlikely it is needed, and supporting it makes the code a bit more
> >> complex.
> >>
> >> Simplify the driver and drop the variable vref support.  
> > 
> > ...
> >   
> >> +       int vref_mv;  
> > 
> > vref_mV please. And yes, I know historical and other reasons for them
> > all being small, but let's try to be more scientific in these crazy
> > days.  
> 
> Sorry Andy but I see zero reason to use capital letters here. In my 
> opinion, this is perfectly clear as it is. Capital letters in variables 
> are ugly (to me) and absolutely not needed to explain the meaning.
> 
> > ...
> >   
> >> +       adc->vref_mv = ret / 1000;  
> > 
> > MILLI ?  
> 
> I suppose using MILLI is Ok. (Although 1000 seems still clear enough to 
> me. Seeing the amount of zeroes at a glance gets troublesome for me at 
> 10000).
> 
> > Or actually a time to introduce MILLIVOLT_PER_VOLT in units.h ?  

It's logically neither. If we did go that way it's MICROVOLT_PER_MILLIVOLT.
So we move to constants it should be
	adc->vref_mv = ret / (MICRO / MILLI);

I'm not seeing that as worthwhile though when people have been particularly
keen on these units.h defines I have argued in favour of similar constructs.

Anyhow on basis of moving forwards and parking this discussion
for the future, I'll apply the patch with just the alignment tweak
David pointed out.  

Jonathan



> 
> I really fail to see the benefit. Do you think we should add 
> MILLIx_PER_x for each unit we can imagine/use?
> 
> That doesn't really scale or make sense to me. We have MILLI. It does 
> not really matter if it is volts, amps, ohms or horse heads - it's still 
> 1000. It just gets cumbersome to search the headers to see if we have 
> some fancy define for unit we have at our hands.
> 
> And, to repeat myself - for me even the 1000 is still clear as it is.
> 
> Yours,
> 	-- Matti


  parent reply	other threads:[~2025-05-05 16:32 UTC|newest]

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-28  7:02 [PATCH] iio: ti-adc128s052: Drop variable vref Matti Vaittinen
2025-04-28  7:08 ` Andy Shevchenko
2025-04-28  9:45   ` Matti Vaittinen
2025-04-28  9:49     ` Andy Shevchenko
2025-04-28 13:10       ` Matti Vaittinen
2025-05-05 16:31     ` Jonathan Cameron [this message]
2025-04-28 15:16 ` David Lechner
2025-04-29  4:10   ` Matti Vaittinen

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=20250505173157.57aa16f9@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=matti.vaittinen@fi.rohmeurope.com \
    --cc=mazziesaccount@gmail.com \
    --cc=nuno.sa@analog.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