All of lore.kernel.org
 help / color / mirror / Atom feed
From: Sasha Levin <sashal@kernel.org>
To: stable@vger.kernel.org
Cc: Takashi Iwai <tiwai@suse.de>,
	Cezary Rojewski <cezary.rojewski@intel.com>,
	Sasha Levin <sashal@kernel.org>
Subject: [PATCH 6.18.y 1/2] ALSA: oss: Drop __force casts
Date: Fri,  4 Dec 2026 08:12:59 -0500	[thread overview]
Message-ID: <20261204131254.3092090-1-sashal@kernel.org> (raw)
In-Reply-To: <2026120327-nectar-tux-33da@gregkh>

From: Takashi Iwai <tiwai@suse.de>

[ Upstream commit 01edf81ac8577278ecbd9371078bc85f0baa65ac ]

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.

Reviewed-by: Cezary Rojewski <cezary.rojewski@intel.com>
Signed-off-by: Takashi Iwai <tiwai@suse.de>
Link: https://patch.msgid.link/20260812060557.80445-6-tiwai@suse.de
Stable-dep-of: ddea524e437e ("ALSA: pcm: oss: Refine slave hw_params after setting format")
Signed-off-by: Sasha Levin <sashal@kernel.org>
---
 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 108ce92b62ae1..0822572679eff 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -877,11 +877,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) {
@@ -907,7 +907,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) &&
@@ -919,7 +919,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;
 
@@ -928,9 +928,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,
@@ -1868,7 +1868,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 82e180c776ae1..fd2f26283e5d9 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -287,13 +287,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[] = {
@@ -322,20 +322,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)
@@ -349,21 +349,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.53.0


  reply	other threads:[~2026-12-04 13:13 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-12-03  3:44 FAILED: patch "[PATCH] ALSA: pcm: oss: Refine slave hw_params after setting format" failed to apply to 6.18-stable tree gregkh
2026-12-04 13:12 ` Sasha Levin [this message]
2026-12-04 13:13   ` [PATCH 6.18.y 2/2] ALSA: pcm: oss: Refine slave hw_params after setting format Sasha Levin

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20261204131254.3092090-1-sashal@kernel.org \
    --to=sashal@kernel.org \
    --cc=cezary.rojewski@intel.com \
    --cc=stable@vger.kernel.org \
    --cc=tiwai@suse.de \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.