aboutsummaryrefslogtreecommitdiffstats
path: root/sound
diff options
context:
space:
mode:
Diffstat (limited to 'sound')
-rw-r--r--sound/Kconfig12
-rw-r--r--sound/Makefile3
-rw-r--r--sound/ac97_bus.c (renamed from sound/pci/ac97/ac97_bus.c)0
-rw-r--r--sound/aoa/aoa-gpio.h2
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-tas.c13
-rw-r--r--sound/aoa/core/snd-aoa-gpio-feature.c16
-rw-r--r--sound/aoa/core/snd-aoa-gpio-pmf.c16
-rw-r--r--sound/arm/sa11xx-uda1341.c2
-rw-r--r--sound/core/control.c4
-rw-r--r--sound/core/info.c7
-rw-r--r--sound/core/init.c8
-rw-r--r--sound/core/oss/pcm_oss.c3
-rw-r--r--sound/core/pcm.c7
-rw-r--r--sound/core/pcm_native.c18
-rw-r--r--sound/core/rtctimer.c20
-rw-r--r--sound/core/sound.c22
-rw-r--r--sound/drivers/Kconfig6
-rw-r--r--sound/i2c/other/ak4114.c8
-rw-r--r--sound/isa/Kconfig1
-rw-r--r--sound/isa/ad1816a/ad1816a.c2
-rw-r--r--sound/isa/cmi8330.c2
-rw-r--r--sound/isa/gus/interwave.c2
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c2
-rw-r--r--sound/oss/Kconfig115
-rw-r--r--sound/oss/btaudio.c2
-rw-r--r--sound/oss/cs46xx.c7
-rw-r--r--sound/oss/dmabuf.c1
-rw-r--r--sound/oss/dmasound/dmasound_core.c4
-rw-r--r--sound/oss/emu10k1/audio.c9
-rw-r--r--sound/oss/emu10k1/cardwi.c31
-rw-r--r--sound/oss/emu10k1/cardwi.h2
-rw-r--r--sound/oss/emu10k1/passthrough.c13
-rw-r--r--sound/oss/es1371.c1
-rw-r--r--sound/oss/i810_audio.c1
-rw-r--r--sound/oss/msnd_pinnacle.c4
-rw-r--r--sound/oss/sh_dac_audio.c2
-rw-r--r--sound/oss/soundcard.c25
-rw-r--r--sound/oss/sscape.c1
-rw-r--r--sound/oss/trident.c1
-rw-r--r--sound/oss/via82cxxx_audio.c4
-rw-r--r--sound/pci/ac97/Makefile2
-rw-r--r--sound/pci/ac97/ac97_codec.c15
-rw-r--r--sound/pci/ali5451/ali5451.c11
-rw-r--r--sound/pci/als300.c11
-rw-r--r--sound/pci/als4000.c11
-rw-r--r--sound/pci/atiixp.c11
-rw-r--r--sound/pci/atiixp_modem.c11
-rw-r--r--sound/pci/azt3328.c11
-rw-r--r--sound/pci/cmipci.c11
-rw-r--r--sound/pci/cs4281.c9
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c11
-rw-r--r--sound/pci/cs5535audio/cs5535audio_pm.c11
-rw-r--r--sound/pci/emu10k1/emu10k1.c13
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c1
-rw-r--r--sound/pci/ens1370.c12
-rw-r--r--sound/pci/es1938.c29
-rw-r--r--sound/pci/es1968.c71
-rw-r--r--sound/pci/fm801.c11
-rw-r--r--sound/pci/hda/hda_codec.c10
-rw-r--r--sound/pci/hda/hda_intel.c81
-rw-r--r--sound/pci/hda/hda_local.h1
-rw-r--r--sound/pci/hda/patch_analog.c2
-rw-r--r--sound/pci/hda/patch_atihdmi.c1
-rw-r--r--sound/pci/hda/patch_realtek.c6
-rw-r--r--sound/pci/hda/patch_sigmatel.c14
-rw-r--r--sound/pci/intel8x0.c29
-rw-r--r--sound/pci/intel8x0m.c23
-rw-r--r--sound/pci/maestro3.c13
-rw-r--r--sound/pci/nm256/nm256.c12
-rw-r--r--sound/pci/riptide/riptide.c11
-rw-r--r--sound/pci/trident/trident_main.c18
-rw-r--r--sound/pci/via82xx.c12
-rw-r--r--sound/pci/via82xx_modem.c12
-rw-r--r--sound/pci/vx222/vx222.c11
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c9
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf.c24
-rw-r--r--sound/pcmcia/vx/vxpocket.c26
-rw-r--r--sound/ppc/tumbler.c8
-rw-r--r--sound/sound_core.c6
-rw-r--r--sound/sound_firmware.c2
-rw-r--r--sound/usb/usbaudio.c3
-rw-r--r--sound/usb/usbmidi.c2
-rw-r--r--sound/usb/usbmixer.c9
-rw-r--r--sound/usb/usx2y/usX2Yhwdep.c2
84 files changed, 538 insertions, 470 deletions
diff --git a/sound/Kconfig b/sound/Kconfig
index e0d791a98452..9d77300746c6 100644
--- a/sound/Kconfig
+++ b/sound/Kconfig
@@ -64,11 +64,11 @@ source "sound/arm/Kconfig"
64 64
65source "sound/mips/Kconfig" 65source "sound/mips/Kconfig"
66 66
67# the following will depenend on the order of config. 67# the following will depend on the order of config.
68# here assuming USB is defined before ALSA 68# here assuming USB is defined before ALSA
69source "sound/usb/Kconfig" 69source "sound/usb/Kconfig"
70 70
71# the following will depenend on the order of config. 71# the following will depend on the order of config.
72# here assuming PCMCIA is defined before ALSA 72# here assuming PCMCIA is defined before ALSA
73source "sound/pcmcia/Kconfig" 73source "sound/pcmcia/Kconfig"
74 74
@@ -93,4 +93,12 @@ endmenu
93 93
94endif 94endif
95 95
96config AC97_BUS
97 tristate
98 help
99 This is used to avoid config and link hard dependencies between the
100 sound subsystem and other function drivers completely unrelated to
101 sound although they're sharing the AC97 bus. Concerned drivers
102 should "select" this.
103
96endmenu 104endmenu
diff --git a/sound/Makefile b/sound/Makefile
index 5f6bef57e825..9aee54c4882d 100644
--- a/sound/Makefile
+++ b/sound/Makefile
@@ -8,6 +8,9 @@ obj-$(CONFIG_DMASOUND) += oss/
8obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/ 8obj-$(CONFIG_SND) += core/ i2c/ drivers/ isa/ pci/ ppc/ arm/ synth/ usb/ sparc/ parisc/ pcmcia/ mips/
9obj-$(CONFIG_SND_AOA) += aoa/ 9obj-$(CONFIG_SND_AOA) += aoa/
10 10
11# This one must be compilable even if sound is configured out
12obj-$(CONFIG_AC97_BUS) += ac97_bus.o
13
11ifeq ($(CONFIG_SND),y) 14ifeq ($(CONFIG_SND),y)
12 obj-y += last.o 15 obj-y += last.o
13endif 16endif
diff --git a/sound/pci/ac97/ac97_bus.c b/sound/ac97_bus.c
index 66de2c2f1554..66de2c2f1554 100644
--- a/sound/pci/ac97/ac97_bus.c
+++ b/sound/ac97_bus.c
diff --git a/sound/aoa/aoa-gpio.h b/sound/aoa/aoa-gpio.h
index 3a61f3115573..ee64f5de8966 100644
--- a/sound/aoa/aoa-gpio.h
+++ b/sound/aoa/aoa-gpio.h
@@ -59,10 +59,10 @@ struct gpio_methods {
59}; 59};
60 60
61struct gpio_notification { 61struct gpio_notification {
62 struct delayed_work work;
62 notify_func_t notify; 63 notify_func_t notify;
63 void *data; 64 void *data;
64 void *gpio_private; 65 void *gpio_private;
65 struct work_struct work;
66 struct mutex mutex; 66 struct mutex mutex;
67}; 67};
68 68
diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c
index 2ef55a17917c..9de8485ba3f5 100644
--- a/sound/aoa/codecs/snd-aoa-codec-tas.c
+++ b/sound/aoa/codecs/snd-aoa-codec-tas.c
@@ -514,9 +514,15 @@ static int tas_snd_capture_source_put(struct snd_kcontrol *kcontrol,
514 mutex_lock(&tas->mtx); 514 mutex_lock(&tas->mtx);
515 oldacr = tas->acr; 515 oldacr = tas->acr;
516 516
517 tas->acr &= ~TAS_ACR_INPUT_B; 517 /*
518 * Despite what the data sheet says in one place, the
519 * TAS_ACR_B_MONAUREAL bit forces mono output even when
520 * input A (line in) is selected.
521 */
522 tas->acr &= ~(TAS_ACR_INPUT_B | TAS_ACR_B_MONAUREAL);
518 if (ucontrol->value.enumerated.item[0]) 523 if (ucontrol->value.enumerated.item[0])
519 tas->acr |= TAS_ACR_INPUT_B; 524 tas->acr |= TAS_ACR_INPUT_B | TAS_ACR_B_MONAUREAL |
525 TAS_ACR_B_MON_SEL_RIGHT;
520 if (oldacr == tas->acr) { 526 if (oldacr == tas->acr) {
521 mutex_unlock(&tas->mtx); 527 mutex_unlock(&tas->mtx);
522 return 0; 528 return 0;
@@ -686,8 +692,7 @@ static int tas_reset_init(struct tas *tas)
686 if (tas_write_reg(tas, TAS_REG_MCS, 1, &tmp)) 692 if (tas_write_reg(tas, TAS_REG_MCS, 1, &tmp))
687 goto outerr; 693 goto outerr;
688 694
689 tas->acr |= TAS_ACR_ANALOG_PDOWN | TAS_ACR_B_MONAUREAL | 695 tas->acr |= TAS_ACR_ANALOG_PDOWN;
690 TAS_ACR_B_MON_SEL_RIGHT;
691 if (tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr)) 696 if (tas_write_reg(tas, TAS_REG_ACR, 1, &tas->acr))
692 goto outerr; 697 goto outerr;
693 698
diff --git a/sound/aoa/core/snd-aoa-gpio-feature.c b/sound/aoa/core/snd-aoa-gpio-feature.c
index 40eb47eccf9a..2b03bc798bcb 100644
--- a/sound/aoa/core/snd-aoa-gpio-feature.c
+++ b/sound/aoa/core/snd-aoa-gpio-feature.c
@@ -195,9 +195,10 @@ static void ftr_gpio_all_amps_restore(struct gpio_runtime *rt)
195 ftr_gpio_set_lineout(rt, (s>>2)&1); 195 ftr_gpio_set_lineout(rt, (s>>2)&1);
196} 196}
197 197
198static void ftr_handle_notify(void *data) 198static void ftr_handle_notify(struct work_struct *work)
199{ 199{
200 struct gpio_notification *notif = data; 200 struct gpio_notification *notif =
201 container_of(work, struct gpio_notification, work.work);
201 202
202 mutex_lock(&notif->mutex); 203 mutex_lock(&notif->mutex);
203 if (notif->notify) 204 if (notif->notify)
@@ -253,12 +254,9 @@ static void ftr_gpio_init(struct gpio_runtime *rt)
253 254
254 ftr_gpio_all_amps_off(rt); 255 ftr_gpio_all_amps_off(rt);
255 rt->implementation_private = 0; 256 rt->implementation_private = 0;
256 INIT_WORK(&rt->headphone_notify.work, ftr_handle_notify, 257 INIT_DELAYED_WORK(&rt->headphone_notify.work, ftr_handle_notify);
257 &rt->headphone_notify); 258 INIT_DELAYED_WORK(&rt->line_in_notify.work, ftr_handle_notify);
258 INIT_WORK(&rt->line_in_notify.work, ftr_handle_notify, 259 INIT_DELAYED_WORK(&rt->line_out_notify.work, ftr_handle_notify);
259 &rt->line_in_notify);
260 INIT_WORK(&rt->line_out_notify.work, ftr_handle_notify,
261 &rt->line_out_notify);
262 mutex_init(&rt->headphone_notify.mutex); 260 mutex_init(&rt->headphone_notify.mutex);
263 mutex_init(&rt->line_in_notify.mutex); 261 mutex_init(&rt->line_in_notify.mutex);
264 mutex_init(&rt->line_out_notify.mutex); 262 mutex_init(&rt->line_out_notify.mutex);
@@ -287,7 +285,7 @@ static irqreturn_t ftr_handle_notify_irq(int xx, void *data)
287{ 285{
288 struct gpio_notification *notif = data; 286 struct gpio_notification *notif = data;
289 287
290 schedule_work(&notif->work); 288 schedule_delayed_work(&notif->work, 0);
291 289
292 return IRQ_HANDLED; 290 return IRQ_HANDLED;
293} 291}
diff --git a/sound/aoa/core/snd-aoa-gpio-pmf.c b/sound/aoa/core/snd-aoa-gpio-pmf.c
index 2836c3218391..5ca2220eac7d 100644
--- a/sound/aoa/core/snd-aoa-gpio-pmf.c
+++ b/sound/aoa/core/snd-aoa-gpio-pmf.c
@@ -69,9 +69,10 @@ static void pmf_gpio_all_amps_restore(struct gpio_runtime *rt)
69 pmf_gpio_set_lineout(rt, (s>>2)&1); 69 pmf_gpio_set_lineout(rt, (s>>2)&1);
70} 70}
71 71
72static void pmf_handle_notify(void *data) 72static void pmf_handle_notify(struct work_struct *work)
73{ 73{
74 struct gpio_notification *notif = data; 74 struct gpio_notification *notif =
75 container_of(work, struct gpio_notification, work.work);
75 76
76 mutex_lock(&notif->mutex); 77 mutex_lock(&notif->mutex);
77 if (notif->notify) 78 if (notif->notify)
@@ -83,12 +84,9 @@ static void pmf_gpio_init(struct gpio_runtime *rt)
83{ 84{
84 pmf_gpio_all_amps_off(rt); 85 pmf_gpio_all_amps_off(rt);
85 rt->implementation_private = 0; 86 rt->implementation_private = 0;
86 INIT_WORK(&rt->headphone_notify.work, pmf_handle_notify, 87 INIT_DELAYED_WORK(&rt->headphone_notify.work, pmf_handle_notify);
87 &rt->headphone_notify); 88 INIT_DELAYED_WORK(&rt->line_in_notify.work, pmf_handle_notify);
88 INIT_WORK(&rt->line_in_notify.work, pmf_handle_notify, 89 INIT_DELAYED_WORK(&rt->line_out_notify.work, pmf_handle_notify);
89 &rt->line_in_notify);
90 INIT_WORK(&rt->line_out_notify.work, pmf_handle_notify,
91 &rt->line_out_notify);
92 mutex_init(&rt->headphone_notify.mutex); 90 mutex_init(&rt->headphone_notify.mutex);
93 mutex_init(&rt->line_in_notify.mutex); 91 mutex_init(&rt->line_in_notify.mutex);
94 mutex_init(&rt->line_out_notify.mutex); 92 mutex_init(&rt->line_out_notify.mutex);
@@ -129,7 +127,7 @@ static void pmf_handle_notify_irq(void *data)
129{ 127{
130 struct gpio_notification *notif = data; 128 struct gpio_notification *notif = data;
131 129
132 schedule_work(&notif->work); 130 schedule_delayed_work(&notif->work, 0);
133} 131}
134 132
135static int pmf_set_notify(struct gpio_runtime *rt, 133static int pmf_set_notify(struct gpio_runtime *rt,
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
index c79a9afd0955..c7e1b2646193 100644
--- a/sound/arm/sa11xx-uda1341.c
+++ b/sound/arm/sa11xx-uda1341.c
@@ -125,7 +125,7 @@ struct audio_stream {
125#else 125#else
126 dma_regs_t *dma_regs; /* points to our DMA registers */ 126 dma_regs_t *dma_regs; /* points to our DMA registers */
127#endif 127#endif
128 int active:1; /* we are using this stream for transfer now */ 128 unsigned int active:1; /* we are using this stream for transfer now */
129 int period; /* current transfer period */ 129 int period; /* current transfer period */
130 int periods; /* current count of periods registerd in the DMA engine */ 130 int periods; /* current count of periods registerd in the DMA engine */
131 int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */ 131 int tx_spin; /* are we recoding - flag used to do DMA trans. for sync */
diff --git a/sound/core/control.c b/sound/core/control.c
index 6973a9686b67..48ef0a09a7a7 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1018,10 +1018,6 @@ static int snd_ctl_elem_add(struct snd_ctl_file *file,
1018 } 1018 }
1019 switch (info->type) { 1019 switch (info->type) {
1020 case SNDRV_CTL_ELEM_TYPE_BOOLEAN: 1020 case SNDRV_CTL_ELEM_TYPE_BOOLEAN:
1021 private_size = sizeof(char);
1022 if (info->count > 128)
1023 return -EINVAL;
1024 break;
1025 case SNDRV_CTL_ELEM_TYPE_INTEGER: 1021 case SNDRV_CTL_ELEM_TYPE_INTEGER:
1026 private_size = sizeof(long); 1022 private_size = sizeof(long);
1027 if (info->count > 128) 1023 if (info->count > 128)
diff --git a/sound/core/info.c b/sound/core/info.c
index e43662b33f16..54591e2eb6ee 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -120,7 +120,10 @@ int snd_iprintf(struct snd_info_buffer *buffer, char *fmt,...)
120 len = buffer->len - buffer->size; 120 len = buffer->len - buffer->size;
121 va_start(args, fmt); 121 va_start(args, fmt);
122 for (;;) { 122 for (;;) {
123 res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, args); 123 va_list ap;
124 va_copy(ap, args);
125 res = vsnprintf(buffer->buffer + buffer->curr, len, fmt, ap);
126 va_end(ap);
124 if (res < len) 127 if (res < len)
125 break; 128 break;
126 err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE); 129 err = resize_info_buffer(buffer, buffer->len + PAGE_SIZE);
@@ -485,7 +488,7 @@ static long snd_info_entry_ioctl(struct file *file, unsigned int cmd,
485 488
486static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma) 489static int snd_info_entry_mmap(struct file *file, struct vm_area_struct *vma)
487{ 490{
488 struct inode *inode = file->f_dentry->d_inode; 491 struct inode *inode = file->f_path.dentry->d_inode;
489 struct snd_info_private_data *data; 492 struct snd_info_private_data *data;
490 struct snd_info_entry *entry; 493 struct snd_info_entry *entry;
491 494
diff --git a/sound/core/init.c b/sound/core/init.c
index 3058d626a90a..6152a7554dfd 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -361,6 +361,8 @@ static int snd_card_do_free(struct snd_card *card)
361 snd_printk(KERN_WARNING "unable to free card info\n"); 361 snd_printk(KERN_WARNING "unable to free card info\n");
362 /* Not fatal error */ 362 /* Not fatal error */
363 } 363 }
364 if (card->dev)
365 device_unregister(card->dev);
364 kfree(card); 366 kfree(card);
365 return 0; 367 return 0;
366} 368}
@@ -495,6 +497,12 @@ int snd_card_register(struct snd_card *card)
495 int err; 497 int err;
496 498
497 snd_assert(card != NULL, return -EINVAL); 499 snd_assert(card != NULL, return -EINVAL);
500 if (!card->dev) {
501 card->dev = device_create(sound_class, card->parent, 0,
502 "card%i", card->number);
503 if (IS_ERR(card->dev))
504 card->dev = NULL;
505 }
498 if ((err = snd_device_register_all(card)) < 0) 506 if ((err = snd_device_register_all(card)) < 0)
499 return err; 507 return err;
500 mutex_lock(&snd_card_mutex); 508 mutex_lock(&snd_card_mutex);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index 505b23ec4058..e0821eb3d851 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -2359,7 +2359,8 @@ static int snd_pcm_oss_release(struct inode *inode, struct file *file)
2359 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE]; 2359 substream = pcm_oss_file->streams[SNDRV_PCM_STREAM_CAPTURE];
2360 snd_assert(substream != NULL, return -ENXIO); 2360 snd_assert(substream != NULL, return -ENXIO);
2361 pcm = substream->pcm; 2361 pcm = substream->pcm;
2362 snd_pcm_oss_sync(pcm_oss_file); 2362 if (!pcm->card->shutdown)
2363 snd_pcm_oss_sync(pcm_oss_file);
2363 mutex_lock(&pcm->open_mutex); 2364 mutex_lock(&pcm->open_mutex);
2364 snd_pcm_oss_release_file(pcm_oss_file); 2365 snd_pcm_oss_release_file(pcm_oss_file);
2365 mutex_unlock(&pcm->open_mutex); 2366 mutex_unlock(&pcm->open_mutex);
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index fbbbcd20c4cc..5ac6e19ccb41 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -910,7 +910,8 @@ void snd_pcm_detach_substream(struct snd_pcm_substream *substream)
910 substream->pstr->substream_opened--; 910 substream->pstr->substream_opened--;
911} 911}
912 912
913static ssize_t show_pcm_class(struct class_device *class_device, char *buf) 913static ssize_t show_pcm_class(struct device *dev,
914 struct device_attribute *attr, char *buf)
914{ 915{
915 struct snd_pcm *pcm; 916 struct snd_pcm *pcm;
916 const char *str; 917 const char *str;
@@ -921,7 +922,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf)
921 [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer", 922 [SNDRV_PCM_CLASS_DIGITIZER] = "digitizer",
922 }; 923 };
923 924
924 if (! (pcm = class_get_devdata(class_device)) || 925 if (! (pcm = dev_get_drvdata(dev)) ||
925 pcm->dev_class > SNDRV_PCM_CLASS_LAST) 926 pcm->dev_class > SNDRV_PCM_CLASS_LAST)
926 str = "none"; 927 str = "none";
927 else 928 else
@@ -929,7 +930,7 @@ static ssize_t show_pcm_class(struct class_device *class_device, char *buf)
929 return snprintf(buf, PAGE_SIZE, "%s\n", str); 930 return snprintf(buf, PAGE_SIZE, "%s\n", str);
930} 931}
931 932
932static struct class_device_attribute pcm_attrs = 933static struct device_attribute pcm_attrs =
933 __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL); 934 __ATTR(pcm_class, S_IRUGO, show_pcm_class, NULL);
934 935
935static int snd_pcm_dev_register(struct snd_device *device) 936static int snd_pcm_dev_register(struct snd_device *device)
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 37b4b10850ae..b52e89393fa3 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -1310,7 +1310,8 @@ static int snd_pcm_pre_prepare(struct snd_pcm_substream *substream,
1310 int f_flags) 1310 int f_flags)
1311{ 1311{
1312 struct snd_pcm_runtime *runtime = substream->runtime; 1312 struct snd_pcm_runtime *runtime = substream->runtime;
1313 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 1313 if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
1314 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
1314 return -EBADFD; 1315 return -EBADFD;
1315 if (snd_pcm_running(substream)) 1316 if (snd_pcm_running(substream))
1316 return -EBUSY; 1317 return -EBUSY;
@@ -1568,7 +1569,8 @@ static int snd_pcm_drop(struct snd_pcm_substream *substream)
1568 runtime = substream->runtime; 1569 runtime = substream->runtime;
1569 card = substream->pcm->card; 1570 card = substream->pcm->card;
1570 1571
1571 if (runtime->status->state == SNDRV_PCM_STATE_OPEN) 1572 if (runtime->status->state == SNDRV_PCM_STATE_OPEN ||
1573 runtime->status->state == SNDRV_PCM_STATE_DISCONNECTED)
1572 return -EBADFD; 1574 return -EBADFD;
1573 1575
1574 snd_power_lock(card); 1576 snd_power_lock(card);
@@ -1602,7 +1604,7 @@ static struct file *snd_pcm_file_fd(int fd)
1602 file = fget(fd); 1604 file = fget(fd);
1603 if (!file) 1605 if (!file)
1604 return NULL; 1606 return NULL;
1605 inode = file->f_dentry->d_inode; 1607 inode = file->f_path.dentry->d_inode;
1606 if (!S_ISCHR(inode->i_mode) || 1608 if (!S_ISCHR(inode->i_mode) ||
1607 imajor(inode) != snd_major) { 1609 imajor(inode) != snd_major) {
1608 fput(file); 1610 fput(file);
@@ -3025,7 +3027,7 @@ static struct page * snd_pcm_mmap_status_nopage(struct vm_area_struct *area,
3025 struct page * page; 3027 struct page * page;
3026 3028
3027 if (substream == NULL) 3029 if (substream == NULL)
3028 return NOPAGE_OOM; 3030 return NOPAGE_SIGBUS;
3029 runtime = substream->runtime; 3031 runtime = substream->runtime;
3030 page = virt_to_page(runtime->status); 3032 page = virt_to_page(runtime->status);
3031 get_page(page); 3033 get_page(page);
@@ -3068,7 +3070,7 @@ static struct page * snd_pcm_mmap_control_nopage(struct vm_area_struct *area,
3068 struct page * page; 3070 struct page * page;
3069 3071
3070 if (substream == NULL) 3072 if (substream == NULL)
3071 return NOPAGE_OOM; 3073 return NOPAGE_SIGBUS;
3072 runtime = substream->runtime; 3074 runtime = substream->runtime;
3073 page = virt_to_page(runtime->control); 3075 page = virt_to_page(runtime->control);
3074 get_page(page); 3076 get_page(page);
@@ -3129,18 +3131,18 @@ static struct page *snd_pcm_mmap_data_nopage(struct vm_area_struct *area,
3129 size_t dma_bytes; 3131 size_t dma_bytes;
3130 3132
3131 if (substream == NULL) 3133 if (substream == NULL)
3132 return NOPAGE_OOM; 3134 return NOPAGE_SIGBUS;
3133 runtime = substream->runtime; 3135 runtime = substream->runtime;
3134 offset = area->vm_pgoff << PAGE_SHIFT; 3136 offset = area->vm_pgoff << PAGE_SHIFT;
3135 offset += address - area->vm_start; 3137 offset += address - area->vm_start;
3136 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); 3138 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS);
3137 dma_bytes = PAGE_ALIGN(runtime->dma_bytes); 3139 dma_bytes = PAGE_ALIGN(runtime->dma_bytes);
3138 if (offset > dma_bytes - PAGE_SIZE) 3140 if (offset > dma_bytes - PAGE_SIZE)
3139 return NOPAGE_SIGBUS; 3141 return NOPAGE_SIGBUS;
3140 if (substream->ops->page) { 3142 if (substream->ops->page) {
3141 page = substream->ops->page(substream, offset); 3143 page = substream->ops->page(substream, offset);
3142 if (! page) 3144 if (! page)
3143 return NOPAGE_OOM; 3145 return NOPAGE_OOM; /* XXX: is this really due to OOM? */
3144 } else { 3146 } else {
3145 vaddr = runtime->dma_area + offset; 3147 vaddr = runtime->dma_area + offset;
3146 page = virt_to_page(vaddr); 3148 page = virt_to_page(vaddr);
diff --git a/sound/core/rtctimer.c b/sound/core/rtctimer.c
index 412dd62b654e..9f7b32e1ccde 100644
--- a/sound/core/rtctimer.c
+++ b/sound/core/rtctimer.c
@@ -22,13 +22,10 @@
22 22
23#include <sound/driver.h> 23#include <sound/driver.h>
24#include <linux/init.h> 24#include <linux/init.h>
25#include <linux/time.h>
26#include <linux/threads.h>
27#include <linux/interrupt.h> 25#include <linux/interrupt.h>
28#include <linux/moduleparam.h> 26#include <linux/moduleparam.h>
29#include <sound/core.h> 27#include <sound/core.h>
30#include <sound/timer.h> 28#include <sound/timer.h>
31#include <sound/info.h>
32 29
33#if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE) 30#if defined(CONFIG_RTC) || defined(CONFIG_RTC_MODULE)
34 31
@@ -50,7 +47,9 @@ static int rtctimer_stop(struct snd_timer *t);
50 * The hardware dependent description for this timer. 47 * The hardware dependent description for this timer.
51 */ 48 */
52static struct snd_timer_hardware rtc_hw = { 49static struct snd_timer_hardware rtc_hw = {
53 .flags = SNDRV_TIMER_HW_FIRST|SNDRV_TIMER_HW_AUTO, 50 .flags = SNDRV_TIMER_HW_AUTO |
51 SNDRV_TIMER_HW_FIRST |
52 SNDRV_TIMER_HW_TASKLET,
54 .ticks = 100000000L, /* FIXME: XXX */ 53 .ticks = 100000000L, /* FIXME: XXX */
55 .open = rtctimer_open, 54 .open = rtctimer_open,
56 .close = rtctimer_close, 55 .close = rtctimer_close,
@@ -60,6 +59,7 @@ static struct snd_timer_hardware rtc_hw = {
60 59
61static int rtctimer_freq = RTC_FREQ; /* frequency */ 60static int rtctimer_freq = RTC_FREQ; /* frequency */
62static struct snd_timer *rtctimer; 61static struct snd_timer *rtctimer;
62static struct tasklet_struct rtc_tasklet;
63static rtc_task_t rtc_task; 63static rtc_task_t rtc_task;
64 64
65 65
@@ -81,6 +81,7 @@ rtctimer_close(struct snd_timer *t)
81 rtc_task_t *rtc = t->private_data; 81 rtc_task_t *rtc = t->private_data;
82 if (rtc) { 82 if (rtc) {
83 rtc_unregister(rtc); 83 rtc_unregister(rtc);
84 tasklet_kill(&rtc_tasklet);
84 t->private_data = NULL; 85 t->private_data = NULL;
85 } 86 }
86 return 0; 87 return 0;
@@ -105,12 +106,17 @@ rtctimer_stop(struct snd_timer *timer)
105 return 0; 106 return 0;
106} 107}
107 108
109static void rtctimer_tasklet(unsigned long data)
110{
111 snd_timer_interrupt((struct snd_timer *)data, 1);
112}
113
108/* 114/*
109 * interrupt 115 * interrupt
110 */ 116 */
111static void rtctimer_interrupt(void *private_data) 117static void rtctimer_interrupt(void *private_data)
112{ 118{
113 snd_timer_interrupt(private_data, 1); 119 tasklet_hi_schedule(private_data);
114} 120}
115 121
116 122
@@ -139,9 +145,11 @@ static int __init rtctimer_init(void)
139 timer->hw = rtc_hw; 145 timer->hw = rtc_hw;
140 timer->hw.resolution = NANO_SEC / rtctimer_freq; 146 timer->hw.resolution = NANO_SEC / rtctimer_freq;
141 147
148 tasklet_init(&rtc_tasklet, rtctimer_tasklet, (unsigned long)timer);
149
142 /* set up RTC callback */ 150 /* set up RTC callback */
143 rtc_task.func = rtctimer_interrupt; 151 rtc_task.func = rtctimer_interrupt;
144 rtc_task.private_data = timer; 152 rtc_task.private_data = &rtc_tasklet;
145 153
146 err = snd_timer_global_register(timer); 154 err = snd_timer_global_register(timer);
147 if (err < 0) { 155 if (err < 0) {
diff --git a/sound/core/sound.c b/sound/core/sound.c
index efa476c5210a..282742022de6 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -61,9 +61,6 @@ EXPORT_SYMBOL(snd_ecards_limit);
61static struct snd_minor *snd_minors[SNDRV_OS_MINORS]; 61static struct snd_minor *snd_minors[SNDRV_OS_MINORS];
62static DEFINE_MUTEX(sound_mutex); 62static DEFINE_MUTEX(sound_mutex);
63 63
64extern struct class *sound_class;
65
66
67#ifdef CONFIG_KMOD 64#ifdef CONFIG_KMOD
68 65
69/** 66/**
@@ -268,11 +265,10 @@ int snd_register_device(int type, struct snd_card *card, int dev,
268 snd_minors[minor] = preg; 265 snd_minors[minor] = preg;
269 if (card) 266 if (card)
270 device = card->dev; 267 device = card->dev;
271 preg->class_dev = class_device_create(sound_class, NULL, 268 preg->dev = device_create(sound_class, device, MKDEV(major, minor),
272 MKDEV(major, minor), 269 "%s", name);
273 device, "%s", name); 270 if (preg->dev)
274 if (preg->class_dev) 271 dev_set_drvdata(preg->dev, private_data);
275 class_set_devdata(preg->class_dev, private_data);
276 272
277 mutex_unlock(&sound_mutex); 273 mutex_unlock(&sound_mutex);
278 return 0; 274 return 0;
@@ -320,7 +316,7 @@ int snd_unregister_device(int type, struct snd_card *card, int dev)
320 return -EINVAL; 316 return -EINVAL;
321 } 317 }
322 318
323 class_device_destroy(sound_class, MKDEV(major, minor)); 319 device_destroy(sound_class, MKDEV(major, minor));
324 320
325 kfree(snd_minors[minor]); 321 kfree(snd_minors[minor]);
326 snd_minors[minor] = NULL; 322 snd_minors[minor] = NULL;
@@ -331,15 +327,15 @@ int snd_unregister_device(int type, struct snd_card *card, int dev)
331EXPORT_SYMBOL(snd_unregister_device); 327EXPORT_SYMBOL(snd_unregister_device);
332 328
333int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev, 329int snd_add_device_sysfs_file(int type, struct snd_card *card, int dev,
334 const struct class_device_attribute *attr) 330 struct device_attribute *attr)
335{ 331{
336 int minor, ret = -EINVAL; 332 int minor, ret = -EINVAL;
337 struct class_device *cdev; 333 struct device *d;
338 334
339 mutex_lock(&sound_mutex); 335 mutex_lock(&sound_mutex);
340 minor = find_snd_minor(type, card, dev); 336 minor = find_snd_minor(type, card, dev);
341 if (minor >= 0 && (cdev = snd_minors[minor]->class_dev) != NULL) 337 if (minor >= 0 && (d = snd_minors[minor]->dev) != NULL)
342 ret = class_device_create_file(cdev, attr); 338 ret = device_create_file(d, attr);
343 mutex_unlock(&sound_mutex); 339 mutex_unlock(&sound_mutex);
344 return ret; 340 return ret;
345 341
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index 7971285dfd5b..40ebd2f44056 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -26,11 +26,7 @@ config SND_VX_LIB
26config SND_AC97_CODEC 26config SND_AC97_CODEC
27 tristate 27 tristate
28 select SND_PCM 28 select SND_PCM
29 select SND_AC97_BUS 29 select AC97_BUS
30
31config SND_AC97_BUS
32 tristate
33
34 30
35config SND_DUMMY 31config SND_DUMMY
36 tristate "Dummy (/dev/null) soundcard" 32 tristate "Dummy (/dev/null) soundcard"
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index 12ffffc9e814..d2f2c5078e65 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -35,7 +35,7 @@ MODULE_LICENSE("GPL");
35 35
36#define AK4114_ADDR 0x00 /* fixed address */ 36#define AK4114_ADDR 0x00 /* fixed address */
37 37
38static void ak4114_stats(void *); 38static void ak4114_stats(struct work_struct *work);
39 39
40static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val) 40static void reg_write(struct ak4114 *ak4114, unsigned char reg, unsigned char val)
41{ 41{
@@ -158,7 +158,7 @@ void snd_ak4114_reinit(struct ak4114 *chip)
158 reg_write(chip, AK4114_REG_PWRDN, old | AK4114_RST | AK4114_PWN); 158 reg_write(chip, AK4114_REG_PWRDN, old | AK4114_RST | AK4114_PWN);
159 /* bring up statistics / event queing */ 159 /* bring up statistics / event queing */
160 chip->init = 0; 160 chip->init = 0;
161 INIT_WORK(&chip->work, ak4114_stats, chip); 161 INIT_DELAYED_WORK(&chip->work, ak4114_stats);
162 queue_delayed_work(chip->workqueue, &chip->work, HZ / 10); 162 queue_delayed_work(chip->workqueue, &chip->work, HZ / 10);
163} 163}
164 164
@@ -561,9 +561,9 @@ int snd_ak4114_check_rate_and_errors(struct ak4114 *ak4114, unsigned int flags)
561 return res; 561 return res;
562} 562}
563 563
564static void ak4114_stats(void *data) 564static void ak4114_stats(struct work_struct *work)
565{ 565{
566 struct ak4114 *chip = (struct ak4114 *)data; 566 struct ak4114 *chip = container_of(work, struct ak4114, work.work);
567 567
568 if (chip->init) 568 if (chip->init)
569 return; 569 return;
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 557c4de22960..57371f1a441f 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -13,6 +13,7 @@ config SND_CS4231_LIB
13 13
14config SND_ADLIB 14config SND_ADLIB
15 tristate "AdLib FM card" 15 tristate "AdLib FM card"
16 depends on SND
16 select SND_OPL3_LIB 17 select SND_OPL3_LIB
17 help 18 help
18 Say Y here to include support for AdLib FM cards. 19 Say Y here to include support for AdLib FM cards.
diff --git a/sound/isa/ad1816a/ad1816a.c b/sound/isa/ad1816a/ad1816a.c
index b33a5fb59ec2..59034507175b 100644
--- a/sound/isa/ad1816a/ad1816a.c
+++ b/sound/isa/ad1816a/ad1816a.c
@@ -120,6 +120,8 @@ static int __devinit snd_card_ad1816a_pnp(int dev, struct snd_card_ad1816a *acar
120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 120 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
121 int err; 121 int err;
122 122
123 if (!cfg)
124 return -ENOMEM;
123 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 125 acard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
124 if (acard->dev == NULL) { 126 if (acard->dev == NULL) {
125 kfree(cfg); 127 kfree(cfg);
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 3c1e9fd56fe0..d1f6dfcec46e 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -289,6 +289,8 @@ static int __devinit snd_cmi8330_pnp(int dev, struct snd_cmi8330 *acard,
289 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); 289 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
290 int err; 290 int err;
291 291
292 if (!cfg)
293 return -ENOMEM;
292 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL); 294 acard->cap = pnp_request_card_device(card, id->devs[0].id, NULL);
293 if (acard->cap == NULL) { 295 if (acard->cap == NULL) {
294 kfree(cfg); 296 kfree(cfg);
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index f12cd09d1fcc..4ec2d79431fc 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -564,6 +564,8 @@ static int __devinit snd_interwave_pnp(int dev, struct snd_interwave *iwcard,
564 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL); 564 struct pnp_resource_table * cfg = kmalloc(sizeof(struct pnp_resource_table), GFP_KERNEL);
565 int err; 565 int err;
566 566
567 if (!cfg)
568 return -ENOMEM;
567 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL); 569 iwcard->dev = pnp_request_card_device(card, id->devs[0].id, NULL);
568 if (iwcard->dev == NULL) { 570 if (iwcard->dev == NULL) {
569 kfree(cfg); 571 kfree(cfg);
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index a1ad39a8cdce..df227377c333 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -1683,6 +1683,8 @@ static int __init snd_card_opti9xx_pnp(struct snd_opti9xx *chip, struct pnp_card
1683 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL); 1683 struct pnp_resource_table *cfg = kmalloc(sizeof(*cfg), GFP_KERNEL);
1684 int err; 1684 int err;
1685 1685
1686 if (!cfg)
1687 return -ENOMEM;
1686 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL); 1688 chip->dev = pnp_request_card_device(card, pid->devs[0].id, NULL);
1687 if (chip->dev == NULL) { 1689 if (chip->dev == NULL) {
1688 kfree(cfg); 1690 kfree(cfg);
diff --git a/sound/oss/Kconfig b/sound/oss/Kconfig
index cc2b9ab7f4e5..a0588c21324a 100644
--- a/sound/oss/Kconfig
+++ b/sound/oss/Kconfig
@@ -5,20 +5,6 @@
5# 5#
6# Prompt user for primary drivers. 6# Prompt user for primary drivers.
7 7
8config OSS_OBSOLETE_DRIVER
9 bool "Obsolete OSS drivers"
10 depends on SOUND_PRIME
11 help
12 This option enables support for obsolete OSS drivers that
13 are scheduled for removal in the near future since there
14 are ALSA drivers for the same hardware.
15
16 Please contact Adrian Bunk <bunk@stusta.de> if you had to
17 say Y here because your soundcard is not properly supported
18 by ALSA.
19
20 If unsure, say N.
21
22config SOUND_BT878 8config SOUND_BT878
23 tristate "BT878 audio dma" 9 tristate "BT878 audio dma"
24 depends on SOUND_PRIME && PCI 10 depends on SOUND_PRIME && PCI
@@ -35,40 +21,6 @@ config SOUND_BT878
35 To compile this driver as a module, choose M here: the module will 21 To compile this driver as a module, choose M here: the module will
36 be called btaudio. 22 be called btaudio.
37 23
38config SOUND_EMU10K1
39 tristate "Creative SBLive! (EMU10K1)"
40 depends on SOUND_PRIME && PCI && OSS_OBSOLETE_DRIVER
41 ---help---
42 Say Y or M if you have a PCI sound card using the EMU10K1 chipset,
43 such as the Creative SBLive!, SB PCI512 or Emu-APS.
44
45 For more information on this driver and the degree of support for
46 the different card models please check:
47
48 <http://sourceforge.net/projects/emu10k1/>
49
50 It is now possible to load dsp microcode patches into the EMU10K1
51 chip. These patches are used to implement real time sound
52 processing effects which include for example: signal routing,
53 bass/treble control, AC3 passthrough, ...
54 Userspace tools to create new patches and load/unload them can be
55 found in the emu-tools package at the above URL.
56
57config MIDI_EMU10K1
58 bool "Creative SBLive! MIDI (EXPERIMENTAL)"
59 depends on SOUND_EMU10K1 && EXPERIMENTAL && ISA_DMA_API
60 help
61 Say Y if you want to be able to use the OSS /dev/sequencer
62 interface. This code is still experimental.
63
64config SOUND_FUSION
65 tristate "Crystal SoundFusion (CS4280/461x)"
66 depends on SOUND_PRIME && PCI && OSS_OBSOLETE_DRIVER
67 help
68 This module drives the Crystal SoundFusion devices (CS4280/46xx
69 series) when wired as native sound drivers with AC97 codecs. If
70 this driver does not work try the CS4232 driver.
71
72config SOUND_BCM_CS4297A 24config SOUND_BCM_CS4297A
73 tristate "Crystal Sound CS4297a (for Swarm)" 25 tristate "Crystal Sound CS4297a (for Swarm)"
74 depends on SOUND_PRIME && SIBYTE_SWARM 26 depends on SOUND_PRIME && SIBYTE_SWARM
@@ -448,47 +400,6 @@ config SOUND_DMAP
448 400
449 Say Y unless you have 16MB or more RAM or a PCI sound card. 401 Say Y unless you have 16MB or more RAM or a PCI sound card.
450 402
451config SOUND_AD1816
452 tristate "AD1816(A) based cards (EXPERIMENTAL)"
453 depends on EXPERIMENTAL && SOUND_OSS && OSS_OBSOLETE_DRIVER
454 help
455 Say M here if you have a sound card based on the Analog Devices
456 AD1816(A) chip.
457
458 If you compile the driver into the kernel, you have to add
459 "ad1816=<io>,<irq>,<dma>,<dma2>" to the kernel command line.
460
461config SOUND_AD1889
462 tristate "AD1889 based cards (AD1819 codec) (EXPERIMENTAL)"
463 depends on EXPERIMENTAL && SOUND_OSS && PCI && OSS_OBSOLETE_DRIVER
464 help
465 Say M here if you have a sound card based on the Analog Devices
466 AD1889 chip.
467
468config SOUND_ADLIB
469 tristate "Adlib Cards"
470 depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
471 help
472 Includes ASB 64 4D. Information on programming AdLib cards is
473 available at <http://www.itsnet.com/home/ldragon/Specs/adlib.html>.
474
475config SOUND_ACI_MIXER
476 tristate "ACI mixer (miroSOUND PCM1-pro/PCM12/PCM20)"
477 depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
478 ---help---
479 ACI (Audio Command Interface) is a protocol used to communicate with
480 the microcontroller on some sound cards produced by miro and
481 Cardinal Technologies. The main function of the ACI is to control
482 the mixer and to get a product identification.
483
484 This VoxWare ACI driver currently supports the ACI functions on the
485 miroSOUND PCM1-pro, PCM12 and PCM20 radio. On the PCM20 radio, ACI
486 also controls the radio tuner. This is supported in the video4linux
487 miropcm20 driver (say M or Y here and go back to "Multimedia
488 devices" -> "Radio Adapters").
489
490 This driver is also available as a module and will be called aci.
491
492config SOUND_CS4232 403config SOUND_CS4232
493 tristate "Crystal CS4232 based (PnP) cards" 404 tristate "Crystal CS4232 based (PnP) cards"
494 depends on SOUND_OSS 405 depends on SOUND_OSS
@@ -594,18 +505,6 @@ config SOUND_MPU401
594 If you compile the driver into the kernel, you have to add 505 If you compile the driver into the kernel, you have to add
595 "mpu401=<io>,<irq>" to the kernel command line. 506 "mpu401=<io>,<irq>" to the kernel command line.
596 507
597config SOUND_NM256
598 tristate "NM256AV/NM256ZX audio support"
599 depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
600 help
601 Say M here to include audio support for the NeoMagic 256AV/256ZX
602 chipsets. These are the audio chipsets found in the Sony
603 Z505S/SX/DX, some Sony F-series, and the Dell Latitude CPi and CPt
604 laptops. It includes support for an AC97-compatible mixer and an
605 apparently proprietary sound engine.
606
607 See <file:Documentation/sound/oss/NM256> for further information.
608
609config SOUND_PAS 508config SOUND_PAS
610 tristate "ProAudioSpectrum 16 support" 509 tristate "ProAudioSpectrum 16 support"
611 depends on SOUND_OSS 510 depends on SOUND_OSS
@@ -714,20 +613,6 @@ config SOUND_YM3812
714 613
715 If unsure, say Y. 614 If unsure, say Y.
716 615
717config SOUND_OPL3SA2
718 tristate "Yamaha OPL3-SA2 and SA3 based PnP cards"
719 depends on SOUND_OSS && OSS_OBSOLETE_DRIVER
720 help
721 Say Y or M if you have a card based on one of these Yamaha sound
722 chipsets or the "SAx", which is actually a SA3. Read
723 <file:Documentation/sound/oss/OPL3-SA2> for more information on
724 configuring these cards.
725
726 If you compile the driver into the kernel and do not also
727 configure in the optional ISA PnP support, you will have to add
728 "opl3sa2=<io>,<irq>,<dma>,<dma2>,<mssio>,<mpuio>" to the kernel
729 command line.
730
731config SOUND_UART6850 616config SOUND_UART6850
732 tristate "6850 UART support" 617 tristate "6850 UART support"
733 depends on SOUND_OSS 618 depends on SOUND_OSS
diff --git a/sound/oss/btaudio.c b/sound/oss/btaudio.c
index 6ad384114239..ad7210a00dc0 100644
--- a/sound/oss/btaudio.c
+++ b/sound/oss/btaudio.c
@@ -1020,6 +1020,7 @@ static int __devinit btaudio_probe(struct pci_dev *pci_dev,
1020 fail2: 1020 fail2:
1021 free_irq(bta->irq,bta); 1021 free_irq(bta->irq,bta);
1022 fail1: 1022 fail1:
1023 iounmap(bta->mmio);
1023 kfree(bta); 1024 kfree(bta);
1024 fail0: 1025 fail0:
1025 release_mem_region(pci_resource_start(pci_dev,0), 1026 release_mem_region(pci_resource_start(pci_dev,0),
@@ -1051,6 +1052,7 @@ static void __devexit btaudio_remove(struct pci_dev *pci_dev)
1051 free_irq(bta->irq,bta); 1052 free_irq(bta->irq,bta);
1052 release_mem_region(pci_resource_start(pci_dev,0), 1053 release_mem_region(pci_resource_start(pci_dev,0),
1053 pci_resource_len(pci_dev,0)); 1054 pci_resource_len(pci_dev,0));
1055 iounmap(bta->mmio);
1054 1056
1055 /* remove from linked list */ 1057 /* remove from linked list */
1056 if (bta == btaudios) { 1058 if (bta == btaudios) {
diff --git a/sound/oss/cs46xx.c b/sound/oss/cs46xx.c
index 6e3c41f530e6..147c8a951137 100644
--- a/sound/oss/cs46xx.c
+++ b/sound/oss/cs46xx.c
@@ -91,6 +91,7 @@
91#include <linux/poll.h> 91#include <linux/poll.h>
92#include <linux/ac97_codec.h> 92#include <linux/ac97_codec.h>
93#include <linux/mutex.h> 93#include <linux/mutex.h>
94#include <linux/mm.h>
94 95
95#include <asm/io.h> 96#include <asm/io.h>
96#include <asm/dma.h> 97#include <asm/dma.h>
@@ -779,7 +780,7 @@ static unsigned int cs_set_adc_rate(struct cs_state *state, unsigned int rate)
779 rate = 48000 / 9; 780 rate = 48000 / 9;
780 781
781 /* 782 /*
782 * We can not capture at at rate greater than the Input Rate (48000). 783 * We cannot capture at at rate greater than the Input Rate (48000).
783 * Return an error if an attempt is made to stray outside that limit. 784 * Return an error if an attempt is made to stray outside that limit.
784 */ 785 */
785 if (rate > 48000) 786 if (rate > 48000)
@@ -4754,8 +4755,8 @@ static int cs_hardware_init(struct cs_card *card)
4754 mdelay(5 * cs_laptop_wait); /* Shouldnt be needed ?? */ 4755 mdelay(5 * cs_laptop_wait); /* Shouldnt be needed ?? */
4755 4756
4756/* 4757/*
4757* If we are resuming under 2.2.x then we can not schedule a timeout. 4758* If we are resuming under 2.2.x then we cannot schedule a timeout,
4758* so, just spin the CPU. 4759* so just spin the CPU.
4759*/ 4760*/
4760 if (card->pm.flags & CS46XX_PM_IDLE) { 4761 if (card->pm.flags & CS46XX_PM_IDLE) {
4761 /* 4762 /*
diff --git a/sound/oss/dmabuf.c b/sound/oss/dmabuf.c
index b256c0401161..eaf69971bf92 100644
--- a/sound/oss/dmabuf.c
+++ b/sound/oss/dmabuf.c
@@ -25,6 +25,7 @@
25#define BE_CONSERVATIVE 25#define BE_CONSERVATIVE
26#define SAMPLE_ROUNDUP 0 26#define SAMPLE_ROUNDUP 0
27 27
28#include <linux/mm.h>
28#include "sound_config.h" 29#include "sound_config.h"
29 30
30#define DMAP_FREE_ON_CLOSE 0 31#define DMAP_FREE_ON_CLOSE 0
diff --git a/sound/oss/dmasound/dmasound_core.c b/sound/oss/dmasound/dmasound_core.c
index 87bd3100aef3..80b836e80d99 100644
--- a/sound/oss/dmasound/dmasound_core.c
+++ b/sound/oss/dmasound/dmasound_core.c
@@ -1051,7 +1051,7 @@ static int sq_release(struct inode *inode, struct file *file)
1051 1051
1052 if (file->f_mode & FMODE_WRITE) { 1052 if (file->f_mode & FMODE_WRITE) {
1053 if (write_sq.busy) 1053 if (write_sq.busy)
1054 rc = sq_fsync(file, file->f_dentry); 1054 rc = sq_fsync(file, file->f_path.dentry);
1055 1055
1056 sq_reset_output() ; /* make sure dma is stopped and all is quiet */ 1056 sq_reset_output() ; /* make sure dma is stopped and all is quiet */
1057 write_sq_release_buffers(); 1057 write_sq_release_buffers();
@@ -1217,7 +1217,7 @@ static int sq_ioctl(struct inode *inode, struct file *file, u_int cmd,
1217 if ((file->f_mode & FMODE_READ) && dmasound.mach.record) 1217 if ((file->f_mode & FMODE_READ) && dmasound.mach.record)
1218 sq_reset_input() ; 1218 sq_reset_input() ;
1219 if (file->f_mode & FMODE_WRITE) { 1219 if (file->f_mode & FMODE_WRITE) {
1220 result = sq_fsync(file, file->f_dentry); 1220 result = sq_fsync(file, file->f_path.dentry);
1221 sq_reset_output() ; 1221 sq_reset_output() ;
1222 } 1222 }
1223 /* if we are the shared resource owner then release them */ 1223 /* if we are the shared resource owner then release them */
diff --git a/sound/oss/emu10k1/audio.c b/sound/oss/emu10k1/audio.c
index cde4d59d5430..49f902f35c28 100644
--- a/sound/oss/emu10k1/audio.c
+++ b/sound/oss/emu10k1/audio.c
@@ -36,6 +36,7 @@
36#include <linux/bitops.h> 36#include <linux/bitops.h>
37#include <asm/io.h> 37#include <asm/io.h>
38#include <linux/sched.h> 38#include <linux/sched.h>
39#include <linux/mm.h>
39#include <linux/smp_lock.h> 40#include <linux/smp_lock.h>
40 41
41#include "hwaccess.h" 42#include "hwaccess.h"
@@ -110,9 +111,15 @@ static ssize_t emu10k1_audio_read(struct file *file, char __user *buffer, size_t
110 111
111 if ((bytestocopy >= wiinst->buffer.fragment_size) 112 if ((bytestocopy >= wiinst->buffer.fragment_size)
112 || (bytestocopy >= count)) { 113 || (bytestocopy >= count)) {
114 int rc;
115
113 bytestocopy = min_t(u32, bytestocopy, count); 116 bytestocopy = min_t(u32, bytestocopy, count);
114 117
115 emu10k1_wavein_xferdata(wiinst, (u8 __user *)buffer, &bytestocopy); 118 rc = emu10k1_wavein_xferdata(wiinst,
119 (u8 __user *)buffer,
120 &bytestocopy);
121 if (rc)
122 return rc;
116 123
117 count -= bytestocopy; 124 count -= bytestocopy;
118 buffer += bytestocopy; 125 buffer += bytestocopy;
diff --git a/sound/oss/emu10k1/cardwi.c b/sound/oss/emu10k1/cardwi.c
index 8bbf44b881b4..060d1be94d33 100644
--- a/sound/oss/emu10k1/cardwi.c
+++ b/sound/oss/emu10k1/cardwi.c
@@ -304,11 +304,12 @@ void emu10k1_wavein_getxfersize(struct wiinst *wiinst, u32 * size)
304 } 304 }
305} 305}
306 306
307static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov) 307static int copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov)
308{ 308{
309 if (cov == 1) 309 if (cov == 1) {
310 __copy_to_user(dst, src + str, len); 310 if (__copy_to_user(dst, src + str, len))
311 else { 311 return -EFAULT;
312 } else {
312 u8 byte; 313 u8 byte;
313 u32 i; 314 u32 i;
314 315
@@ -316,22 +317,26 @@ static void copy_block(u8 __user *dst, u8 * src, u32 str, u32 len, u8 cov)
316 317
317 for (i = 0; i < len; i++) { 318 for (i = 0; i < len; i++) {
318 byte = src[2 * i] ^ 0x80; 319 byte = src[2 * i] ^ 0x80;
319 __copy_to_user(dst + i, &byte, 1); 320 if (__copy_to_user(dst + i, &byte, 1))
321 return -EFAULT;
320 } 322 }
321 } 323 }
324
325 return 0;
322} 326}
323 327
324void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size) 328int emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size)
325{ 329{
326 struct wavein_buffer *buffer = &wiinst->buffer; 330 struct wavein_buffer *buffer = &wiinst->buffer;
327 u32 sizetocopy, sizetocopy_now, start; 331 u32 sizetocopy, sizetocopy_now, start;
328 unsigned long flags; 332 unsigned long flags;
333 int ret;
329 334
330 sizetocopy = min_t(u32, buffer->size, *size); 335 sizetocopy = min_t(u32, buffer->size, *size);
331 *size = sizetocopy; 336 *size = sizetocopy;
332 337
333 if (!sizetocopy) 338 if (!sizetocopy)
334 return; 339 return 0;
335 340
336 spin_lock_irqsave(&wiinst->lock, flags); 341 spin_lock_irqsave(&wiinst->lock, flags);
337 start = buffer->pos; 342 start = buffer->pos;
@@ -345,11 +350,17 @@ void emu10k1_wavein_xferdata(struct wiinst *wiinst, u8 __user *data, u32 * size)
345 if (sizetocopy > sizetocopy_now) { 350 if (sizetocopy > sizetocopy_now) {
346 sizetocopy -= sizetocopy_now; 351 sizetocopy -= sizetocopy_now;
347 352
348 copy_block(data, buffer->addr, start, sizetocopy_now, buffer->cov); 353 ret = copy_block(data, buffer->addr, start, sizetocopy_now,
349 copy_block(data + sizetocopy_now, buffer->addr, 0, sizetocopy, buffer->cov); 354 buffer->cov);
355 if (ret == 0)
356 ret = copy_block(data + sizetocopy_now, buffer->addr, 0,
357 sizetocopy, buffer->cov);
350 } else { 358 } else {
351 copy_block(data, buffer->addr, start, sizetocopy, buffer->cov); 359 ret = copy_block(data, buffer->addr, start, sizetocopy,
360 buffer->cov);
352 } 361 }
362
363 return ret;
353} 364}
354 365
355void emu10k1_wavein_update(struct emu10k1_card *card, struct wiinst *wiinst) 366void emu10k1_wavein_update(struct emu10k1_card *card, struct wiinst *wiinst)
diff --git a/sound/oss/emu10k1/cardwi.h b/sound/oss/emu10k1/cardwi.h
index 15cfb9b35596..e82029b46ad1 100644
--- a/sound/oss/emu10k1/cardwi.h
+++ b/sound/oss/emu10k1/cardwi.h
@@ -83,7 +83,7 @@ void emu10k1_wavein_close(struct emu10k1_wavedevice *);
83void emu10k1_wavein_start(struct emu10k1_wavedevice *); 83void emu10k1_wavein_start(struct emu10k1_wavedevice *);
84void emu10k1_wavein_stop(struct emu10k1_wavedevice *); 84void emu10k1_wavein_stop(struct emu10k1_wavedevice *);
85void emu10k1_wavein_getxfersize(struct wiinst *, u32 *); 85void emu10k1_wavein_getxfersize(struct wiinst *, u32 *);
86void emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *); 86int emu10k1_wavein_xferdata(struct wiinst *, u8 __user *, u32 *);
87int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *); 87int emu10k1_wavein_setformat(struct emu10k1_wavedevice *, struct wave_format *);
88void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *); 88void emu10k1_wavein_update(struct emu10k1_card *, struct wiinst *);
89 89
diff --git a/sound/oss/emu10k1/passthrough.c b/sound/oss/emu10k1/passthrough.c
index 4e3baca7d41f..6d21d4368dec 100644
--- a/sound/oss/emu10k1/passthrough.c
+++ b/sound/oss/emu10k1/passthrough.c
@@ -162,12 +162,15 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co
162 162
163 DPD(3, "prepend size %d, prepending %d bytes\n", pt->prepend_size, needed); 163 DPD(3, "prepend size %d, prepending %d bytes\n", pt->prepend_size, needed);
164 if (count < needed) { 164 if (count < needed) {
165 copy_from_user(pt->buf + pt->prepend_size, buffer, count); 165 if (copy_from_user(pt->buf + pt->prepend_size,
166 buffer, count))
167 return -EFAULT;
166 pt->prepend_size += count; 168 pt->prepend_size += count;
167 DPD(3, "prepend size now %d\n", pt->prepend_size); 169 DPD(3, "prepend size now %d\n", pt->prepend_size);
168 return count; 170 return count;
169 } 171 }
170 copy_from_user(pt->buf + pt->prepend_size, buffer, needed); 172 if (copy_from_user(pt->buf + pt->prepend_size, buffer, needed))
173 return -EFAULT;
171 r = pt_putblock(wave_dev, (u16 *) pt->buf, nonblock); 174 r = pt_putblock(wave_dev, (u16 *) pt->buf, nonblock);
172 if (r) 175 if (r)
173 return r; 176 return r;
@@ -178,7 +181,8 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co
178 blocks_copied = 0; 181 blocks_copied = 0;
179 while (blocks > 0) { 182 while (blocks > 0) {
180 u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2); 183 u16 __user *bufptr = (u16 __user *) buffer + (bytes_copied/2);
181 copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE); 184 if (copy_from_user(pt->buf, bufptr, PT_BLOCKSIZE))
185 return -EFAULT;
182 r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock); 186 r = pt_putblock(wave_dev, (u16 *)pt->buf, nonblock);
183 if (r) { 187 if (r) {
184 if (bytes_copied) 188 if (bytes_copied)
@@ -193,7 +197,8 @@ ssize_t emu10k1_pt_write(struct file *file, const char __user *buffer, size_t co
193 i = count - bytes_copied; 197 i = count - bytes_copied;
194 if (i) { 198 if (i) {
195 pt->prepend_size = i; 199 pt->prepend_size = i;
196 copy_from_user(pt->buf, buffer + bytes_copied, i); 200 if (copy_from_user(pt->buf, buffer + bytes_copied, i))
201 return -EFAULT;
197 bytes_copied += i; 202 bytes_copied += i;
198 DPD(3, "filling prepend buffer with %d bytes", i); 203 DPD(3, "filling prepend buffer with %d bytes", i);
199 } 204 }
diff --git a/sound/oss/es1371.c b/sound/oss/es1371.c
index ddf6b0a0bca5..cc282a0cd539 100644
--- a/sound/oss/es1371.c
+++ b/sound/oss/es1371.c
@@ -130,6 +130,7 @@
130#include <linux/wait.h> 130#include <linux/wait.h>
131#include <linux/dma-mapping.h> 131#include <linux/dma-mapping.h>
132#include <linux/mutex.h> 132#include <linux/mutex.h>
133#include <linux/mm.h>
133 134
134#include <asm/io.h> 135#include <asm/io.h>
135#include <asm/page.h> 136#include <asm/page.h>
diff --git a/sound/oss/i810_audio.c b/sound/oss/i810_audio.c
index 240cc7939b69..c3c8a720d555 100644
--- a/sound/oss/i810_audio.c
+++ b/sound/oss/i810_audio.c
@@ -101,6 +101,7 @@
101#include <linux/ac97_codec.h> 101#include <linux/ac97_codec.h>
102#include <linux/bitops.h> 102#include <linux/bitops.h>
103#include <linux/mutex.h> 103#include <linux/mutex.h>
104#include <linux/mm.h>
104 105
105#include <asm/uaccess.h> 106#include <asm/uaccess.h>
106 107
diff --git a/sound/oss/msnd_pinnacle.c b/sound/oss/msnd_pinnacle.c
index d5146790f5e3..24110d63b136 100644
--- a/sound/oss/msnd_pinnacle.c
+++ b/sound/oss/msnd_pinnacle.c
@@ -1007,7 +1007,7 @@ static int dsp_write(const char __user *buf, size_t len)
1007 1007
1008static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off) 1008static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_t *off)
1009{ 1009{
1010 int minor = iminor(file->f_dentry->d_inode); 1010 int minor = iminor(file->f_path.dentry->d_inode);
1011 if (minor == dev.dsp_minor) 1011 if (minor == dev.dsp_minor)
1012 return dsp_read(buf, count); 1012 return dsp_read(buf, count);
1013 else 1013 else
@@ -1016,7 +1016,7 @@ static ssize_t dev_read(struct file *file, char __user *buf, size_t count, loff_
1016 1016
1017static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off) 1017static ssize_t dev_write(struct file *file, const char __user *buf, size_t count, loff_t *off)
1018{ 1018{
1019 int minor = iminor(file->f_dentry->d_inode); 1019 int minor = iminor(file->f_path.dentry->d_inode);
1020 if (minor == dev.dsp_minor) 1020 if (minor == dev.dsp_minor)
1021 return dsp_write(buf, count); 1021 return dsp_write(buf, count);
1022 else 1022 else
diff --git a/sound/oss/sh_dac_audio.c b/sound/oss/sh_dac_audio.c
index 3b3b4da8cfd3..51f554154c48 100644
--- a/sound/oss/sh_dac_audio.c
+++ b/sound/oss/sh_dac_audio.c
@@ -26,7 +26,7 @@
26#include <asm/cpu/dac.h> 26#include <asm/cpu/dac.h>
27#include <asm/cpu/timer.h> 27#include <asm/cpu/timer.h>
28#include <asm/machvec.h> 28#include <asm/machvec.h>
29#include <asm/hp6xx/hp6xx.h> 29#include <asm/hp6xx.h>
30#include <asm/hd64461.h> 30#include <asm/hd64461.h>
31 31
32#define MODNAME "sh_dac_audio" 32#define MODNAME "sh_dac_audio"
diff --git a/sound/oss/soundcard.c b/sound/oss/soundcard.c
index 2344d09c7114..a89108cb74ea 100644
--- a/sound/oss/soundcard.c
+++ b/sound/oss/soundcard.c
@@ -42,6 +42,7 @@
42#include <linux/proc_fs.h> 42#include <linux/proc_fs.h>
43#include <linux/smp_lock.h> 43#include <linux/smp_lock.h>
44#include <linux/module.h> 44#include <linux/module.h>
45#include <linux/mm.h>
45 46
46/* 47/*
47 * This ought to be moved into include/asm/dma.h 48 * This ought to be moved into include/asm/dma.h
@@ -140,7 +141,7 @@ static int get_mixer_levels(void __user * arg)
140 141
141static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos) 142static ssize_t sound_read(struct file *file, char __user *buf, size_t count, loff_t *ppos)
142{ 143{
143 int dev = iminor(file->f_dentry->d_inode); 144 int dev = iminor(file->f_path.dentry->d_inode);
144 int ret = -EINVAL; 145 int ret = -EINVAL;
145 146
146 /* 147 /*
@@ -173,7 +174,7 @@ static ssize_t sound_read(struct file *file, char __user *buf, size_t count, lof
173 174
174static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos) 175static ssize_t sound_write(struct file *file, const char __user *buf, size_t count, loff_t *ppos)
175{ 176{
176 int dev = iminor(file->f_dentry->d_inode); 177 int dev = iminor(file->f_path.dentry->d_inode);
177 int ret = -EINVAL; 178 int ret = -EINVAL;
178 179
179 lock_kernel(); 180 lock_kernel();
@@ -392,7 +393,7 @@ static int sound_ioctl(struct inode *inode, struct file *file,
392 393
393static unsigned int sound_poll(struct file *file, poll_table * wait) 394static unsigned int sound_poll(struct file *file, poll_table * wait)
394{ 395{
395 struct inode *inode = file->f_dentry->d_inode; 396 struct inode *inode = file->f_path.dentry->d_inode;
396 int dev = iminor(inode); 397 int dev = iminor(inode);
397 398
398 DEB(printk("sound_poll(dev=%d)\n", dev)); 399 DEB(printk("sound_poll(dev=%d)\n", dev));
@@ -417,7 +418,7 @@ static int sound_mmap(struct file *file, struct vm_area_struct *vma)
417 int dev_class; 418 int dev_class;
418 unsigned long size; 419 unsigned long size;
419 struct dma_buffparms *dmap = NULL; 420 struct dma_buffparms *dmap = NULL;
420 int dev = iminor(file->f_dentry->d_inode); 421 int dev = iminor(file->f_path.dentry->d_inode);
421 422
422 dev_class = dev & 0x0f; 423 dev_class = dev & 0x0f;
423 dev >>= 4; 424 dev >>= 4;
@@ -557,17 +558,17 @@ static int __init oss_init(void)
557 sound_dmap_flag = (dmabuf > 0 ? 1 : 0); 558 sound_dmap_flag = (dmabuf > 0 ? 1 : 0);
558 559
559 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { 560 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
560 class_device_create(sound_class, NULL, 561 device_create(sound_class, NULL,
561 MKDEV(SOUND_MAJOR, dev_list[i].minor), 562 MKDEV(SOUND_MAJOR, dev_list[i].minor),
562 NULL, "%s", dev_list[i].name); 563 "%s", dev_list[i].name);
563 564
564 if (!dev_list[i].num) 565 if (!dev_list[i].num)
565 continue; 566 continue;
566 567
567 for (j = 1; j < *dev_list[i].num; j++) 568 for (j = 1; j < *dev_list[i].num; j++)
568 class_device_create(sound_class, NULL, 569 device_create(sound_class, NULL,
569 MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)), 570 MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)),
570 NULL, "%s%d", dev_list[i].name, j); 571 "%s%d", dev_list[i].name, j);
571 } 572 }
572 573
573 if (sound_nblocks >= 1024) 574 if (sound_nblocks >= 1024)
@@ -581,11 +582,11 @@ static void __exit oss_cleanup(void)
581 int i, j; 582 int i, j;
582 583
583 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) { 584 for (i = 0; i < sizeof (dev_list) / sizeof *dev_list; i++) {
584 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor)); 585 device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor));
585 if (!dev_list[i].num) 586 if (!dev_list[i].num)
586 continue; 587 continue;
587 for (j = 1; j < *dev_list[i].num; j++) 588 for (j = 1; j < *dev_list[i].num; j++)
588 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10))); 589 device_destroy(sound_class, MKDEV(SOUND_MAJOR, dev_list[i].minor + (j*0x10)));
589 } 590 }
590 591
591 unregister_sound_special(1); 592 unregister_sound_special(1);
diff --git a/sound/oss/sscape.c b/sound/oss/sscape.c
index 51f2fa615413..30c36d1f35d7 100644
--- a/sound/oss/sscape.c
+++ b/sound/oss/sscape.c
@@ -39,6 +39,7 @@
39#include <linux/ioport.h> 39#include <linux/ioport.h>
40#include <linux/delay.h> 40#include <linux/delay.h>
41#include <linux/proc_fs.h> 41#include <linux/proc_fs.h>
42#include <linux/mm.h>
42#include <linux/spinlock.h> 43#include <linux/spinlock.h>
43 44
44#include "coproc.h" 45#include "coproc.h"
diff --git a/sound/oss/trident.c b/sound/oss/trident.c
index 7a363a178afd..6b1f8c9cdcf8 100644
--- a/sound/oss/trident.c
+++ b/sound/oss/trident.c
@@ -216,6 +216,7 @@
216#include <linux/gameport.h> 216#include <linux/gameport.h>
217#include <linux/kernel.h> 217#include <linux/kernel.h>
218#include <linux/mutex.h> 218#include <linux/mutex.h>
219#include <linux/mm.h>
219 220
220#include <asm/uaccess.h> 221#include <asm/uaccess.h>
221#include <asm/io.h> 222#include <asm/io.h>
diff --git a/sound/oss/via82cxxx_audio.c b/sound/oss/via82cxxx_audio.c
index 17837d4b5ed3..c96cc8c68b3b 100644
--- a/sound/oss/via82cxxx_audio.c
+++ b/sound/oss/via82cxxx_audio.c
@@ -2120,8 +2120,8 @@ static struct page * via_mm_nopage (struct vm_area_struct * vma,
2120 return NOPAGE_SIGBUS; /* Disallow mremap */ 2120 return NOPAGE_SIGBUS; /* Disallow mremap */
2121 } 2121 }
2122 if (!card) { 2122 if (!card) {
2123 DPRINTK ("EXIT, returning NOPAGE_OOM\n"); 2123 DPRINTK ("EXIT, returning NOPAGE_SIGBUS\n");
2124 return NOPAGE_OOM; /* Nothing allocated */ 2124 return NOPAGE_SIGBUS; /* Nothing allocated */
2125 } 2125 }
2126 2126
2127 pgoff = vma->vm_pgoff + ((address - vma->vm_start) >> PAGE_SHIFT); 2127 pgoff = vma->vm_pgoff + ((address - vma->vm_start) >> PAGE_SHIFT);
diff --git a/sound/pci/ac97/Makefile b/sound/pci/ac97/Makefile
index 77b3482cb133..3c3222122d8b 100644
--- a/sound/pci/ac97/Makefile
+++ b/sound/pci/ac97/Makefile
@@ -10,11 +10,9 @@ snd-ac97-codec-objs += ac97_proc.o
10endif 10endif
11 11
12snd-ak4531-codec-objs := ak4531_codec.o 12snd-ak4531-codec-objs := ak4531_codec.o
13snd-ac97-bus-objs := ac97_bus.o
14 13
15# Toplevel Module Dependency 14# Toplevel Module Dependency
16obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o 15obj-$(CONFIG_SND_AC97_CODEC) += snd-ac97-codec.o
17obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o 16obj-$(CONFIG_SND_ENS1370) += snd-ak4531-codec.o
18obj-$(CONFIG_SND_AC97_BUS) += snd-ac97-bus.o
19 17
20obj-m := $(sort $(obj-m)) 18obj-m := $(sort $(obj-m))
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index a79e91850ba3..7abcb10b2754 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -570,8 +570,7 @@ int snd_ac97_put_volsw(struct snd_kcontrol *kcontrol, struct snd_ctl_elem_value
570 ac97->power_up &= ~(1 << (reg>>1)); 570 ac97->power_up &= ~(1 << (reg>>1));
571 else 571 else
572 ac97->power_up |= 1 << (reg>>1); 572 ac97->power_up |= 1 << (reg>>1);
573 if (power_save) 573 update_power_regs(ac97);
574 update_power_regs(ac97);
575 } 574 }
576#endif 575#endif
577 return err; 576 return err;
@@ -1928,9 +1927,10 @@ static int snd_ac97_dev_disconnect(struct snd_device *device)
1928static struct snd_ac97_build_ops null_build_ops; 1927static struct snd_ac97_build_ops null_build_ops;
1929 1928
1930#ifdef CONFIG_SND_AC97_POWER_SAVE 1929#ifdef CONFIG_SND_AC97_POWER_SAVE
1931static void do_update_power(void *data) 1930static void do_update_power(struct work_struct *work)
1932{ 1931{
1933 update_power_regs(data); 1932 update_power_regs(
1933 container_of(work, struct snd_ac97, power_work.work));
1934} 1934}
1935#endif 1935#endif
1936 1936
@@ -1990,7 +1990,7 @@ int snd_ac97_mixer(struct snd_ac97_bus *bus, struct snd_ac97_template *template,
1990 mutex_init(&ac97->page_mutex); 1990 mutex_init(&ac97->page_mutex);
1991#ifdef CONFIG_SND_AC97_POWER_SAVE 1991#ifdef CONFIG_SND_AC97_POWER_SAVE
1992 ac97->power_workq = create_workqueue("ac97"); 1992 ac97->power_workq = create_workqueue("ac97");
1993 INIT_WORK(&ac97->power_work, do_update_power, ac97); 1993 INIT_DELAYED_WORK(&ac97->power_work, do_update_power);
1994#endif 1994#endif
1995 1995
1996#ifdef CONFIG_PCI 1996#ifdef CONFIG_PCI
@@ -2337,10 +2337,7 @@ int snd_ac97_update_power(struct snd_ac97 *ac97, int reg, int powerup)
2337 } 2337 }
2338 } 2338 }
2339 2339
2340 if (! power_save) 2340 if (power_save && !powerup && ac97->power_workq)
2341 return 0;
2342
2343 if (! powerup && ac97->power_workq)
2344 /* adjust power-down bits after two seconds delay 2341 /* adjust power-down bits after two seconds delay
2345 * (for avoiding loud click noises for many (OSS) apps 2342 * (for avoiding loud click noises for many (OSS) apps
2346 * that open/close frequently) 2343 * that open/close frequently)
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 13a8cefa7749..a7edd56542d4 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2032,8 +2032,10 @@ static int ali_suspend(struct pci_dev *pci, pm_message_t state)
2032 outl(0xffffffff, ALI_REG(chip, ALI_STOP)); 2032 outl(0xffffffff, ALI_REG(chip, ALI_STOP));
2033 2033
2034 spin_unlock_irq(&chip->reg_lock); 2034 spin_unlock_irq(&chip->reg_lock);
2035
2035 pci_disable_device(pci); 2036 pci_disable_device(pci);
2036 pci_save_state(pci); 2037 pci_save_state(pci);
2038 pci_set_power_state(pci, pci_choose_state(pci, state));
2037 return 0; 2039 return 0;
2038} 2040}
2039 2041
@@ -2048,8 +2050,15 @@ static int ali_resume(struct pci_dev *pci)
2048 if (! im) 2050 if (! im)
2049 return 0; 2051 return 0;
2050 2052
2053 pci_set_power_state(pci, PCI_D0);
2051 pci_restore_state(pci); 2054 pci_restore_state(pci);
2052 pci_enable_device(pci); 2055 if (pci_enable_device(pci) < 0) {
2056 printk(KERN_ERR "ali5451: pci_enable_device failed, "
2057 "disabling device\n");
2058 snd_card_disconnect(card);
2059 return -EIO;
2060 }
2061 pci_set_master(pci);
2053 2062
2054 spin_lock_irq(&chip->reg_lock); 2063 spin_lock_irq(&chip->reg_lock);
2055 2064
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 9b16c299f0a9..95f70f3cc37e 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -768,9 +768,9 @@ static int snd_als300_suspend(struct pci_dev *pci, pm_message_t state)
768 snd_pcm_suspend_all(chip->pcm); 768 snd_pcm_suspend_all(chip->pcm);
769 snd_ac97_suspend(chip->ac97); 769 snd_ac97_suspend(chip->ac97);
770 770
771 pci_set_power_state(pci, PCI_D3hot);
772 pci_disable_device(pci); 771 pci_disable_device(pci);
773 pci_save_state(pci); 772 pci_save_state(pci);
773 pci_set_power_state(pci, pci_choose_state(pci, state));
774 return 0; 774 return 0;
775} 775}
776 776
@@ -779,9 +779,14 @@ static int snd_als300_resume(struct pci_dev *pci)
779 struct snd_card *card = pci_get_drvdata(pci); 779 struct snd_card *card = pci_get_drvdata(pci);
780 struct snd_als300 *chip = card->private_data; 780 struct snd_als300 *chip = card->private_data;
781 781
782 pci_restore_state(pci);
783 pci_enable_device(pci);
784 pci_set_power_state(pci, PCI_D0); 782 pci_set_power_state(pci, PCI_D0);
783 pci_restore_state(pci);
784 if (pci_enable_device(pci) < 0) {
785 printk(KERN_ERR "als300: pci_enable_device failed, "
786 "disabling device\n");
787 snd_card_disconnect(card);
788 return -EIO;
789 }
785 pci_set_master(pci); 790 pci_set_master(pci);
786 791
787 snd_als300_init(chip); 792 snd_als300_init(chip);
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index 15fc3929b5f7..8fb55d3b454b 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -804,9 +804,9 @@ static int snd_als4000_suspend(struct pci_dev *pci, pm_message_t state)
804 snd_pcm_suspend_all(chip->pcm); 804 snd_pcm_suspend_all(chip->pcm);
805 snd_sbmixer_suspend(chip); 805 snd_sbmixer_suspend(chip);
806 806
807 pci_set_power_state(pci, PCI_D3hot);
808 pci_disable_device(pci); 807 pci_disable_device(pci);
809 pci_save_state(pci); 808 pci_save_state(pci);
809 pci_set_power_state(pci, pci_choose_state(pci, state));
810 return 0; 810 return 0;
811} 811}
812 812
@@ -816,9 +816,14 @@ static int snd_als4000_resume(struct pci_dev *pci)
816 struct snd_card_als4000 *acard = card->private_data; 816 struct snd_card_als4000 *acard = card->private_data;
817 struct snd_sb *chip = acard->chip; 817 struct snd_sb *chip = acard->chip;
818 818
819 pci_restore_state(pci);
820 pci_enable_device(pci);
821 pci_set_power_state(pci, PCI_D0); 819 pci_set_power_state(pci, PCI_D0);
820 pci_restore_state(pci);
821 if (pci_enable_device(pci) < 0) {
822 printk(KERN_ERR "als4000: pci_enable_device failed, "
823 "disabling device\n");
824 snd_card_disconnect(card);
825 return -EIO;
826 }
822 pci_set_master(pci); 827 pci_set_master(pci);
823 828
824 snd_als4000_configure(chip); 829 snd_als4000_configure(chip);
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 3e8fc5a0006a..e3e99f396711 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1442,9 +1442,9 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
1442 snd_atiixp_aclink_down(chip); 1442 snd_atiixp_aclink_down(chip);
1443 snd_atiixp_chip_stop(chip); 1443 snd_atiixp_chip_stop(chip);
1444 1444
1445 pci_set_power_state(pci, PCI_D3hot);
1446 pci_disable_device(pci); 1445 pci_disable_device(pci);
1447 pci_save_state(pci); 1446 pci_save_state(pci);
1447 pci_set_power_state(pci, pci_choose_state(pci, state));
1448 return 0; 1448 return 0;
1449} 1449}
1450 1450
@@ -1454,9 +1454,14 @@ static int snd_atiixp_resume(struct pci_dev *pci)
1454 struct atiixp *chip = card->private_data; 1454 struct atiixp *chip = card->private_data;
1455 int i; 1455 int i;
1456 1456
1457 pci_restore_state(pci);
1458 pci_enable_device(pci);
1459 pci_set_power_state(pci, PCI_D0); 1457 pci_set_power_state(pci, PCI_D0);
1458 pci_restore_state(pci);
1459 if (pci_enable_device(pci) < 0) {
1460 printk(KERN_ERR "atiixp: pci_enable_device failed, "
1461 "disabling device\n");
1462 snd_card_disconnect(card);
1463 return -EIO;
1464 }
1460 pci_set_master(pci); 1465 pci_set_master(pci);
1461 1466
1462 snd_atiixp_aclink_reset(chip); 1467 snd_atiixp_aclink_reset(chip);
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index c5dda1bf3d46..dc54f2c68ed7 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1128,9 +1128,9 @@ static int snd_atiixp_suspend(struct pci_dev *pci, pm_message_t state)
1128 snd_atiixp_aclink_down(chip); 1128 snd_atiixp_aclink_down(chip);
1129 snd_atiixp_chip_stop(chip); 1129 snd_atiixp_chip_stop(chip);
1130 1130
1131 pci_set_power_state(pci, PCI_D3hot);
1132 pci_disable_device(pci); 1131 pci_disable_device(pci);
1133 pci_save_state(pci); 1132 pci_save_state(pci);
1133 pci_set_power_state(pci, pci_choose_state(pci, state));
1134 return 0; 1134 return 0;
1135} 1135}
1136 1136
@@ -1140,9 +1140,14 @@ static int snd_atiixp_resume(struct pci_dev *pci)
1140 struct atiixp_modem *chip = card->private_data; 1140 struct atiixp_modem *chip = card->private_data;
1141 int i; 1141 int i;
1142 1142
1143 pci_restore_state(pci);
1144 pci_enable_device(pci);
1145 pci_set_power_state(pci, PCI_D0); 1143 pci_set_power_state(pci, PCI_D0);
1144 pci_restore_state(pci);
1145 if (pci_enable_device(pci) < 0) {
1146 printk(KERN_ERR "atiixp-modem: pci_enable_device failed, "
1147 "disabling device\n");
1148 snd_card_disconnect(card);
1149 return -EIO;
1150 }
1146 pci_set_master(pci); 1151 pci_set_master(pci);
1147 1152
1148 snd_atiixp_aclink_reset(chip); 1153 snd_atiixp_aclink_reset(chip);
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 692f203d65d8..2414ee630756 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1903,9 +1903,9 @@ snd_azf3328_suspend(struct pci_dev *pci, pm_message_t state)
1903 for (reg = 0; reg < AZF_IO_SIZE_SYNTH_PM / 2; reg++) 1903 for (reg = 0; reg < AZF_IO_SIZE_SYNTH_PM / 2; reg++)
1904 chip->saved_regs_synth[reg] = inw(chip->synth_port + reg * 2); 1904 chip->saved_regs_synth[reg] = inw(chip->synth_port + reg * 2);
1905 1905
1906 pci_set_power_state(pci, PCI_D3hot);
1907 pci_disable_device(pci); 1906 pci_disable_device(pci);
1908 pci_save_state(pci); 1907 pci_save_state(pci);
1908 pci_set_power_state(pci, pci_choose_state(pci, state));
1909 return 0; 1909 return 0;
1910} 1910}
1911 1911
@@ -1916,9 +1916,14 @@ snd_azf3328_resume(struct pci_dev *pci)
1916 struct snd_azf3328 *chip = card->private_data; 1916 struct snd_azf3328 *chip = card->private_data;
1917 int reg; 1917 int reg;
1918 1918
1919 pci_restore_state(pci);
1920 pci_enable_device(pci);
1921 pci_set_power_state(pci, PCI_D0); 1919 pci_set_power_state(pci, PCI_D0);
1920 pci_restore_state(pci);
1921 if (pci_enable_device(pci) < 0) {
1922 printk(KERN_ERR "azt3328: pci_enable_device failed, "
1923 "disabling device\n");
1924 snd_card_disconnect(card);
1925 return -EIO;
1926 }
1922 pci_set_master(pci); 1927 pci_set_master(pci);
1923 1928
1924 for (reg = 0; reg < AZF_IO_SIZE_IO2_PM / 2; reg++) 1929 for (reg = 0; reg < AZF_IO_SIZE_IO2_PM / 2; reg++)
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 1f7e71083069..0093cd1f92db 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -3122,9 +3122,9 @@ static int snd_cmipci_suspend(struct pci_dev *pci, pm_message_t state)
3122 /* disable ints */ 3122 /* disable ints */
3123 snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0); 3123 snd_cmipci_write(cm, CM_REG_INT_HLDCLR, 0);
3124 3124
3125 pci_set_power_state(pci, PCI_D3hot);
3126 pci_disable_device(pci); 3125 pci_disable_device(pci);
3127 pci_save_state(pci); 3126 pci_save_state(pci);
3127 pci_set_power_state(pci, pci_choose_state(pci, state));
3128 return 0; 3128 return 0;
3129} 3129}
3130 3130
@@ -3134,9 +3134,14 @@ static int snd_cmipci_resume(struct pci_dev *pci)
3134 struct cmipci *cm = card->private_data; 3134 struct cmipci *cm = card->private_data;
3135 int i; 3135 int i;
3136 3136
3137 pci_restore_state(pci);
3138 pci_enable_device(pci);
3139 pci_set_power_state(pci, PCI_D0); 3137 pci_set_power_state(pci, PCI_D0);
3138 pci_restore_state(pci);
3139 if (pci_enable_device(pci) < 0) {
3140 printk(KERN_ERR "cmipci: pci_enable_device failed, "
3141 "disabling device\n");
3142 snd_card_disconnect(card);
3143 return -EIO;
3144 }
3140 pci_set_master(pci); 3145 pci_set_master(pci);
3141 3146
3142 /* reset / initialize to a sane state */ 3147 /* reset / initialize to a sane state */
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index d54924e60bb1..0905fa88129d 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -2050,6 +2050,7 @@ static int cs4281_suspend(struct pci_dev *pci, pm_message_t state)
2050 2050
2051 pci_disable_device(pci); 2051 pci_disable_device(pci);
2052 pci_save_state(pci); 2052 pci_save_state(pci);
2053 pci_set_power_state(pci, pci_choose_state(pci, state));
2053 return 0; 2054 return 0;
2054} 2055}
2055 2056
@@ -2060,8 +2061,14 @@ static int cs4281_resume(struct pci_dev *pci)
2060 unsigned int i; 2061 unsigned int i;
2061 u32 ulCLK; 2062 u32 ulCLK;
2062 2063
2064 pci_set_power_state(pci, PCI_D0);
2063 pci_restore_state(pci); 2065 pci_restore_state(pci);
2064 pci_enable_device(pci); 2066 if (pci_enable_device(pci) < 0) {
2067 printk(KERN_ERR "cs4281: pci_enable_device failed, "
2068 "disabling device\n");
2069 snd_card_disconnect(card);
2070 return -EIO;
2071 }
2065 pci_set_master(pci); 2072 pci_set_master(pci);
2066 2073
2067 ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1); 2074 ulCLK = snd_cs4281_peekBA0(chip, BA0_CLKCR1);
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 16d4ebf2a33f..2807b9756ef0 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -3687,8 +3687,10 @@ int snd_cs46xx_suspend(struct pci_dev *pci, pm_message_t state)
3687 /* disable CLKRUN */ 3687 /* disable CLKRUN */
3688 chip->active_ctrl(chip, -chip->amplifier); 3688 chip->active_ctrl(chip, -chip->amplifier);
3689 chip->amplifier = amp_saved; /* restore the status */ 3689 chip->amplifier = amp_saved; /* restore the status */
3690
3690 pci_disable_device(pci); 3691 pci_disable_device(pci);
3691 pci_save_state(pci); 3692 pci_save_state(pci);
3693 pci_set_power_state(pci, pci_choose_state(pci, state));
3692 return 0; 3694 return 0;
3693} 3695}
3694 3696
@@ -3698,9 +3700,16 @@ int snd_cs46xx_resume(struct pci_dev *pci)
3698 struct snd_cs46xx *chip = card->private_data; 3700 struct snd_cs46xx *chip = card->private_data;
3699 int amp_saved; 3701 int amp_saved;
3700 3702
3703 pci_set_power_state(pci, PCI_D0);
3701 pci_restore_state(pci); 3704 pci_restore_state(pci);
3702 pci_enable_device(pci); 3705 if (pci_enable_device(pci) < 0) {
3706 printk(KERN_ERR "cs46xx: pci_enable_device failed, "
3707 "disabling device\n");
3708 snd_card_disconnect(card);
3709 return -EIO;
3710 }
3703 pci_set_master(pci); 3711 pci_set_master(pci);
3712
3704 amp_saved = chip->amplifier; 3713 amp_saved = chip->amplifier;
3705 chip->amplifier = 0; 3714 chip->amplifier = 0;
3706 chip->active_ctrl(chip, 1); /* force to on */ 3715 chip->active_ctrl(chip, 1); /* force to on */
diff --git a/sound/pci/cs5535audio/cs5535audio_pm.c b/sound/pci/cs5535audio/cs5535audio_pm.c
index aad0e69db9c1..3e4d198a4502 100644
--- a/sound/pci/cs5535audio/cs5535audio_pm.c
+++ b/sound/pci/cs5535audio/cs5535audio_pm.c
@@ -73,9 +73,10 @@ int snd_cs5535audio_suspend(struct pci_dev *pci, pm_message_t state)
73 snd_ac97_suspend(cs5535au->ac97); 73 snd_ac97_suspend(cs5535au->ac97);
74 /* save important regs, then disable aclink in hw */ 74 /* save important regs, then disable aclink in hw */
75 snd_cs5535audio_stop_hardware(cs5535au); 75 snd_cs5535audio_stop_hardware(cs5535au);
76
76 pci_disable_device(pci); 77 pci_disable_device(pci);
77 pci_save_state(pci); 78 pci_save_state(pci);
78 79 pci_set_power_state(pci, pci_choose_state(pci, state));
79 return 0; 80 return 0;
80} 81}
81 82
@@ -87,8 +88,14 @@ int snd_cs5535audio_resume(struct pci_dev *pci)
87 int timeout; 88 int timeout;
88 int i; 89 int i;
89 90
91 pci_set_power_state(pci, PCI_D0);
90 pci_restore_state(pci); 92 pci_restore_state(pci);
91 pci_enable_device(pci); 93 if (pci_enable_device(pci) < 0) {
94 printk(KERN_ERR "cs5535audio: pci_enable_device failed, "
95 "disabling device\n");
96 snd_card_disconnect(card);
97 return -EIO;
98 }
92 pci_set_master(pci); 99 pci_set_master(pci);
93 100
94 /* set LNK_WRM_RST to reset AC link */ 101 /* set LNK_WRM_RST to reset AC link */
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index 493ec0816bb3..55caf341933a 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -226,9 +226,9 @@ static int snd_emu10k1_suspend(struct pci_dev *pci, pm_message_t state)
226 226
227 snd_emu10k1_done(emu); 227 snd_emu10k1_done(emu);
228 228
229 pci_set_power_state(pci, PCI_D3hot);
230 pci_disable_device(pci); 229 pci_disable_device(pci);
231 pci_save_state(pci); 230 pci_save_state(pci);
231 pci_set_power_state(pci, pci_choose_state(pci, state));
232 return 0; 232 return 0;
233} 233}
234 234
@@ -237,11 +237,16 @@ static int snd_emu10k1_resume(struct pci_dev *pci)
237 struct snd_card *card = pci_get_drvdata(pci); 237 struct snd_card *card = pci_get_drvdata(pci);
238 struct snd_emu10k1 *emu = card->private_data; 238 struct snd_emu10k1 *emu = card->private_data;
239 239
240 pci_restore_state(pci);
241 pci_enable_device(pci);
242 pci_set_power_state(pci, PCI_D0); 240 pci_set_power_state(pci, PCI_D0);
241 pci_restore_state(pci);
242 if (pci_enable_device(pci) < 0) {
243 printk(KERN_ERR "emu10k1: pci_enable_device failed, "
244 "disabling device\n");
245 snd_card_disconnect(card);
246 return -EIO;
247 }
243 pci_set_master(pci); 248 pci_set_master(pci);
244 249
245 snd_emu10k1_resume_init(emu); 250 snd_emu10k1_resume_init(emu);
246 snd_emu10k1_efx_resume(emu); 251 snd_emu10k1_efx_resume(emu);
247 snd_ac97_resume(emu->ac97); 252 snd_ac97_resume(emu->ac97);
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 8058059c56e9..8bc4ffa6220d 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -956,6 +956,7 @@ static struct snd_emu_chip_details emu_chip_details[] = {
956 .ca0151_chip = 1, 956 .ca0151_chip = 1,
957 .spk71 = 1, 957 .spk71 = 1,
958 .spdif_bug = 1, 958 .spdif_bug = 1,
959 .adc_1361t = 1, /* 24 bit capture instead of 16bit. Fixes ALSA bug#324 */
959 .ac97_chip = 1} , 960 .ac97_chip = 1} ,
960 {.vendor = 0x1102, .device = 0x0004, .revision = 0x04, 961 {.vendor = 0x1102, .device = 0x0004, .revision = 0x04,
961 .driver = "Audigy2", .name = "Audigy 2 [Unknown]", 962 .driver = "Audigy2", .name = "Audigy 2 [Unknown]",
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index 8cb4fb2412db..d2a811f222c9 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2072,9 +2072,10 @@ static int snd_ensoniq_suspend(struct pci_dev *pci, pm_message_t state)
2072 udelay(100); 2072 udelay(100);
2073 snd_ak4531_suspend(ensoniq->u.es1370.ak4531); 2073 snd_ak4531_suspend(ensoniq->u.es1370.ak4531);
2074#endif 2074#endif
2075 pci_set_power_state(pci, PCI_D3hot); 2075
2076 pci_disable_device(pci); 2076 pci_disable_device(pci);
2077 pci_save_state(pci); 2077 pci_save_state(pci);
2078 pci_set_power_state(pci, pci_choose_state(pci, state));
2078 return 0; 2079 return 0;
2079} 2080}
2080 2081
@@ -2083,9 +2084,14 @@ static int snd_ensoniq_resume(struct pci_dev *pci)
2083 struct snd_card *card = pci_get_drvdata(pci); 2084 struct snd_card *card = pci_get_drvdata(pci);
2084 struct ensoniq *ensoniq = card->private_data; 2085 struct ensoniq *ensoniq = card->private_data;
2085 2086
2086 pci_restore_state(pci);
2087 pci_enable_device(pci);
2088 pci_set_power_state(pci, PCI_D0); 2087 pci_set_power_state(pci, PCI_D0);
2088 pci_restore_state(pci);
2089 if (pci_enable_device(pci) < 0) {
2090 printk(KERN_ERR DRIVER_NAME ": pci_enable_device failed, "
2091 "disabling device\n");
2092 snd_card_disconnect(card);
2093 return -EIO;
2094 }
2089 pci_set_master(pci); 2095 pci_set_master(pci);
2090 2096
2091 snd_ensoniq_chip_init(ensoniq); 2097 snd_ensoniq_chip_init(ensoniq);
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 2da988f78ba7..1a8d36df4b5d 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1481,10 +1481,14 @@ static int es1938_suspend(struct pci_dev *pci, pm_message_t state)
1481 *d = snd_es1938_reg_read(chip, *s); 1481 *d = snd_es1938_reg_read(chip, *s);
1482 1482
1483 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */ 1483 outb(0x00, SLIO_REG(chip, IRQCONTROL)); /* disable irqs */
1484 if (chip->irq >= 0) 1484 if (chip->irq >= 0) {
1485 synchronize_irq(chip->irq);
1485 free_irq(chip->irq, chip); 1486 free_irq(chip->irq, chip);
1487 chip->irq = -1;
1488 }
1486 pci_disable_device(pci); 1489 pci_disable_device(pci);
1487 pci_save_state(pci); 1490 pci_save_state(pci);
1491 pci_set_power_state(pci, pci_choose_state(pci, state));
1488 return 0; 1492 return 0;
1489} 1493}
1490 1494
@@ -1494,10 +1498,22 @@ static int es1938_resume(struct pci_dev *pci)
1494 struct es1938 *chip = card->private_data; 1498 struct es1938 *chip = card->private_data;
1495 unsigned char *s, *d; 1499 unsigned char *s, *d;
1496 1500
1501 pci_set_power_state(pci, PCI_D0);
1497 pci_restore_state(pci); 1502 pci_restore_state(pci);
1498 pci_enable_device(pci); 1503 if (pci_enable_device(pci) < 0) {
1499 request_irq(pci->irq, snd_es1938_interrupt, 1504 printk(KERN_ERR "es1938: pci_enable_device failed, "
1500 IRQF_DISABLED|IRQF_SHARED, "ES1938", chip); 1505 "disabling device\n");
1506 snd_card_disconnect(card);
1507 return -EIO;
1508 }
1509
1510 if (request_irq(pci->irq, snd_es1938_interrupt,
1511 IRQF_DISABLED|IRQF_SHARED, "ES1938", chip)) {
1512 printk(KERN_ERR "es1938: unable to grab IRQ %d, "
1513 "disabling device\n", pci->irq);
1514 snd_card_disconnect(card);
1515 return -EIO;
1516 }
1501 chip->irq = pci->irq; 1517 chip->irq = pci->irq;
1502 snd_es1938_chip_init(chip); 1518 snd_es1938_chip_init(chip);
1503 1519
@@ -1556,8 +1572,10 @@ static int snd_es1938_free(struct es1938 *chip)
1556 1572
1557 snd_es1938_free_gameport(chip); 1573 snd_es1938_free_gameport(chip);
1558 1574
1559 if (chip->irq >= 0) 1575 if (chip->irq >= 0) {
1576 synchronize_irq(chip->irq);
1560 free_irq(chip->irq, chip); 1577 free_irq(chip->irq, chip);
1578 }
1561 pci_release_regions(chip->pci); 1579 pci_release_regions(chip->pci);
1562 pci_disable_device(chip->pci); 1580 pci_disable_device(chip->pci);
1563 kfree(chip); 1581 kfree(chip);
@@ -1602,6 +1620,7 @@ static int __devinit snd_es1938_create(struct snd_card *card,
1602 spin_lock_init(&chip->mixer_lock); 1620 spin_lock_init(&chip->mixer_lock);
1603 chip->card = card; 1621 chip->card = card;
1604 chip->pci = pci; 1622 chip->pci = pci;
1623 chip->irq = -1;
1605 if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) { 1624 if ((err = pci_request_regions(pci, "ESS Solo-1")) < 0) {
1606 kfree(chip); 1625 kfree(chip);
1607 pci_disable_device(pci); 1626 pci_disable_device(pci);
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index b9d723c7e1db..092da53e1464 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -432,46 +432,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
432#define ESM_MODE_PLAY 0 432#define ESM_MODE_PLAY 0
433#define ESM_MODE_CAPTURE 1 433#define ESM_MODE_CAPTURE 1
434 434
435/* acpi states */
436enum {
437 ACPI_D0=0,
438 ACPI_D1,
439 ACPI_D2,
440 ACPI_D3
441};
442
443/* bits in the acpi masks */
444#define ACPI_12MHZ ( 1 << 15)
445#define ACPI_24MHZ ( 1 << 14)
446#define ACPI_978 ( 1 << 13)
447#define ACPI_SPDIF ( 1 << 12)
448#define ACPI_GLUE ( 1 << 11)
449#define ACPI__10 ( 1 << 10) /* reserved */
450#define ACPI_PCIINT ( 1 << 9)
451#define ACPI_HV ( 1 << 8) /* hardware volume */
452#define ACPI_GPIO ( 1 << 7)
453#define ACPI_ASSP ( 1 << 6)
454#define ACPI_SB ( 1 << 5) /* sb emul */
455#define ACPI_FM ( 1 << 4) /* fm emul */
456#define ACPI_RB ( 1 << 3) /* ringbus / aclink */
457#define ACPI_MIDI ( 1 << 2)
458#define ACPI_GP ( 1 << 1) /* game port */
459#define ACPI_WP ( 1 << 0) /* wave processor */
460
461#define ACPI_ALL (0xffff)
462#define ACPI_SLEEP (~(ACPI_SPDIF|ACPI_ASSP|ACPI_SB|ACPI_FM| \
463 ACPI_MIDI|ACPI_GP|ACPI_WP))
464#define ACPI_NONE (ACPI__10)
465
466/* these masks indicate which units we care about at
467 which states */
468static u16 acpi_state_mask[] = {
469 [ACPI_D0] = ACPI_ALL,
470 [ACPI_D1] = ACPI_SLEEP,
471 [ACPI_D2] = ACPI_SLEEP,
472 [ACPI_D3] = ACPI_NONE
473};
474
475 435
476/* APU use in the driver */ 436/* APU use in the driver */
477enum snd_enum_apu_type { 437enum snd_enum_apu_type {
@@ -2160,21 +2120,6 @@ static void snd_es1968_reset(struct es1968 *chip)
2160} 2120}
2161 2121
2162/* 2122/*
2163 * power management
2164 */
2165static void snd_es1968_set_acpi(struct es1968 *chip, int state)
2166{
2167 u16 active_mask = acpi_state_mask[state];
2168
2169 pci_set_power_state(chip->pci, state);
2170 /* make sure the units we care about are on
2171 XXX we might want to do this before state flipping? */
2172 pci_write_config_word(chip->pci, 0x54, ~ active_mask);
2173 pci_write_config_word(chip->pci, 0x56, ~ active_mask);
2174}
2175
2176
2177/*
2178 * initialize maestro chip 2123 * initialize maestro chip
2179 */ 2124 */
2180static void snd_es1968_chip_init(struct es1968 *chip) 2125static void snd_es1968_chip_init(struct es1968 *chip)
@@ -2196,9 +2141,6 @@ static void snd_es1968_chip_init(struct es1968 *chip)
2196 * IRQs. 2141 * IRQs.
2197 */ 2142 */
2198 2143
2199 /* do config work at full power */
2200 snd_es1968_set_acpi(chip, ACPI_D0);
2201
2202 /* Config Reg A */ 2144 /* Config Reg A */
2203 pci_read_config_word(pci, ESM_CONFIG_A, &w); 2145 pci_read_config_word(pci, ESM_CONFIG_A, &w);
2204 2146
@@ -2397,9 +2339,10 @@ static int es1968_suspend(struct pci_dev *pci, pm_message_t state)
2397 snd_pcm_suspend_all(chip->pcm); 2339 snd_pcm_suspend_all(chip->pcm);
2398 snd_ac97_suspend(chip->ac97); 2340 snd_ac97_suspend(chip->ac97);
2399 snd_es1968_bob_stop(chip); 2341 snd_es1968_bob_stop(chip);
2400 snd_es1968_set_acpi(chip, ACPI_D3); 2342
2401 pci_disable_device(pci); 2343 pci_disable_device(pci);
2402 pci_save_state(pci); 2344 pci_save_state(pci);
2345 pci_set_power_state(pci, pci_choose_state(pci, state));
2403 return 0; 2346 return 0;
2404} 2347}
2405 2348
@@ -2413,9 +2356,16 @@ static int es1968_resume(struct pci_dev *pci)
2413 return 0; 2356 return 0;
2414 2357
2415 /* restore all our config */ 2358 /* restore all our config */
2359 pci_set_power_state(pci, PCI_D0);
2416 pci_restore_state(pci); 2360 pci_restore_state(pci);
2417 pci_enable_device(pci); 2361 if (pci_enable_device(pci) < 0) {
2362 printk(KERN_ERR "es1968: pci_enable_device failed, "
2363 "disabling device\n");
2364 snd_card_disconnect(card);
2365 return -EIO;
2366 }
2418 pci_set_master(pci); 2367 pci_set_master(pci);
2368
2419 snd_es1968_chip_init(chip); 2369 snd_es1968_chip_init(chip);
2420 2370
2421 /* need to restore the base pointers.. */ 2371 /* need to restore the base pointers.. */
@@ -2514,7 +2464,6 @@ static int snd_es1968_free(struct es1968 *chip)
2514 if (chip->irq >= 0) 2464 if (chip->irq >= 0)
2515 free_irq(chip->irq, (void *)chip); 2465 free_irq(chip->irq, (void *)chip);
2516 snd_es1968_free_gameport(chip); 2466 snd_es1968_free_gameport(chip);
2517 snd_es1968_set_acpi(chip, ACPI_D3);
2518 chip->master_switch = NULL; 2467 chip->master_switch = NULL;
2519 chip->master_volume = NULL; 2468 chip->master_volume = NULL;
2520 pci_release_regions(chip->pci); 2469 pci_release_regions(chip->pci);
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 3ec7d7ee04dd..77e3d5c18302 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1531,9 +1531,9 @@ static int snd_fm801_suspend(struct pci_dev *pci, pm_message_t state)
1531 chip->saved_regs[i] = inw(chip->port + saved_regs[i]); 1531 chip->saved_regs[i] = inw(chip->port + saved_regs[i]);
1532 /* FIXME: tea575x suspend */ 1532 /* FIXME: tea575x suspend */
1533 1533
1534 pci_set_power_state(pci, PCI_D3hot);
1535 pci_disable_device(pci); 1534 pci_disable_device(pci);
1536 pci_save_state(pci); 1535 pci_save_state(pci);
1536 pci_set_power_state(pci, pci_choose_state(pci, state));
1537 return 0; 1537 return 0;
1538} 1538}
1539 1539
@@ -1543,9 +1543,14 @@ static int snd_fm801_resume(struct pci_dev *pci)
1543 struct fm801 *chip = card->private_data; 1543 struct fm801 *chip = card->private_data;
1544 int i; 1544 int i;
1545 1545
1546 pci_restore_state(pci);
1547 pci_enable_device(pci);
1548 pci_set_power_state(pci, PCI_D0); 1546 pci_set_power_state(pci, PCI_D0);
1547 pci_restore_state(pci);
1548 if (pci_enable_device(pci) < 0) {
1549 printk(KERN_ERR "fm801: pci_enable_device failed, "
1550 "disabling device\n");
1551 snd_card_disconnect(card);
1552 return -EIO;
1553 }
1549 pci_set_master(pci); 1554 pci_set_master(pci);
1550 1555
1551 snd_fm801_chip_init(chip, 1); 1556 snd_fm801_chip_init(chip, 1);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 9c3d7ac08068..71482c15a852 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -272,10 +272,11 @@ EXPORT_SYMBOL(snd_hda_queue_unsol_event);
272/* 272/*
273 * process queueud unsolicited events 273 * process queueud unsolicited events
274 */ 274 */
275static void process_unsol_events(void *data) 275static void process_unsol_events(struct work_struct *work)
276{ 276{
277 struct hda_bus *bus = data; 277 struct hda_bus_unsolicited *unsol =
278 struct hda_bus_unsolicited *unsol = bus->unsol; 278 container_of(work, struct hda_bus_unsolicited, work);
279 struct hda_bus *bus = unsol->bus;
279 struct hda_codec *codec; 280 struct hda_codec *codec;
280 unsigned int rp, caddr, res; 281 unsigned int rp, caddr, res;
281 282
@@ -314,7 +315,8 @@ static int init_unsol_queue(struct hda_bus *bus)
314 kfree(unsol); 315 kfree(unsol);
315 return -ENOMEM; 316 return -ENOMEM;
316 } 317 }
317 INIT_WORK(&unsol->work, process_unsol_events, bus); 318 INIT_WORK(&unsol->work, process_unsol_events);
319 unsol->bus = bus;
318 bus->unsol = unsol; 320 bus->unsol = unsol;
319 return 0; 321 return 0;
320} 322}
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index feeed12920b4..e35cfd326df2 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -55,7 +55,7 @@ static char *model;
55static int position_fix; 55static int position_fix;
56static int probe_mask = -1; 56static int probe_mask = -1;
57static int single_cmd; 57static int single_cmd;
58static int disable_msi; 58static int enable_msi;
59 59
60module_param(index, int, 0444); 60module_param(index, int, 0444);
61MODULE_PARM_DESC(index, "Index value for Intel HD audio interface."); 61MODULE_PARM_DESC(index, "Index value for Intel HD audio interface.");
@@ -69,8 +69,8 @@ module_param(probe_mask, int, 0444);
69MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1)."); 69MODULE_PARM_DESC(probe_mask, "Bitmask to probe codecs (default = -1).");
70module_param(single_cmd, bool, 0444); 70module_param(single_cmd, bool, 0444);
71MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs (for debugging only)."); 71MODULE_PARM_DESC(single_cmd, "Use single command to communicate with codecs (for debugging only).");
72module_param(disable_msi, int, 0); 72module_param(enable_msi, int, 0);
73MODULE_PARM_DESC(disable_msi, "Disable Message Signaled Interrupt (MSI)"); 73MODULE_PARM_DESC(enable_msi, "Enable Message Signaled Interrupt (MSI)");
74 74
75 75
76/* just for backward compatibility */ 76/* just for backward compatibility */
@@ -86,6 +86,7 @@ MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
86 "{ATI, SB450}," 86 "{ATI, SB450},"
87 "{ATI, SB600}," 87 "{ATI, SB600},"
88 "{ATI, RS600}," 88 "{ATI, RS600},"
89 "{ATI, RS690},"
89 "{VIA, VT8251}," 90 "{VIA, VT8251},"
90 "{VIA, VT8237A}," 91 "{VIA, VT8237A},"
91 "{SiS, SIS966}," 92 "{SiS, SIS966},"
@@ -336,6 +337,7 @@ struct azx {
336 unsigned int initialized :1; 337 unsigned int initialized :1;
337 unsigned int single_cmd :1; 338 unsigned int single_cmd :1;
338 unsigned int polling_mode :1; 339 unsigned int polling_mode :1;
340 unsigned int msi :1;
339}; 341};
340 342
341/* driver types */ 343/* driver types */
@@ -396,6 +398,7 @@ static char *driver_short_names[] __devinitdata = {
396 */ 398 */
397#define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)((addr) >> 32) : (u32)0) 399#define upper_32bit(addr) (sizeof(addr) > 4 ? (u32)((addr) >> 32) : (u32)0)
398 400
401static int azx_acquire_irq(struct azx *chip, int do_disconnect);
399 402
400/* 403/*
401 * Interface for HD codec 404 * Interface for HD codec
@@ -535,6 +538,18 @@ static unsigned int azx_rirb_get_response(struct hda_codec *codec)
535 schedule_timeout_interruptible(1); 538 schedule_timeout_interruptible(1);
536 } while (time_after_eq(timeout, jiffies)); 539 } while (time_after_eq(timeout, jiffies));
537 540
541 if (chip->msi) {
542 snd_printk(KERN_WARNING "hda_intel: No response from codec, "
543 "disabling MSI...\n");
544 free_irq(chip->irq, chip);
545 chip->irq = -1;
546 pci_disable_msi(chip->pci);
547 chip->msi = 0;
548 if (azx_acquire_irq(chip, 1) < 0)
549 return -1;
550 goto again;
551 }
552
538 if (!chip->polling_mode) { 553 if (!chip->polling_mode) {
539 snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, " 554 snd_printk(KERN_WARNING "hda_intel: azx_get_response timeout, "
540 "switching to polling mode...\n"); 555 "switching to polling mode...\n");
@@ -1363,6 +1378,20 @@ static int __devinit azx_init_stream(struct azx *chip)
1363 return 0; 1378 return 0;
1364} 1379}
1365 1380
1381static int azx_acquire_irq(struct azx *chip, int do_disconnect)
1382{
1383 if (request_irq(chip->pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED,
1384 "HDA Intel", chip)) {
1385 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
1386 "disabling device\n", chip->pci->irq);
1387 if (do_disconnect)
1388 snd_card_disconnect(chip->card);
1389 return -1;
1390 }
1391 chip->irq = chip->pci->irq;
1392 return 0;
1393}
1394
1366 1395
1367#ifdef CONFIG_PM 1396#ifdef CONFIG_PM
1368/* 1397/*
@@ -1379,12 +1408,16 @@ static int azx_suspend(struct pci_dev *pci, pm_message_t state)
1379 snd_pcm_suspend_all(chip->pcm[i]); 1408 snd_pcm_suspend_all(chip->pcm[i]);
1380 snd_hda_suspend(chip->bus, state); 1409 snd_hda_suspend(chip->bus, state);
1381 azx_free_cmd_io(chip); 1410 azx_free_cmd_io(chip);
1382 if (chip->irq >= 0) 1411 if (chip->irq >= 0) {
1412 synchronize_irq(chip->irq);
1383 free_irq(chip->irq, chip); 1413 free_irq(chip->irq, chip);
1384 if (!disable_msi) 1414 chip->irq = -1;
1415 }
1416 if (chip->msi)
1385 pci_disable_msi(chip->pci); 1417 pci_disable_msi(chip->pci);
1386 pci_disable_device(pci); 1418 pci_disable_device(pci);
1387 pci_save_state(pci); 1419 pci_save_state(pci);
1420 pci_set_power_state(pci, pci_choose_state(pci, state));
1388 return 0; 1421 return 0;
1389} 1422}
1390 1423
@@ -1393,15 +1426,20 @@ static int azx_resume(struct pci_dev *pci)
1393 struct snd_card *card = pci_get_drvdata(pci); 1426 struct snd_card *card = pci_get_drvdata(pci);
1394 struct azx *chip = card->private_data; 1427 struct azx *chip = card->private_data;
1395 1428
1429 pci_set_power_state(pci, PCI_D0);
1396 pci_restore_state(pci); 1430 pci_restore_state(pci);
1397 pci_enable_device(pci); 1431 if (pci_enable_device(pci) < 0) {
1398 if (!disable_msi) 1432 printk(KERN_ERR "hda-intel: pci_enable_device failed, "
1399 pci_enable_msi(pci); 1433 "disabling device\n");
1400 /* FIXME: need proper error handling */ 1434 snd_card_disconnect(card);
1401 request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1435 return -EIO;
1402 "HDA Intel", chip); 1436 }
1403 chip->irq = pci->irq;
1404 pci_set_master(pci); 1437 pci_set_master(pci);
1438 if (chip->msi)
1439 if (pci_enable_msi(pci) < 0)
1440 chip->msi = 0;
1441 if (azx_acquire_irq(chip, 1) < 0)
1442 return -EIO;
1405 azx_init_chip(chip); 1443 azx_init_chip(chip);
1406 snd_hda_resume(chip->bus); 1444 snd_hda_resume(chip->bus);
1407 snd_power_change_state(card, SNDRV_CTL_POWER_D0); 1445 snd_power_change_state(card, SNDRV_CTL_POWER_D0);
@@ -1431,15 +1469,14 @@ static int azx_free(struct azx *chip)
1431 /* disable position buffer */ 1469 /* disable position buffer */
1432 azx_writel(chip, DPLBASE, 0); 1470 azx_writel(chip, DPLBASE, 0);
1433 azx_writel(chip, DPUBASE, 0); 1471 azx_writel(chip, DPUBASE, 0);
1434
1435 synchronize_irq(chip->irq);
1436 } 1472 }
1437 1473
1438 if (chip->irq >= 0) { 1474 if (chip->irq >= 0) {
1475 synchronize_irq(chip->irq);
1439 free_irq(chip->irq, (void*)chip); 1476 free_irq(chip->irq, (void*)chip);
1440 if (!disable_msi)
1441 pci_disable_msi(chip->pci);
1442 } 1477 }
1478 if (chip->msi)
1479 pci_disable_msi(chip->pci);
1443 if (chip->remap_addr) 1480 if (chip->remap_addr)
1444 iounmap(chip->remap_addr); 1481 iounmap(chip->remap_addr);
1445 1482
@@ -1494,6 +1531,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1494 chip->pci = pci; 1531 chip->pci = pci;
1495 chip->irq = -1; 1532 chip->irq = -1;
1496 chip->driver_type = driver_type; 1533 chip->driver_type = driver_type;
1534 chip->msi = enable_msi;
1497 1535
1498 chip->position_fix = position_fix; 1536 chip->position_fix = position_fix;
1499 chip->single_cmd = single_cmd; 1537 chip->single_cmd = single_cmd;
@@ -1523,16 +1561,14 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
1523 goto errout; 1561 goto errout;
1524 } 1562 }
1525 1563
1526 if (!disable_msi) 1564 if (chip->msi)
1527 pci_enable_msi(pci); 1565 if (pci_enable_msi(pci) < 0)
1566 chip->msi = 0;
1528 1567
1529 if (request_irq(pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1568 if (azx_acquire_irq(chip, 0) < 0) {
1530 "HDA Intel", (void*)chip)) {
1531 snd_printk(KERN_ERR SFX "unable to grab IRQ %d\n", pci->irq);
1532 err = -EBUSY; 1569 err = -EBUSY;
1533 goto errout; 1570 goto errout;
1534 } 1571 }
1535 chip->irq = pci->irq;
1536 1572
1537 pci_set_master(pci); 1573 pci_set_master(pci);
1538 synchronize_irq(chip->irq); 1574 synchronize_irq(chip->irq);
@@ -1677,6 +1713,7 @@ static struct pci_device_id azx_ids[] = {
1677 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */ 1713 { 0x1002, 0x437b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB450 */
1678 { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */ 1714 { 0x1002, 0x4383, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATI }, /* ATI SB600 */
1679 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */ 1715 { 0x1002, 0x793b, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS600 HDMI */
1716 { 0x1002, 0x7919, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ATIHDMI }, /* ATI RS690 HDMI */
1680 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */ 1717 { 0x1106, 0x3288, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_VIA }, /* VIA VT8251/VT8237A */
1681 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */ 1718 { 0x1039, 0x7502, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_SIS }, /* SIS966 */
1682 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */ 1719 { 0x10b9, 0x5461, PCI_ANY_ID, PCI_ANY_ID, 0, 0, AZX_DRIVER_ULI }, /* ULI M5461 */
diff --git a/sound/pci/hda/hda_local.h b/sound/pci/hda/hda_local.h
index f9416c36396e..9ca1baf860bd 100644
--- a/sound/pci/hda/hda_local.h
+++ b/sound/pci/hda/hda_local.h
@@ -206,6 +206,7 @@ struct hda_bus_unsolicited {
206 /* workqueue */ 206 /* workqueue */
207 struct workqueue_struct *workq; 207 struct workqueue_struct *workq;
208 struct work_struct work; 208 struct work_struct work;
209 struct hda_bus *bus;
209}; 210};
210 211
211/* 212/*
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index 511df07fa2a3..edd22dec8286 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -818,6 +818,8 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
818 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */ 818 .config = AD1986A_LAPTOP_EAPD }, /* ASUS A6J */
819 { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7, 819 { .pci_subvendor = 0x1043, .pci_subdevice = 0x11f7,
820 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */ 820 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5A */
821 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1263,
822 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */
821 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297, 823 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297,
822 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */ 824 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */
823 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af, 825 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af,
diff --git a/sound/pci/hda/patch_atihdmi.c b/sound/pci/hda/patch_atihdmi.c
index a27440ffd1c8..7333f275decd 100644
--- a/sound/pci/hda/patch_atihdmi.c
+++ b/sound/pci/hda/patch_atihdmi.c
@@ -161,5 +161,6 @@ static int patch_atihdmi(struct hda_codec *codec)
161 */ 161 */
162struct hda_codec_preset snd_hda_preset_atihdmi[] = { 162struct hda_codec_preset snd_hda_preset_atihdmi[] = {
163 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi }, 163 { .id = 0x1002793c, .name = "ATI RS600 HDMI", .patch = patch_atihdmi },
164 { .id = 0x1002791a, .name = "ATI RS690 HDMI", .patch = patch_atihdmi },
164 {} /* terminator */ 165 {} /* terminator */
165}; 166};
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index 84a3eb8aacc2..fb961448db19 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1799,7 +1799,7 @@ static int alc_build_pcms(struct hda_codec *codec)
1799 /* SPDIF for stream index #1 */ 1799 /* SPDIF for stream index #1 */
1800 if (spec->multiout.dig_out_nid || spec->dig_in_nid) { 1800 if (spec->multiout.dig_out_nid || spec->dig_in_nid) {
1801 codec->num_pcms = 2; 1801 codec->num_pcms = 2;
1802 info++; 1802 info = spec->pcm_rec + 1;
1803 info->name = spec->stream_name_digital; 1803 info->name = spec->stream_name_digital;
1804 if (spec->multiout.dig_out_nid && 1804 if (spec->multiout.dig_out_nid &&
1805 spec->stream_digital_playback) { 1805 spec->stream_digital_playback) {
@@ -1820,7 +1820,7 @@ static int alc_build_pcms(struct hda_codec *codec)
1820 if (spec->num_adc_nids > 1 && spec->stream_analog_capture && 1820 if (spec->num_adc_nids > 1 && spec->stream_analog_capture &&
1821 spec->adc_nids) { 1821 spec->adc_nids) {
1822 codec->num_pcms = 3; 1822 codec->num_pcms = 3;
1823 info++; 1823 info = spec->pcm_rec + 2;
1824 info->name = spec->stream_name_analog; 1824 info->name = spec->stream_name_analog;
1825 /* No playback stream for second PCM */ 1825 /* No playback stream for second PCM */
1826 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback; 1826 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = alc_pcm_null_playback;
@@ -5870,7 +5870,7 @@ static struct hda_board_config alc262_cfg_tbl[] = {
5870 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397, 5870 { .pci_subvendor = 0x10cf, .pci_subdevice = 0x1397,
5871 .config = ALC262_FUJITSU }, 5871 .config = ALC262_FUJITSU },
5872 { .modelname = "hp-bpc", .config = ALC262_HP_BPC }, 5872 { .modelname = "hp-bpc", .config = ALC262_HP_BPC },
5873 { .pci_subvendor = 0x103c, .pci_subdevice = 0x208c, 5873 { .pci_subvendor = 0x103c, .pci_subdevice = 0x280c,
5874 .config = ALC262_HP_BPC }, /* xw4400 */ 5874 .config = ALC262_HP_BPC }, /* xw4400 */
5875 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, 5875 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014,
5876 .config = ALC262_HP_BPC }, /* xw6400 */ 5876 .config = ALC262_HP_BPC }, /* xw6400 */
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 731b7b97ee71..fe51ef3e49d2 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -336,6 +336,13 @@ static struct hda_board_config stac9200_cfg_tbl[] = {
336 .pci_subvendor = PCI_VENDOR_ID_INTEL, 336 .pci_subvendor = PCI_VENDOR_ID_INTEL,
337 .pci_subdevice = 0x2668, /* DFI LanParty */ 337 .pci_subdevice = 0x2668, /* DFI LanParty */
338 .config = STAC_REF }, 338 .config = STAC_REF },
339 /* Dell laptops have BIOS problem */
340 { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01b5,
341 .config = STAC_REF }, /* Dell Inspiron 630m */
342 { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01c2,
343 .config = STAC_REF }, /* Dell Latitude D620 */
344 { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01cb,
345 .config = STAC_REF }, /* Dell Latitude 120L */
339 {} /* terminator */ 346 {} /* terminator */
340}; 347};
341 348
@@ -591,13 +598,6 @@ static struct hda_board_config stac9205_cfg_tbl[] = {
591 .pci_subvendor = PCI_VENDOR_ID_INTEL, 598 .pci_subvendor = PCI_VENDOR_ID_INTEL,
592 .pci_subdevice = 0x2668, /* DFI LanParty */ 599 .pci_subdevice = 0x2668, /* DFI LanParty */
593 .config = STAC_REF }, /* SigmaTel reference board */ 600 .config = STAC_REF }, /* SigmaTel reference board */
594 /* Dell laptops have BIOS problem */
595 { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01b5,
596 .config = STAC_REF }, /* Dell Inspiron 630m */
597 { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01c2,
598 .config = STAC_REF }, /* Dell Latitude D620 */
599 { .pci_subvendor = PCI_VENDOR_ID_DELL, .pci_subdevice = 0x01cb,
600 .config = STAC_REF }, /* Dell Latitude 120L */
601 {} /* terminator */ 601 {} /* terminator */
602}; 602};
603 603
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index f4319b8d4644..9c1bce7afa86 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -1962,6 +1962,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1962 .type = AC97_TUNE_HP_ONLY 1962 .type = AC97_TUNE_HP_ONLY
1963 }, 1963 },
1964 { 1964 {
1965 .subvendor = 0x10f7,
1966 .subdevice = 0x834c,
1967 .name = "Panasonic CF-R4",
1968 .type = AC97_TUNE_HP_ONLY,
1969 },
1970 {
1965 .subvendor = 0x110a, 1971 .subvendor = 0x110a,
1966 .subdevice = 0x0056, 1972 .subdevice = 0x0056,
1967 .name = "Fujitsu-Siemens Scenic", /* AD1981? */ 1973 .name = "Fujitsu-Siemens Scenic", /* AD1981? */
@@ -2476,10 +2482,14 @@ static int intel8x0_suspend(struct pci_dev *pci, pm_message_t state)
2476 if (chip->device_type == DEVICE_INTEL_ICH4) 2482 if (chip->device_type == DEVICE_INTEL_ICH4)
2477 chip->sdm_saved = igetbyte(chip, ICHREG(SDM)); 2483 chip->sdm_saved = igetbyte(chip, ICHREG(SDM));
2478 2484
2479 if (chip->irq >= 0) 2485 if (chip->irq >= 0) {
2486 synchronize_irq(chip->irq);
2480 free_irq(chip->irq, chip); 2487 free_irq(chip->irq, chip);
2488 chip->irq = -1;
2489 }
2481 pci_disable_device(pci); 2490 pci_disable_device(pci);
2482 pci_save_state(pci); 2491 pci_save_state(pci);
2492 pci_set_power_state(pci, pci_choose_state(pci, state));
2483 return 0; 2493 return 0;
2484} 2494}
2485 2495
@@ -2489,11 +2499,22 @@ static int intel8x0_resume(struct pci_dev *pci)
2489 struct intel8x0 *chip = card->private_data; 2499 struct intel8x0 *chip = card->private_data;
2490 int i; 2500 int i;
2491 2501
2502 pci_set_power_state(pci, PCI_D0);
2492 pci_restore_state(pci); 2503 pci_restore_state(pci);
2493 pci_enable_device(pci); 2504 if (pci_enable_device(pci) < 0) {
2505 printk(KERN_ERR "intel8x0: pci_enable_device failed, "
2506 "disabling device\n");
2507 snd_card_disconnect(card);
2508 return -EIO;
2509 }
2494 pci_set_master(pci); 2510 pci_set_master(pci);
2495 request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, 2511 if (request_irq(pci->irq, snd_intel8x0_interrupt,
2496 card->shortname, chip); 2512 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) {
2513 printk(KERN_ERR "intel8x0: unable to grab IRQ %d, "
2514 "disabling device\n", pci->irq);
2515 snd_card_disconnect(card);
2516 return -EIO;
2517 }
2497 chip->irq = pci->irq; 2518 chip->irq = pci->irq;
2498 synchronize_irq(chip->irq); 2519 synchronize_irq(chip->irq);
2499 snd_intel8x0_chip_init(chip, 0); 2520 snd_intel8x0_chip_init(chip, 0);
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index 6703f5cb5569..bd467c501123 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1045,10 +1045,14 @@ static int intel8x0m_suspend(struct pci_dev *pci, pm_message_t state)
1045 for (i = 0; i < chip->pcm_devs; i++) 1045 for (i = 0; i < chip->pcm_devs; i++)
1046 snd_pcm_suspend_all(chip->pcm[i]); 1046 snd_pcm_suspend_all(chip->pcm[i]);
1047 snd_ac97_suspend(chip->ac97); 1047 snd_ac97_suspend(chip->ac97);
1048 if (chip->irq >= 0) 1048 if (chip->irq >= 0) {
1049 synchronize_irq(chip->irq);
1049 free_irq(chip->irq, chip); 1050 free_irq(chip->irq, chip);
1051 chip->irq = -1;
1052 }
1050 pci_disable_device(pci); 1053 pci_disable_device(pci);
1051 pci_save_state(pci); 1054 pci_save_state(pci);
1055 pci_set_power_state(pci, pci_choose_state(pci, state));
1052 return 0; 1056 return 0;
1053} 1057}
1054 1058
@@ -1057,11 +1061,22 @@ static int intel8x0m_resume(struct pci_dev *pci)
1057 struct snd_card *card = pci_get_drvdata(pci); 1061 struct snd_card *card = pci_get_drvdata(pci);
1058 struct intel8x0m *chip = card->private_data; 1062 struct intel8x0m *chip = card->private_data;
1059 1063
1064 pci_set_power_state(pci, PCI_D0);
1060 pci_restore_state(pci); 1065 pci_restore_state(pci);
1061 pci_enable_device(pci); 1066 if (pci_enable_device(pci) < 0) {
1067 printk(KERN_ERR "intel8x0m: pci_enable_device failed, "
1068 "disabling device\n");
1069 snd_card_disconnect(card);
1070 return -EIO;
1071 }
1062 pci_set_master(pci); 1072 pci_set_master(pci);
1063 request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, 1073 if (request_irq(pci->irq, snd_intel8x0_interrupt,
1064 card->shortname, chip); 1074 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) {
1075 printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, "
1076 "disabling device\n", pci->irq);
1077 snd_card_disconnect(card);
1078 return -EIO;
1079 }
1065 chip->irq = pci->irq; 1080 chip->irq = pci->irq;
1066 snd_intel8x0_chip_init(chip, 0); 1081 snd_intel8x0_chip_init(chip, 0);
1067 snd_ac97_resume(chip->ac97); 1082 snd_ac97_resume(chip->ac97);
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 05605f474a72..8cab342bbaaf 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2589,12 +2589,9 @@ static int m3_suspend(struct pci_dev *pci, pm_message_t state)
2589 chip->suspend_mem[index++] = 2589 chip->suspend_mem[index++] =
2590 snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i); 2590 snd_m3_assp_read(chip, MEMTYPE_INTERNAL_DATA, i);
2591 2591
2592 /* power down apci registers */
2593 snd_m3_outw(chip, 0xffff, 0x54);
2594 snd_m3_outw(chip, 0xffff, 0x56);
2595
2596 pci_disable_device(pci); 2592 pci_disable_device(pci);
2597 pci_save_state(pci); 2593 pci_save_state(pci);
2594 pci_set_power_state(pci, pci_choose_state(pci, state));
2598 return 0; 2595 return 0;
2599} 2596}
2600 2597
@@ -2607,8 +2604,14 @@ static int m3_resume(struct pci_dev *pci)
2607 if (chip->suspend_mem == NULL) 2604 if (chip->suspend_mem == NULL)
2608 return 0; 2605 return 0;
2609 2606
2607 pci_set_power_state(pci, PCI_D0);
2610 pci_restore_state(pci); 2608 pci_restore_state(pci);
2611 pci_enable_device(pci); 2609 if (pci_enable_device(pci) < 0) {
2610 printk(KERN_ERR "maestor3: pci_enable_device failed, "
2611 "disabling device\n");
2612 snd_card_disconnect(card);
2613 return -EIO;
2614 }
2612 pci_set_master(pci); 2615 pci_set_master(pci);
2613 2616
2614 /* first lets just bring everything back. .*/ 2617 /* first lets just bring everything back. .*/
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index b1bbdb9e3b7b..945d21bf187e 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -1390,6 +1390,7 @@ static int nm256_suspend(struct pci_dev *pci, pm_message_t state)
1390 chip->coeffs_current = 0; 1390 chip->coeffs_current = 0;
1391 pci_disable_device(pci); 1391 pci_disable_device(pci);
1392 pci_save_state(pci); 1392 pci_save_state(pci);
1393 pci_set_power_state(pci, pci_choose_state(pci, state));
1393 return 0; 1394 return 0;
1394} 1395}
1395 1396
@@ -1401,8 +1402,17 @@ static int nm256_resume(struct pci_dev *pci)
1401 1402
1402 /* Perform a full reset on the hardware */ 1403 /* Perform a full reset on the hardware */
1403 chip->in_resume = 1; 1404 chip->in_resume = 1;
1405
1406 pci_set_power_state(pci, PCI_D0);
1404 pci_restore_state(pci); 1407 pci_restore_state(pci);
1405 pci_enable_device(pci); 1408 if (pci_enable_device(pci) < 0) {
1409 printk(KERN_ERR "nm256: pci_enable_device failed, "
1410 "disabling device\n");
1411 snd_card_disconnect(card);
1412 return -EIO;
1413 }
1414 pci_set_master(pci);
1415
1406 snd_nm256_init_chip(chip); 1416 snd_nm256_init_chip(chip);
1407 1417
1408 /* restore ac97 */ 1418 /* restore ac97 */
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index ec4899147e1d..56e0c01123e7 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1178,9 +1178,9 @@ static int riptide_suspend(struct pci_dev *pci, pm_message_t state)
1178 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot); 1178 snd_power_change_state(card, SNDRV_CTL_POWER_D3hot);
1179 snd_pcm_suspend_all(chip->pcm); 1179 snd_pcm_suspend_all(chip->pcm);
1180 snd_ac97_suspend(chip->ac97); 1180 snd_ac97_suspend(chip->ac97);
1181 pci_set_power_state(pci, PCI_D3hot);
1182 pci_disable_device(pci); 1181 pci_disable_device(pci);
1183 pci_save_state(pci); 1182 pci_save_state(pci);
1183 pci_set_power_state(pci, pci_choose_state(pci, state));
1184 return 0; 1184 return 0;
1185} 1185}
1186 1186
@@ -1189,9 +1189,14 @@ static int riptide_resume(struct pci_dev *pci)
1189 struct snd_card *card = pci_get_drvdata(pci); 1189 struct snd_card *card = pci_get_drvdata(pci);
1190 struct snd_riptide *chip = card->private_data; 1190 struct snd_riptide *chip = card->private_data;
1191 1191
1192 pci_restore_state(pci);
1193 pci_enable_device(pci);
1194 pci_set_power_state(pci, PCI_D0); 1192 pci_set_power_state(pci, PCI_D0);
1193 pci_restore_state(pci);
1194 if (pci_enable_device(pci) < 0) {
1195 printk(KERN_ERR "riptide: pci_enable_device failed, "
1196 "disabling device\n");
1197 snd_card_disconnect(card);
1198 return -EIO;
1199 }
1195 pci_set_master(pci); 1200 pci_set_master(pci);
1196 snd_riptide_initialize(chip); 1201 snd_riptide_initialize(chip);
1197 snd_ac97_resume(chip->ac97); 1202 snd_ac97_resume(chip->ac97);
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 0d478871808d..1fbc4321122f 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3966,15 +3966,9 @@ int snd_trident_suspend(struct pci_dev *pci, pm_message_t state)
3966 snd_ac97_suspend(trident->ac97); 3966 snd_ac97_suspend(trident->ac97);
3967 snd_ac97_suspend(trident->ac97_sec); 3967 snd_ac97_suspend(trident->ac97_sec);
3968 3968
3969 switch (trident->device) {
3970 case TRIDENT_DEVICE_ID_DX:
3971 case TRIDENT_DEVICE_ID_NX:
3972 break; /* TODO */
3973 case TRIDENT_DEVICE_ID_SI7018:
3974 break;
3975 }
3976 pci_disable_device(pci); 3969 pci_disable_device(pci);
3977 pci_save_state(pci); 3970 pci_save_state(pci);
3971 pci_set_power_state(pci, pci_choose_state(pci, state));
3978 return 0; 3972 return 0;
3979} 3973}
3980 3974
@@ -3983,9 +3977,15 @@ int snd_trident_resume(struct pci_dev *pci)
3983 struct snd_card *card = pci_get_drvdata(pci); 3977 struct snd_card *card = pci_get_drvdata(pci);
3984 struct snd_trident *trident = card->private_data; 3978 struct snd_trident *trident = card->private_data;
3985 3979
3980 pci_set_power_state(pci, PCI_D0);
3986 pci_restore_state(pci); 3981 pci_restore_state(pci);
3987 pci_enable_device(pci); 3982 if (pci_enable_device(pci) < 0) {
3988 pci_set_master(pci); /* to be sure */ 3983 printk(KERN_ERR "trident: pci_enable_device failed, "
3984 "disabling device\n");
3985 snd_card_disconnect(card);
3986 return -EIO;
3987 }
3988 pci_set_master(pci);
3989 3989
3990 switch (trident->device) { 3990 switch (trident->device) {
3991 case TRIDENT_DEVICE_ID_DX: 3991 case TRIDENT_DEVICE_ID_DX:
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index e6990e0bbf23..92b0736c0fdb 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2185,9 +2185,9 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
2185 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10); 2185 chip->capture_src_saved[1] = inb(chip->port + VIA_REG_CAPTURE_CHANNEL + 0x10);
2186 } 2186 }
2187 2187
2188 pci_set_power_state(pci, PCI_D3hot);
2189 pci_disable_device(pci); 2188 pci_disable_device(pci);
2190 pci_save_state(pci); 2189 pci_save_state(pci);
2190 pci_set_power_state(pci, pci_choose_state(pci, state));
2191 return 0; 2191 return 0;
2192} 2192}
2193 2193
@@ -2197,9 +2197,15 @@ static int snd_via82xx_resume(struct pci_dev *pci)
2197 struct via82xx *chip = card->private_data; 2197 struct via82xx *chip = card->private_data;
2198 int i; 2198 int i;
2199 2199
2200 pci_restore_state(pci);
2201 pci_enable_device(pci);
2202 pci_set_power_state(pci, PCI_D0); 2200 pci_set_power_state(pci, PCI_D0);
2201 pci_restore_state(pci);
2202 if (pci_enable_device(pci) < 0) {
2203 printk(KERN_ERR "via82xx: pci_enable_device failed, "
2204 "disabling device\n");
2205 snd_card_disconnect(card);
2206 return -EIO;
2207 }
2208 pci_set_master(pci);
2203 2209
2204 snd_via82xx_chip_init(chip); 2210 snd_via82xx_chip_init(chip);
2205 2211
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5ab1cf3d434b..feb27c966256 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1032,9 +1032,10 @@ static int snd_via82xx_suspend(struct pci_dev *pci, pm_message_t state)
1032 snd_via82xx_channel_reset(chip, &chip->devs[i]); 1032 snd_via82xx_channel_reset(chip, &chip->devs[i]);
1033 synchronize_irq(chip->irq); 1033 synchronize_irq(chip->irq);
1034 snd_ac97_suspend(chip->ac97); 1034 snd_ac97_suspend(chip->ac97);
1035 pci_set_power_state(pci, PCI_D3hot); 1035
1036 pci_disable_device(pci); 1036 pci_disable_device(pci);
1037 pci_save_state(pci); 1037 pci_save_state(pci);
1038 pci_set_power_state(pci, pci_choose_state(pci, state));
1038 return 0; 1039 return 0;
1039} 1040}
1040 1041
@@ -1044,9 +1045,14 @@ static int snd_via82xx_resume(struct pci_dev *pci)
1044 struct via82xx_modem *chip = card->private_data; 1045 struct via82xx_modem *chip = card->private_data;
1045 int i; 1046 int i;
1046 1047
1047 pci_restore_state(pci);
1048 pci_enable_device(pci);
1049 pci_set_power_state(pci, PCI_D0); 1048 pci_set_power_state(pci, PCI_D0);
1049 pci_restore_state(pci);
1050 if (pci_enable_device(pci) < 0) {
1051 printk(KERN_ERR "via82xx-modem: pci_enable_device failed, "
1052 "disabling device\n");
1053 snd_card_disconnect(card);
1054 return -EIO;
1055 }
1050 pci_set_master(pci); 1056 pci_set_master(pci);
1051 1057
1052 snd_via82xx_chip_init(chip); 1058 snd_via82xx_chip_init(chip);
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index e7cd8acab59a..af49e8aabf55 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -266,9 +266,9 @@ static int snd_vx222_suspend(struct pci_dev *pci, pm_message_t state)
266 int err; 266 int err;
267 267
268 err = snd_vx_suspend(&vx->core, state); 268 err = snd_vx_suspend(&vx->core, state);
269 pci_set_power_state(pci, PCI_D3hot);
270 pci_disable_device(pci); 269 pci_disable_device(pci);
271 pci_save_state(pci); 270 pci_save_state(pci);
271 pci_set_power_state(pci, pci_choose_state(pci, state));
272 return err; 272 return err;
273} 273}
274 274
@@ -277,9 +277,14 @@ static int snd_vx222_resume(struct pci_dev *pci)
277 struct snd_card *card = pci_get_drvdata(pci); 277 struct snd_card *card = pci_get_drvdata(pci);
278 struct snd_vx222 *vx = card->private_data; 278 struct snd_vx222 *vx = card->private_data;
279 279
280 pci_restore_state(pci);
281 pci_enable_device(pci);
282 pci_set_power_state(pci, PCI_D0); 280 pci_set_power_state(pci, PCI_D0);
281 pci_restore_state(pci);
282 if (pci_enable_device(pci) < 0) {
283 printk(KERN_ERR "vx222: pci_enable_device failed, "
284 "disabling device\n");
285 snd_card_disconnect(card);
286 return -EIO;
287 }
283 pci_set_master(pci); 288 pci_set_master(pci);
284 return snd_vx_resume(&vx->core); 289 return snd_vx_resume(&vx->core);
285} 290}
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index ebc6da89edf3..a40c1085fd20 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -2218,6 +2218,7 @@ int snd_ymfpci_suspend(struct pci_dev *pci, pm_message_t state)
2218 snd_ymfpci_disable_dsp(chip); 2218 snd_ymfpci_disable_dsp(chip);
2219 pci_disable_device(pci); 2219 pci_disable_device(pci);
2220 pci_save_state(pci); 2220 pci_save_state(pci);
2221 pci_set_power_state(pci, pci_choose_state(pci, state));
2221 return 0; 2222 return 0;
2222} 2223}
2223 2224
@@ -2227,8 +2228,14 @@ int snd_ymfpci_resume(struct pci_dev *pci)
2227 struct snd_ymfpci *chip = card->private_data; 2228 struct snd_ymfpci *chip = card->private_data;
2228 unsigned int i; 2229 unsigned int i;
2229 2230
2231 pci_set_power_state(pci, PCI_D0);
2230 pci_restore_state(pci); 2232 pci_restore_state(pci);
2231 pci_enable_device(pci); 2233 if (pci_enable_device(pci) < 0) {
2234 printk(KERN_ERR "ymfpci: pci_enable_device failed, "
2235 "disabling device\n");
2236 snd_card_disconnect(card);
2237 return -EIO;
2238 }
2232 pci_set_master(pci); 2239 pci_set_master(pci);
2233 snd_ymfpci_aclink_reset(pci); 2240 snd_ymfpci_aclink_reset(pci);
2234 snd_ymfpci_codec_ready(chip, 0); 2241 snd_ymfpci_codec_ready(chip, 0);
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf.c b/sound/pcmcia/pdaudiocf/pdaudiocf.c
index fd3590fcaedb..2d40cc72f236 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf.c
@@ -219,35 +219,15 @@ do { last_fn = (fn); if ((last_ret = (ret)) != 0) goto cs_failed; } while (0)
219static int pdacf_config(struct pcmcia_device *link) 219static int pdacf_config(struct pcmcia_device *link)
220{ 220{
221 struct snd_pdacf *pdacf = link->priv; 221 struct snd_pdacf *pdacf = link->priv;
222 tuple_t tuple;
223 cisparse_t *parse = NULL;
224 u_short buf[32];
225 int last_fn, last_ret; 222 int last_fn, last_ret;
226 223
227 snd_printdd(KERN_DEBUG "pdacf_config called\n"); 224 snd_printdd(KERN_DEBUG "pdacf_config called\n");
228 parse = kmalloc(sizeof(*parse), GFP_KERNEL);
229 if (! parse) {
230 snd_printk(KERN_ERR "pdacf_config: cannot allocate\n");
231 return -ENOMEM;
232 }
233 tuple.DesiredTuple = CISTPL_CFTABLE_ENTRY;
234 tuple.Attributes = 0;
235 tuple.TupleData = (cisdata_t *)buf;
236 tuple.TupleDataMax = sizeof(buf);
237 tuple.TupleOffset = 0;
238 tuple.DesiredTuple = CISTPL_CONFIG;
239 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
240 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
241 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
242 link->conf.ConfigBase = parse->config.base;
243 link->conf.ConfigIndex = 0x5; 225 link->conf.ConfigIndex = 0x5;
244 226
245 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io)); 227 CS_CHECK(RequestIO, pcmcia_request_io(link, &link->io));
246 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq)); 228 CS_CHECK(RequestIRQ, pcmcia_request_irq(link, &link->irq));
247 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf)); 229 CS_CHECK(RequestConfiguration, pcmcia_request_configuration(link, &link->conf));
248 230
249 kfree(parse);
250
251 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0) 231 if (snd_pdacf_assign_resources(pdacf, link->io.BasePort1, link->irq.AssignedIRQ) < 0)
252 goto failed; 232 goto failed;
253 233
@@ -255,7 +235,6 @@ static int pdacf_config(struct pcmcia_device *link)
255 return 0; 235 return 0;
256 236
257cs_failed: 237cs_failed:
258 kfree(parse);
259 cs_error(link, last_fn, last_ret); 238 cs_error(link, last_fn, last_ret);
260failed: 239failed:
261 pcmcia_disable_device(link); 240 pcmcia_disable_device(link);
@@ -299,7 +278,8 @@ static int pdacf_resume(struct pcmcia_device *link)
299 * Module entry points 278 * Module entry points
300 */ 279 */
301static struct pcmcia_device_id snd_pdacf_ids[] = { 280static struct pcmcia_device_id snd_pdacf_ids[] = {
302 PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45), 281 /* this is too general PCMCIA_DEVICE_MANF_CARD(0x015d, 0x4c45), */
282 PCMCIA_DEVICE_PROD_ID12("Core Sound","PDAudio-CF",0x396d19d2,0x71717b49),
303 PCMCIA_DEVICE_NULL 283 PCMCIA_DEVICE_NULL
304}; 284};
305MODULE_DEVICE_TABLE(pcmcia, snd_pdacf_ids); 285MODULE_DEVICE_TABLE(pcmcia, snd_pdacf_ids);
diff --git a/sound/pcmcia/vx/vxpocket.c b/sound/pcmcia/vx/vxpocket.c
index 3089fcca800e..d7df59e9c647 100644
--- a/sound/pcmcia/vx/vxpocket.c
+++ b/sound/pcmcia/vx/vxpocket.c
@@ -217,34 +217,12 @@ static int vxpocket_config(struct pcmcia_device *link)
217{ 217{
218 struct vx_core *chip = link->priv; 218 struct vx_core *chip = link->priv;
219 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip; 219 struct snd_vxpocket *vxp = (struct snd_vxpocket *)chip;
220 tuple_t tuple;
221 cisparse_t *parse;
222 u_short buf[32];
223 int last_fn, last_ret; 220 int last_fn, last_ret;
224 221
225 snd_printdd(KERN_DEBUG "vxpocket_config called\n"); 222 snd_printdd(KERN_DEBUG "vxpocket_config called\n");
226 parse = kmalloc(sizeof(*parse), GFP_KERNEL);
227 if (! parse) {
228 snd_printk(KERN_ERR "vx: cannot allocate\n");
229 return -ENOMEM;
230 }
231 tuple.Attributes = 0;
232 tuple.TupleData = (cisdata_t *)buf;
233 tuple.TupleDataMax = sizeof(buf);
234 tuple.TupleOffset = 0;
235 tuple.DesiredTuple = CISTPL_CONFIG;
236 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
237 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
238 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
239 link->conf.ConfigBase = parse->config.base;
240 link->conf.Present = parse->config.rmask[0];
241 223
242 /* redefine hardware record according to the VERSION1 string */ 224 /* redefine hardware record according to the VERSION1 string */
243 tuple.DesiredTuple = CISTPL_VERS_1; 225 if (!strcmp(link->prod_id[1], "VX-POCKET")) {
244 CS_CHECK(GetFirstTuple, pcmcia_get_first_tuple(link, &tuple));
245 CS_CHECK(GetTupleData, pcmcia_get_tuple_data(link, &tuple));
246 CS_CHECK(ParseTuple, pcmcia_parse_tuple(link, &tuple, parse));
247 if (! strcmp(parse->version_1.str + parse->version_1.ofs[1], "VX-POCKET")) {
248 snd_printdd("VX-pocket is detected\n"); 226 snd_printdd("VX-pocket is detected\n");
249 } else { 227 } else {
250 snd_printdd("VX-pocket 440 is detected\n"); 228 snd_printdd("VX-pocket 440 is detected\n");
@@ -265,14 +243,12 @@ static int vxpocket_config(struct pcmcia_device *link)
265 goto failed; 243 goto failed;
266 244
267 link->dev_node = &vxp->node; 245 link->dev_node = &vxp->node;
268 kfree(parse);
269 return 0; 246 return 0;
270 247
271cs_failed: 248cs_failed:
272 cs_error(link, last_fn, last_ret); 249 cs_error(link, last_fn, last_ret);
273failed: 250failed:
274 pcmcia_disable_device(link); 251 pcmcia_disable_device(link);
275 kfree(parse);
276 return -ENODEV; 252 return -ENODEV;
277} 253}
278 254
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index 2fbe1d183fce..8f074c7936e6 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -942,10 +942,11 @@ static void check_mute(struct snd_pmac *chip, struct pmac_gpio *gp, int val, int
942} 942}
943 943
944static struct work_struct device_change; 944static struct work_struct device_change;
945static struct snd_pmac *device_change_chip;
945 946
946static void device_change_handler(void *self) 947static void device_change_handler(struct work_struct *work)
947{ 948{
948 struct snd_pmac *chip = self; 949 struct snd_pmac *chip = device_change_chip;
949 struct pmac_tumbler *mix; 950 struct pmac_tumbler *mix;
950 int headphone, lineout; 951 int headphone, lineout;
951 952
@@ -1417,7 +1418,8 @@ int __init snd_pmac_tumbler_init(struct snd_pmac *chip)
1417 chip->resume = tumbler_resume; 1418 chip->resume = tumbler_resume;
1418#endif 1419#endif
1419 1420
1420 INIT_WORK(&device_change, device_change_handler, (void *)chip); 1421 INIT_WORK(&device_change, device_change_handler);
1422 device_change_chip = chip;
1421 1423
1422#ifdef PMAC_SUPPORT_AUTOMUTE 1424#ifdef PMAC_SUPPORT_AUTOMUTE
1423 if ((mix->headphone_irq >=0 || mix->lineout_irq >= 0) 1425 if ((mix->headphone_irq >=0 || mix->lineout_irq >= 0)
diff --git a/sound/sound_core.c b/sound/sound_core.c
index 5322c50c9617..8f1ced4ab34c 100644
--- a/sound/sound_core.c
+++ b/sound/sound_core.c
@@ -170,8 +170,8 @@ static int sound_insert_unit(struct sound_unit **list, const struct file_operati
170 else 170 else
171 sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP); 171 sprintf(s->name, "sound/%s%d", name, r / SOUND_STEP);
172 172
173 class_device_create(sound_class, NULL, MKDEV(SOUND_MAJOR, s->unit_minor), 173 device_create(sound_class, dev, MKDEV(SOUND_MAJOR, s->unit_minor),
174 dev, s->name+6); 174 s->name+6);
175 return r; 175 return r;
176 176
177 fail: 177 fail:
@@ -193,7 +193,7 @@ static void sound_remove_unit(struct sound_unit **list, int unit)
193 p = __sound_remove_unit(list, unit); 193 p = __sound_remove_unit(list, unit);
194 spin_unlock(&sound_loader_lock); 194 spin_unlock(&sound_loader_lock);
195 if (p) { 195 if (p) {
196 class_device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor)); 196 device_destroy(sound_class, MKDEV(SOUND_MAJOR, p->unit_minor));
197 kfree(p); 197 kfree(p);
198 } 198 }
199} 199}
diff --git a/sound/sound_firmware.c b/sound/sound_firmware.c
index 3a181d4c0dc6..3304344713ae 100644
--- a/sound/sound_firmware.c
+++ b/sound/sound_firmware.c
@@ -19,7 +19,7 @@ static int do_mod_firmware_load(const char *fn, char **fp)
19 printk(KERN_INFO "Unable to load '%s'.\n", fn); 19 printk(KERN_INFO "Unable to load '%s'.\n", fn);
20 return 0; 20 return 0;
21 } 21 }
22 l = filp->f_dentry->d_inode->i_size; 22 l = filp->f_path.dentry->d_inode->i_size;
23 if (l <= 0 || l > 131072) 23 if (l <= 0 || l > 131072)
24 { 24 {
25 printk(KERN_INFO "Invalid firmware '%s'\n", fn); 25 printk(KERN_INFO "Invalid firmware '%s'\n", fn);
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index c82b01c7ad3a..67202b9eeb77 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1469,7 +1469,8 @@ static int snd_usb_hw_free(struct snd_pcm_substream *substream)
1469 subs->cur_audiofmt = NULL; 1469 subs->cur_audiofmt = NULL;
1470 subs->cur_rate = 0; 1470 subs->cur_rate = 0;
1471 subs->period_bytes = 0; 1471 subs->period_bytes = 0;
1472 release_substream_urbs(subs, 0); 1472 if (!subs->stream->chip->shutdown)
1473 release_substream_urbs(subs, 0);
1473 return snd_pcm_free_vmalloc_buffer(substream); 1474 return snd_pcm_free_vmalloc_buffer(substream);
1474} 1475}
1475 1476
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index b7c5e59b2299..24f5a26c5f0c 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -981,7 +981,7 @@ void snd_usbmidi_disconnect(struct list_head* p)
981 if (umidi->usb_protocol_ops->finish_out_endpoint) 981 if (umidi->usb_protocol_ops->finish_out_endpoint)
982 umidi->usb_protocol_ops->finish_out_endpoint(ep->out); 982 umidi->usb_protocol_ops->finish_out_endpoint(ep->out);
983 } 983 }
984 if (ep->in && ep->in->urb) 984 if (ep->in)
985 usb_kill_urb(ep->in->urb); 985 usb_kill_urb(ep->in->urb);
986 } 986 }
987} 987}
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index 1024c178f5c0..e74eb1bc8d87 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -1620,8 +1620,7 @@ static void snd_usb_mixer_free(struct usb_mixer_interface *mixer)
1620 kfree(mixer->urb->transfer_buffer); 1620 kfree(mixer->urb->transfer_buffer);
1621 usb_free_urb(mixer->urb); 1621 usb_free_urb(mixer->urb);
1622 } 1622 }
1623 if (mixer->rc_urb) 1623 usb_free_urb(mixer->rc_urb);
1624 usb_free_urb(mixer->rc_urb);
1625 kfree(mixer->rc_setup_packet); 1624 kfree(mixer->rc_setup_packet);
1626 kfree(mixer); 1625 kfree(mixer);
1627} 1626}
@@ -2056,8 +2055,6 @@ void snd_usb_mixer_disconnect(struct list_head *p)
2056 struct usb_mixer_interface *mixer; 2055 struct usb_mixer_interface *mixer;
2057 2056
2058 mixer = list_entry(p, struct usb_mixer_interface, list); 2057 mixer = list_entry(p, struct usb_mixer_interface, list);
2059 if (mixer->urb) 2058 usb_kill_urb(mixer->urb);
2060 usb_kill_urb(mixer->urb); 2059 usb_kill_urb(mixer->rc_urb);
2061 if (mixer->rc_urb)
2062 usb_kill_urb(mixer->rc_urb);
2063} 2060}
diff --git a/sound/usb/usx2y/usX2Yhwdep.c b/sound/usb/usx2y/usX2Yhwdep.c
index 4b52d18dcd53..b76b3dd9df25 100644
--- a/sound/usb/usx2y/usX2Yhwdep.c
+++ b/sound/usb/usx2y/usX2Yhwdep.c
@@ -48,7 +48,7 @@ static struct page * snd_us428ctls_vm_nopage(struct vm_area_struct *area, unsign
48 48
49 offset = area->vm_pgoff << PAGE_SHIFT; 49 offset = area->vm_pgoff << PAGE_SHIFT;
50 offset += address - area->vm_start; 50 offset += address - area->vm_start;
51 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_OOM); 51 snd_assert((offset % PAGE_SIZE) == 0, return NOPAGE_SIGBUS);
52 vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset; 52 vaddr = (char*)((struct usX2Ydev *)area->vm_private_data)->us428ctls_sharedmem + offset;
53 page = virt_to_page(vaddr); 53 page = virt_to_page(vaddr);
54 get_page(page); 54 get_page(page);