From: Jonathan Cameron <jic23@kernel.org>
To: Ariana Lazar <ariana.lazar@microchip.com>
Cc: "David Lechner" <dlechner@baylibre.com>,
"Nuno Sá" <nuno.sa@analog.com>,
"Andy Shevchenko" <andy@kernel.org>,
"Rob Herring" <robh@kernel.org>,
"Krzysztof Kozlowski" <krzk+dt@kernel.org>,
"Conor Dooley" <conor+dt@kernel.org>,
linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org,
devicetree@vger.kernel.org
Subject: Re: [PATCH v7 03/11] iio: dac: mcp47feb02: use field_get() instead of custom dynamic macros
Date: Sun, 20 Sep 2026 19:44:54 +0100 [thread overview]
Message-ID: <20260920194454.7fffbf97@jic23-hlaptop> (raw)
In-Reply-To: <20260918-mcp47feb02_refactor-v7-3-82ca794eafe2@microchip.com>
On Fri, 18 Sep 2026 12:06:29 +0300
Ariana Lazar <ariana.lazar@microchip.com> wrote:
> Replace manual bit operations which select channel corresponding bits
> from a control register in mcp47feb02_init_ctrl_regs() with field_get()
> macro used with masks already defined for regmap operations within the
> driver.
>
> Suggested-by: Jonathan Cameron <jic23@kernel.org>
> Link: https://lore.kernel.org/all/20260913224339.490d89ba@jic23-hlaptop/
> Signed-off-by: Ariana Lazar <ariana.lazar@microchip.com>
The Eagle eyed sashiko points out that MCP47FEB02_DAC_CTRL_MASK seems to be
no longer used after this patch. Please drop that as well.
Jonathan
> ---
> drivers/iio/dac/mcp47feb02.c | 4 ++--
> 1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/iio/dac/mcp47feb02.c b/drivers/iio/dac/mcp47feb02.c
> index 1b1a4972f77196399297b3912abe69efcbf17d75..d910a6cf9718d6c6ad68eb1bb1ff5f3b15b33e84 100644
> --- a/drivers/iio/dac/mcp47feb02.c
> +++ b/drivers/iio/dac/mcp47feb02.c
> @@ -1024,7 +1024,7 @@ static int mcp47feb02_init_ctrl_regs(struct mcp47feb02_data *data)
> return ret;
> data->chdata[i].dac_data = dac_val;
>
> - data->chdata[i].ref_mode = (vref_ch >> (2 * i)) & MCP47FEB02_DAC_CTRL_MASK;
> + data->chdata[i].ref_mode = field_get(DAC_CTRL_MASK(i), vref_ch);
> data->chdata[i].use_2x_gain = field_get(DAC_GAIN_MASK(i), gain_ch);
>
> /*
> @@ -1068,7 +1068,7 @@ static int mcp47feb02_init_ctrl_regs(struct mcp47feb02_data *data)
> break;
> }
>
> - pd_tmp = (pd_ch >> (2 * i)) & MCP47FEB02_DAC_CTRL_MASK;
> + pd_tmp = field_get(DAC_CTRL_MASK(i), pd_ch);
> data->chdata[i].powerdown_mode = pd_tmp ? (pd_tmp - 1) : pd_tmp;
> data->chdata[i].powerdown = !!(data->chdata[i].powerdown_mode);
> }
>
next prev parent reply other threads:[~2026-09-20 18:44 UTC|newest]
Thread overview: 29+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-09-18 9:06 [PATCH v7 00/11] Refactor Microchip MCP47FEB02 I2C driver in separate modules to add support for MCP48FEB02 SPI driver Ariana Lazar
2026-09-18 9:06 ` [PATCH v7 01/11] iio: dac: mcp47feb02: initialize dac_data field in channel data struct at probe Ariana Lazar
2026-09-18 9:48 ` Andy Shevchenko
2026-09-18 9:06 ` [PATCH v7 02/11] iio: dac: mcp47feb02: Fix gain field initialization for active channels Ariana Lazar
2026-09-18 9:48 ` Andy Shevchenko
2026-09-18 9:06 ` [PATCH v7 03/11] iio: dac: mcp47feb02: use field_get() instead of custom dynamic macros Ariana Lazar
2026-09-18 9:17 ` sashiko-bot
2026-09-18 9:46 ` Andy Shevchenko
2026-09-20 18:44 ` Jonathan Cameron [this message]
2026-09-18 9:06 ` [PATCH v7 04/11] iio: dac: mcp47feb02: Return len when disabling EEPROM store Ariana Lazar
2026-09-18 9:49 ` Andy Shevchenko
2026-09-18 9:06 ` [PATCH v7 05/11] iio: dac: mcp47feb02: Increase EEPROM Programming Write Cycle Time Ariana Lazar
2026-09-18 9:49 ` Andy Shevchenko
2026-09-18 9:06 ` [PATCH v7 06/11] iio: dac: mcp47feb02: Avoid unjustified probe error on missing label Ariana Lazar
2026-09-18 9:22 ` sashiko-bot
2026-09-18 9:50 ` Andy Shevchenko
2026-09-20 22:52 ` Jonathan Cameron
2026-09-18 9:06 ` [PATCH v7 07/11] iio: dac: mcp47feb02: correct typo from a comment Ariana Lazar
2026-09-18 9:51 ` Andy Shevchenko
2026-09-18 9:06 ` [PATCH v7 08/11] iio: dac: mcp47feb02: use field_prep() instead of custom dynamic macros Ariana Lazar
2026-09-18 9:06 ` [PATCH v7 09/11] iio: dac: mcp47feb02: refactor MCP47FEB02 I2C driver into two modules Ariana Lazar
2026-09-18 9:28 ` sashiko-bot
2026-09-20 22:52 ` Jonathan Cameron
2026-09-18 9:06 ` [PATCH v7 10/11] dt-bindings: iio: dac: add support for MCP48FEB02 SPI Ariana Lazar
2026-09-18 9:06 ` [PATCH v7 11/11] iio: dac: add support for Microchip MCP48FEB02 Ariana Lazar
2026-09-18 9:52 ` [PATCH v7 00/11] Refactor Microchip MCP47FEB02 I2C driver in separate modules to add support for MCP48FEB02 SPI driver Andy Shevchenko
2026-09-20 23:08 ` Jonathan Cameron
2026-09-21 14:16 ` Ariana.Lazar
2026-09-21 23:56 ` 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=20260920194454.7fffbf97@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=andy@kernel.org \
--cc=ariana.lazar@microchip.com \
--cc=conor+dt@kernel.org \
--cc=devicetree@vger.kernel.org \
--cc=dlechner@baylibre.com \
--cc=krzk+dt@kernel.org \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@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.