summaryrefslogtreecommitdiffstats
path: root/sound/pci/hda/tas2781_hda_i2c.c
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@linux-foundation.org>2023-09-08 13:07:50 -0700
committerLinus Torvalds <torvalds@linux-foundation.org>2023-09-08 13:07:50 -0700
commita3d231e44ab827345d24973a621e9364949423a4 (patch)
treebc1b5c45b7441d0b28bdbf7707088af13cc31faa /sound/pci/hda/tas2781_hda_i2c.c
parentca9c7abf9502e108fae0e34181e01b1a20bc439f (diff)
parentecc8b4d0b6e19031733f28537971f8c5088dada2 (diff)
downloadlinux-stable-a3d231e44ab827345d24973a621e9364949423a4.tar.gz
linux-stable-a3d231e44ab827345d24973a621e9364949423a4.tar.bz2
linux-stable-a3d231e44ab827345d24973a621e9364949423a4.zip
Merge tag 'sound-fix-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound
Pull sound fixes from Takashi Iwai: "A collection of fixes for 6.6-rc1. All small and easy ones. - The corrections of the previous PCM iov_iter transitions - Regression fixes in MIDI 2.0 / USB changes - Various ASoC codec fixes for Cirrus, Realtek, WCD - ASoC AMD quirks and ASoC Intel AVS driver workaround" * tag 'sound-fix-6.6-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/tiwai/sound: (21 commits) ALSA: hda/realtek - ALC287 I2S speaker platform support ASoC: amd: yc: Fix a non-functional mic on Lenovo 82TL ASoC: Intel: avs: Provide support for fallback topology ALSA: seq: Fix snd_seq_expand_var_event() call to user-space ALSA: usb-audio: Fix potential memory leaks at error path for UMP open ALSA: hda/cirrus: Fix broken audio on hardware with two CS42L42 codecs. ASoC: rt5645: NULL pointer access when removing jack ASoC: amd: yc: Add DMI entries to support Victus by HP Gaming Laptop 15-fb0xxx (8A3E) MAINTAINERS: Update the MAINTAINERS enties for TEXAS INSTRUMENTS ASoC DRIVERS ALSA: sb: Fix wrong argument in commented code ALSA: pcm: Fix error checks of default read/write copy ops ASoC: Name iov_iter argument as iterator instead of buffer ASoC: dmaengine: Drop unused iov_iter for process callback ALSA: hda/tas2781: Use standard clamp() macro ASoC: cs35l56: Waiting for firmware to boot must be tolerant of I/O errors ASoC: dt-bindings: fsl_easrc: Add support for imx8mp-easrc ASoC: cs42l43: Fix missing error code in cs42l43_codec_probe() ASoC: cs35l45: Rename DACPCM1 Source control ASoC: cs35l45: Fix "Dead assigment" warning ASoC: cs35l45: Add support for Chip ID 0x35A460 ...
Diffstat (limited to 'sound/pci/hda/tas2781_hda_i2c.c')
-rw-r--r--sound/pci/hda/tas2781_hda_i2c.c16
1 files changed, 3 insertions, 13 deletions
diff --git a/sound/pci/hda/tas2781_hda_i2c.c b/sound/pci/hda/tas2781_hda_i2c.c
index 37114fd61a38..fb802802939e 100644
--- a/sound/pci/hda/tas2781_hda_i2c.c
+++ b/sound/pci/hda/tas2781_hda_i2c.c
@@ -173,16 +173,6 @@ static int tasdevice_get_profile_id(struct snd_kcontrol *kcontrol,
return 0;
}
-static int tasdevice_hda_clamp(int val, int max)
-{
- if (val > max)
- val = max;
-
- if (val < 0)
- val = 0;
- return val;
-}
-
static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
struct snd_ctl_elem_value *ucontrol)
{
@@ -191,7 +181,7 @@ static int tasdevice_set_profile_id(struct snd_kcontrol *kcontrol,
int max = tas_priv->rcabin.ncfgs - 1;
int val, ret = 0;
- val = tasdevice_hda_clamp(nr_profile, max);
+ val = clamp(nr_profile, 0, max);
if (tas_priv->rcabin.profile_cfg_id != val) {
tas_priv->rcabin.profile_cfg_id = val;
@@ -248,7 +238,7 @@ static int tasdevice_program_put(struct snd_kcontrol *kcontrol,
int max = tas_fw->nr_programs - 1;
int val, ret = 0;
- val = tasdevice_hda_clamp(nr_program, max);
+ val = clamp(nr_program, 0, max);
if (tas_priv->cur_prog != val) {
tas_priv->cur_prog = val;
@@ -277,7 +267,7 @@ static int tasdevice_config_put(struct snd_kcontrol *kcontrol,
int max = tas_fw->nr_configurations - 1;
int val, ret = 0;
- val = tasdevice_hda_clamp(nr_config, max);
+ val = clamp(nr_config, 0, max);
if (tas_priv->cur_conf != val) {
tas_priv->cur_conf = val;