ALSA: Drop __bitwise and __force prefix
Subsystems (10)
cover ALSA: Drop __bitwise and __force prefix
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(-)
Signature · 1 line
2.55.0
PATCH 1/14 ALSA: uapi: Drop __bitwise and __force prefix
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.
--- include/uapi/sound/asequencer.h | 8 +- include/uapi/sound/asound.h | 178 ++++++++++++++++---------------- 2 files changed, 93 insertions(+), 93 deletions(-)
include/uapi/sound/asequencer.h +4 -4
@@ -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 */
include/uapi/sound/asound.h +89 -89
212 lines not on this page · raw message
Signature · 1 line
2.55.0
PATCH 2/14 ALSA: pcm: Drop __force casts
In reply to Takashi IwaiNow 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.
--- 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(-)
include/sound/pcm.h +4 -6
@@ -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...) \
include/sound/pcm_params.h +5 -8
@@ -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 )); }/**
sound/core/pcm.c +5 -7
@@ -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 )
sound/core/pcm_misc.c +11 -14
@@ -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 intreturn -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 ;
sound/core/pcm_native.c +14 -14
@@ -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 0struct 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);
Signature · 1 line
2.55.0
PATCH 3/14 ALSA: pcm: Avoid macros for SNDRV_PCM_FMTBIT and SNDRV_PCM_SUBFMTBIT
In reply to Takashi IwaiAvoid 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.
--- include/sound/pcm.h | 112 ++++++++++++++++++++++---------------------- 1 file changed, 55 insertions(+), 57 deletions(-)
include/sound/pcm.h +55 -57
@@ -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;
Signature · 1 line
2.55.0
PATCH 4/14 ALSA: control: Drop __force casts
In reply to Takashi IwaiNow 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.
--- sound/core/control_compat.c | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-)
sound/core/control_compat.c +6 -6
@@ -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 ; }
Signature · 1 line
2.55.0
PATCH 5/14 ALSA: oss: Drop __force casts
In reply to Takashi IwaiNow 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.
--- sound/core/oss/pcm_oss.c | 16 ++++++++-------- sound/core/oss/pcm_plugin.c | 20 ++++++++++---------- 2 files changed, 18 insertions(+), 18 deletions(-)
sound/core/oss/pcm_oss.c +8 -8
@@ -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; }
sound/core/oss/pcm_plugin.c +10 -10
@@ -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 ; } } }
Signature · 1 line
2.55.0
PATCH 6/14 ALSA: kunit: Drop __force casts
In reply to Takashi IwaiNow 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
--- sound/core/sound_kunit.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/core/sound_kunit.c +2 -2
@@ -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"
Signature · 1 line
2.55.0
PATCH 7/14 ALSA: aloop: Drop __force casts
In reply to Takashi IwaiNow 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.
--- sound/drivers/aloop.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
sound/drivers/aloop.c +2 -2
@@ -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 ; }
Signature · 1 line
2.55.0
PATCH 8/14 ALSA: hda: Drop __force casts
In reply to Takashi IwaiNow 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.
--- sound/hda/common/codec.c | 2 +- sound/hda/core/device.c | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-)
sound/hda/common/codec.c +1 -1
@@ -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);
sound/hda/core/device.c +1 -1
@@ -765,7 +765,7 @@ unsigned int snd_hdac_stream_format_bits(snd_pcm_format_t format, snd_pcm_subforparams_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)
Signature · 1 line
2.55.0
PATCH 9/14 ALSA: asihpi: Drop __force cast
In reply to Takashi IwaiNow 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.
--- sound/pci/asihpi/asihpi.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/pci/asihpi/asihpi.c +1 -1
@@ -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 -1static const snd_pcm_format_t hpi_to_alsa_formats[] = {INVALID_FORMAT ,/* INVALID */
Signature · 1 line
2.55.0
PATCH 10/14 ALSA: emu10k1: Drop __force casts
In reply to Takashi IwaiNow 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.
--- sound/pci/emu10k1/emufx.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
sound/pci/emu10k1/emufx.c +9 -9
@@ -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 ;
Signature · 1 line
2.55.0
PATCH 11/14 ASoC: fsl: Drop __force casts
In reply to Takashi IwaiNow 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.
--- 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(-)
sound/soc/fsl/fsl-asoc-card.c +1 -1
@@ -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",
sound/soc/fsl/fsl_asrc.c +1 -1
@@ -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) {
sound/soc/fsl/fsl_asrc_m2m.c +5 -5
@@ -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 =
sound/soc/fsl/fsl_easrc.c +1 -1
@@ -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;
sound/soc/fsl/fsl_qmc_audio.c +4 -4
@@ -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 *substreareturn 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) {
sound/soc/fsl/imx-card.c +2 -2
@@ -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);
Signature · 1 line
2.55.0
Re: [PATCH 11/14] ASoC: fsl: Drop __force casts
Quoted 6 lines · Takashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly
__forceprefix. Simply drop those superfluous casts.Signed-off-by Takashi Iwai <[email protected]>
Best regards
Shengjiu Wang
Quoted 130 lines
--- 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(-)sound/soc/fsl/fsl-asoc-card.c +1
-1@@ -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",sound/soc/fsl/fsl_asrc.c +1
-1@@ -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) {sound/soc/fsl/fsl_asrc_m2m.c +5
-5@@ -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 =sound/soc/fsl/fsl_easrc.c +1
-1@@ -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;sound/soc/fsl/fsl_qmc_audio.c +4
-4@@ -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 *substreareturn 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) {sound/soc/fsl/imx-card.c +2
-3@@ -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
Re: [PATCH 11/14] ASoC: fsl: Drop __force casts
In reply to Takashi IwaiQuoted 3 lines · Takashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly
__forceprefix. Simply drop those superfluous casts.
PATCH 12/14 ASoC: Intel: avs: Drop __force cast
In reply to Takashi IwaiNow 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.
--- sound/soc/intel/avs/probes.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/intel/avs/probes.c +1 -1
@@ -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);
Signature · 1 line
2.55.0
Re: [PATCH 12/14] ASoC: Intel: avs: Drop __force cast
Quoted 5 lines · Takashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly
__forceprefix. Simply drop a superfluous cast.Signed-off-by Takashi Iwai <[email protected]>
A very welcomed change.
Re: [PATCH 12/14] ASoC: Intel: avs: Drop __force cast
In reply to Takashi IwaiQuoted 3 lines · Takashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly
__forceprefix. Simply drop a superfluous cast.
PATCH 13/14 ASoC: mediatek: Drop __force casts
In reply to Takashi IwaiNow 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.
--- 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(-)
sound/soc/mediatek/mt8183/mt8183-da7219-max98357.c +2 -2
@@ -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 );
sound/soc/mediatek/mt8183/mt8183-mt6358-ts3a227-max98357.c +2 -2
@@ -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 ;
sound/soc/mediatek/mt8186/mt8186-mt6366.c +1 -1
@@ -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);
sound/soc/mediatek/mt8188/mt8188-mt6359.c +1 -1
@@ -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 );
sound/soc/mediatek/mt8189/mt8189-nau8825.c +1 -1
@@ -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 );
sound/soc/mediatek/mt8192/mt8192-mt6359-rt1015-rt5682.c +1 -1
@@ -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 );
sound/soc/mediatek/mt8195/mt8195-mt6359.c +2 -2
@@ -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 );
sound/soc/mediatek/mt8196/mt8196-nau8825.c +1 -1
@@ -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 ;
Signature · 1 line
2.55.0
Re: [PATCH 13/14] ASoC: mediatek: Drop __force casts
Quoted 3 lines · Takashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly
__forceprefix. Simply drop those superfluous casts.
PATCH 14/14 ASoC: meson: Drop __force cast
In reply to Takashi IwaiNow 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.
--- sound/soc/meson/meson-codec-glue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
sound/soc/meson/meson-codec-glue.c +1 -1
@@ -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;
Signature · 1 line
2.55.0
Re: [PATCH 14/14] ASoC: meson: Drop __force cast
Quoted 3 lines · Takashi Iwai
Now that the bitwise parameter definitions are gone for PCM parameters, we don't have to cast with ugly
__forceprefix. Simply drop a superfluous cast.
Quoted 6 lines · Takashi Iwai
Hi,
this is a series of cleanup patches to kill the infamous
__bitwiseand__forceprefix 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:
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
Quoted 8 lines · Cezary Rojewski
Quoted 6 lines · Takashi Iwai
Hi,
this is a series of cleanup patches to kill the infamous
__bitwiseand__forceprefix 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.
Quoted 7 lines
Thank you for cleaning this up. For the series:
Reviewed-by Cezary Rojewski <[email protected]>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