All of lore.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: John Erasmus Mari Geronimo <johnerasmusmari.geronimo@analog.com>
Cc: linux-iio@vger.kernel.org, devicetree@vger.kernel.org,
	krzk+dt@kernel.org, jic23@kernel.org, dlechner@baylibre.com,
	nuno.sa@analog.com, Michael.Hennerich@analog.com,
	andy@kernel.org, robh@kernel.org, conor+dt@kernel.org,
	joshua.crofts1@gmail.com
Subject: Re: [PATCH v6 2/2] iio: temperature: add support for Analog Devices MAX30210
Date: Tue, 10 Nov 2026 22:55:24 +0200	[thread overview]
Message-ID: <avOEvEdidRIjjnAg@ashevche-desk.local> (raw)
In-Reply-To: <avOEPk_cwJSqxECQ@ashevche-desk.local>

On Tue, Nov 10, 2026 at 10:53:23PM +0200, Andy Shevchenko wrote:
> On Tue, Nov 10, 2026 at 10:14:42AM +0800, John Erasmus Mari Geronimo wrote:

...

> > +static int max30210_write_raw(struct iio_dev *indio_dev,
> > +			      struct iio_chan_spec const *chan,
> > +			      int val, int val2, long mask)
> > +{
> > +	struct max30210_state *st = iio_priv(indio_dev);
> > +
> > +	switch (mask) {
> > +	case IIO_CHAN_INFO_SAMP_FREQ: {
> 
> 		struct regmap *map = st->regmap;
> 
> > +		if (val < 0 || val2 < 0)
> > +			return -EINVAL;
> > +
> > +		IIO_DEV_ACQUIRE_DIRECT_MODE(indio_dev, claim);
> > +		if (IIO_DEV_ACQUIRE_FAILED(claim))
> > +			return -EBUSY;
> > +
> > +		for (unsigned int i = 0; i < ARRAY_SIZE(max30210_samp_freq_avail); i++) {
> 
> 			unsigned int mask = MAX30210_TEMPCONF2_TEMP_PERIOD_MASK;
> 			unsigned int value = field_prep(mask, i);

Ah, there is a conflict with above 'mask'. Something like 'm' and 'v'
would fit?

> > +			if (val != max30210_samp_freq_avail[i][0] ||
> > +			    val2 != max30210_samp_freq_avail[i][1])
> > +				continue;
> > +
> > +			return regmap_update_bits(st->regmap, MAX30210_TEMP_CONF_2_REG,
> > +					MAX30210_TEMPCONF2_TEMP_PERIOD_MASK,
> > +					FIELD_PREP(MAX30210_TEMPCONF2_TEMP_PERIOD_MASK, i));
> 
> 			return regmap_update_bits(map, MAX30210_TEMP_CONF_2_REG,
> 						  mask, value);
> 
> > +		}
> > +
> > +		return -EINVAL;
> > +	}
> > +	default:
> > +		return -EINVAL;
> > +	}
> > +}

-- 
With Best Regards,
Andy Shevchenko



      reply	other threads:[~2026-11-10 20:55 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-11-10  2:14 [PATCH v6 0/2] Add support for Analog Devices MAX30210 John Erasmus Mari Geronimo
2026-11-10  2:14 ` [PATCH v6 1/2] dt-bindings: iio: temperature: add ADI MAX30210 John Erasmus Mari Geronimo
2026-11-10  2:14 ` [PATCH v6 2/2] iio: temperature: add support for Analog Devices MAX30210 John Erasmus Mari Geronimo
2026-11-10  2:33   ` sashiko-bot
2026-11-10 20:53   ` Andy Shevchenko
2026-11-10 20:55     ` Andy Shevchenko [this message]

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=avOEvEdidRIjjnAg@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=conor+dt@kernel.org \
    --cc=devicetree@vger.kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=jic23@kernel.org \
    --cc=johnerasmusmari.geronimo@analog.com \
    --cc=joshua.crofts1@gmail.com \
    --cc=krzk+dt@kernel.org \
    --cc=linux-iio@vger.kernel.org \
    --cc=nuno.sa@analog.com \
    --cc=robh@kernel.org \
    /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 an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.