aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/platform/x86/thinkpad_acpi.c
diff options
context:
space:
mode:
authorHenrique de Moraes Holschuh <hmh@hmh.eng.br>2009-12-26 19:52:14 -0500
committerLen Brown <len.brown@intel.com>2009-12-26 22:37:20 -0500
commit74c75c1848b618f6717c1be887ad539ffac2e96d (patch)
tree743bed97884b102b30a41612c960502eecda9e27 /drivers/platform/x86/thinkpad_acpi.c
parentead510cebcdf41c92fce2a909f342255b028a33d (diff)
thinkpad-acpi: don't fail to load the entire module due to ALSA problems
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> Signed-off-by: Len Brown <len.brown@intel.com>
Diffstat (limited to 'drivers/platform/x86/thinkpad_acpi.c')
-rw-r--r--drivers/platform/x86/thinkpad_acpi.c31
1 files changed, 18 insertions, 13 deletions
diff --git a/drivers/platform/x86/thinkpad_acpi.c b/drivers/platform/x86/thinkpad_acpi.c
index 3311b002056..9b7da9c96e7 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)
6705 6705
6706 rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE, 6706 rc = snd_card_create(alsa_index, alsa_id, THIS_MODULE,
6707 sizeof(struct tpacpi_alsa_data), &card); 6707 sizeof(struct tpacpi_alsa_data), &card);
6708 if (rc < 0) 6708 if (rc < 0 || !card) {
6709 return rc; 6709 printk(TPACPI_ERR
6710 if (!card) 6710 "Failed to create ALSA card structures: %d\n", rc);
6711 return -ENOMEM; 6711 return 1;
6712 }
6712 6713
6713 BUG_ON(!card->private_data); 6714 BUG_ON(!card->private_data);
6714 data = card->private_data; 6715 data = card->private_data;
@@ -6741,8 +6742,9 @@ static int __init volume_create_alsa_mixer(void)
6741 rc = snd_ctl_add(card, ctl_vol); 6742 rc = snd_ctl_add(card, ctl_vol);
6742 if (rc < 0) { 6743 if (rc < 0) {
6743 printk(TPACPI_ERR 6744 printk(TPACPI_ERR
6744 "Failed to create ALSA volume control\n"); 6745 "Failed to create ALSA volume control: %d\n",
6745 goto err_out; 6746 rc);
6747 goto err_exit;
6746 } 6748 }
6747 data->ctl_vol_id = &ctl_vol->id; 6749 data->ctl_vol_id = &ctl_vol->id;
6748 } 6750 }
@@ -6750,22 +6752,25 @@ static int __init volume_create_alsa_mixer(void)
6750 ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL); 6752 ctl_mute = snd_ctl_new1(&volume_alsa_control_mute, NULL);
6751 rc = snd_ctl_add(card, ctl_mute); 6753 rc = snd_ctl_add(card, ctl_mute);
6752 if (rc < 0) { 6754 if (rc < 0) {
6753 printk(TPACPI_ERR "Failed to create ALSA mute control\n"); 6755 printk(TPACPI_ERR "Failed to create ALSA mute control: %d\n",
6754 goto err_out; 6756 rc);
6757 goto err_exit;
6755 } 6758 }
6756 data->ctl_mute_id = &ctl_mute->id; 6759 data->ctl_mute_id = &ctl_mute->id;
6757 6760
6758 snd_card_set_dev(card, &tpacpi_pdev->dev); 6761 snd_card_set_dev(card, &tpacpi_pdev->dev);
6759 rc = snd_card_register(card); 6762 rc = snd_card_register(card);
6760
6761err_out:
6762 if (rc < 0) { 6763 if (rc < 0) {
6763 snd_card_free(card); 6764 printk(TPACPI_ERR "Failed to register ALSA card: %d\n", rc);
6764 card = NULL; 6765 goto err_exit;
6765 } 6766 }
6766 6767
6767 alsa_card = card; 6768 alsa_card = card;
6768 return rc; 6769 return 0;
6770
6771err_exit:
6772 snd_card_free(card);
6773 return 1;
6769} 6774}
6770 6775
6771#define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */ 6776#define TPACPI_VOL_Q_MUTEONLY 0x0001 /* Mute-only control available */