* [PATCH 00/14] ALSA: Drop __bitwise and __force prefix
@ 2026-08-12 6:04 Takashi Iwai
2026-08-12 6:04 ` [PATCH 01/14] ALSA: uapi: " Takashi Iwai
` (14 more replies)
0 siblings, 15 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Cc: Cezary Rojewski, Fabio Estevam, Jerome Brunet, Mark Brown,
Nicolin Chen, Shengjiu Wang, Xiubo Li
Hi,
this is a series of cleanup patches to kill the infamous __bitwise and
__force prefix usage for some PCM and control parameter types.
They were added ages ago just for code safety, but its effect is quite
limited, while the drawback is significant. Let's drop them.
Takashi
===
Takashi Iwai (14):
ALSA: uapi: Drop __bitwise and __force prefix
ALSA: pcm: Drop __force casts
ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBIT
ALSA: control: Drop __force casts
ALSA: oss: Drop __force casts
ALSA: kunit: Drop __force casts
ALSA: aloop: Drop __force casts
ALSA: hda: Drop __force casts
ALSA: asihpi: Drop __force cast
ALSA: emu10k1: Drop __force casts
ASoC: fsl: Drop __force casts
ASoC: Intel: avs: Drop __force cast
ASoC: mediatek: Drop __force casts
ASoC: meson: Drop __force cast
include/sound/pcm.h | 118 ++++++------
include/sound/pcm_params.h | 13 +-
include/uapi/sound/asequencer.h | 8 +-
include/uapi/sound/asound.h | 178 +++++++++---------
sound/core/control_compat.c | 12 +-
sound/core/oss/pcm_oss.c | 16 +-
sound/core/oss/pcm_plugin.c | 20 +-
sound/core/pcm.c | 12 +-
sound/core/pcm_misc.c | 25 ++-
sound/core/pcm_native.c | 28 +--
sound/core/sound_kunit.c | 4 +-
sound/drivers/aloop.c | 4 +-
sound/hda/common/codec.c | 2 +-
sound/hda/core/device.c | 2 +-
sound/pci/asihpi/asihpi.c | 2 +-
sound/pci/emu10k1/emufx.c | 18 +-
sound/soc/fsl/fsl-asoc-card.c | 2 +-
sound/soc/fsl/fsl_asrc.c | 2 +-
sound/soc/fsl/fsl_asrc_m2m.c | 10 +-
sound/soc/fsl/fsl_easrc.c | 2 +-
sound/soc/fsl/fsl_qmc_audio.c | 8 +-
sound/soc/fsl/imx-card.c | 4 +-
sound/soc/intel/avs/probes.c | 2 +-
.../mediatek/mt8183/mt8183-da7219-max98357.c | 4 +-
.../mt8183/mt8183-mt6358-ts3a227-max98357.c | 4 +-
sound/soc/mediatek/mt8186/mt8186-mt6366.c | 2 +-
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
sound/soc/mediatek/mt8189/mt8189-nau8825.c | 2 +-
.../mt8192/mt8192-mt6359-rt1015-rt5682.c | 2 +-
sound/soc/mediatek/mt8195/mt8195-mt6359.c | 4 +-
sound/soc/mediatek/mt8196/mt8196-nau8825.c | 2 +-
sound/soc/meson/meson-codec-glue.c | 2 +-
32 files changed, 252 insertions(+), 264 deletions(-)
--
2.55.0
^ permalink raw reply [flat|nested] 18+ messages in thread
* [PATCH 01/14] ALSA: uapi: Drop __bitwise and __force prefix
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 02/14] ALSA: pcm: Drop __force casts Takashi Iwai
` (13 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
We've used __bitwise and __force for some integer parameters for
sanity-checks via sparse, with a hope that it'll reduce the misuse or
incorrect assignments. This worked in principle, but OTOH, it's been
quite a PITA, making the code much uglier than its gain, too, because
one had to cast with __force everywhere. Also, Rust-binding would
skip those defines because of __force usage, which will become more
pains in near future.
So let's drop __bitwise and __force prefix usages. In this patch, we
start cleaning up the UAPI headers at first. The former bit-wised
typedefs are still kept for compatibility for now.
As it's only markers for sparse, the changes are absolutely safe, per
se. Only that we'll need to watch out more carefully about the
variable usage for PCM format type, etc.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/uapi/sound/asequencer.h | 8 +-
include/uapi/sound/asound.h | 178 ++++++++++++++++----------------
2 files changed, 93 insertions(+), 93 deletions(-)
diff --git a/include/uapi/sound/asequencer.h b/include/uapi/sound/asequencer.h
index a5c41f771e05..0c4281992a99 100644
--- a/include/uapi/sound/asequencer.h
+++ b/include/uapi/sound/asequencer.h
@@ -348,10 +348,10 @@ struct snd_seq_running_info {
/* client types */
-typedef int __bitwise snd_seq_client_type_t;
-#define NO_CLIENT ((__force snd_seq_client_type_t) 0)
-#define USER_CLIENT ((__force snd_seq_client_type_t) 1)
-#define KERNEL_CLIENT ((__force snd_seq_client_type_t) 2)
+typedef int snd_seq_client_type_t;
+#define NO_CLIENT 0
+#define USER_CLIENT 1
+#define KERNEL_CLIENT 2
/* event filter flags */
#define SNDRV_SEQ_FILTER_BROADCAST (1U<<0) /* accept broadcast messages */
diff --git a/include/uapi/sound/asound.h b/include/uapi/sound/asound.h
index 500599213f93..c11da9656e38 100644
--- a/include/uapi/sound/asound.h
+++ b/include/uapi/sound/asound.h
@@ -169,72 +169,72 @@ enum {
SNDRV_PCM_STREAM_LAST = SNDRV_PCM_STREAM_CAPTURE,
};
-typedef int __bitwise snd_pcm_access_t;
-#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED ((__force snd_pcm_access_t) 0) /* interleaved mmap */
-#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED ((__force snd_pcm_access_t) 1) /* noninterleaved mmap */
-#define SNDRV_PCM_ACCESS_MMAP_COMPLEX ((__force snd_pcm_access_t) 2) /* complex mmap */
-#define SNDRV_PCM_ACCESS_RW_INTERLEAVED ((__force snd_pcm_access_t) 3) /* readi/writei */
-#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED ((__force snd_pcm_access_t) 4) /* readn/writen */
+typedef int snd_pcm_access_t;
+#define SNDRV_PCM_ACCESS_MMAP_INTERLEAVED 0 /* interleaved mmap */
+#define SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED 1 /* noninterleaved mmap */
+#define SNDRV_PCM_ACCESS_MMAP_COMPLEX 2 /* complex mmap */
+#define SNDRV_PCM_ACCESS_RW_INTERLEAVED 3 /* readi/writei */
+#define SNDRV_PCM_ACCESS_RW_NONINTERLEAVED 4 /* readn/writen */
#define SNDRV_PCM_ACCESS_LAST SNDRV_PCM_ACCESS_RW_NONINTERLEAVED
-typedef int __bitwise snd_pcm_format_t;
-#define SNDRV_PCM_FORMAT_S8 ((__force snd_pcm_format_t) 0)
-#define SNDRV_PCM_FORMAT_U8 ((__force snd_pcm_format_t) 1)
-#define SNDRV_PCM_FORMAT_S16_LE ((__force snd_pcm_format_t) 2)
-#define SNDRV_PCM_FORMAT_S16_BE ((__force snd_pcm_format_t) 3)
-#define SNDRV_PCM_FORMAT_U16_LE ((__force snd_pcm_format_t) 4)
-#define SNDRV_PCM_FORMAT_U16_BE ((__force snd_pcm_format_t) 5)
-#define SNDRV_PCM_FORMAT_S24_LE ((__force snd_pcm_format_t) 6) /* low three bytes */
-#define SNDRV_PCM_FORMAT_S24_BE ((__force snd_pcm_format_t) 7) /* low three bytes */
-#define SNDRV_PCM_FORMAT_U24_LE ((__force snd_pcm_format_t) 8) /* low three bytes */
-#define SNDRV_PCM_FORMAT_U24_BE ((__force snd_pcm_format_t) 9) /* low three bytes */
+typedef int snd_pcm_format_t;
+#define SNDRV_PCM_FORMAT_S8 0
+#define SNDRV_PCM_FORMAT_U8 1
+#define SNDRV_PCM_FORMAT_S16_LE 2
+#define SNDRV_PCM_FORMAT_S16_BE 3
+#define SNDRV_PCM_FORMAT_U16_LE 4
+#define SNDRV_PCM_FORMAT_U16_BE 5
+#define SNDRV_PCM_FORMAT_S24_LE 6 /* low three bytes */
+#define SNDRV_PCM_FORMAT_S24_BE 7 /* low three bytes */
+#define SNDRV_PCM_FORMAT_U24_LE 8 /* low three bytes */
+#define SNDRV_PCM_FORMAT_U24_BE 9 /* low three bytes */
/*
* For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
* available bit count in most significant bit. It's for the case of so-called 'left-justified' or
* `right-padding` sample which has less width than 32 bit.
*/
-#define SNDRV_PCM_FORMAT_S32_LE ((__force snd_pcm_format_t) 10)
-#define SNDRV_PCM_FORMAT_S32_BE ((__force snd_pcm_format_t) 11)
-#define SNDRV_PCM_FORMAT_U32_LE ((__force snd_pcm_format_t) 12)
-#define SNDRV_PCM_FORMAT_U32_BE ((__force snd_pcm_format_t) 13)
-#define SNDRV_PCM_FORMAT_FLOAT_LE ((__force snd_pcm_format_t) 14) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_FLOAT_BE ((__force snd_pcm_format_t) 15) /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_FLOAT64_LE ((__force snd_pcm_format_t) 16) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_FLOAT64_BE ((__force snd_pcm_format_t) 17) /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE ((__force snd_pcm_format_t) 18) /* IEC-958 subframe, Little Endian */
-#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE ((__force snd_pcm_format_t) 19) /* IEC-958 subframe, Big Endian */
-#define SNDRV_PCM_FORMAT_MU_LAW ((__force snd_pcm_format_t) 20)
-#define SNDRV_PCM_FORMAT_A_LAW ((__force snd_pcm_format_t) 21)
-#define SNDRV_PCM_FORMAT_IMA_ADPCM ((__force snd_pcm_format_t) 22)
-#define SNDRV_PCM_FORMAT_MPEG ((__force snd_pcm_format_t) 23)
-#define SNDRV_PCM_FORMAT_GSM ((__force snd_pcm_format_t) 24)
-#define SNDRV_PCM_FORMAT_S20_LE ((__force snd_pcm_format_t) 25) /* in four bytes, LSB justified */
-#define SNDRV_PCM_FORMAT_S20_BE ((__force snd_pcm_format_t) 26) /* in four bytes, LSB justified */
-#define SNDRV_PCM_FORMAT_U20_LE ((__force snd_pcm_format_t) 27) /* in four bytes, LSB justified */
-#define SNDRV_PCM_FORMAT_U20_BE ((__force snd_pcm_format_t) 28) /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_S32_LE 10
+#define SNDRV_PCM_FORMAT_S32_BE 11
+#define SNDRV_PCM_FORMAT_U32_LE 12
+#define SNDRV_PCM_FORMAT_U32_BE 13
+#define SNDRV_PCM_FORMAT_FLOAT_LE 14 /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_FLOAT_BE 15 /* 4-byte float, IEEE-754 32-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_FLOAT64_LE 16 /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_FLOAT64_BE 17 /* 8-byte float, IEEE-754 64-bit, range -1.0 to 1.0 */
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE 18 /* IEC-958 subframe, Little Endian */
+#define SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE 19 /* IEC-958 subframe, Big Endian */
+#define SNDRV_PCM_FORMAT_MU_LAW 20
+#define SNDRV_PCM_FORMAT_A_LAW 21
+#define SNDRV_PCM_FORMAT_IMA_ADPCM 22
+#define SNDRV_PCM_FORMAT_MPEG 23
+#define SNDRV_PCM_FORMAT_GSM 24
+#define SNDRV_PCM_FORMAT_S20_LE 25 /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_S20_BE 26 /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_U20_LE 27 /* in four bytes, LSB justified */
+#define SNDRV_PCM_FORMAT_U20_BE 28 /* in four bytes, LSB justified */
/* gap in the numbering for a future standard linear format */
-#define SNDRV_PCM_FORMAT_SPECIAL ((__force snd_pcm_format_t) 31)
-#define SNDRV_PCM_FORMAT_S24_3LE ((__force snd_pcm_format_t) 32) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S24_3BE ((__force snd_pcm_format_t) 33) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U24_3LE ((__force snd_pcm_format_t) 34) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U24_3BE ((__force snd_pcm_format_t) 35) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S20_3LE ((__force snd_pcm_format_t) 36) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S20_3BE ((__force snd_pcm_format_t) 37) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U20_3LE ((__force snd_pcm_format_t) 38) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U20_3BE ((__force snd_pcm_format_t) 39) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S18_3LE ((__force snd_pcm_format_t) 40) /* in three bytes */
-#define SNDRV_PCM_FORMAT_S18_3BE ((__force snd_pcm_format_t) 41) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U18_3LE ((__force snd_pcm_format_t) 42) /* in three bytes */
-#define SNDRV_PCM_FORMAT_U18_3BE ((__force snd_pcm_format_t) 43) /* in three bytes */
-#define SNDRV_PCM_FORMAT_G723_24 ((__force snd_pcm_format_t) 44) /* 8 samples in 3 bytes */
-#define SNDRV_PCM_FORMAT_G723_24_1B ((__force snd_pcm_format_t) 45) /* 1 sample in 1 byte */
-#define SNDRV_PCM_FORMAT_G723_40 ((__force snd_pcm_format_t) 46) /* 8 Samples in 5 bytes */
-#define SNDRV_PCM_FORMAT_G723_40_1B ((__force snd_pcm_format_t) 47) /* 1 sample in 1 byte */
-#define SNDRV_PCM_FORMAT_DSD_U8 ((__force snd_pcm_format_t) 48) /* DSD, 1-byte samples DSD (x8) */
-#define SNDRV_PCM_FORMAT_DSD_U16_LE ((__force snd_pcm_format_t) 49) /* DSD, 2-byte samples DSD (x16), little endian */
-#define SNDRV_PCM_FORMAT_DSD_U32_LE ((__force snd_pcm_format_t) 50) /* DSD, 4-byte samples DSD (x32), little endian */
-#define SNDRV_PCM_FORMAT_DSD_U16_BE ((__force snd_pcm_format_t) 51) /* DSD, 2-byte samples DSD (x16), big endian */
-#define SNDRV_PCM_FORMAT_DSD_U32_BE ((__force snd_pcm_format_t) 52) /* DSD, 4-byte samples DSD (x32), big endian */
+#define SNDRV_PCM_FORMAT_SPECIAL 31
+#define SNDRV_PCM_FORMAT_S24_3LE 32 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S24_3BE 33 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U24_3LE 34 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U24_3BE 35 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S20_3LE 36 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S20_3BE 37 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U20_3LE 38 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U20_3BE 39 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S18_3LE 40 /* in three bytes */
+#define SNDRV_PCM_FORMAT_S18_3BE 41 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U18_3LE 42 /* in three bytes */
+#define SNDRV_PCM_FORMAT_U18_3BE 43 /* in three bytes */
+#define SNDRV_PCM_FORMAT_G723_24 44 /* 8 samples in 3 bytes */
+#define SNDRV_PCM_FORMAT_G723_24_1B 45 /* 1 sample in 1 byte */
+#define SNDRV_PCM_FORMAT_G723_40 46 /* 8 Samples in 5 bytes */
+#define SNDRV_PCM_FORMAT_G723_40_1B 47 /* 1 sample in 1 byte */
+#define SNDRV_PCM_FORMAT_DSD_U8 48 /* DSD, 1-byte samples DSD (x8) */
+#define SNDRV_PCM_FORMAT_DSD_U16_LE 49 /* DSD, 2-byte samples DSD (x16), little endian */
+#define SNDRV_PCM_FORMAT_DSD_U32_LE 50 /* DSD, 4-byte samples DSD (x32), little endian */
+#define SNDRV_PCM_FORMAT_DSD_U16_BE 51 /* DSD, 2-byte samples DSD (x16), big endian */
+#define SNDRV_PCM_FORMAT_DSD_U32_BE 52 /* DSD, 4-byte samples DSD (x32), big endian */
#define SNDRV_PCM_FORMAT_LAST SNDRV_PCM_FORMAT_DSD_U32_BE
#define SNDRV_PCM_FORMAT_FIRST SNDRV_PCM_FORMAT_S8
@@ -265,11 +265,11 @@ typedef int __bitwise snd_pcm_format_t;
#define SNDRV_PCM_FORMAT_U20 SNDRV_PCM_FORMAT_U20_BE
#endif
-typedef int __bitwise snd_pcm_subformat_t;
-#define SNDRV_PCM_SUBFORMAT_STD ((__force snd_pcm_subformat_t) 0)
-#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX ((__force snd_pcm_subformat_t) 1)
-#define SNDRV_PCM_SUBFORMAT_MSBITS_20 ((__force snd_pcm_subformat_t) 2)
-#define SNDRV_PCM_SUBFORMAT_MSBITS_24 ((__force snd_pcm_subformat_t) 3)
+typedef int snd_pcm_subformat_t;
+#define SNDRV_PCM_SUBFORMAT_STD 0
+#define SNDRV_PCM_SUBFORMAT_MSBITS_MAX 1
+#define SNDRV_PCM_SUBFORMAT_MSBITS_20 2
+#define SNDRV_PCM_SUBFORMAT_MSBITS_24 3
#define SNDRV_PCM_SUBFORMAT_LAST SNDRV_PCM_SUBFORMAT_MSBITS_24
#define SNDRV_PCM_INFO_MMAP 0x00000001 /* hardware supports mmap */
@@ -303,16 +303,16 @@ typedef int __bitwise snd_pcm_subformat_t;
#define __SND_STRUCT_TIME64
#endif
-typedef int __bitwise snd_pcm_state_t;
-#define SNDRV_PCM_STATE_OPEN ((__force snd_pcm_state_t) 0) /* stream is open */
-#define SNDRV_PCM_STATE_SETUP ((__force snd_pcm_state_t) 1) /* stream has a setup */
-#define SNDRV_PCM_STATE_PREPARED ((__force snd_pcm_state_t) 2) /* stream is ready to start */
-#define SNDRV_PCM_STATE_RUNNING ((__force snd_pcm_state_t) 3) /* stream is running */
-#define SNDRV_PCM_STATE_XRUN ((__force snd_pcm_state_t) 4) /* stream reached an xrun */
-#define SNDRV_PCM_STATE_DRAINING ((__force snd_pcm_state_t) 5) /* stream is draining */
-#define SNDRV_PCM_STATE_PAUSED ((__force snd_pcm_state_t) 6) /* stream is paused */
-#define SNDRV_PCM_STATE_SUSPENDED ((__force snd_pcm_state_t) 7) /* hardware is suspended */
-#define SNDRV_PCM_STATE_DISCONNECTED ((__force snd_pcm_state_t) 8) /* hardware is disconnected */
+typedef int snd_pcm_state_t;
+#define SNDRV_PCM_STATE_OPEN 0 /* stream is open */
+#define SNDRV_PCM_STATE_SETUP 1 /* stream has a setup */
+#define SNDRV_PCM_STATE_PREPARED 2 /* stream is ready to start */
+#define SNDRV_PCM_STATE_RUNNING 3 /* stream is running */
+#define SNDRV_PCM_STATE_XRUN 4 /* stream reached an xrun */
+#define SNDRV_PCM_STATE_DRAINING 5 /* stream is draining */
+#define SNDRV_PCM_STATE_PAUSED 6 /* stream is paused */
+#define SNDRV_PCM_STATE_SUSPENDED 7 /* hardware is suspended */
+#define SNDRV_PCM_STATE_DISCONNECTED 8 /* hardware is disconnected */
#define SNDRV_PCM_STATE_LAST SNDRV_PCM_STATE_DISCONNECTED
enum {
@@ -1091,24 +1091,24 @@ struct snd_ctl_card_bytes {
__u64 data; /* user buffer (pointer stored as __u64) */
};
-typedef int __bitwise snd_ctl_elem_type_t;
-#define SNDRV_CTL_ELEM_TYPE_NONE ((__force snd_ctl_elem_type_t) 0) /* invalid */
-#define SNDRV_CTL_ELEM_TYPE_BOOLEAN ((__force snd_ctl_elem_type_t) 1) /* boolean type */
-#define SNDRV_CTL_ELEM_TYPE_INTEGER ((__force snd_ctl_elem_type_t) 2) /* integer type */
-#define SNDRV_CTL_ELEM_TYPE_ENUMERATED ((__force snd_ctl_elem_type_t) 3) /* enumerated type */
-#define SNDRV_CTL_ELEM_TYPE_BYTES ((__force snd_ctl_elem_type_t) 4) /* byte array */
-#define SNDRV_CTL_ELEM_TYPE_IEC958 ((__force snd_ctl_elem_type_t) 5) /* IEC958 (S/PDIF) setup */
-#define SNDRV_CTL_ELEM_TYPE_INTEGER64 ((__force snd_ctl_elem_type_t) 6) /* 64-bit integer type */
+typedef int snd_ctl_elem_type_t;
+#define SNDRV_CTL_ELEM_TYPE_NONE 0 /* invalid */
+#define SNDRV_CTL_ELEM_TYPE_BOOLEAN 1 /* boolean type */
+#define SNDRV_CTL_ELEM_TYPE_INTEGER 2 /* integer type */
+#define SNDRV_CTL_ELEM_TYPE_ENUMERATED 3 /* enumerated type */
+#define SNDRV_CTL_ELEM_TYPE_BYTES 4 /* byte array */
+#define SNDRV_CTL_ELEM_TYPE_IEC958 5 /* IEC958 (S/PDIF) setup */
+#define SNDRV_CTL_ELEM_TYPE_INTEGER64 6 /* 64-bit integer type */
#define SNDRV_CTL_ELEM_TYPE_LAST SNDRV_CTL_ELEM_TYPE_INTEGER64
-typedef int __bitwise snd_ctl_elem_iface_t;
-#define SNDRV_CTL_ELEM_IFACE_CARD ((__force snd_ctl_elem_iface_t) 0) /* global control */
-#define SNDRV_CTL_ELEM_IFACE_HWDEP ((__force snd_ctl_elem_iface_t) 1) /* hardware dependent device */
-#define SNDRV_CTL_ELEM_IFACE_MIXER ((__force snd_ctl_elem_iface_t) 2) /* virtual mixer device */
-#define SNDRV_CTL_ELEM_IFACE_PCM ((__force snd_ctl_elem_iface_t) 3) /* PCM device */
-#define SNDRV_CTL_ELEM_IFACE_RAWMIDI ((__force snd_ctl_elem_iface_t) 4) /* RawMidi device */
-#define SNDRV_CTL_ELEM_IFACE_TIMER ((__force snd_ctl_elem_iface_t) 5) /* timer device */
-#define SNDRV_CTL_ELEM_IFACE_SEQUENCER ((__force snd_ctl_elem_iface_t) 6) /* sequencer client */
+typedef int snd_ctl_elem_iface_t;
+#define SNDRV_CTL_ELEM_IFACE_CARD 0 /* global control */
+#define SNDRV_CTL_ELEM_IFACE_HWDEP 1 /* hardware dependent device */
+#define SNDRV_CTL_ELEM_IFACE_MIXER 2 /* virtual mixer device */
+#define SNDRV_CTL_ELEM_IFACE_PCM 3 /* PCM device */
+#define SNDRV_CTL_ELEM_IFACE_RAWMIDI 4 /* RawMidi device */
+#define SNDRV_CTL_ELEM_IFACE_TIMER 5 /* timer device */
+#define SNDRV_CTL_ELEM_IFACE_SEQUENCER 6 /* sequencer client */
#define SNDRV_CTL_ELEM_IFACE_LAST SNDRV_CTL_ELEM_IFACE_SEQUENCER
#define SNDRV_CTL_ELEM_ACCESS_READ (1<<0)
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 02/14] ALSA: pcm: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
2026-08-12 6:04 ` [PATCH 01/14] ALSA: uapi: " Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 03/14] ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBIT Takashi Iwai
` (12 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/sound/pcm.h | 10 ++++------
include/sound/pcm_params.h | 13 +++++--------
sound/core/pcm.c | 12 +++++-------
sound/core/pcm_misc.c | 25 +++++++++++--------------
sound/core/pcm_native.c | 28 ++++++++++++++--------------
5 files changed, 39 insertions(+), 49 deletions(-)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index 76fc33dce537..ab96396a7444 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -145,7 +145,7 @@ struct snd_pcm_ops {
#define SNDRV_PCM_RATE_8000_768000 (SNDRV_PCM_RATE_8000_384000|\
SNDRV_PCM_RATE_705600|\
SNDRV_PCM_RATE_768000)
-#define _SNDRV_PCM_FMTBIT(fmt) (1ULL << (__force int)SNDRV_PCM_FORMAT_##fmt)
+#define _SNDRV_PCM_FMTBIT(fmt) (1ULL << SNDRV_PCM_FORMAT_##fmt)
#define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8)
#define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8)
#define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE)
@@ -228,7 +228,7 @@ struct snd_pcm_ops {
#define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_BE
#endif
-#define _SNDRV_PCM_SUBFMTBIT(fmt) BIT((__force int)SNDRV_PCM_SUBFORMAT_##fmt)
+#define _SNDRV_PCM_SUBFMTBIT(fmt) BIT(SNDRV_PCM_SUBFORMAT_##fmt)
#define SNDRV_PCM_SUBFMTBIT_STD _SNDRV_PCM_SUBFMTBIT(STD)
#define SNDRV_PCM_SUBFMTBIT_MSBITS_MAX _SNDRV_PCM_SUBFMTBIT(MSBITS_MAX)
#define SNDRV_PCM_SUBFMTBIT_MSBITS_20 _SNDRV_PCM_SUBFMTBIT(MSBITS_20)
@@ -1515,7 +1515,7 @@ int snd_pcm_add_chmap_ctls(struct snd_pcm *pcm, int stream,
*/
static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
{
- return 1ULL << (__force int) pcm_format;
+ return 1ULL << pcm_format;
}
/**
@@ -1523,9 +1523,7 @@ static inline u64 pcm_format_to_bits(snd_pcm_format_t pcm_format)
* @f: the iterator variable in snd_pcm_format_t type
*/
#define pcm_for_each_format(f) \
- for ((f) = SNDRV_PCM_FORMAT_FIRST; \
- (__force int)(f) <= (__force int)SNDRV_PCM_FORMAT_LAST; \
- (f) = (__force snd_pcm_format_t)((__force int)(f) + 1))
+ for ((f) = SNDRV_PCM_FORMAT_FIRST; (f) <= SNDRV_PCM_FORMAT_LAST; (f)++)
/* printk helpers */
#define pcm_err(pcm, fmt, args...) \
diff --git a/include/sound/pcm_params.h b/include/sound/pcm_params.h
index fbf35df6e5cf..bc43955fcb76 100644
--- a/include/sound/pcm_params.h
+++ b/include/sound/pcm_params.h
@@ -71,7 +71,7 @@ static inline void snd_mask_set(struct snd_mask *mask, unsigned int val)
static inline void snd_mask_set_format(struct snd_mask *mask,
snd_pcm_format_t format)
{
- snd_mask_set(mask, (__force unsigned int)format);
+ snd_mask_set(mask, format);
}
static inline void snd_mask_reset(struct snd_mask *mask, unsigned int val)
@@ -132,7 +132,7 @@ static inline int snd_mask_test(const struct snd_mask *mask, unsigned int val)
static inline int snd_mask_test_format(const struct snd_mask *mask,
snd_pcm_format_t format)
{
- return snd_mask_test(mask, (__force unsigned int)format);
+ return snd_mask_test(mask, format);
}
static inline int snd_mask_single(const struct snd_mask *mask)
@@ -302,8 +302,7 @@ static inline int snd_interval_eq(const struct snd_interval *i1, const struct sn
*/
static inline snd_pcm_access_t params_access(const struct snd_pcm_hw_params *p)
{
- return (__force snd_pcm_access_t)snd_mask_min(hw_param_mask_c(p,
- SNDRV_PCM_HW_PARAM_ACCESS));
+ return snd_mask_min(hw_param_mask_c(p, SNDRV_PCM_HW_PARAM_ACCESS));
}
/**
@@ -312,8 +311,7 @@ static inline snd_pcm_access_t params_access(const struct snd_pcm_hw_params *p)
*/
static inline snd_pcm_format_t params_format(const struct snd_pcm_hw_params *p)
{
- return (__force snd_pcm_format_t)snd_mask_min(hw_param_mask_c(p,
- SNDRV_PCM_HW_PARAM_FORMAT));
+ return snd_mask_min(hw_param_mask_c(p, SNDRV_PCM_HW_PARAM_FORMAT));
}
/**
@@ -323,8 +321,7 @@ static inline snd_pcm_format_t params_format(const struct snd_pcm_hw_params *p)
static inline snd_pcm_subformat_t
params_subformat(const struct snd_pcm_hw_params *p)
{
- return (__force snd_pcm_subformat_t)snd_mask_min(hw_param_mask_c(p,
- SNDRV_PCM_HW_PARAM_SUBFORMAT));
+ return snd_mask_min(hw_param_mask_c(p, SNDRV_PCM_HW_PARAM_SUBFORMAT));
}
/**
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index bfedf571e021..41c2cab7a52c 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -211,11 +211,9 @@ static const char * const snd_pcm_format_names[] = {
*/
const char *snd_pcm_format_name(snd_pcm_format_t format)
{
- unsigned int format_num = (__force unsigned int)format;
-
- if (format_num >= ARRAY_SIZE(snd_pcm_format_names) || !snd_pcm_format_names[format_num])
+ if (format >= ARRAY_SIZE(snd_pcm_format_names) || !snd_pcm_format_names[format])
return "Unknown";
- return snd_pcm_format_names[format_num];
+ return snd_pcm_format_names[format];
}
EXPORT_SYMBOL_GPL(snd_pcm_format_name);
@@ -275,12 +273,12 @@ static const char *snd_pcm_stream_name(int stream)
static const char *snd_pcm_access_name(snd_pcm_access_t access)
{
- return snd_pcm_access_names[(__force int)access];
+ return snd_pcm_access_names[access];
}
static const char *snd_pcm_subformat_name(snd_pcm_subformat_t subformat)
{
- return snd_pcm_subformat_names[(__force int)subformat];
+ return snd_pcm_subformat_names[subformat];
}
static const char *snd_pcm_tstamp_mode_name(int mode)
@@ -290,7 +288,7 @@ static const char *snd_pcm_tstamp_mode_name(int mode)
static const char *snd_pcm_state_name(snd_pcm_state_t state)
{
- return snd_pcm_state_names[(__force int)state];
+ return snd_pcm_state_names[state];
}
#if IS_ENABLED(CONFIG_SND_PCM_OSS)
diff --git a/sound/core/pcm_misc.c b/sound/core/pcm_misc.c
index 180b6b64a448..13de3b02aa34 100644
--- a/sound/core/pcm_misc.c
+++ b/sound/core/pcm_misc.c
@@ -24,15 +24,12 @@ struct pcm_format_data {
unsigned char silence[8]; /* silence data to fill */
};
-/* we do lots of calculations on snd_pcm_format_t; shut up sparse */
-#define INT __force int
-
static bool valid_format(snd_pcm_format_t format)
{
- return (INT)format >= 0 && (INT)format <= (INT)SNDRV_PCM_FORMAT_LAST;
+ return format >= 0 && format <= SNDRV_PCM_FORMAT_LAST;
}
-static const struct pcm_format_data pcm_formats[(INT)SNDRV_PCM_FORMAT_LAST+1] = {
+static const struct pcm_format_data pcm_formats[SNDRV_PCM_FORMAT_LAST+1] = {
[SNDRV_PCM_FORMAT_S8] = {
.width = 8, .phys = 8, .le = -1, .signd = 1,
.silence = {},
@@ -251,7 +248,7 @@ int snd_pcm_format_signed(snd_pcm_format_t format)
int val;
if (!valid_format(format))
return -EINVAL;
- val = pcm_formats[(INT)format].signd;
+ val = pcm_formats[format].signd;
if (val < 0)
return -EINVAL;
return val;
@@ -300,7 +297,7 @@ int snd_pcm_format_little_endian(snd_pcm_format_t format)
int val;
if (!valid_format(format))
return -EINVAL;
- val = pcm_formats[(INT)format].le;
+ val = pcm_formats[format].le;
if (val < 0)
return -EINVAL;
return val;
@@ -337,7 +334,7 @@ int snd_pcm_format_width(snd_pcm_format_t format)
int val;
if (!valid_format(format))
return -EINVAL;
- val = pcm_formats[(INT)format].width;
+ val = pcm_formats[format].width;
if (!val)
return -EINVAL;
return val;
@@ -356,7 +353,7 @@ int snd_pcm_format_physical_width(snd_pcm_format_t format)
int val;
if (!valid_format(format))
return -EINVAL;
- val = pcm_formats[(INT)format].phys;
+ val = pcm_formats[format].phys;
if (!val)
return -EINVAL;
return val;
@@ -390,9 +387,9 @@ const unsigned char *snd_pcm_format_silence_64(snd_pcm_format_t format)
{
if (!valid_format(format))
return NULL;
- if (! pcm_formats[(INT)format].phys)
+ if (! pcm_formats[format].phys)
return NULL;
- return pcm_formats[(INT)format].silence;
+ return pcm_formats[format].silence;
}
EXPORT_SYMBOL(snd_pcm_format_silence_64);
@@ -416,12 +413,12 @@ int snd_pcm_format_set_silence(snd_pcm_format_t format, void *data, unsigned int
return -EINVAL;
if (samples == 0)
return 0;
- width = pcm_formats[(INT)format].phys; /* physical width */
+ width = pcm_formats[format].phys; /* physical width */
if (!width)
return -EINVAL;
- pat = pcm_formats[(INT)format].silence;
+ pat = pcm_formats[format].silence;
/* signed or 1 byte data */
- if (pcm_formats[(INT)format].signd == 1 || width <= 8) {
+ if (pcm_formats[format].signd == 1 || width <= 8) {
unsigned int bytes = samples * width / 8;
memset(data, *pat, bytes);
return 0;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index f44dc334aac6..4a5057e7629d 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -257,7 +257,7 @@ int snd_pcm_info_user(struct snd_pcm_substream *substream,
}
/* macro for simplified cast */
-#define PARAM_MASK_BIT(b) (1U << (__force int)(b))
+#define PARAM_MASK_BIT(b) (1U << (b))
static bool hw_support_mmap(struct snd_pcm_substream *substream)
{
@@ -489,7 +489,7 @@ static int fixup_unreferenced_params(struct snd_pcm_substream *substream,
params->msbits = snd_interval_value(i);
m = hw_param_mask_c(params, SNDRV_PCM_HW_PARAM_FORMAT);
if (snd_mask_single(m)) {
- snd_pcm_format_t format = (__force snd_pcm_format_t)snd_mask_min(m);
+ snd_pcm_format_t format = snd_mask_min(m);
params->msbits = snd_pcm_format_width(format);
}
}
@@ -497,13 +497,13 @@ static int fixup_unreferenced_params(struct snd_pcm_substream *substream,
if (params->msbits) {
m = hw_param_mask_c(params, SNDRV_PCM_HW_PARAM_FORMAT);
if (snd_mask_single(m)) {
- snd_pcm_format_t format = (__force snd_pcm_format_t)snd_mask_min(m);
+ snd_pcm_format_t format = snd_mask_min(m);
if (snd_pcm_format_linear(format) &&
snd_pcm_format_width(format) != params->msbits) {
m_rw = hw_param_mask(params, SNDRV_PCM_HW_PARAM_SUBFORMAT);
snd_mask_reset(m_rw,
- (__force unsigned)SNDRV_PCM_SUBFORMAT_MSBITS_MAX);
+ SNDRV_PCM_SUBFORMAT_MSBITS_MAX);
if (snd_mask_empty(m_rw))
return -EINVAL;
}
@@ -1252,7 +1252,7 @@ static void snd_pcm_trigger_tstamp(struct snd_pcm_substream *substream)
runtime->trigger_master = NULL;
}
-#define ACTION_ARG_IGNORE (__force snd_pcm_state_t)0
+#define ACTION_ARG_IGNORE 0
struct action_ops {
int (*pre_action)(struct snd_pcm_substream *substream,
@@ -1635,7 +1635,7 @@ EXPORT_SYMBOL_GPL(snd_pcm_stop_xrun);
/*
* pause callbacks: pass boolean (to start pause or resume) as state argument
*/
-#define pause_pushed(state) (__force bool)(state)
+#define pause_pushed(state) (bool)(state)
static int snd_pcm_pre_pause(struct snd_pcm_substream *substream,
snd_pcm_state_t state)
@@ -1707,14 +1707,14 @@ static const struct action_ops snd_pcm_action_pause = {
static int snd_pcm_pause(struct snd_pcm_substream *substream, bool push)
{
return snd_pcm_action(&snd_pcm_action_pause, substream,
- (__force snd_pcm_state_t)push);
+ (snd_pcm_state_t)push);
}
static int snd_pcm_pause_lock_irq(struct snd_pcm_substream *substream,
bool push)
{
return snd_pcm_action_lock_irq(&snd_pcm_action_pause, substream,
- (__force snd_pcm_state_t)push);
+ (snd_pcm_state_t)push);
}
#ifdef CONFIG_PM
@@ -1982,7 +1982,7 @@ static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream,
snd_pcm_state_t state)
{
snd_pcm_state_t cur_state = snd_pcm_get_state(substream);
- int f_flags = (__force int)state;
+ int f_flags = state;
if (cur_state == SNDRV_PCM_STATE_OPEN ||
cur_state == SNDRV_PCM_STATE_DISCONNECTED)
@@ -2050,7 +2050,7 @@ static int snd_pcm_prepare(struct snd_pcm_substream *substream,
return snd_pcm_action_nonatomic(&snd_pcm_action_prepare,
substream,
- (__force snd_pcm_state_t)f_flags);
+ (snd_pcm_state_t)f_flags);
}
/*
@@ -2461,7 +2461,7 @@ static int snd_pcm_hw_rule_format(struct snd_pcm_hw_params *params,
if (bits <= 0)
continue; /* ignore invalid formats */
if ((unsigned)bits < i->min || (unsigned)bits > i->max)
- snd_mask_reset(&m, (__force unsigned)k);
+ snd_mask_reset(&m, k);
}
return snd_mask_refine(mask, &m);
}
@@ -2543,16 +2543,16 @@ static int snd_pcm_hw_rule_subformats(struct snd_pcm_hw_params *params,
snd_mask_none(&m);
/* All PCMs support at least the default STD subformat. */
- snd_mask_set(&m, (__force unsigned)SNDRV_PCM_SUBFORMAT_STD);
+ snd_mask_set(&m, SNDRV_PCM_SUBFORMAT_STD);
pcm_for_each_format(f) {
- if (!snd_mask_test(fmask, (__force unsigned)f))
+ if (!snd_mask_test(fmask, f))
continue;
if (f == SNDRV_PCM_FORMAT_S32_LE && *subformats)
m.bits[0] |= *subformats;
else if (snd_pcm_format_linear(f))
- snd_mask_set(&m, (__force unsigned)SNDRV_PCM_SUBFORMAT_MSBITS_MAX);
+ snd_mask_set(&m, SNDRV_PCM_SUBFORMAT_MSBITS_MAX);
}
return snd_mask_refine(sfmask, &m);
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 03/14] ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBIT
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
2026-08-12 6:04 ` [PATCH 01/14] ALSA: uapi: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 02/14] ALSA: pcm: Drop __force casts Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 04/14] ALSA: control: Drop __force casts Takashi Iwai
` (11 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Avoid macros to define SNDRV_PCM_FMTBIT_* and SNDRV_PCM_SUBFMTBIT_*
contants but use plain bit shifts, instead. This allows bindgen and
other tools aware of those definitions.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
include/sound/pcm.h | 112 ++++++++++++++++++++++----------------------
1 file changed, 55 insertions(+), 57 deletions(-)
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index ab96396a7444..02d8689354c4 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -145,61 +145,60 @@ struct snd_pcm_ops {
#define SNDRV_PCM_RATE_8000_768000 (SNDRV_PCM_RATE_8000_384000|\
SNDRV_PCM_RATE_705600|\
SNDRV_PCM_RATE_768000)
-#define _SNDRV_PCM_FMTBIT(fmt) (1ULL << SNDRV_PCM_FORMAT_##fmt)
-#define SNDRV_PCM_FMTBIT_S8 _SNDRV_PCM_FMTBIT(S8)
-#define SNDRV_PCM_FMTBIT_U8 _SNDRV_PCM_FMTBIT(U8)
-#define SNDRV_PCM_FMTBIT_S16_LE _SNDRV_PCM_FMTBIT(S16_LE)
-#define SNDRV_PCM_FMTBIT_S16_BE _SNDRV_PCM_FMTBIT(S16_BE)
-#define SNDRV_PCM_FMTBIT_U16_LE _SNDRV_PCM_FMTBIT(U16_LE)
-#define SNDRV_PCM_FMTBIT_U16_BE _SNDRV_PCM_FMTBIT(U16_BE)
-#define SNDRV_PCM_FMTBIT_S24_LE _SNDRV_PCM_FMTBIT(S24_LE)
-#define SNDRV_PCM_FMTBIT_S24_BE _SNDRV_PCM_FMTBIT(S24_BE)
-#define SNDRV_PCM_FMTBIT_U24_LE _SNDRV_PCM_FMTBIT(U24_LE)
-#define SNDRV_PCM_FMTBIT_U24_BE _SNDRV_PCM_FMTBIT(U24_BE)
+#define SNDRV_PCM_FMTBIT_S8 (1ULL << SNDRV_PCM_FORMAT_S8)
+#define SNDRV_PCM_FMTBIT_U8 (1ULL << SNDRV_PCM_FORMAT_U8)
+#define SNDRV_PCM_FMTBIT_S16_LE (1ULL << SNDRV_PCM_FORMAT_S16_LE)
+#define SNDRV_PCM_FMTBIT_S16_BE (1ULL << SNDRV_PCM_FORMAT_S16_BE)
+#define SNDRV_PCM_FMTBIT_U16_LE (1ULL << SNDRV_PCM_FORMAT_U16_LE)
+#define SNDRV_PCM_FMTBIT_U16_BE (1ULL << SNDRV_PCM_FORMAT_U16_BE)
+#define SNDRV_PCM_FMTBIT_S24_LE (1ULL << SNDRV_PCM_FORMAT_S24_LE)
+#define SNDRV_PCM_FMTBIT_S24_BE (1ULL << SNDRV_PCM_FORMAT_S24_BE)
+#define SNDRV_PCM_FMTBIT_U24_LE (1ULL << SNDRV_PCM_FORMAT_U24_LE)
+#define SNDRV_PCM_FMTBIT_U24_BE (1ULL << SNDRV_PCM_FORMAT_U24_BE)
// For S32/U32 formats, 'msbits' hardware parameter is often used to deliver information about the
// available bit count in most significant bit. It's for the case of so-called 'left-justified' or
// `right-padding` sample which has less width than 32 bit.
-#define SNDRV_PCM_FMTBIT_S32_LE _SNDRV_PCM_FMTBIT(S32_LE)
-#define SNDRV_PCM_FMTBIT_S32_BE _SNDRV_PCM_FMTBIT(S32_BE)
-#define SNDRV_PCM_FMTBIT_U32_LE _SNDRV_PCM_FMTBIT(U32_LE)
-#define SNDRV_PCM_FMTBIT_U32_BE _SNDRV_PCM_FMTBIT(U32_BE)
-#define SNDRV_PCM_FMTBIT_FLOAT_LE _SNDRV_PCM_FMTBIT(FLOAT_LE)
-#define SNDRV_PCM_FMTBIT_FLOAT_BE _SNDRV_PCM_FMTBIT(FLOAT_BE)
-#define SNDRV_PCM_FMTBIT_FLOAT64_LE _SNDRV_PCM_FMTBIT(FLOAT64_LE)
-#define SNDRV_PCM_FMTBIT_FLOAT64_BE _SNDRV_PCM_FMTBIT(FLOAT64_BE)
-#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_LE)
-#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE _SNDRV_PCM_FMTBIT(IEC958_SUBFRAME_BE)
-#define SNDRV_PCM_FMTBIT_MU_LAW _SNDRV_PCM_FMTBIT(MU_LAW)
-#define SNDRV_PCM_FMTBIT_A_LAW _SNDRV_PCM_FMTBIT(A_LAW)
-#define SNDRV_PCM_FMTBIT_IMA_ADPCM _SNDRV_PCM_FMTBIT(IMA_ADPCM)
-#define SNDRV_PCM_FMTBIT_MPEG _SNDRV_PCM_FMTBIT(MPEG)
-#define SNDRV_PCM_FMTBIT_GSM _SNDRV_PCM_FMTBIT(GSM)
-#define SNDRV_PCM_FMTBIT_S20_LE _SNDRV_PCM_FMTBIT(S20_LE)
-#define SNDRV_PCM_FMTBIT_U20_LE _SNDRV_PCM_FMTBIT(U20_LE)
-#define SNDRV_PCM_FMTBIT_S20_BE _SNDRV_PCM_FMTBIT(S20_BE)
-#define SNDRV_PCM_FMTBIT_U20_BE _SNDRV_PCM_FMTBIT(U20_BE)
-#define SNDRV_PCM_FMTBIT_SPECIAL _SNDRV_PCM_FMTBIT(SPECIAL)
-#define SNDRV_PCM_FMTBIT_S24_3LE _SNDRV_PCM_FMTBIT(S24_3LE)
-#define SNDRV_PCM_FMTBIT_U24_3LE _SNDRV_PCM_FMTBIT(U24_3LE)
-#define SNDRV_PCM_FMTBIT_S24_3BE _SNDRV_PCM_FMTBIT(S24_3BE)
-#define SNDRV_PCM_FMTBIT_U24_3BE _SNDRV_PCM_FMTBIT(U24_3BE)
-#define SNDRV_PCM_FMTBIT_S20_3LE _SNDRV_PCM_FMTBIT(S20_3LE)
-#define SNDRV_PCM_FMTBIT_U20_3LE _SNDRV_PCM_FMTBIT(U20_3LE)
-#define SNDRV_PCM_FMTBIT_S20_3BE _SNDRV_PCM_FMTBIT(S20_3BE)
-#define SNDRV_PCM_FMTBIT_U20_3BE _SNDRV_PCM_FMTBIT(U20_3BE)
-#define SNDRV_PCM_FMTBIT_S18_3LE _SNDRV_PCM_FMTBIT(S18_3LE)
-#define SNDRV_PCM_FMTBIT_U18_3LE _SNDRV_PCM_FMTBIT(U18_3LE)
-#define SNDRV_PCM_FMTBIT_S18_3BE _SNDRV_PCM_FMTBIT(S18_3BE)
-#define SNDRV_PCM_FMTBIT_U18_3BE _SNDRV_PCM_FMTBIT(U18_3BE)
-#define SNDRV_PCM_FMTBIT_G723_24 _SNDRV_PCM_FMTBIT(G723_24)
-#define SNDRV_PCM_FMTBIT_G723_24_1B _SNDRV_PCM_FMTBIT(G723_24_1B)
-#define SNDRV_PCM_FMTBIT_G723_40 _SNDRV_PCM_FMTBIT(G723_40)
-#define SNDRV_PCM_FMTBIT_G723_40_1B _SNDRV_PCM_FMTBIT(G723_40_1B)
-#define SNDRV_PCM_FMTBIT_DSD_U8 _SNDRV_PCM_FMTBIT(DSD_U8)
-#define SNDRV_PCM_FMTBIT_DSD_U16_LE _SNDRV_PCM_FMTBIT(DSD_U16_LE)
-#define SNDRV_PCM_FMTBIT_DSD_U32_LE _SNDRV_PCM_FMTBIT(DSD_U32_LE)
-#define SNDRV_PCM_FMTBIT_DSD_U16_BE _SNDRV_PCM_FMTBIT(DSD_U16_BE)
-#define SNDRV_PCM_FMTBIT_DSD_U32_BE _SNDRV_PCM_FMTBIT(DSD_U32_BE)
+#define SNDRV_PCM_FMTBIT_S32_LE (1ULL << SNDRV_PCM_FORMAT_S32_LE)
+#define SNDRV_PCM_FMTBIT_S32_BE (1ULL << SNDRV_PCM_FORMAT_S32_BE)
+#define SNDRV_PCM_FMTBIT_U32_LE (1ULL << SNDRV_PCM_FORMAT_U32_LE)
+#define SNDRV_PCM_FMTBIT_U32_BE (1ULL << SNDRV_PCM_FORMAT_U32_BE)
+#define SNDRV_PCM_FMTBIT_FLOAT_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT_LE)
+#define SNDRV_PCM_FMTBIT_FLOAT_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT_BE)
+#define SNDRV_PCM_FMTBIT_FLOAT64_LE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_LE)
+#define SNDRV_PCM_FMTBIT_FLOAT64_BE (1ULL << SNDRV_PCM_FORMAT_FLOAT64_BE)
+#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_LE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_LE)
+#define SNDRV_PCM_FMTBIT_IEC958_SUBFRAME_BE (1ULL << SNDRV_PCM_FORMAT_IEC958_SUBFRAME_BE)
+#define SNDRV_PCM_FMTBIT_MU_LAW (1ULL << SNDRV_PCM_FORMAT_MU_LAW)
+#define SNDRV_PCM_FMTBIT_A_LAW (1ULL << SNDRV_PCM_FORMAT_A_LAW)
+#define SNDRV_PCM_FMTBIT_IMA_ADPCM (1ULL << SNDRV_PCM_FORMAT_IMA_ADPCM)
+#define SNDRV_PCM_FMTBIT_MPEG (1ULL << SNDRV_PCM_FORMAT_MPEG)
+#define SNDRV_PCM_FMTBIT_GSM (1ULL << SNDRV_PCM_FORMAT_GSM)
+#define SNDRV_PCM_FMTBIT_S20_LE (1ULL << SNDRV_PCM_FORMAT_S20_LE)
+#define SNDRV_PCM_FMTBIT_U20_LE (1ULL << SNDRV_PCM_FORMAT_U20_LE)
+#define SNDRV_PCM_FMTBIT_S20_BE (1ULL << SNDRV_PCM_FORMAT_S20_BE)
+#define SNDRV_PCM_FMTBIT_U20_BE (1ULL << SNDRV_PCM_FORMAT_U20_BE)
+#define SNDRV_PCM_FMTBIT_SPECIAL (1ULL << SNDRV_PCM_FORMAT_SPECIAL)
+#define SNDRV_PCM_FMTBIT_S24_3LE (1ULL << SNDRV_PCM_FORMAT_S24_3LE)
+#define SNDRV_PCM_FMTBIT_U24_3LE (1ULL << SNDRV_PCM_FORMAT_U24_3LE)
+#define SNDRV_PCM_FMTBIT_S24_3BE (1ULL << SNDRV_PCM_FORMAT_S24_3BE)
+#define SNDRV_PCM_FMTBIT_U24_3BE (1ULL << SNDRV_PCM_FORMAT_U24_3BE)
+#define SNDRV_PCM_FMTBIT_S20_3LE (1ULL << SNDRV_PCM_FORMAT_S20_3LE)
+#define SNDRV_PCM_FMTBIT_U20_3LE (1ULL << SNDRV_PCM_FORMAT_U20_3LE)
+#define SNDRV_PCM_FMTBIT_S20_3BE (1ULL << SNDRV_PCM_FORMAT_S20_3BE)
+#define SNDRV_PCM_FMTBIT_U20_3BE (1ULL << SNDRV_PCM_FORMAT_U20_3BE)
+#define SNDRV_PCM_FMTBIT_S18_3LE (1ULL << SNDRV_PCM_FORMAT_S18_3LE)
+#define SNDRV_PCM_FMTBIT_U18_3LE (1ULL << SNDRV_PCM_FORMAT_U18_3LE)
+#define SNDRV_PCM_FMTBIT_S18_3BE (1ULL << SNDRV_PCM_FORMAT_S18_3BE)
+#define SNDRV_PCM_FMTBIT_U18_3BE (1ULL << SNDRV_PCM_FORMAT_U18_3BE)
+#define SNDRV_PCM_FMTBIT_G723_24 (1ULL << SNDRV_PCM_FORMAT_G723_24)
+#define SNDRV_PCM_FMTBIT_G723_24_1B (1ULL << SNDRV_PCM_FORMAT_G723_24_1B)
+#define SNDRV_PCM_FMTBIT_G723_40 (1ULL << SNDRV_PCM_FORMAT_G723_40)
+#define SNDRV_PCM_FMTBIT_G723_40_1B (1ULL << SNDRV_PCM_FORMAT_G723_40_1B)
+#define SNDRV_PCM_FMTBIT_DSD_U8 (1ULL << SNDRV_PCM_FORMAT_DSD_U8)
+#define SNDRV_PCM_FMTBIT_DSD_U16_LE (1ULL << SNDRV_PCM_FORMAT_DSD_U16_LE)
+#define SNDRV_PCM_FMTBIT_DSD_U32_LE (1ULL << SNDRV_PCM_FORMAT_DSD_U32_LE)
+#define SNDRV_PCM_FMTBIT_DSD_U16_BE (1ULL << SNDRV_PCM_FORMAT_DSD_U16_BE)
+#define SNDRV_PCM_FMTBIT_DSD_U32_BE (1ULL << SNDRV_PCM_FORMAT_DSD_U32_BE)
#ifdef SNDRV_LITTLE_ENDIAN
#define SNDRV_PCM_FMTBIT_S16 SNDRV_PCM_FMTBIT_S16_LE
@@ -228,11 +227,10 @@ struct snd_pcm_ops {
#define SNDRV_PCM_FMTBIT_U20 SNDRV_PCM_FMTBIT_U20_BE
#endif
-#define _SNDRV_PCM_SUBFMTBIT(fmt) BIT(SNDRV_PCM_SUBFORMAT_##fmt)
-#define SNDRV_PCM_SUBFMTBIT_STD _SNDRV_PCM_SUBFMTBIT(STD)
-#define SNDRV_PCM_SUBFMTBIT_MSBITS_MAX _SNDRV_PCM_SUBFMTBIT(MSBITS_MAX)
-#define SNDRV_PCM_SUBFMTBIT_MSBITS_20 _SNDRV_PCM_SUBFMTBIT(MSBITS_20)
-#define SNDRV_PCM_SUBFMTBIT_MSBITS_24 _SNDRV_PCM_SUBFMTBIT(MSBITS_24)
+#define SNDRV_PCM_SUBFMTBIT_STD (1U << SNDRV_PCM_SUBFORMAT_STD)
+#define SNDRV_PCM_SUBFMTBIT_MSBITS_MAX (1U << SNDRV_PCM_SUBFORMAT_MSBITS_MAX)
+#define SNDRV_PCM_SUBFMTBIT_MSBITS_20 (1U << SNDRV_PCM_SUBFORMAT_MSBITS_20)
+#define SNDRV_PCM_SUBFMTBIT_MSBITS_24 (1U << SNDRV_PCM_SUBFORMAT_MSBITS_24)
struct snd_pcm_file {
struct snd_pcm_substream *substream;
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 04/14] ALSA: control: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (2 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 03/14] ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBIT Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 05/14] ALSA: oss: " Takashi Iwai
` (10 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for control
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/control_compat.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
index f14d9f5e94be..87f7ad5ab739 100644
--- a/sound/core/control_compat.c
+++ b/sound/core/control_compat.c
@@ -226,8 +226,8 @@ static int copy_ctl_value_from_user(struct snd_card *card,
if (type < 0)
return type;
- if (type == (__force int)SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
- type == (__force int)SNDRV_CTL_ELEM_TYPE_INTEGER) {
+ if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
+ type == SNDRV_CTL_ELEM_TYPE_INTEGER) {
for (i = 0; i < count; i++) {
s32 __user *intp = valuep;
int val;
@@ -236,7 +236,7 @@ static int copy_ctl_value_from_user(struct snd_card *card,
data->value.integer.value[i] = val;
}
} else {
- size = get_elem_size((__force snd_ctl_elem_type_t)type, count);
+ size = get_elem_size(type, count);
if (size < 0) {
dev_err(card->dev, "snd_ioctl32_ctl_elem_value: unknown type %d\n", type);
return -EINVAL;
@@ -259,8 +259,8 @@ static int copy_ctl_value_to_user(void __user *userdata,
struct snd_ctl_elem_value32 __user *data32 = userdata;
int i, size;
- if (type == (__force int)SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
- type == (__force int)SNDRV_CTL_ELEM_TYPE_INTEGER) {
+ if (type == SNDRV_CTL_ELEM_TYPE_BOOLEAN ||
+ type == SNDRV_CTL_ELEM_TYPE_INTEGER) {
for (i = 0; i < count; i++) {
s32 __user *intp = valuep;
int val;
@@ -269,7 +269,7 @@ static int copy_ctl_value_to_user(void __user *userdata,
return -EFAULT;
}
} else {
- size = get_elem_size((__force snd_ctl_elem_type_t)type, count);
+ size = get_elem_size(type, count);
if (copy_to_user(valuep, data->value.bytes.data, size))
return -EFAULT;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 05/14] ALSA: oss: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (3 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 04/14] ALSA: control: Drop __force casts Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 06/14] ALSA: kunit: " Takashi Iwai
` (9 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/oss/pcm_oss.c | 16 ++++++++--------
sound/core/oss/pcm_plugin.c | 20 ++++++++++----------
2 files changed, 18 insertions(+), 18 deletions(-)
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 0924f1ff1ae7..bd19328dca9e 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -879,11 +879,11 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
_snd_pcm_hw_param_min(sparams, SNDRV_PCM_HW_PARAM_PERIODS, 2, 0);
snd_mask_none(&mask);
if (atomic_read(&substream->mmap_count))
- snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_MMAP_INTERLEAVED);
+ snd_mask_set(&mask, SNDRV_PCM_ACCESS_MMAP_INTERLEAVED);
else {
- snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_RW_INTERLEAVED);
+ snd_mask_set(&mask, SNDRV_PCM_ACCESS_RW_INTERLEAVED);
if (!direct)
- snd_mask_set(&mask, (__force int)SNDRV_PCM_ACCESS_RW_NONINTERLEAVED);
+ snd_mask_set(&mask, SNDRV_PCM_ACCESS_RW_NONINTERLEAVED);
}
err = snd_pcm_hw_param_mask(substream, sparams, SNDRV_PCM_HW_PARAM_ACCESS, &mask);
if (err < 0) {
@@ -909,7 +909,7 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
else
sformat = snd_pcm_plug_slave_format(format, sformat_mask);
- if ((__force int)sformat < 0 ||
+ if (sformat < 0 ||
!snd_mask_test_format(sformat_mask, sformat)) {
pcm_for_each_format(sformat) {
if (snd_mask_test_format(sformat_mask, sformat) &&
@@ -921,7 +921,7 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
goto failure;
}
format_found:
- err = _snd_pcm_hw_param_set(sparams, SNDRV_PCM_HW_PARAM_FORMAT, (__force int)sformat, 0);
+ err = _snd_pcm_hw_param_set(sparams, SNDRV_PCM_HW_PARAM_FORMAT, sformat, 0);
if (err < 0)
goto failure;
@@ -930,9 +930,9 @@ static int snd_pcm_oss_change_params_locked(struct snd_pcm_substream *substream)
} else {
_snd_pcm_hw_params_any(params);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_ACCESS,
- (__force int)SNDRV_PCM_ACCESS_RW_INTERLEAVED, 0);
+ SNDRV_PCM_ACCESS_RW_INTERLEAVED, 0);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_FORMAT,
- (__force int)snd_pcm_oss_format_from(runtime->oss.format), 0);
+ snd_pcm_oss_format_from(runtime->oss.format), 0);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_CHANNELS,
runtime->oss.channels, 0);
_snd_pcm_hw_param_set(params, SNDRV_PCM_HW_PARAM_RATE,
@@ -1875,7 +1875,7 @@ static int snd_pcm_oss_get_formats(struct snd_pcm_oss_file *pcm_oss_file)
format_mask = hw_param_mask_c(params, SNDRV_PCM_HW_PARAM_FORMAT);
for (fmt = 0; fmt < 32; ++fmt) {
if (snd_mask_test(format_mask, fmt)) {
- int f = snd_pcm_oss_format_to((__force snd_pcm_format_t)fmt);
+ int f = snd_pcm_oss_format_to(fmt);
if (f >= 0)
formats |= f;
}
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 5f4d6945a7df..acf5ca663ba8 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -272,13 +272,13 @@ static int snd_pcm_plug_formats(const struct snd_mask *mask,
SNDRV_PCM_FMTBIT_U24_3BE | SNDRV_PCM_FMTBIT_S24_3BE |
SNDRV_PCM_FMTBIT_U32_LE | SNDRV_PCM_FMTBIT_S32_LE |
SNDRV_PCM_FMTBIT_U32_BE | SNDRV_PCM_FMTBIT_S32_BE);
- snd_mask_set(&formats, (__force int)SNDRV_PCM_FORMAT_MU_LAW);
+ snd_mask_set(&formats, SNDRV_PCM_FORMAT_MU_LAW);
if (formats.bits[0] & lower_32_bits(linfmts))
formats.bits[0] |= lower_32_bits(linfmts);
if (formats.bits[1] & upper_32_bits(linfmts))
formats.bits[1] |= upper_32_bits(linfmts);
- return snd_mask_test(&formats, (__force int)format);
+ return snd_mask_test(&formats, format);
}
static const snd_pcm_format_t preferred_formats[] = {
@@ -307,20 +307,20 @@ snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
{
int i;
- if (snd_mask_test(format_mask, (__force int)format))
+ if (snd_mask_test(format_mask, format))
return format;
if (!snd_pcm_plug_formats(format_mask, format))
- return (__force snd_pcm_format_t)-EINVAL;
+ return -EINVAL;
if (snd_pcm_format_linear(format)) {
unsigned int width = snd_pcm_format_width(format);
int unsignd = snd_pcm_format_unsigned(format) > 0;
int big = snd_pcm_format_big_endian(format) > 0;
unsigned int badness, best = -1;
- snd_pcm_format_t best_format = (__force snd_pcm_format_t)-1;
+ snd_pcm_format_t best_format = -1;
for (i = 0; i < ARRAY_SIZE(preferred_formats); i++) {
snd_pcm_format_t f = preferred_formats[i];
unsigned int w;
- if (!snd_mask_test(format_mask, (__force int)f))
+ if (!snd_mask_test(format_mask, f))
continue;
w = snd_pcm_format_width(f);
if (w >= width)
@@ -334,21 +334,21 @@ snd_pcm_format_t snd_pcm_plug_slave_format(snd_pcm_format_t format,
best = badness;
}
}
- if ((__force int)best_format >= 0)
+ if (best_format >= 0)
return best_format;
else
- return (__force snd_pcm_format_t)-EINVAL;
+ return -EINVAL;
} else {
switch (format) {
case SNDRV_PCM_FORMAT_MU_LAW:
for (i = 0; i < ARRAY_SIZE(preferred_formats); ++i) {
snd_pcm_format_t format1 = preferred_formats[i];
- if (snd_mask_test(format_mask, (__force int)format1))
+ if (snd_mask_test(format_mask, format1))
return format1;
}
fallthrough;
default:
- return (__force snd_pcm_format_t)-EINVAL;
+ return -EINVAL;
}
}
}
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 06/14] ALSA: kunit: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (4 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 05/14] ALSA: oss: " Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 07/14] ALSA: aloop: " Takashi Iwai
` (8 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/core/sound_kunit.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/core/sound_kunit.c b/sound/core/sound_kunit.c
index 84e337ecbddd..0376112cc67e 100644
--- a/sound/core/sound_kunit.c
+++ b/sound/core/sound_kunit.c
@@ -17,8 +17,8 @@
.name = #fmt, \
}
-#define WRONG_FORMAT_1 (__force snd_pcm_format_t)((__force int)SNDRV_PCM_FORMAT_LAST + 1)
-#define WRONG_FORMAT_2 (__force snd_pcm_format_t)-1
+#define WRONG_FORMAT_1 (SNDRV_PCM_FORMAT_LAST + 1)
+#define WRONG_FORMAT_2 -1
#define VALID_NAME "ValidName"
#define NAME_W_SPEC_CHARS "In%v@1id name"
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 07/14] ALSA: aloop: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (5 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 06/14] ALSA: kunit: " Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 08/14] ALSA: hda: " Takashi Iwai
` (7 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/drivers/aloop.c | 4 ++--
1 file changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/drivers/aloop.c b/sound/drivers/aloop.c
index 92ef821ddbeb..4e3ea23ca913 100644
--- a/sound/drivers/aloop.c
+++ b/sound/drivers/aloop.c
@@ -1603,7 +1603,7 @@ static int loopback_format_info(struct snd_kcontrol *kcontrol,
uinfo->type = SNDRV_CTL_ELEM_TYPE_INTEGER;
uinfo->count = 1;
uinfo->value.integer.min = 0;
- uinfo->value.integer.max = (__force int)SNDRV_PCM_FORMAT_LAST;
+ uinfo->value.integer.max = SNDRV_PCM_FORMAT_LAST;
uinfo->value.integer.step = 1;
return 0;
}
@@ -1614,7 +1614,7 @@ static int loopback_format_get(struct snd_kcontrol *kcontrol,
struct loopback *loopback = snd_kcontrol_chip(kcontrol);
ucontrol->value.integer.value[0] =
- (__force int)loopback->setup[kcontrol->id.subdevice]
+ loopback->setup[kcontrol->id.subdevice]
[kcontrol->id.device].format;
return 0;
}
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 08/14] ALSA: hda: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (6 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 07/14] ALSA: aloop: " Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 09/14] ALSA: asihpi: Drop __force cast Takashi Iwai
` (6 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for PCM and
control parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/hda/common/codec.c | 2 +-
sound/hda/core/device.c | 2 +-
2 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/sound/hda/common/codec.c b/sound/hda/common/codec.c
index 641083c2376f..7d17d773cfbf 100644
--- a/sound/hda/common/codec.c
+++ b/sound/hda/common/codec.c
@@ -3379,7 +3379,7 @@ int snd_hda_add_new_ctls(struct hda_codec *codec,
for (; knew->name; knew++) {
struct snd_kcontrol *kctl;
int addr = 0, idx = 0;
- if (knew->iface == (__force snd_ctl_elem_iface_t)-1)
+ if (knew->iface == -1)
continue; /* skip this codec private value */
for (;;) {
kctl = snd_ctl_new1(knew, codec);
diff --git a/sound/hda/core/device.c b/sound/hda/core/device.c
index 160c8d0453b0..832494035f0a 100644
--- a/sound/hda/core/device.c
+++ b/sound/hda/core/device.c
@@ -765,7 +765,7 @@ unsigned int snd_hdac_stream_format_bits(snd_pcm_format_t format, snd_pcm_subfor
params_set_format(¶ms, snd_hdac_format_normalize(format));
snd_mask_set(hw_param_mask(¶ms, SNDRV_PCM_HW_PARAM_SUBFORMAT),
- (__force unsigned int)subformat);
+ subformat);
bits = snd_pcm_hw_params_bits(¶ms);
if (maxbits)
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 09/14] ALSA: asihpi: Drop __force cast
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (7 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 08/14] ALSA: hda: " Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 10/14] ALSA: emu10k1: Drop __force casts Takashi Iwai
` (5 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop a superfluous cast.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/asihpi/asihpi.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/pci/asihpi/asihpi.c b/sound/pci/asihpi/asihpi.c
index 4dbc79899c09..b78e96caef9d 100644
--- a/sound/pci/asihpi/asihpi.c
+++ b/sound/pci/asihpi/asihpi.c
@@ -280,7 +280,7 @@ static void print_hwparams(struct snd_pcm_substream *substream,
snd_pcm_format_width(params_format(p)) / 8);
}
-#define INVALID_FORMAT (__force snd_pcm_format_t)(-1)
+#define INVALID_FORMAT -1
static const snd_pcm_format_t hpi_to_alsa_formats[] = {
INVALID_FORMAT, /* INVALID */
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 10/14] ALSA: emu10k1: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (8 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 09/14] ALSA: asihpi: Drop __force cast Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 11/14] ASoC: fsl: " Takashi Iwai
` (4 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Now that the bitwise parameter definitions are gone for control
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/pci/emu10k1/emufx.c | 18 +++++++++---------
1 file changed, 9 insertions(+), 9 deletions(-)
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 08e0556bf161..49cabb2eb2b7 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -990,7 +990,7 @@ static int snd_emu10k1_list_controls(struct snd_emu10k1 *emu,
i < icode->gpr_list_control_count) {
memset(gctl, 0, sizeof(*gctl));
id = &ctl->kcontrol->id;
- gctl->id.iface = (__force int)id->iface;
+ gctl->id.iface = id->iface;
strscpy(gctl->id.name, id->name, sizeof(gctl->id.name));
gctl->id.index = id->index;
gctl->id.device = id->device;
@@ -1156,7 +1156,7 @@ static void
snd_emu10k1_init_mono_control2(struct snd_emu10k1_fx8010_control_gpr *ctl,
const char *name, int gpr, int defval, int defval_hr)
{
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, name);
ctl->vcount = ctl->count = 1;
if (high_res_gpr_volume) {
@@ -1180,7 +1180,7 @@ static void
snd_emu10k1_init_stereo_control2(struct snd_emu10k1_fx8010_control_gpr *ctl,
const char *name, int gpr, int defval, int defval_hr)
{
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, name);
ctl->vcount = ctl->count = 2;
if (high_res_gpr_volume) {
@@ -1205,7 +1205,7 @@ static void
snd_emu10k1_init_mono_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
const char *name, int gpr, int defval)
{
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, name);
ctl->vcount = ctl->count = 1;
ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
@@ -1218,7 +1218,7 @@ static void
snd_emu10k1_init_stereo_onoff_control(struct snd_emu10k1_fx8010_control_gpr *ctl,
const char *name, int gpr, int defval)
{
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, name);
ctl->vcount = ctl->count = 2;
ctl->gpr[0] = gpr + 0; ctl->value[0] = defval;
@@ -1542,7 +1542,7 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
* Process tone control
*/
ctl = &controls[nctl + 0];
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, "Tone Control - Bass");
ctl->vcount = 2;
ctl->count = 10;
@@ -1551,7 +1551,7 @@ static int _snd_emu10k1_audigy_init_efx(struct snd_emu10k1 *emu)
ctl->value[0] = ctl->value[1] = 20;
ctl->translation = EMU10K1_GPR_TRANSLATION_BASS;
ctl = &controls[nctl + 1];
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, "Tone Control - Treble");
ctl->vcount = 2;
ctl->count = 10;
@@ -2137,7 +2137,7 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
* Process tone control
*/
ctl = &controls[i + 0];
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, "Tone Control - Bass");
ctl->vcount = 2;
ctl->count = 10;
@@ -2147,7 +2147,7 @@ static int _snd_emu10k1_init_efx(struct snd_emu10k1 *emu)
ctl->tlv = snd_emu10k1_bass_treble_db_scale;
ctl->translation = EMU10K1_GPR_TRANSLATION_BASS;
ctl = &controls[i + 1];
- ctl->id.iface = (__force int)SNDRV_CTL_ELEM_IFACE_MIXER;
+ ctl->id.iface = SNDRV_CTL_ELEM_IFACE_MIXER;
strscpy(ctl->id.name, "Tone Control - Treble");
ctl->vcount = 2;
ctl->count = 10;
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 11/14] ASoC: fsl: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (9 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 10/14] ALSA: emu10k1: Drop __force casts Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 12/14] ASoC: Intel: avs: Drop __force cast Takashi Iwai
` (3 subsequent siblings)
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound
Cc: Shengjiu Wang, Xiubo Li, Fabio Estevam, Nicolin Chen, Mark Brown
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/fsl/fsl-asoc-card.c | 2 +-
sound/soc/fsl/fsl_asrc.c | 2 +-
sound/soc/fsl/fsl_asrc_m2m.c | 10 +++++-----
sound/soc/fsl/fsl_easrc.c | 2 +-
sound/soc/fsl/fsl_qmc_audio.c | 8 ++++----
sound/soc/fsl/imx-card.c | 4 ++--
6 files changed, 14 insertions(+), 14 deletions(-)
diff --git a/sound/soc/fsl/fsl-asoc-card.c b/sound/soc/fsl/fsl-asoc-card.c
index 709543308fe9..9dc46ab1d3e1 100644
--- a/sound/soc/fsl/fsl-asoc-card.c
+++ b/sound/soc/fsl/fsl-asoc-card.c
@@ -1118,7 +1118,7 @@ static int fsl_asoc_card_probe(struct platform_device *pdev)
}
ret = of_property_read_u32(asrc_np, "fsl,asrc-format", &asrc_fmt);
- priv->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
+ priv->asrc_format = asrc_fmt;
if (ret) {
/* Fallback to old binding; translate to asrc_format */
ret = of_property_read_u32(asrc_np, "fsl,asrc-width",
diff --git a/sound/soc/fsl/fsl_asrc.c b/sound/soc/fsl/fsl_asrc.c
index f23c21032287..11748c65d5cc 100644
--- a/sound/soc/fsl/fsl_asrc.c
+++ b/sound/soc/fsl/fsl_asrc.c
@@ -1358,7 +1358,7 @@ static int fsl_asrc_probe(struct platform_device *pdev)
}
ret = of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt);
- asrc->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
+ asrc->asrc_format = asrc_fmt;
if (ret) {
ret = of_property_read_u32(np, "fsl,asrc-width", &width);
if (ret) {
diff --git a/sound/soc/fsl/fsl_asrc_m2m.c b/sound/soc/fsl/fsl_asrc_m2m.c
index 7d39378c0622..4bc40f328f58 100644
--- a/sound/soc/fsl/fsl_asrc_m2m.c
+++ b/sound/soc/fsl/fsl_asrc_m2m.c
@@ -367,13 +367,13 @@ static int fsl_asrc_m2m_comp_set_params(struct snd_compr_stream *stream,
if (ret)
return -EINVAL;
- if (pcm_format_to_bits((__force snd_pcm_format_t)params->codec.format) & cap.fmt_in)
- pair->sample_format[IN] = (__force snd_pcm_format_t)params->codec.format;
+ if (pcm_format_to_bits(params->codec.format) & cap.fmt_in)
+ pair->sample_format[IN] = params->codec.format;
else
return -EINVAL;
- if (pcm_format_to_bits((__force snd_pcm_format_t)params->codec.pcm_format) & cap.fmt_out)
- pair->sample_format[OUT] = (__force snd_pcm_format_t)params->codec.pcm_format;
+ if (pcm_format_to_bits(params->codec.pcm_format) & cap.fmt_out)
+ pair->sample_format[OUT] = params->codec.pcm_format;
else
return -EINVAL;
@@ -600,7 +600,7 @@ static int fsl_asrc_m2m_fill_codec_caps(struct fsl_asrc *asrc,
cap.rate_in,
cap.rate_in_count * sizeof(__u32));
codec->descriptor[j].num_sample_rates = cap.rate_in_count;
- codec->descriptor[j].formats = (__force __u32)k;
+ codec->descriptor[j].formats = k;
codec->descriptor[j].pcm_formats = cap.fmt_out;
codec->descriptor[j].src.out_sample_rate_min = cap.rate_out[0];
codec->descriptor[j].src.out_sample_rate_max =
diff --git a/sound/soc/fsl/fsl_easrc.c b/sound/soc/fsl/fsl_easrc.c
index 8535ef844ce0..79eb2391058d 100644
--- a/sound/soc/fsl/fsl_easrc.c
+++ b/sound/soc/fsl/fsl_easrc.c
@@ -2227,7 +2227,7 @@ static int fsl_easrc_probe(struct platform_device *pdev)
}
ret = of_property_read_u32(np, "fsl,asrc-format", &asrc_fmt);
- easrc->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
+ easrc->asrc_format = asrc_fmt;
if (ret) {
dev_err(dev, "failed to asrc format\n");
return ret;
diff --git a/sound/soc/fsl/fsl_qmc_audio.c b/sound/soc/fsl/fsl_qmc_audio.c
index d0f644573f49..f27934cf49da 100644
--- a/sound/soc/fsl/fsl_qmc_audio.c
+++ b/sound/soc/fsl/fsl_qmc_audio.c
@@ -503,8 +503,8 @@ static int qmc_dai_constraints_interleaved(struct snd_pcm_substream *substream,
return ret;
}
- access = 1ULL << (__force int)SNDRV_PCM_ACCESS_MMAP_INTERLEAVED |
- 1ULL << (__force int)SNDRV_PCM_ACCESS_RW_INTERLEAVED;
+ access = 1ULL << SNDRV_PCM_ACCESS_MMAP_INTERLEAVED |
+ 1ULL << SNDRV_PCM_ACCESS_RW_INTERLEAVED;
ret = snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_ACCESS,
access);
if (ret) {
@@ -532,8 +532,8 @@ static int qmc_dai_constraints_noninterleaved(struct snd_pcm_substream *substrea
return ret;
}
- access = 1ULL << (__force int)SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED |
- 1ULL << (__force int)SNDRV_PCM_ACCESS_RW_NONINTERLEAVED;
+ access = 1ULL << SNDRV_PCM_ACCESS_MMAP_NONINTERLEAVED |
+ 1ULL << SNDRV_PCM_ACCESS_RW_NONINTERLEAVED;
ret = snd_pcm_hw_constraint_mask64(substream->runtime, SNDRV_PCM_HW_PARAM_ACCESS,
access);
if (ret) {
diff --git a/sound/soc/fsl/imx-card.c b/sound/soc/fsl/imx-card.c
index 43438af1e1c6..e3cb1438e837 100644
--- a/sound/soc/fsl/imx-card.c
+++ b/sound/soc/fsl/imx-card.c
@@ -531,7 +531,7 @@ static int be_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
mask = hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT);
snd_mask_none(mask);
- snd_mask_set(mask, (__force unsigned int)data->asrc_format);
+ snd_mask_set(mask, data->asrc_format);
return 0;
}
@@ -684,7 +684,7 @@ static int imx_card_parse_of(struct imx_card_data *data)
}
ret = of_property_read_u32(args.np, "fsl,asrc-format", &asrc_fmt);
- data->asrc_format = (__force snd_pcm_format_t)asrc_fmt;
+ data->asrc_format = asrc_fmt;
if (ret) {
/* Fallback to old binding; translate to asrc_format */
ret = of_property_read_u32(args.np, "fsl,asrc-width", &width);
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 12/14] ASoC: Intel: avs: Drop __force cast
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (10 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 11/14] ASoC: fsl: " Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 7:12 ` Cezary Rojewski
2026-08-12 6:04 ` [PATCH 13/14] ASoC: mediatek: Drop __force casts Takashi Iwai
` (2 subsequent siblings)
14 siblings, 1 reply; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound; +Cc: Cezary Rojewski, Mark Brown
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop a superfluous cast.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/intel/avs/probes.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/intel/avs/probes.c b/sound/soc/intel/avs/probes.c
index 099119ad28b3..74096236984a 100644
--- a/sound/soc/intel/avs/probes.c
+++ b/sound/soc/intel/avs/probes.c
@@ -144,7 +144,7 @@ static int avs_probe_compr_set_params(struct snd_compr_stream *cstream,
ret = snd_compr_malloc_pages(cstream, rtd->buffer_size);
if (ret < 0)
return ret;
- bps = snd_pcm_format_physical_width((__force snd_pcm_format_t)params->codec.format);
+ bps = snd_pcm_format_physical_width(params->codec.format);
if (bps < 0)
return bps;
format_val = snd_hdac_stream_format(params->codec.ch_out, bps, params->codec.sample_rate);
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 13/14] ASoC: mediatek: Drop __force casts
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (11 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 12/14] ASoC: Intel: avs: Drop __force cast Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 6:04 ` [PATCH 14/14] ASoC: meson: Drop __force cast Takashi Iwai
2026-08-12 7:27 ` [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Cezary Rojewski
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound; +Cc: Mark Brown
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop those superfluous casts.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c | 4 ++--
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c | 4 ++--
sound/soc/mediatek/mt8186/mt8186-mt6366.c | 2 +-
sound/soc/mediatek/mt8188/mt8188-mt6359.c | 2 +-
sound/soc/mediatek/mt8189/mt8189-nau8825.c | 2 +-
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c | 2 +-
sound/soc/mediatek/mt8195/mt8195-mt6359.c | 4 ++--
sound/soc/mediatek/mt8196/mt8196-nau8825.c | 2 +-
8 files changed, 11 insertions(+), 11 deletions(-)
diff --git a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
index 983f3b91119a..aa3d1a588479 100644
--- a/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
+++ b/sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c
@@ -172,7 +172,7 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
{
/* fix BE i2s format to S32_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
@@ -184,7 +184,7 @@ static int mt8183_rt1015_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
{
/* fix BE i2s format to S24_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
diff --git a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
index 0bc1f11e17aa..dea7ad167a49 100644
--- a/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
+++ b/sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c
@@ -99,7 +99,7 @@ static int mt8183_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
/* fix BE i2s format to S32_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
return 0;
@@ -112,7 +112,7 @@ static int mt8183_rt1015_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
/* fix BE i2s format to S24_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
return 0;
diff --git a/sound/soc/mediatek/mt8186/mt8186-mt6366.c b/sound/soc/mediatek/mt8186/mt8186-mt6366.c
index 22123b087c3c..b68f474b63f4 100644
--- a/sound/soc/mediatek/mt8186/mt8186-mt6366.c
+++ b/sound/soc/mediatek/mt8186/mt8186-mt6366.c
@@ -387,7 +387,7 @@ static int mt8186_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
/* clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, fmt);
diff --git a/sound/soc/mediatek/mt8188/mt8188-mt6359.c b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
index 55ebac0c3cef..75c90d1d165f 100644
--- a/sound/soc/mediatek/mt8188/mt8188-mt6359.c
+++ b/sound/soc/mediatek/mt8188/mt8188-mt6359.c
@@ -623,7 +623,7 @@ static int mt8188_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
{
/* fix BE i2s format to 32bit, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
diff --git a/sound/soc/mediatek/mt8189/mt8189-nau8825.c b/sound/soc/mediatek/mt8189/mt8189-nau8825.c
index e849e7a649bc..5d652d0cf01e 100644
--- a/sound/soc/mediatek/mt8189/mt8189-nau8825.c
+++ b/sound/soc/mediatek/mt8189/mt8189-nau8825.c
@@ -174,7 +174,7 @@ static int mt8189_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
/* fix BE i2s format to 32bit, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
diff --git a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
index 91c57765ab57..8af8b0a366d5 100644
--- a/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
+++ b/sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c
@@ -382,7 +382,7 @@ static int mt8192_i2s_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
{
/* fix BE i2s format to S24_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
diff --git a/sound/soc/mediatek/mt8195/mt8195-mt6359.c b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
index 4d62bc654a58..fc293ca71502 100644
--- a/sound/soc/mediatek/mt8195/mt8195-mt6359.c
+++ b/sound/soc/mediatek/mt8195/mt8195-mt6359.c
@@ -387,7 +387,7 @@ static int mt8195_dptx_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
{
/* fix BE i2s format to S24_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
@@ -650,7 +650,7 @@ static int mt8195_etdm_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
{
/* fix BE i2s format to S24_LE, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S24_LE);
diff --git a/sound/soc/mediatek/mt8196/mt8196-nau8825.c b/sound/soc/mediatek/mt8196/mt8196-nau8825.c
index c9424786c53d..1d1dad86365b 100644
--- a/sound/soc/mediatek/mt8196/mt8196-nau8825.c
+++ b/sound/soc/mediatek/mt8196/mt8196-nau8825.c
@@ -180,7 +180,7 @@ static int mt8196_hw_params_fixup(struct snd_soc_pcm_runtime *rtd,
/* fix BE i2s format to 32bit, clean param mask first */
snd_mask_reset_range(hw_param_mask(params, SNDRV_PCM_HW_PARAM_FORMAT),
- 0, (__force unsigned int)SNDRV_PCM_FORMAT_LAST);
+ 0, SNDRV_PCM_FORMAT_LAST);
params_set_format(params, SNDRV_PCM_FORMAT_S32_LE);
return 0;
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* [PATCH 14/14] ASoC: meson: Drop __force cast
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (12 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 13/14] ASoC: mediatek: Drop __force casts Takashi Iwai
@ 2026-08-12 6:04 ` Takashi Iwai
2026-08-12 7:27 ` [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Cezary Rojewski
14 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 6:04 UTC (permalink / raw)
To: linux-sound; +Cc: Jerome Brunet, Mark Brown
Now that the bitwise parameter definitions are gone for PCM
parameters, we don't have to cast with ugly __force prefix.
Simply drop a superfluous cast.
Signed-off-by: Takashi Iwai <tiwai@suse.de>
---
sound/soc/meson/meson-codec-glue.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/sound/soc/meson/meson-codec-glue.c b/sound/soc/meson/meson-codec-glue.c
index 2ff6066e1b6c..8773bf06e154 100644
--- a/sound/soc/meson/meson-codec-glue.c
+++ b/sound/soc/meson/meson-codec-glue.c
@@ -74,7 +74,7 @@ int meson_codec_glue_input_hw_params(struct snd_pcm_substream *substream,
data->params.rates = snd_pcm_rate_to_rate_bit(params_rate(params));
data->params.rate_min = params_rate(params);
data->params.rate_max = params_rate(params);
- data->params.formats = 1ULL << (__force int) params_format(params);
+ data->params.formats = 1ULL << params_format(params);
data->params.channels_min = params_channels(params);
data->params.channels_max = params_channels(params);
data->params.sig_bits = dai->driver->playback.sig_bits;
--
2.55.0
^ permalink raw reply related [flat|nested] 18+ messages in thread
* Re: [PATCH 12/14] ASoC: Intel: avs: Drop __force cast
2026-08-12 6:04 ` [PATCH 12/14] ASoC: Intel: avs: Drop __force cast Takashi Iwai
@ 2026-08-12 7:12 ` Cezary Rojewski
0 siblings, 0 replies; 18+ messages in thread
From: Cezary Rojewski @ 2026-08-12 7:12 UTC (permalink / raw)
To: Takashi Iwai; +Cc: Mark Brown, linux-sound
On 8/12/2026 8:04 AM, Takashi Iwai wrote:
> Now that the bitwise parameter definitions are gone for PCM
> parameters, we don't have to cast with ugly __force prefix.
> Simply drop a superfluous cast.
>
> Signed-off-by: Takashi Iwai <tiwai@suse.de>
A very welcomed change.
Acked-by: Cezary Rojewski <cezary.rojewski@intel.com>
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/14] ALSA: Drop __bitwise and __force prefix
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
` (13 preceding siblings ...)
2026-08-12 6:04 ` [PATCH 14/14] ASoC: meson: Drop __force cast Takashi Iwai
@ 2026-08-12 7:27 ` Cezary Rojewski
2026-08-12 7:34 ` Takashi Iwai
14 siblings, 1 reply; 18+ messages in thread
From: Cezary Rojewski @ 2026-08-12 7:27 UTC (permalink / raw)
To: Takashi Iwai
Cc: Fabio Estevam, Jerome Brunet, Mark Brown, Nicolin Chen,
Shengjiu Wang, Xiubo Li, linux-sound
On 8/12/2026 8:04 AM, Takashi Iwai wrote:
> Hi,
>
> this is a series of cleanup patches to kill the infamous __bitwise and
> __force prefix usage for some PCM and control parameter types.
> They were added ages ago just for code safety, but its effect is quite
> limited, while the drawback is significant. Let's drop them.
Thank you for cleaning this up. For the series:
Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
sidetopic: Had to review via web browser as only 2 patches (00 and 12)
went through to my inbox for whatever reason.
Kind regards,
Czarek
^ permalink raw reply [flat|nested] 18+ messages in thread
* Re: [PATCH 00/14] ALSA: Drop __bitwise and __force prefix
2026-08-12 7:27 ` [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Cezary Rojewski
@ 2026-08-12 7:34 ` Takashi Iwai
0 siblings, 0 replies; 18+ messages in thread
From: Takashi Iwai @ 2026-08-12 7:34 UTC (permalink / raw)
To: Cezary Rojewski
Cc: Takashi Iwai, Fabio Estevam, Jerome Brunet, Mark Brown,
Nicolin Chen, Shengjiu Wang, Xiubo Li, linux-sound
On Wed, 12 Aug 2026 09:27:21 +0200,
Cezary Rojewski wrote:
>
> On 8/12/2026 8:04 AM, Takashi Iwai wrote:
> > Hi,
> >
> > this is a series of cleanup patches to kill the infamous __bitwise and
> > __force prefix usage for some PCM and control parameter types.
> > They were added ages ago just for code safety, but its effect is quite
> > limited, while the drawback is significant. Let's drop them.
> Thank you for cleaning this up. For the series:
>
> Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
>
>
> sidetopic: Had to review via web browser as only 2 patches (00 and 12)
> went through to my inbox for whatever reason.
It was intentional, I tried to reduce Cc only for a relevant patch and
a cover letter, as people often complaining when receiving unrelated
patches. The whole series should be available via ML, though.
thanks,
Takashi
^ permalink raw reply [flat|nested] 18+ messages in thread
end of thread, other threads:[~2026-08-12 7:34 UTC | newest]
Thread overview: 18+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2026-08-12 6:04 [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Takashi Iwai
2026-08-12 6:04 ` [PATCH 01/14] ALSA: uapi: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 02/14] ALSA: pcm: Drop __force casts Takashi Iwai
2026-08-12 6:04 ` [PATCH 03/14] ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBIT Takashi Iwai
2026-08-12 6:04 ` [PATCH 04/14] ALSA: control: Drop __force casts Takashi Iwai
2026-08-12 6:04 ` [PATCH 05/14] ALSA: oss: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 06/14] ALSA: kunit: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 07/14] ALSA: aloop: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 08/14] ALSA: hda: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 09/14] ALSA: asihpi: Drop __force cast Takashi Iwai
2026-08-12 6:04 ` [PATCH 10/14] ALSA: emu10k1: Drop __force casts Takashi Iwai
2026-08-12 6:04 ` [PATCH 11/14] ASoC: fsl: " Takashi Iwai
2026-08-12 6:04 ` [PATCH 12/14] ASoC: Intel: avs: Drop __force cast Takashi Iwai
2026-08-12 7:12 ` Cezary Rojewski
2026-08-12 6:04 ` [PATCH 13/14] ASoC: mediatek: Drop __force casts Takashi Iwai
2026-08-12 6:04 ` [PATCH 14/14] ASoC: meson: Drop __force cast Takashi Iwai
2026-08-12 7:27 ` [PATCH 00/14] ALSA: Drop __bitwise and __force prefix Cezary Rojewski
2026-08-12 7:34 ` Takashi Iwai
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox