public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
From: Andy Shevchenko <andriy.shevchenko@intel.com>
To: rodrigo.alencar@analog.com
Cc: linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	Stefan Popa <stefan.popa@analog.com>,
	Jonathan Cameron <jic23@cam.ac.uk>,
	Greg Kroah-Hartman <gregkh@suse.de>,
	Michael Auchter <michael.auchter@ni.com>,
	Jonathan Cameron <jic23@kernel.org>,
	Lars-Peter Clausen <lars@metafoo.de>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	David Lechner <dlechner@baylibre.com>,
	Andy Shevchenko <andy@kernel.org>
Subject: Re: [PATCH v5 10/12] iio: dac: ad5686: add control_sync() for single-channel devices
Date: Mon, 4 May 2026 11:29:54 +0300	[thread overview]
Message-ID: <afhZAl3JLwgzfFsD@ashevche-desk.local> (raw)
In-Reply-To: <20260501-ad5686-fixes-v5-10-0b2f45488418@analog.com>

On Fri, May 01, 2026 at 10:15:03AM +0100, Rodrigo Alencar via B4 Relay wrote:

> Create ad5310_control_sync() and ad5683_control_sync() functions that
> properly consume the mask definitions with FIELD_PREP(). This allows to
> reuse a function that updates the control register with cached values,
> without relying on confusing logic that depends on st->use_internal_vref,
> which is initialized earlier in ad5686_probe() because it is also
> applicable to the AD5686_REGMAP case, removing the need for the
> has_external_vref. Powerdown masks initialization is simplified as
> *_control_sync() masks outs any unused bits for the single-channel case.
> The change cleans up ad5686_write_dac_powerdown() and ad5686_probe(),
> organizing the code for feature extension, e.g. gain control support for
> single-channel devices.

...

> +	/* Initialize masks to all ones */
> +	st->pwr_down_mask = ~0U;
> +	st->pwr_down_mode = ~0U;

Thanks for this change, but be careful of what is done here. If ever the
pwr_down_* become longer than 32-bit value, this will set a wrong data.
The rule of thumb: If we want to set *all* bits to one, use ~0, the compiler
will take care of the rest.

-- 
With Best Regards,
Andy Shevchenko



  reply	other threads:[~2026-05-04  8:29 UTC|newest]

Thread overview: 22+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-05-01  9:14 [PATCH v5 00/12] Fixes and cleanups for the AD5686 IIO driver Rodrigo Alencar via B4 Relay
2026-05-01  9:14 ` [PATCH v5 01/12] iio: dac: ad5686: fix ref bit initialization for single-channel parts Rodrigo Alencar via B4 Relay
2026-05-05 11:06   ` Jonathan Cameron
2026-05-01  9:14 ` [PATCH v5 02/12] iio: dac: ad5686: fix input raw value check Rodrigo Alencar via B4 Relay
2026-05-05 11:08   ` Jonathan Cameron
2026-05-01  9:14 ` [PATCH v5 03/12] iio: dac: ad5686: acquire lock when doing powerdown control Rodrigo Alencar via B4 Relay
2026-05-05 11:05   ` Jonathan Cameron
2026-05-05 11:16     ` Rodrigo Alencar
2026-05-05 12:09       ` Jonathan Cameron
2026-05-01  9:14 ` [PATCH v5 04/12] iio: dac: ad5686: fix powerdown control on dual-channel devices Rodrigo Alencar via B4 Relay
2026-05-05 11:16   ` Jonathan Cameron
2026-05-01  9:14 ` [PATCH v5 05/12] iio: dac: ad5686: refactor include headers Rodrigo Alencar via B4 Relay
2026-05-01  9:14 ` [PATCH v5 06/12] iio: dac: ad5686: remove redundant register definition Rodrigo Alencar via B4 Relay
2026-05-01  9:15 ` [PATCH v5 07/12] iio: dac: ad5686: drop enum id Rodrigo Alencar via B4 Relay
2026-05-01  9:15 ` [PATCH v5 08/12] iio: dac: ad5686: add of_match table to the spi driver Rodrigo Alencar via B4 Relay
2026-05-01  9:15 ` [PATCH v5 09/12] iio: dac: ad5686: add helpers to handle powerdown masks Rodrigo Alencar via B4 Relay
2026-05-04  8:25   ` Andy Shevchenko
2026-05-01  9:15 ` [PATCH v5 10/12] iio: dac: ad5686: add control_sync() for single-channel devices Rodrigo Alencar via B4 Relay
2026-05-04  8:29   ` Andy Shevchenko [this message]
2026-05-01  9:15 ` [PATCH v5 11/12] iio: dac: ad5686: cleanup doc header of local structs Rodrigo Alencar via B4 Relay
2026-05-01  9:15 ` [PATCH v5 12/12] iio: dac: ad5686: create bus ops struct Rodrigo Alencar via B4 Relay
2026-05-05 12:06   ` 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=afhZAl3JLwgzfFsD@ashevche-desk.local \
    --to=andriy.shevchenko@intel.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=andy@kernel.org \
    --cc=dlechner@baylibre.com \
    --cc=gregkh@suse.de \
    --cc=jic23@cam.ac.uk \
    --cc=jic23@kernel.org \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=michael.auchter@ni.com \
    --cc=rodrigo.alencar@analog.com \
    --cc=stefan.popa@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