Linux IIO development
 help / color / mirror / Atom feed
From: "Nuno Sá" <noname.nuno@gmail.com>
To: "Andy Shevchenko" <andy.shevchenko@gmail.com>,
	"Uwe Kleine-König" <u.kleine-koenig@baylibre.com>
Cc: Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	 Michael Hennerich <Michael.Hennerich@analog.com>,
	Alexandru Ardelean <aardelean@baylibre.com>,
	Alisa-Dariana Roman	 <alisa.roman@analog.com>,
	Conor Dooley <conor+dt@kernel.org>,
	David Lechner <dlechner@baylibre.com>,
	Dumitru Ceclan <dumitru.ceclan@analog.com>,
	 Krzysztof Kozlowski	 <krzk+dt@kernel.org>,
	Nuno Sa <nuno.sa@analog.com>, Rob Herring <robh@kernel.org>,
		devicetree@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH v3 10/10] iio: adc: ad7124: Implement temperature measurement
Date: Wed, 27 Nov 2024 15:05:04 +0100	[thread overview]
Message-ID: <848b5160b1170a9725df48d8dba563db2a0ce998.camel@gmail.com> (raw)
In-Reply-To: <CAHp75VcMHyqjsAVveRf58PhoiKyPJRsjBQiLkz+XVu+NDc+Wog@mail.gmail.com>

On Mon, 2024-11-25 at 21:33 +0200, Andy Shevchenko wrote:
> On Mon, Nov 25, 2024 at 4:52 PM Uwe Kleine-König
> <u.kleine-koenig@baylibre.com> wrote:
> > On Mon, Nov 25, 2024 at 03:47:25PM +0200, Andy Shevchenko wrote:
> > > On Mon, Nov 25, 2024 at 1:27 PM Uwe Kleine-König
> > > <u.kleine-koenig@baylibre.com> wrote:
> > > > On Fri, Nov 22, 2024 at 10:31:07PM +0200, Andy Shevchenko wrote:
> > > > > On Fri, Nov 22, 2024 at 1:34 PM Uwe Kleine-König
> > > > > <u.kleine-koenig@baylibre.com> wrote:
> > > > > > +       /* Add one for temperature */
> > > > > > +       st->num_channels = min(num_channels + 1,
> > > > > > AD7124_MAX_CHANNELS);
> > > > > 
> > > > > Is the type of both arguments the same?
> > > > 
> > > > Hmm, my compiler is happy with it at least. I don't understand why
> > > > though. I'll do a few more tests ...
> > > 
> > > If num_channels is signed int or shorter than (independently on the
> > > sign) int, then it's obvious why. + 1 makes it int.
> > 
> > Ah indeed, I should have understood that without that explanation.
> 
> Yeah, but a closer look shows to me that num_channels is unsigned int
> or did I look in the wrong place? If that's true, that should make a
> warning appear since AD7124_MAX_CHANNELS is signed int...
> 
> 

Hmm,

Weren't the min()/max() macros improved for things like this?

https://elixir.bootlin.com/linux/v6.12.1/source/include/linux/minmax.h#L22

- Nuno Sá

  reply	other threads:[~2024-11-27 14:00 UTC|newest]

Thread overview: 37+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2024-11-22 11:33 [PATCH v3 00/10] iio: adc: ad7124: Various fixes Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 01/10] iio: adc: ad7124: Don't create more channels than the driver can handle Uwe Kleine-König
2024-11-22 15:14   ` David Lechner
2024-11-22 15:54     ` Uwe Kleine-König
2024-11-22 16:18       ` David Lechner
2024-11-22 11:33 ` [PATCH v3 02/10] iio: adc: ad7124: Refuse invalid input specifiers Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 03/10] dt-bindings: iio: adc: adi,ad7124: Allow specifications of a gpio for irq line Uwe Kleine-König
2024-11-27 13:41   ` Rob Herring
2024-11-27 15:09     ` Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 04/10] iio: adc: ad_sigma_delta: Add support for reading irq status using a GPIO Uwe Kleine-König
2024-11-22 19:16   ` Andy Shevchenko
2024-11-25 10:49     ` Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 05/10] iio: adc: ad_sigma_delta: Handle CS assertion as intended in ad_sd_read_reg_raw() Uwe Kleine-König
2024-11-22 15:16   ` Trevor Gamblin
2024-11-22 15:55     ` Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 06/10] iio: adc: ad_sigma_delta: Fix a race condition Uwe Kleine-König
2024-11-22 19:21   ` Andy Shevchenko
2024-11-22 11:33 ` [PATCH v3 07/10] iio: adc: ad_sigma_delta: Store information about reset sequence length Uwe Kleine-König
2024-11-22 20:07   ` Andy Shevchenko
2024-11-25 10:14   ` kernel test robot
2024-11-22 11:33 ` [PATCH v3 08/10] iio: adc: ad_sigma_delta: Check for previous ready signals Uwe Kleine-König
2024-11-22 20:17   ` Andy Shevchenko
2024-11-25 11:10     ` Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 09/10] iio: adc: ad7124: Add error reporting during probe Uwe Kleine-König
2024-11-22 16:44   ` Trevor Gamblin
2024-11-25 11:20     ` Uwe Kleine-König
2024-11-22 20:25   ` Andy Shevchenko
2024-11-25 11:18     ` Uwe Kleine-König
2024-11-22 11:33 ` [PATCH v3 10/10] iio: adc: ad7124: Implement temperature measurement Uwe Kleine-König
2024-11-22 15:46   ` David Lechner
2024-11-22 20:31   ` Andy Shevchenko
2024-11-25 11:27     ` Uwe Kleine-König
2024-11-25 13:47       ` Andy Shevchenko
2024-11-25 14:52         ` Uwe Kleine-König
2024-11-25 19:33           ` Andy Shevchenko
2024-11-27 14:05             ` Nuno Sá [this message]
2024-11-27 14:38             ` Uwe Kleine-König

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=848b5160b1170a9725df48d8dba563db2a0ce998.camel@gmail.com \
    --to=noname.nuno@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=aardelean@baylibre.com \
    --cc=alisa.roman@analog.com \
    --cc=andy.shevchenko@gmail.com \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=dumitru.ceclan@analog.com \
    --cc=jic23@kernel.org \
    --cc=krzk+dt@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    --cc=u.kleine-koenig@baylibre.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