From: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
To: Len Brown <lenb@kernel.org>
Cc: linux-acpi@vger.kernel.org, ibm-acpi-devel@lists.sourceforge.net,
Henrique de Moraes Holschuh <hmh@hmh.eng.br>
Subject: [PATCH 2/5] thinkpad-acpi: don't fail to load the entire module due to ALSA problems
Date: Sat, 26 Dec 2009 22:52:14 -0200 [thread overview]
Message-ID: <1261875137-27565-3-git-send-email-hmh@hmh.eng.br> (raw)
In-Reply-To: <1261875137-27565-1-git-send-email-hmh@hmh.eng.br>
If we cannot create the ALSA mixer, it is a good reason to fail to
load the volume subdriver, and not to fail to load the entire module.
While at it, add more debugging messages, as the error paths are being
used a lot more than I'd expect, and it is failing to set up the ALSA
mixer on a number of ThinkPads.
Reported-by: Peter Jordan <usernetwork@gmx.info>
Signed-off-by: Henrique de Moraes Holschuh <hmh@hmh.eng.br>
---
drivers/platform/x86/thinkpad_acpi.c | 31 ++++++++++++++++++-------------
1 files changed, 18 insertions(+), 13 deletions(-)
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 3311b00..9b7da9c 100644
--- a/drivers/platform/x86/thinkpad_acpi.c
+++ b/drivers/platform/x86/thinkpad_acpi.c
@@ -6705,10 +6705,11 @@ static int __init volume_create_alsa_mixer(void)
rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,
sizeof(struct tpacpi_alsa_data), &card);
- if (rc < 0)
- return rc;
- if (!card)
- return -ENOMEM;
+ if (rc < 0 || !card) {
+ printk(TPACPI_ERR
+ "Failed to create ALSA card structures: %d\n", rc);
+ return 1;
+ }
BUG_ON(!card->private_data);
data = card->private_data;
@@ -6741,8 +6742,9 @@ static int __init volume_create_alsa_mixer(void)
rc = snd_ctl_add(card, ctl_vol);
if (rc < 0) {
printk(TPACPI_ERR
- "Failed to create ALSA volume control\n");
- goto err_out;
+ "Failed to create ALSA volume control: %d\n",
+ rc);
+ goto err_exit;
}
data->ctl_vol_id = &ctl_vol->id;
}
@@ -6750,22 +6752,25 @@ static int __init volume_create_alsa_mixer(void)
ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL);
rc = snd_ctl_add(card, ctl_mute);
if (rc < 0) {
- printk(TPACPI_ERR "Failed to create ALSA mute control\n");
- goto err_out;
+ printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n",
+ rc);
+ goto err_exit;
}
data->ctl_mute_id = &ctl_mute->id;
snd_card_set_dev(card, &tpacpi_pdev->dev);
rc = snd_card_register(card);
-
-err_out:
if (rc < 0) {
- snd_card_free(card);
- card = NULL;
+ printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc);
+ goto err_exit;
}
alsa_card = card;
- return rc;
+ return 0;
+
+err_exit:
+ snd_card_free(card);
+ return 1;
}
#define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */
--
1.6.5.7
next prev parent reply other threads:[~2009-12-27 0:52 UTC|newest]
Thread overview: 15+ messages / expand[flat|nested] mbox.gz Atom feed top
2009-12-27 0:52 [GIT PATCH] thinkpad-acpi fixes for 2.6.32-rc2 Henrique de Moraes Holschuh
2009-12-27 0:52 ` [PATCH 1/5] thinkpad-acpi: don't take the first ALSA slot by default Henrique de Moraes Holschuh
2009-12-27 0:52 ` Henrique de Moraes Holschuh [this message]
2009-12-27 0:52 ` [PATCH 3/5] thinkpad-acpi: make volume subdriver optional Henrique de Moraes Holschuh
2009-12-27 9:38 ` Takashi Iwai
[not found] ` <s5hr5qgvjsa.wl%tiwai-l3A5Bk7waGM@public.gmane.org>
2009-12-27 18:32 ` Henrique de Moraes Holschuh
2009-12-27 22:37 ` Ian Molton
2009-12-28 13:17 ` Henrique de Moraes Holschuh
[not found] ` <20091228131744.GC19362-ZGHd14iZgfaRjzvQDGKj+xxZW9W5cXbT@public.gmane.org>
2009-12-28 21:30 ` Jerone Young
2009-12-27 0:52 ` [PATCH 4/5] thinkpad-acpi: update volume documentation Henrique de Moraes Holschuh
2009-12-27 0:52 ` [PATCH 5/5] thinkpad-acpi: improve Kconfig help text Henrique de Moraes Holschuh
2009-12-28 13:30 ` tytso
2009-12-28 13:35 ` Henrique de Moraes Holschuh
2009-12-29 14:21 ` tytso
2009-12-27 3:41 ` [GIT PATCH] thinkpad-acpi fixes for 2.6.32-rc2 Len Brown
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=1261875137-27565-3-git-send-email-hmh@hmh.eng.br \
--to=hmh@hmh.eng.br \
--cc=ibm-acpi-devel@lists.sourceforge.net \
--cc=lenb@kernel.org \
--cc=linux-acpi@vger.kernel.org \
/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.