* [PATCH] Change manual bitfield manipulation to use FIELD_PREP()
@ 2026-04-21 19:31 Gabriel Jacob Perin
2026-04-21 19:50 ` Mark Brown
2026-04-26 21:53 ` Mark Brown
0 siblings, 2 replies; 3+ messages in thread
From: Gabriel Jacob Perin @ 2026-04-21 19:31 UTC (permalink / raw)
To: claudiu.beznea, andrei.simion, lgirdwood, broonie, perex, tiwai,
nicolas.ferre, alexandre.belloni
Cc: carlos.albmr, Gabriel Jacob Perin, linux-sound, linux-arm-kernel
Co-developed-by: Carlos Alberto Marques Rabelo <carlos.albmr@usp.br>
Signed-off-by: Carlos Alberto Marques Rabelo <carlos.albmr@usp.br>
Signed-off-by: Gabriel Jacob Perin <gabrieljp@usp.br>
---
sound/soc/atmel/atmel-classd.c | 41 ++++++++++++++++++----------------
1 file changed, 22 insertions(+), 19 deletions(-)
diff --git a/sound/soc/atmel/atmel-classd.c b/sound/soc/atmel/atmel-classd.c
index 1f8c60d2d..6693bdcbb 100644
--- a/sound/soc/atmel/atmel-classd.c
+++ b/sound/soc/atmel/atmel-classd.c
@@ -11,6 +11,7 @@
#include <linux/module.h>
#include <linux/platform_device.h>
#include <linux/regmap.h>
+#include <linux/bitfield.h>
#include <linux/string_choices.h>
#include <sound/core.h>
#include <sound/dmaengine_pcm.h>
@@ -236,34 +237,34 @@ static int atmel_classd_component_probe(struct snd_soc_component *component)
u32 mask, val;
mask = CLASSD_MR_PWMTYP_MASK;
- val = pdata->pwm_type << CLASSD_MR_PWMTYP_SHIFT;
+ val = FIELD_PREP(CLASSD_MR_PWMTYP_MASK, pdata->pwm_type);
mask |= CLASSD_MR_NON_OVERLAP_MASK;
if (pdata->non_overlap_enable) {
- val |= (CLASSD_MR_NON_OVERLAP_EN
- << CLASSD_MR_NON_OVERLAP_SHIFT);
+ val |= FIELD_PREP(CLASSD_MR_NON_OVERLAP_MASK,
+ CLASSD_MR_NON_OVERLAP_EN);
mask |= CLASSD_MR_NOVR_VAL_MASK;
switch (pdata->non_overlap_time) {
case 5:
- val |= (CLASSD_MR_NOVR_VAL_5NS
- << CLASSD_MR_NOVR_VAL_SHIFT);
+ val |= FIELD_PREP(CLASSD_MR_NOVR_VAL_MASK,
+ CLASSD_MR_NOVR_VAL_5NS);
break;
case 10:
- val |= (CLASSD_MR_NOVR_VAL_10NS
- << CLASSD_MR_NOVR_VAL_SHIFT);
+ val |= FIELD_PREP(CLASSD_MR_NOVR_VAL_MASK,
+ CLASSD_MR_NOVR_VAL_10NS);
break;
case 15:
- val |= (CLASSD_MR_NOVR_VAL_15NS
- << CLASSD_MR_NOVR_VAL_SHIFT);
+ val |= FIELD_PREP(CLASSD_MR_NOVR_VAL_MASK,
+ CLASSD_MR_NOVR_VAL_15NS);
break;
case 20:
- val |= (CLASSD_MR_NOVR_VAL_20NS
- << CLASSD_MR_NOVR_VAL_SHIFT);
+ val |= FIELD_PREP(CLASSD_MR_NOVR_VAL_MASK,
+ CLASSD_MR_NOVR_VAL_20NS);
break;
default:
- val |= (CLASSD_MR_NOVR_VAL_10NS
- << CLASSD_MR_NOVR_VAL_SHIFT);
+ val |= FIELD_PREP(CLASSD_MR_NOVR_VAL_MASK,
+ CLASSD_MR_NOVR_VAL_10NS);
dev_warn(component->dev,
"non-overlapping value %d is invalid, the default value 10 is specified\n",
pdata->non_overlap_time);
@@ -370,8 +371,10 @@ atmel_classd_cpu_dai_hw_params(struct snd_pcm_substream *substream,
return ret;
mask = CLASSD_INTPMR_DSP_CLK_FREQ_MASK | CLASSD_INTPMR_FRAME_MASK;
- val = (sample_rates[best].dsp_clk << CLASSD_INTPMR_DSP_CLK_FREQ_SHIFT)
- | (sample_rates[best].sample_rate << CLASSD_INTPMR_FRAME_SHIFT);
+ val = FIELD_PREP(CLASSD_INTPMR_DSP_CLK_FREQ_MASK,
+ sample_rates[best].dsp_clk) |
+ FIELD_PREP(CLASSD_INTPMR_FRAME_MASK,
+ sample_rates[best].sample_rate);
snd_soc_component_update_bits(component, CLASSD_INTPMR, mask, val);
@@ -395,8 +398,8 @@ static int atmel_classd_cpu_dai_prepare(struct snd_pcm_substream *substream,
snd_soc_component_update_bits(component, CLASSD_MR,
CLASSD_MR_LEN_MASK | CLASSD_MR_REN_MASK,
- (CLASSD_MR_LEN_DIS << CLASSD_MR_LEN_SHIFT)
- |(CLASSD_MR_REN_DIS << CLASSD_MR_REN_SHIFT));
+ FIELD_PREP(CLASSD_MR_LEN_MASK, CLASSD_MR_LEN_DIS) |
+ FIELD_PREP(CLASSD_MR_REN_MASK, CLASSD_MR_REN_DIS));
return 0;
}
@@ -418,8 +421,8 @@ static int atmel_classd_cpu_dai_trigger(struct snd_pcm_substream *substream,
case SNDRV_PCM_TRIGGER_STOP:
case SNDRV_PCM_TRIGGER_SUSPEND:
case SNDRV_PCM_TRIGGER_PAUSE_PUSH:
- val = (CLASSD_MR_LEN_DIS << CLASSD_MR_LEN_SHIFT)
- | (CLASSD_MR_REN_DIS << CLASSD_MR_REN_SHIFT);
+ val = FIELD_PREP(CLASSD_MR_LEN_MASK, CLASSD_MR_LEN_DIS) |
+ FIELD_PREP(CLASSD_MR_REN_MASK, CLASSD_MR_REN_DIS);
break;
default:
return -EINVAL;
--
2.25.1
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] Change manual bitfield manipulation to use FIELD_PREP()
2026-04-21 19:31 [PATCH] Change manual bitfield manipulation to use FIELD_PREP() Gabriel Jacob Perin
@ 2026-04-21 19:50 ` Mark Brown
2026-04-26 21:53 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-04-21 19:50 UTC (permalink / raw)
To: Gabriel Jacob Perin
Cc: claudiu.beznea, andrei.simion, lgirdwood, perex, tiwai,
nicolas.ferre, alexandre.belloni, carlos.albmr, linux-sound,
linux-arm-kernel
[-- Attachment #1: Type: text/plain, Size: 729 bytes --]
On Tue, Apr 21, 2026 at 04:31:13PM -0300, Gabriel Jacob Perin wrote:
> Co-developed-by: Carlos Alberto Marques Rabelo <carlos.albmr@usp.br>
> Signed-off-by: Carlos Alberto Marques Rabelo <carlos.albmr@usp.br>
> Signed-off-by: Gabriel Jacob Perin <gabrieljp@usp.br>
> ---
> sound/soc/atmel/atmel-classd.c | 41 ++++++++++++++++++----------------
> 1 file changed, 22 insertions(+), 19 deletions(-)
Please submit patches using subject lines reflecting the style for the
subsystem, this makes it easier for people to identify relevant patches.
Look at what existing commits in the area you're changing are doing and
make sure your subject lines visually resemble what they're doing.
There's no need to resubmit to fix this alone.
[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] Change manual bitfield manipulation to use FIELD_PREP()
2026-04-21 19:31 [PATCH] Change manual bitfield manipulation to use FIELD_PREP() Gabriel Jacob Perin
2026-04-21 19:50 ` Mark Brown
@ 2026-04-26 21:53 ` Mark Brown
1 sibling, 0 replies; 3+ messages in thread
From: Mark Brown @ 2026-04-26 21:53 UTC (permalink / raw)
To: claudiu.beznea, andrei.simion, lgirdwood, perex, tiwai,
nicolas.ferre, alexandre.belloni, Gabriel Jacob Perin
Cc: carlos.albmr, linux-sound, linux-arm-kernel
On Tue, 21 Apr 2026 16:31:13 -0300, Gabriel Jacob Perin wrote:
> Change manual bitfield manipulation to use FIELD_PREP()
Applied to
https://git.kernel.org/pub/scm/linux/kernel/git/broonie/sound.git for-7.2
Thanks!
[1/1] Change manual bitfield manipulation to use FIELD_PREP()
https://git.kernel.org/broonie/sound/c/ae93afff9818
All being well this means that it will be integrated into the linux-next
tree (usually sometime in the next 24 hours) and sent to Linus during
the next merge window (or sooner if it is a bug fix), however if
problems are discovered then the patch may be dropped or reverted.
You may get further e-mails resulting from automated or manual testing
and review of the tree, please engage with people reporting problems and
send followup patches addressing any issues that are reported if needed.
If any updates are required or you are submitting further changes they
should be sent as incremental updates against current git, existing
patches will not be replaced.
Please add any relevant lists and maintainers to the CCs when replying
to this mail.
Thanks,
Mark
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2026-04-26 23:22 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-04-21 19:31 [PATCH] Change manual bitfield manipulation to use FIELD_PREP() Gabriel Jacob Perin
2026-04-21 19:50 ` Mark Brown
2026-04-26 21:53 ` Mark Brown
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox