[alsa-devel] [PATCH] ALSA: control: obsolete 'already present' messaging because it's caller's fault
Takashi Iwai
tiwai at suse.de
Sun Feb 8 12:16:33 CET 2015
At Sun, 8 Feb 2015 19:29:08 +0900,
Takashi Sakamoto wrote:
>
> When drivers or userspace applications add a duplicated control, snd
> module outputs error message and return -EBUSY.
>
> This state is a bug in driver or application, therefore the messaging
> should be done by them, not by snd module.
The message should be hidden for user-space actions, indeed, but it's
been very helpful for the driver developments, so I'm against the
unconditional removal.
Also, think what you really suggested: there are almost 500 calls of
snd_ctl_add() in the tree and you suggest to put the error message to
each of them.
Rather try to show the error only for the kernel snd_ctl_add() calls.
thanks,
Takashi
>
> Signed-off-by: Takashi Sakamoto <o-takashi at sakamocchi.jp>
> ---
> sound/core/control.c | 9 +--------
> 1 file changed, 1 insertion(+), 8 deletions(-)
>
> diff --git a/sound/core/control.c b/sound/core/control.c
> index d482997..8906b66 100644
> --- a/sound/core/control.c
> +++ b/sound/core/control.c
> @@ -357,18 +357,10 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
>
> down_write(&card->controls_rwsem);
> if (snd_ctl_find_id(card, &id)) {
> - up_write(&card->controls_rwsem);
> - dev_err(card->dev, "control %i:%i:%i:%s:%i is already present\n",
> - id.iface,
> - id.device,
> - id.subdevice,
> - id.name,
> - id.index);
> err = -EBUSY;
> goto error;
> }
> if (snd_ctl_find_hole(card, kcontrol->count) < 0) {
> - up_write(&card->controls_rwsem);
> err = -ENOMEM;
> goto error;
> }
> @@ -388,6 +380,7 @@ int snd_ctl_add(struct snd_card *card, struct snd_kcontrol *kcontrol)
> return 0;
>
> error:
> + up_write(&card->controls_rwsem);
> snd_ctl_free_one(kcontrol);
> return err;
> }
> --
> 2.1.0
>
More information about the Alsa-devel
mailing list