[alsa-devel] [PATCH 5/6] bebob: Correction for return value of .put callback functions
Takashi Sakamoto
o-takashi at sakamocchi.jp
Mon Jul 21 04:10:04 CEST 2014
This commit is for correction of my misunderstanding for return value of
.put callback of ALSA Control interface.
According to 'Writing ALSA Driver' (*1), return value of the callback has
three patterns; 1: changed, 0: not changed, an negative value: fatal error.
But I misunderstood that it's boolean; zero or nonzero.
*1: Writing an ALSA Driver (2005, Takashi Iwai)
http://www.alsa-project.org/main/index.php/ALSA_Driver_Documentation
Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
---
sound/firewire/bebob/bebob_maudio.c | 12 ++++++++++--
1 file changed, 10 insertions(+), 2 deletions(-)
diff --git a/sound/firewire/bebob/bebob_maudio.c b/sound/firewire/bebob/bebob_maudio.c
index f2277ce..acfe94a 100644
--- a/sound/firewire/bebob/bebob_maudio.c
+++ b/sound/firewire/bebob/bebob_maudio.c
@@ -396,8 +396,10 @@ static int special_clk_ctl_set(struct snd_kcontrol *kctl,
if (err < 0)
dev_err(&bebob->unit->device,
"fail to change clock source: %d\n", err);
+ else
+ err = 1;
- return err >= 0;
+ return err;
}
static struct snd_kcontrol_new special_clk_ctl = {
.name = "Clock Source",
@@ -519,13 +521,17 @@ static int special_dig_in_iface_ctl_set(struct snd_kcontrol *kctl,
}
/* For ADAT, optical interface is only available. */
- if (params->dig_in_fmt > 0)
+ if (params->dig_in_fmt > 0) {
+ err = 1;
goto end;
+ }
err = avc_audio_set_selector(bebob->unit, 0x00, 0x04, dig_in_iface);
if (err < 0)
dev_err(&bebob->unit->device,
"fail to set digital input interface: %d\n", err);
+ else
+ err = 1;
end:
mutex_unlock(&bebob->mutex);
return err;
@@ -592,6 +598,8 @@ static int special_dig_out_iface_ctl_set(struct snd_kcontrol *kctl,
if (err < 0)
dev_err(&bebob->unit->device,
"fail to change digital output interface: %d\n", err);
+ else
+ err = 1;
return err;
}
--
1.9.1
More information about the Alsa-devel
mailing list