aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorLinus Torvalds <torvalds@woody.osdl.org>2006-12-21 02:56:06 -0500
committerLinus Torvalds <torvalds@woody.osdl.org>2006-12-21 02:56:06 -0500
commite4ddc9cc62b40a8b08d02379064d5d8fd78e98bc (patch)
tree190f0d721ce4f00fe016a526717ee3f5dee26962
parenteb2112fbcf2d97eda221790bd53cb3a2cdf58c95 (diff)
parent7c21699e30a5c0ca4972d1b6ad22350fe63128d3 (diff)
Merge branch 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa
* 'linus' of master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa: (30 commits) [ALSA] version 1.0.14rc1 [ALSA] ac97: Identify CMI9761 chips. [ALSA] ac97_codec - trivial fix for bit update functions [ALSA] snd-ca0106: Fix typos. [ALSA] snd-ca0106: Add new card variant. [ALSA] sound: fix PCM substream list [ALSA] sound: initialize rawmidi substream list [ALSA] snd_hda_intel 3stack mode for ASUS P5P-L2 [ALSA] Remove IRQF_DISABLED for shared PCI irqs [ALSA] Fix invalid assignment of PCI revision [ALSA] Fix races in PCM OSS emulation [ALSA] hda-codec - fix typo in PCI IDs [ALSA] ac97 - Fix potential negative array index [ALSA] hda-codec - Verbose proc output for PCM parameters [ALSA] hda-codec - Fix detection of supported sample rates [ALSA] hda-codec - Fix model for ASUS V1j laptop [ALSA] sound/core/control.c: remove dead code [ALSA] hda-codec - Add model for HP q965 [ALSA] pcm core: fix silence_start calculations [ALSA] hda-codec - Fix a typo ...
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl8
-rw-r--r--include/sound/pcm_oss.h1
-rw-r--r--include/sound/version.h4
-rw-r--r--include/sound/ymfpci.h5
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-onyx.h1
-rw-r--r--sound/aoa/codecs/snd-aoa-codec-tas.c1
-rw-r--r--sound/core/control.c2
-rw-r--r--sound/core/oss/pcm_oss.c52
-rw-r--r--sound/core/pcm.c4
-rw-r--r--sound/core/pcm_lib.c8
-rw-r--r--sound/core/rawmidi.c4
-rw-r--r--sound/core/seq/seq_memory.c2
-rw-r--r--sound/core/sgbuf.c2
-rw-r--r--sound/isa/gus/gus_mem.c7
-rw-r--r--sound/isa/sb/sb_common.c2
-rw-r--r--sound/isa/wavefront/wavefront_synth.c2
-rw-r--r--sound/pci/ac97/ac97_codec.c10
-rw-r--r--sound/pci/ac97/ac97_patch.c7
-rw-r--r--sound/pci/ad1889.c4
-rw-r--r--sound/pci/ali5451/ali5451.c5
-rw-r--r--sound/pci/als300.c6
-rw-r--r--sound/pci/atiixp.c2
-rw-r--r--sound/pci/atiixp_modem.c2
-rw-r--r--sound/pci/au88x0/au88x0.c2
-rw-r--r--sound/pci/azt3328.c5
-rw-r--r--sound/pci/bt87x.c4
-rw-r--r--sound/pci/ca0106/ca0106.h2
-rw-r--r--sound/pci/ca0106/ca0106_main.c37
-rw-r--r--sound/pci/cmipci.c2
-rw-r--r--sound/pci/cs4281.c2
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c2
-rw-r--r--sound/pci/cs5535audio/cs5535audio.c2
-rw-r--r--sound/pci/echoaudio/echoaudio.c6
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c5
-rw-r--r--sound/pci/emu10k1/emu10k1x.c9
-rw-r--r--sound/pci/ens1370.c2
-rw-r--r--sound/pci/es1938.c4
-rw-r--r--sound/pci/es1968.c8
-rw-r--r--sound/pci/fm801.c2
-rw-r--r--sound/pci/hda/hda_codec.c3
-rw-r--r--sound/pci/hda/hda_intel.c3
-rw-r--r--sound/pci/hda/hda_proc.c53
-rw-r--r--sound/pci/hda/patch_analog.c8
-rw-r--r--sound/pci/hda/patch_realtek.c4
-rw-r--r--sound/pci/hda/patch_si3054.c3
-rw-r--r--sound/pci/ice1712/ice1712.c2
-rw-r--r--sound/pci/ice1712/ice1724.c2
-rw-r--r--sound/pci/intel8x0.c4
-rw-r--r--sound/pci/intel8x0m.c4
-rw-r--r--sound/pci/korg1212/korg1212.c2
-rw-r--r--sound/pci/maestro3.c4
-rw-r--r--sound/pci/mixart/mixart.c5
-rw-r--r--sound/pci/nm256/nm256.c2
-rw-r--r--sound/pci/pcxhr/pcxhr.c2
-rw-r--r--sound/pci/riptide/riptide.c5
-rw-r--r--sound/pci/rme32.c3
-rw-r--r--sound/pci/rme96.c3
-rw-r--r--sound/pci/rme9652/hdsp.c9
-rw-r--r--sound/pci/rme9652/hdspm.c3
-rw-r--r--sound/pci/rme9652/rme9652.c7
-rw-r--r--sound/pci/sonicvibes.c5
-rw-r--r--sound/pci/trident/trident_main.c6
-rw-r--r--sound/pci/via82xx.c6
-rw-r--r--sound/pci/via82xx_modem.c2
-rw-r--r--sound/pci/vx222/vx222.c4
-rw-r--r--sound/pci/ymfpci/ymfpci.c5
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c39
-rw-r--r--sound/usb/usbaudio.c3
68 files changed, 270 insertions, 166 deletions
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 077fbe25eb..ccd0a95395 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -927,7 +927,7 @@
927 <informalexample> 927 <informalexample>
928 <programlisting> 928 <programlisting>
929<![CDATA[ 929<![CDATA[
930 struct mychip *chip = (struct mychip *)card->private_data; 930 struct mychip *chip = card->private_data;
931]]> 931]]>
932 </programlisting> 932 </programlisting>
933 </informalexample> 933 </informalexample>
@@ -1095,7 +1095,7 @@
1095 1095
1096 /* release the irq */ 1096 /* release the irq */
1097 if (chip->irq >= 0) 1097 if (chip->irq >= 0)
1098 free_irq(chip->irq, (void *)chip); 1098 free_irq(chip->irq, chip);
1099 /* release the i/o ports & memory */ 1099 /* release the i/o ports & memory */
1100 pci_release_regions(chip->pci); 1100 pci_release_regions(chip->pci);
1101 /* disable the PCI entry */ 1101 /* disable the PCI entry */
@@ -1148,7 +1148,7 @@
1148 } 1148 }
1149 chip->port = pci_resource_start(pci, 0); 1149 chip->port = pci_resource_start(pci, 0);
1150 if (request_irq(pci->irq, snd_mychip_interrupt, 1150 if (request_irq(pci->irq, snd_mychip_interrupt,
1151 IRQF_DISABLED|IRQF_SHARED, "My Chip", chip)) { 1151 IRQF_SHARED, "My Chip", chip)) {
1152 printk(KERN_ERR "cannot grab irq %d\n", pci->irq); 1152 printk(KERN_ERR "cannot grab irq %d\n", pci->irq);
1153 snd_mychip_free(chip); 1153 snd_mychip_free(chip);
1154 return -EBUSY; 1154 return -EBUSY;
@@ -1387,7 +1387,7 @@
1387 <programlisting> 1387 <programlisting>
1388<![CDATA[ 1388<![CDATA[
1389 if (chip->irq >= 0) 1389 if (chip->irq >= 0)
1390 free_irq(chip->irq, (void *)chip); 1390 free_irq(chip->irq, chip);
1391]]> 1391]]>
1392 </programlisting> 1392 </programlisting>
1393 </informalexample> 1393 </informalexample>
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index c854647b6f..1cd4f64cdf 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -56,6 +56,7 @@ struct snd_pcm_oss_runtime {
56 size_t mmap_bytes; 56 size_t mmap_bytes;
57 char *buffer; /* vmallocated period */ 57 char *buffer; /* vmallocated period */
58 size_t buffer_used; /* used length from period buffer */ 58 size_t buffer_used; /* used length from period buffer */
59 struct mutex params_lock;
59#ifdef CONFIG_SND_PCM_OSS_PLUGINS 60#ifdef CONFIG_SND_PCM_OSS_PLUGINS
60 struct snd_pcm_plugin *plugin_first; 61 struct snd_pcm_plugin *plugin_first;
61 struct snd_pcm_plugin *plugin_last; 62 struct snd_pcm_plugin *plugin_last;
diff --git a/include/sound/version.h b/include/sound/version.h
index 17137f3a3b..2949b9b991 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by alsa/ksync script. */ 1/* include/version.h. Generated by alsa/ksync script. */
2#define CONFIG_SND_VERSION "1.0.13" 2#define CONFIG_SND_VERSION "1.0.14rc1"
3#define CONFIG_SND_DATE " (Tue Nov 28 14:07:24 2006 UTC)" 3#define CONFIG_SND_DATE " (Wed Dec 20 08:11:48 2006 UTC)"
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index d41cda97e9..f3514ee96b 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -286,7 +286,7 @@ struct snd_ymfpci {
286 int irq; 286 int irq;
287 287
288 unsigned int device_id; /* PCI device ID */ 288 unsigned int device_id; /* PCI device ID */
289 unsigned int rev; /* PCI revision */ 289 unsigned char rev; /* PCI revision */
290 unsigned long reg_area_phys; 290 unsigned long reg_area_phys;
291 void __iomem *reg_area_virt; 291 void __iomem *reg_area_virt;
292 struct resource *res_reg_area; 292 struct resource *res_reg_area;
@@ -345,7 +345,6 @@ struct snd_ymfpci {
345 struct snd_kcontrol *spdif_pcm_ctl; 345 struct snd_kcontrol *spdif_pcm_ctl;
346 int mode_dup4ch; 346 int mode_dup4ch;
347 int rear_opened; 347 int rear_opened;
348 int rear_swap;
349 int spdif_opened; 348 int spdif_opened;
350 struct { 349 struct {
351 u16 left; 350 u16 left;
@@ -378,7 +377,7 @@ int snd_ymfpci_pcm(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
378int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 377int snd_ymfpci_pcm2(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
379int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 378int snd_ymfpci_pcm_spdif(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
380int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm); 379int snd_ymfpci_pcm_4ch(struct snd_ymfpci *chip, int device, struct snd_pcm **rpcm);
381int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch, int rear_swap); 380int snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch);
382int snd_ymfpci_timer(struct snd_ymfpci *chip, int device); 381int snd_ymfpci_timer(struct snd_ymfpci *chip, int device);
383 382
384#endif /* __SOUND_YMFPCI_H */ 383#endif /* __SOUND_YMFPCI_H */
diff --git a/sound/aoa/codecs/snd-aoa-codec-onyx.h b/sound/aoa/codecs/snd-aoa-codec-onyx.h
index aeedda7736..ffd20254ff 100644
--- a/sound/aoa/codecs/snd-aoa-codec-onyx.h
+++ b/sound/aoa/codecs/snd-aoa-codec-onyx.h
@@ -9,7 +9,6 @@
9#define __SND_AOA_CODEC_ONYX_H 9#define __SND_AOA_CODEC_ONYX_H
10#include <stddef.h> 10#include <stddef.h>
11#include <linux/i2c.h> 11#include <linux/i2c.h>
12#include <linux/i2c-dev.h>
13#include <asm/pmac_low_i2c.h> 12#include <asm/pmac_low_i2c.h>
14#include <asm/prom.h> 13#include <asm/prom.h>
15 14
diff --git a/sound/aoa/codecs/snd-aoa-codec-tas.c b/sound/aoa/codecs/snd-aoa-codec-tas.c
index 9de8485ba3..2cd81fa07c 100644
--- a/sound/aoa/codecs/snd-aoa-codec-tas.c
+++ b/sound/aoa/codecs/snd-aoa-codec-tas.c
@@ -61,7 +61,6 @@
61 */ 61 */
62#include <stddef.h> 62#include <stddef.h>
63#include <linux/i2c.h> 63#include <linux/i2c.h>
64#include <linux/i2c-dev.h>
65#include <asm/pmac_low_i2c.h> 64#include <asm/pmac_low_i2c.h>
66#include <asm/prom.h> 65#include <asm/prom.h>
67#include <linux/delay.h> 66#include <linux/delay.h>
diff --git a/sound/core/control.c b/sound/core/control.c
index 48ef0a09a7..0c7bcd62e5 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -1275,7 +1275,7 @@ static ssize_t snd_ctl_read(struct file *file, char __user *buffer,
1275 schedule(); 1275 schedule();
1276 remove_wait_queue(&ctl->change_sleep, &wait); 1276 remove_wait_queue(&ctl->change_sleep, &wait);
1277 if (signal_pending(current)) 1277 if (signal_pending(current))
1278 return result > 0 ? result : -ERESTARTSYS; 1278 return -ERESTARTSYS;
1279 spin_lock_irq(&ctl->read_lock); 1279 spin_lock_irq(&ctl->read_lock);
1280 } 1280 }
1281 kev = snd_kctl_event(ctl->events.next); 1281 kev = snd_kctl_event(ctl->events.next);
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index e0821eb3d8..786a82e688 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -810,6 +810,8 @@ static int snd_pcm_oss_change_params(struct snd_pcm_substream *substream)
810 struct snd_mask sformat_mask; 810 struct snd_mask sformat_mask;
811 struct snd_mask mask; 811 struct snd_mask mask;
812 812
813 if (mutex_lock_interruptible(&runtime->oss.params_lock))
814 return -EINTR;
813 sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL); 815 sw_params = kmalloc(sizeof(*sw_params), GFP_KERNEL);
814 params = kmalloc(sizeof(*params), GFP_KERNEL); 816 params = kmalloc(sizeof(*params), GFP_KERNEL);
815 sparams = kmalloc(sizeof(*sparams), GFP_KERNEL); 817 sparams = kmalloc(sizeof(*sparams), GFP_KERNEL);
@@ -1020,6 +1022,7 @@ failure:
1020 kfree(sw_params); 1022 kfree(sw_params);
1021 kfree(params); 1023 kfree(params);
1022 kfree(sparams); 1024 kfree(sparams);
1025 mutex_unlock(&runtime->oss.params_lock);
1023 return err; 1026 return err;
1024} 1027}
1025 1028
@@ -1307,14 +1310,17 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
1307 1310
1308 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0) 1311 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)
1309 return tmp; 1312 return tmp;
1313 mutex_lock(&runtime->oss.params_lock);
1310 while (bytes > 0) { 1314 while (bytes > 0) {
1311 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { 1315 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {
1312 tmp = bytes; 1316 tmp = bytes;
1313 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes) 1317 if (tmp + runtime->oss.buffer_used > runtime->oss.period_bytes)
1314 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used; 1318 tmp = runtime->oss.period_bytes - runtime->oss.buffer_used;
1315 if (tmp > 0) { 1319 if (tmp > 0) {
1316 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) 1320 if (copy_from_user(runtime->oss.buffer + runtime->oss.buffer_used, buf, tmp)) {
1317 return xfer > 0 ? (snd_pcm_sframes_t)xfer : -EFAULT; 1321 tmp = -EFAULT;
1322 goto err;
1323 }
1318 } 1324 }
1319 runtime->oss.buffer_used += tmp; 1325 runtime->oss.buffer_used += tmp;
1320 buf += tmp; 1326 buf += tmp;
@@ -1325,22 +1331,24 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
1325 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr, 1331 tmp = snd_pcm_oss_write2(substream, runtime->oss.buffer + runtime->oss.period_ptr,
1326 runtime->oss.buffer_used - runtime->oss.period_ptr, 1); 1332 runtime->oss.buffer_used - runtime->oss.period_ptr, 1);
1327 if (tmp <= 0) 1333 if (tmp <= 0)
1328 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 1334 goto err;
1329 runtime->oss.bytes += tmp; 1335 runtime->oss.bytes += tmp;
1330 runtime->oss.period_ptr += tmp; 1336 runtime->oss.period_ptr += tmp;
1331 runtime->oss.period_ptr %= runtime->oss.period_bytes; 1337 runtime->oss.period_ptr %= runtime->oss.period_bytes;
1332 if (runtime->oss.period_ptr == 0 || 1338 if (runtime->oss.period_ptr == 0 ||
1333 runtime->oss.period_ptr == runtime->oss.buffer_used) 1339 runtime->oss.period_ptr == runtime->oss.buffer_used)
1334 runtime->oss.buffer_used = 0; 1340 runtime->oss.buffer_used = 0;
1335 else if ((substream->f_flags & O_NONBLOCK) != 0) 1341 else if ((substream->f_flags & O_NONBLOCK) != 0) {
1336 return xfer > 0 ? xfer : -EAGAIN; 1342 tmp = -EAGAIN;
1343 goto err;
1344 }
1337 } 1345 }
1338 } else { 1346 } else {
1339 tmp = snd_pcm_oss_write2(substream, 1347 tmp = snd_pcm_oss_write2(substream,
1340 (const char __force *)buf, 1348 (const char __force *)buf,
1341 runtime->oss.period_bytes, 0); 1349 runtime->oss.period_bytes, 0);
1342 if (tmp <= 0) 1350 if (tmp <= 0)
1343 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 1351 goto err;
1344 runtime->oss.bytes += tmp; 1352 runtime->oss.bytes += tmp;
1345 buf += tmp; 1353 buf += tmp;
1346 bytes -= tmp; 1354 bytes -= tmp;
@@ -1350,7 +1358,12 @@ static ssize_t snd_pcm_oss_write1(struct snd_pcm_substream *substream, const cha
1350 break; 1358 break;
1351 } 1359 }
1352 } 1360 }
1361 mutex_unlock(&runtime->oss.params_lock);
1353 return xfer; 1362 return xfer;
1363
1364 err:
1365 mutex_unlock(&runtime->oss.params_lock);
1366 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
1354} 1367}
1355 1368
1356static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int in_kernel) 1369static ssize_t snd_pcm_oss_read2(struct snd_pcm_substream *substream, char *buf, size_t bytes, int in_kernel)
@@ -1397,12 +1410,13 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
1397 1410
1398 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0) 1411 if ((tmp = snd_pcm_oss_make_ready(substream)) < 0)
1399 return tmp; 1412 return tmp;
1413 mutex_lock(&runtime->oss.params_lock);
1400 while (bytes > 0) { 1414 while (bytes > 0) {
1401 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) { 1415 if (bytes < runtime->oss.period_bytes || runtime->oss.buffer_used > 0) {
1402 if (runtime->oss.buffer_used == 0) { 1416 if (runtime->oss.buffer_used == 0) {
1403 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1); 1417 tmp = snd_pcm_oss_read2(substream, runtime->oss.buffer, runtime->oss.period_bytes, 1);
1404 if (tmp <= 0) 1418 if (tmp <= 0)
1405 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 1419 goto err;
1406 runtime->oss.bytes += tmp; 1420 runtime->oss.bytes += tmp;
1407 runtime->oss.period_ptr = tmp; 1421 runtime->oss.period_ptr = tmp;
1408 runtime->oss.buffer_used = tmp; 1422 runtime->oss.buffer_used = tmp;
@@ -1410,8 +1424,10 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
1410 tmp = bytes; 1424 tmp = bytes;
1411 if ((size_t) tmp > runtime->oss.buffer_used) 1425 if ((size_t) tmp > runtime->oss.buffer_used)
1412 tmp = runtime->oss.buffer_used; 1426 tmp = runtime->oss.buffer_used;
1413 if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), tmp)) 1427 if (copy_to_user(buf, runtime->oss.buffer + (runtime->oss.period_ptr - runtime->oss.buffer_used), tmp)) {
1414 return xfer > 0 ? (snd_pcm_sframes_t)xfer : -EFAULT; 1428 tmp = -EFAULT;
1429 goto err;
1430 }
1415 buf += tmp; 1431 buf += tmp;
1416 bytes -= tmp; 1432 bytes -= tmp;
1417 xfer += tmp; 1433 xfer += tmp;
@@ -1420,14 +1436,19 @@ static ssize_t snd_pcm_oss_read1(struct snd_pcm_substream *substream, char __use
1420 tmp = snd_pcm_oss_read2(substream, (char __force *)buf, 1436 tmp = snd_pcm_oss_read2(substream, (char __force *)buf,
1421 runtime->oss.period_bytes, 0); 1437 runtime->oss.period_bytes, 0);
1422 if (tmp <= 0) 1438 if (tmp <= 0)
1423 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 1439 goto err;
1424 runtime->oss.bytes += tmp; 1440 runtime->oss.bytes += tmp;
1425 buf += tmp; 1441 buf += tmp;
1426 bytes -= tmp; 1442 bytes -= tmp;
1427 xfer += tmp; 1443 xfer += tmp;
1428 } 1444 }
1429 } 1445 }
1446 mutex_unlock(&runtime->oss.params_lock);
1430 return xfer; 1447 return xfer;
1448
1449 err:
1450 mutex_unlock(&runtime->oss.params_lock);
1451 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
1431} 1452}
1432 1453
1433static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file) 1454static int snd_pcm_oss_reset(struct snd_pcm_oss_file *pcm_oss_file)
@@ -1528,6 +1549,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
1528 return err; 1549 return err;
1529 format = snd_pcm_oss_format_from(runtime->oss.format); 1550 format = snd_pcm_oss_format_from(runtime->oss.format);
1530 width = snd_pcm_format_physical_width(format); 1551 width = snd_pcm_format_physical_width(format);
1552 mutex_lock(&runtime->oss.params_lock);
1531 if (runtime->oss.buffer_used > 0) { 1553 if (runtime->oss.buffer_used > 0) {
1532#ifdef OSS_DEBUG 1554#ifdef OSS_DEBUG
1533 printk("sync: buffer_used\n"); 1555 printk("sync: buffer_used\n");
@@ -1537,8 +1559,10 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
1537 runtime->oss.buffer + runtime->oss.buffer_used, 1559 runtime->oss.buffer + runtime->oss.buffer_used,
1538 size); 1560 size);
1539 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes); 1561 err = snd_pcm_oss_sync1(substream, runtime->oss.period_bytes);
1540 if (err < 0) 1562 if (err < 0) {
1563 mutex_unlock(&runtime->oss.params_lock);
1541 return err; 1564 return err;
1565 }
1542 } else if (runtime->oss.period_ptr > 0) { 1566 } else if (runtime->oss.period_ptr > 0) {
1543#ifdef OSS_DEBUG 1567#ifdef OSS_DEBUG
1544 printk("sync: period_ptr\n"); 1568 printk("sync: period_ptr\n");
@@ -1548,8 +1572,10 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
1548 runtime->oss.buffer, 1572 runtime->oss.buffer,
1549 size * 8 / width); 1573 size * 8 / width);
1550 err = snd_pcm_oss_sync1(substream, size); 1574 err = snd_pcm_oss_sync1(substream, size);
1551 if (err < 0) 1575 if (err < 0) {
1576 mutex_unlock(&runtime->oss.params_lock);
1552 return err; 1577 return err;
1578 }
1553 } 1579 }
1554 /* 1580 /*
1555 * The ALSA's period might be a bit large than OSS one. 1581 * The ALSA's period might be a bit large than OSS one.
@@ -1579,6 +1605,7 @@ static int snd_pcm_oss_sync(struct snd_pcm_oss_file *pcm_oss_file)
1579 snd_pcm_lib_writev(substream, buffers, size); 1605 snd_pcm_lib_writev(substream, buffers, size);
1580 } 1606 }
1581 } 1607 }
1608 mutex_unlock(&runtime->oss.params_lock);
1582 /* 1609 /*
1583 * finish sync: drain the buffer 1610 * finish sync: drain the buffer
1584 */ 1611 */
@@ -2172,6 +2199,7 @@ static void snd_pcm_oss_init_substream(struct snd_pcm_substream *substream,
2172 runtime->oss.params = 1; 2199 runtime->oss.params = 1;
2173 runtime->oss.trigger = 1; 2200 runtime->oss.trigger = 1;
2174 runtime->oss.rate = 8000; 2201 runtime->oss.rate = 8000;
2202 mutex_init(&runtime->oss.params_lock);
2175 switch (SNDRV_MINOR_OSS_DEVICE(minor)) { 2203 switch (SNDRV_MINOR_OSS_DEVICE(minor)) {
2176 case SNDRV_MINOR_OSS_PCM_8: 2204 case SNDRV_MINOR_OSS_PCM_8:
2177 runtime->oss.format = AFMT_U8; 2205 runtime->oss.format = AFMT_U8;
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 5ac6e19ccb..8e01898855 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -640,6 +640,10 @@ int snd_pcm_new_stream(struct snd_pcm *pcm, int stream, int substream_count)
640 err = snd_pcm_substream_proc_init(substream); 640 err = snd_pcm_substream_proc_init(substream);
641 if (err < 0) { 641 if (err < 0) {
642 snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n"); 642 snd_printk(KERN_ERR "Error in snd_pcm_stream_proc_init\n");
643 if (prev == NULL)
644 pstr->substream = NULL;
645 else
646 prev->next = NULL;
643 kfree(substream); 647 kfree(substream);
644 return err; 648 return err;
645 } 649 }
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 0bb142a285..b336797be4 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -79,19 +79,17 @@ void snd_pcm_playback_silence(struct snd_pcm_substream *substream, snd_pcm_ufram
79 runtime->silence_filled -= frames; 79 runtime->silence_filled -= frames;
80 if ((snd_pcm_sframes_t)runtime->silence_filled < 0) { 80 if ((snd_pcm_sframes_t)runtime->silence_filled < 0) {
81 runtime->silence_filled = 0; 81 runtime->silence_filled = 0;
82 runtime->silence_start = (ofs + frames) - runtime->buffer_size; 82 runtime->silence_start = new_hw_ptr;
83 } else { 83 } else {
84 runtime->silence_start = ofs - runtime->silence_filled; 84 runtime->silence_start = ofs;
85 } 85 }
86 if ((snd_pcm_sframes_t)runtime->silence_start < 0)
87 runtime->silence_start += runtime->boundary;
88 } 86 }
89 frames = runtime->buffer_size - runtime->silence_filled; 87 frames = runtime->buffer_size - runtime->silence_filled;
90 } 88 }
91 snd_assert(frames <= runtime->buffer_size, return); 89 snd_assert(frames <= runtime->buffer_size, return);
92 if (frames == 0) 90 if (frames == 0)
93 return; 91 return;
94 ofs = (runtime->silence_start + runtime->silence_filled) % runtime->buffer_size; 92 ofs = runtime->silence_start % runtime->buffer_size;
95 while (frames > 0) { 93 while (frames > 0) {
96 transfer = ofs + frames > runtime->buffer_size ? runtime->buffer_size - ofs : frames; 94 transfer = ofs + frames > runtime->buffer_size ? runtime->buffer_size - ofs : frames;
97 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED || 95 if (runtime->access == SNDRV_PCM_ACCESS_RW_INTERLEAVED ||
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index 269c467ca9..0f055bfcbd 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -1385,7 +1385,6 @@ static int snd_rawmidi_alloc_substreams(struct snd_rawmidi *rmidi,
1385 struct snd_rawmidi_substream *substream; 1385 struct snd_rawmidi_substream *substream;
1386 int idx; 1386 int idx;
1387 1387
1388 INIT_LIST_HEAD(&stream->substreams);
1389 for (idx = 0; idx < count; idx++) { 1388 for (idx = 0; idx < count; idx++) {
1390 substream = kzalloc(sizeof(*substream), GFP_KERNEL); 1389 substream = kzalloc(sizeof(*substream), GFP_KERNEL);
1391 if (substream == NULL) { 1390 if (substream == NULL) {
@@ -1440,6 +1439,9 @@ int snd_rawmidi_new(struct snd_card *card, char *id, int device,
1440 rmidi->device = device; 1439 rmidi->device = device;
1441 mutex_init(&rmidi->open_mutex); 1440 mutex_init(&rmidi->open_mutex);
1442 init_waitqueue_head(&rmidi->open_wait); 1441 init_waitqueue_head(&rmidi->open_wait);
1442 INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_INPUT].substreams);
1443 INIT_LIST_HEAD(&rmidi->streams[SNDRV_RAWMIDI_STREAM_OUTPUT].substreams);
1444
1443 if (id != NULL) 1445 if (id != NULL)
1444 strlcpy(rmidi->id, id, sizeof(rmidi->id)); 1446 strlcpy(rmidi->id, id, sizeof(rmidi->id));
1445 if ((err = snd_rawmidi_alloc_substreams(rmidi, 1447 if ((err = snd_rawmidi_alloc_substreams(rmidi,
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 4bffe509f7..a3dc5e01e9 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -151,7 +151,7 @@ int snd_seq_expand_var_event(const struct snd_seq_event *event, int count, char
151 return len; 151 return len;
152 newlen = len; 152 newlen = len;
153 if (size_aligned > 0) 153 if (size_aligned > 0)
154 newlen = ((len + size_aligned - 1) / size_aligned) * size_aligned; 154 newlen = roundup(len, size_aligned);
155 if (count < newlen) 155 if (count < newlen)
156 return -EAGAIN; 156 return -EAGAIN;
157 157
diff --git a/sound/core/sgbuf.c b/sound/core/sgbuf.c
index c30669f14a..cefd228cd2 100644
--- a/sound/core/sgbuf.c
+++ b/sound/core/sgbuf.c
@@ -27,7 +27,7 @@
27 27
28/* table entries are align to 32 */ 28/* table entries are align to 32 */
29#define SGBUF_TBL_ALIGN 32 29#define SGBUF_TBL_ALIGN 32
30#define sgbuf_align_table(tbl) ((((tbl) + SGBUF_TBL_ALIGN - 1) / SGBUF_TBL_ALIGN) * SGBUF_TBL_ALIGN) 30#define sgbuf_align_table(tbl) ALIGN((tbl), SGBUF_TBL_ALIGN)
31 31
32int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab) 32int snd_free_sgbuf_pages(struct snd_dma_buffer *dmab)
33{ 33{
diff --git a/sound/isa/gus/gus_mem.c b/sound/isa/gus/gus_mem.c
index f50c276cae..7107753b85 100644
--- a/sound/isa/gus/gus_mem.c
+++ b/sound/isa/gus/gus_mem.c
@@ -143,9 +143,8 @@ static int snd_gf1_mem_find(struct snd_gf1_mem * alloc,
143 struct snd_gf1_mem_block *pblock; 143 struct snd_gf1_mem_block *pblock;
144 unsigned int ptr1, ptr2; 144 unsigned int ptr1, ptr2;
145 145
146 align--; 146 if (w_16 && align < 2)
147 if (w_16 && align < 1) 147 align = 2;
148 align = 1;
149 block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0; 148 block->flags = w_16 ? SNDRV_GF1_MEM_BLOCK_16BIT : 0;
150 block->owner = SNDRV_GF1_MEM_OWNER_DRIVER; 149 block->owner = SNDRV_GF1_MEM_OWNER_DRIVER;
151 block->share = 0; 150 block->share = 0;
@@ -165,7 +164,7 @@ static int snd_gf1_mem_find(struct snd_gf1_mem * alloc,
165 if (pblock->next->ptr < boundary) 164 if (pblock->next->ptr < boundary)
166 ptr2 = pblock->next->ptr; 165 ptr2 = pblock->next->ptr;
167 } 166 }
168 ptr1 = (pblock->ptr + pblock->size + align) & ~align; 167 ptr1 = ALIGN(pblock->ptr + pblock->size, align);
169 if (ptr1 >= ptr2) 168 if (ptr1 >= ptr2)
170 continue; 169 continue;
171 size1 = ptr2 - ptr1; 170 size1 = ptr2 - ptr1;
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c
index c62a9e3d2a..3094f38521 100644
--- a/sound/isa/sb/sb_common.c
+++ b/sound/isa/sb/sb_common.c
@@ -232,7 +232,7 @@ int snd_sbdsp_create(struct snd_card *card,
232 chip->port = port; 232 chip->port = port;
233 233
234 if (request_irq(irq, irq_handler, hardware == SB_HW_ALS4000 ? 234 if (request_irq(irq, irq_handler, hardware == SB_HW_ALS4000 ?
235 IRQF_DISABLED | IRQF_SHARED : IRQF_DISABLED, 235 IRQF_SHARED : IRQF_DISABLED,
236 "SoundBlaster", (void *) chip)) { 236 "SoundBlaster", (void *) chip)) {
237 snd_printk(KERN_ERR "sb: can't grab irq %d\n", irq); 237 snd_printk(KERN_ERR "sb: can't grab irq %d\n", irq);
238 snd_sbdsp_free(chip); 238 snd_sbdsp_free(chip);
diff --git a/sound/isa/wavefront/wavefront_synth.c b/sound/isa/wavefront/wavefront_synth.c
index bed329edbd..78020d832e 100644
--- a/sound/isa/wavefront/wavefront_synth.c
+++ b/sound/isa/wavefront/wavefront_synth.c
@@ -1068,7 +1068,7 @@ wavefront_send_sample (snd_wavefront_t *dev,
1068 blocksize = max_blksize; 1068 blocksize = max_blksize;
1069 } else { 1069 } else {
1070 /* round to nearest 16-byte value */ 1070 /* round to nearest 16-byte value */
1071 blocksize = ((length-written+7)&~0x7); 1071 blocksize = ALIGN(length - written, 8);
1072 } 1072 }
1073 1073
1074 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) { 1074 if (snd_wavefront_cmd (dev, WFC_DOWNLOAD_BLOCK, NULL, NULL)) {
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 7abcb10b27..d2994cb4c8 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -129,9 +129,9 @@ static const struct ac97_codec_id snd_ac97_codec_ids[] = {
129{ 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL }, 129{ 0x434d4941, 0xffffffff, "CMI9738", patch_cm9738, NULL },
130{ 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL }, 130{ 0x434d4961, 0xffffffff, "CMI9739", patch_cm9739, NULL },
131{ 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL }, 131{ 0x434d4969, 0xffffffff, "CMI9780", patch_cm9780, NULL },
132{ 0x434d4978, 0xffffffff, "CMI9761", patch_cm9761, NULL }, 132{ 0x434d4978, 0xffffffff, "CMI9761A", patch_cm9761, NULL },
133{ 0x434d4982, 0xffffffff, "CMI9761", patch_cm9761, NULL }, 133{ 0x434d4982, 0xffffffff, "CMI9761B", patch_cm9761, NULL },
134{ 0x434d4983, 0xffffffff, "CMI9761", patch_cm9761, NULL }, 134{ 0x434d4983, 0xffffffff, "CMI9761A+", patch_cm9761, NULL },
135{ 0x43525900, 0xfffffff8, "CS4297", NULL, NULL }, 135{ 0x43525900, 0xfffffff8, "CS4297", NULL, NULL },
136{ 0x43525910, 0xfffffff8, "CS4297A", patch_cirrus_spdif, NULL }, 136{ 0x43525910, 0xfffffff8, "CS4297A", patch_cirrus_spdif, NULL },
137{ 0x43525920, 0xfffffff8, "CS4298", patch_cirrus_spdif, NULL }, 137{ 0x43525920, 0xfffffff8, "CS4298", patch_cirrus_spdif, NULL },
@@ -382,7 +382,7 @@ int snd_ac97_update_bits_nolock(struct snd_ac97 *ac97, unsigned short reg,
382 unsigned short old, new; 382 unsigned short old, new;
383 383
384 old = snd_ac97_read_cache(ac97, reg); 384 old = snd_ac97_read_cache(ac97, reg);
385 new = (old & ~mask) | value; 385 new = (old & ~mask) | (value & mask);
386 change = old != new; 386 change = old != new;
387 if (change) { 387 if (change) {
388 ac97->regs[reg] = new; 388 ac97->regs[reg] = new;
@@ -399,7 +399,7 @@ static int snd_ac97_ad18xx_update_pcm_bits(struct snd_ac97 *ac97, int codec, uns
399 399
400 mutex_lock(&ac97->page_mutex); 400 mutex_lock(&ac97->page_mutex);
401 old = ac97->spec.ad18xx.pcmreg[codec]; 401 old = ac97->spec.ad18xx.pcmreg[codec];
402 new = (old & ~mask) | value; 402 new = (old & ~mask) | (value & mask);
403 change = old != new; 403 change = old != new;
404 if (change) { 404 if (change) {
405 mutex_lock(&ac97->reg_mutex); 405 mutex_lock(&ac97->reg_mutex);
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index 15be6ba87c..e813968e0c 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -1467,7 +1467,9 @@ static void patch_ad1881_chained(struct snd_ac97 * ac97, int unchained_idx, int
1467 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); // ID1C 1467 snd_ac97_write_cache(ac97, AC97_AD_CODEC_CFG, 0x0002); // ID1C
1468 ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002; 1468 ac97->spec.ad18xx.codec_cfg[unchained_idx] = 0x0002;
1469 if (cidx1 >= 0) { 1469 if (cidx1 >= 0) {
1470 if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C 1470 if (cidx2 < 0)
1471 patch_ad1881_chained1(ac97, cidx1, 0);
1472 else if (patch_ad1881_chained1(ac97, cidx1, 0x0006)) // SDIE | ID1C
1471 patch_ad1881_chained1(ac97, cidx2, 0); 1473 patch_ad1881_chained1(ac97, cidx2, 0);
1472 else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C 1474 else if (patch_ad1881_chained1(ac97, cidx2, 0x0006)) // SDIE | ID1C
1473 patch_ad1881_chained1(ac97, cidx1, 0); 1475 patch_ad1881_chained1(ac97, cidx1, 0);
@@ -2261,7 +2263,8 @@ int patch_alc655(struct snd_ac97 * ac97)
2261 else { /* ALC655 */ 2263 else { /* ALC655 */
2262 if (ac97->subsystem_vendor == 0x1462 && 2264 if (ac97->subsystem_vendor == 0x1462 &&
2263 (ac97->subsystem_device == 0x0131 || /* MSI S270 laptop */ 2265 (ac97->subsystem_device == 0x0131 || /* MSI S270 laptop */
2264 ac97->subsystem_device == 0x0161)) /* LG K1 Express */ 2266 ac97->subsystem_device == 0x0161 || /* LG K1 Express */
2267 ac97->subsystem_device == 0x0351)) /* MSI L725 laptop */
2265 val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */ 2268 val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */
2266 else 2269 else
2267 val |= (1 << 1); /* Pin 47 is spdif input pin */ 2270 val |= (1 << 1); /* Pin 47 is spdif input pin */
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
index cbf8331c3d..98970d401b 100644
--- a/sound/pci/ad1889.c
+++ b/sound/pci/ad1889.c
@@ -858,7 +858,7 @@ snd_ad1889_free(struct snd_ad1889 *chip)
858 synchronize_irq(chip->irq); 858 synchronize_irq(chip->irq);
859 859
860 if (chip->irq >= 0) 860 if (chip->irq >= 0)
861 free_irq(chip->irq, (void*)chip); 861 free_irq(chip->irq, chip);
862 862
863skip_hw: 863skip_hw:
864 if (chip->iobase) 864 if (chip->iobase)
@@ -945,7 +945,7 @@ snd_ad1889_create(struct snd_card *card,
945 spin_lock_init(&chip->lock); /* only now can we call ad1889_free */ 945 spin_lock_init(&chip->lock); /* only now can we call ad1889_free */
946 946
947 if (request_irq(pci->irq, snd_ad1889_interrupt, 947 if (request_irq(pci->irq, snd_ad1889_interrupt,
948 IRQF_DISABLED|IRQF_SHARED, card->driver, (void*)chip)) { 948 IRQF_SHARED, card->driver, chip)) {
949 printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq); 949 printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq);
950 snd_ad1889_free(chip); 950 snd_ad1889_free(chip);
951 return -EBUSY; 951 return -EBUSY;
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index a7edd56542..9327ab2ecc 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -2095,7 +2095,7 @@ static int snd_ali_free(struct snd_ali * codec)
2095 snd_ali_disable_address_interrupt(codec); 2095 snd_ali_disable_address_interrupt(codec);
2096 if (codec->irq >= 0) { 2096 if (codec->irq >= 0) {
2097 synchronize_irq(codec->irq); 2097 synchronize_irq(codec->irq);
2098 free_irq(codec->irq, (void *)codec); 2098 free_irq(codec->irq, codec);
2099 } 2099 }
2100 if (codec->port) 2100 if (codec->port)
2101 pci_release_regions(codec->pci); 2101 pci_release_regions(codec->pci);
@@ -2192,7 +2192,8 @@ static int __devinit snd_ali_resources(struct snd_ali *codec)
2192 return err; 2192 return err;
2193 codec->port = pci_resource_start(codec->pci, 0); 2193 codec->port = pci_resource_start(codec->pci, 0);
2194 2194
2195 if (request_irq(codec->pci->irq, snd_ali_card_interrupt, IRQF_DISABLED|IRQF_SHARED, "ALI 5451", (void *)codec)) { 2195 if (request_irq(codec->pci->irq, snd_ali_card_interrupt,
2196 IRQF_SHARED, "ALI 5451", codec)) {
2196 snd_printk(KERN_ERR "Unable to request irq.\n"); 2197 snd_printk(KERN_ERR "Unable to request irq.\n");
2197 return -EBUSY; 2198 return -EBUSY;
2198 } 2199 }
diff --git a/sound/pci/als300.c b/sound/pci/als300.c
index 95f70f3cc3..9f406fbe0d 100644
--- a/sound/pci/als300.c
+++ b/sound/pci/als300.c
@@ -190,7 +190,7 @@ static int snd_als300_free(struct snd_als300 *chip)
190 snd_als300_dbgcallenter(); 190 snd_als300_dbgcallenter();
191 snd_als300_set_irq_flag(chip, IRQ_DISABLE); 191 snd_als300_set_irq_flag(chip, IRQ_DISABLE);
192 if (chip->irq >= 0) 192 if (chip->irq >= 0)
193 free_irq(chip->irq, (void *)chip); 193 free_irq(chip->irq, chip);
194 pci_release_regions(chip->pci); 194 pci_release_regions(chip->pci);
195 pci_disable_device(chip->pci); 195 pci_disable_device(chip->pci);
196 kfree(chip); 196 kfree(chip);
@@ -722,8 +722,8 @@ static int __devinit snd_als300_create(snd_card_t *card,
722 else 722 else
723 irq_handler = snd_als300_interrupt; 723 irq_handler = snd_als300_interrupt;
724 724
725 if (request_irq(pci->irq, irq_handler, IRQF_DISABLED|IRQF_SHARED, 725 if (request_irq(pci->irq, irq_handler, IRQF_SHARED,
726 card->shortname, (void *)chip)) { 726 card->shortname, chip)) {
727 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 727 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
728 snd_als300_free(chip); 728 snd_als300_free(chip);
729 return -EBUSY; 729 return -EBUSY;
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index e3e99f3967..476c343307 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1583,7 +1583,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
1583 return -EIO; 1583 return -EIO;
1584 } 1584 }
1585 1585
1586 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_DISABLED|IRQF_SHARED, 1586 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED,
1587 card->shortname, chip)) { 1587 card->shortname, chip)) {
1588 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1588 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1589 snd_atiixp_free(chip); 1589 snd_atiixp_free(chip);
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index dc54f2c68e..cc2e6b9d40 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1256,7 +1256,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
1256 return -EIO; 1256 return -EIO;
1257 } 1257 }
1258 1258
1259 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_DISABLED|IRQF_SHARED, 1259 if (request_irq(pci->irq, snd_atiixp_interrupt, IRQF_SHARED,
1260 card->shortname, chip)) { 1260 card->shortname, chip)) {
1261 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1261 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1262 snd_atiixp_free(chip); 1262 snd_atiixp_free(chip);
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index 6ed5ad59f5..238154bb7a 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -198,7 +198,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
198 } 198 }
199 199
200 if ((err = request_irq(pci->irq, vortex_interrupt, 200 if ((err = request_irq(pci->irq, vortex_interrupt,
201 IRQF_DISABLED | IRQF_SHARED, CARD_NAME_SHORT, 201 IRQF_SHARED, CARD_NAME_SHORT,
202 chip)) != 0) { 202 chip)) != 0) {
203 printk(KERN_ERR "cannot grab irq\n"); 203 printk(KERN_ERR "cannot grab irq\n");
204 goto irq_out; 204 goto irq_out;
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 2414ee6307..43edd2839b 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1513,7 +1513,7 @@ snd_azf3328_free(struct snd_azf3328 *chip)
1513__end_hw: 1513__end_hw:
1514 snd_azf3328_free_joystick(chip); 1514 snd_azf3328_free_joystick(chip);
1515 if (chip->irq >= 0) 1515 if (chip->irq >= 0)
1516 free_irq(chip->irq, (void *)chip); 1516 free_irq(chip->irq, chip);
1517 pci_release_regions(chip->pci); 1517 pci_release_regions(chip->pci);
1518 pci_disable_device(chip->pci); 1518 pci_disable_device(chip->pci);
1519 1519
@@ -1724,7 +1724,8 @@ snd_azf3328_create(struct snd_card *card,
1724 chip->synth_port = pci_resource_start(pci, 3); 1724 chip->synth_port = pci_resource_start(pci, 3);
1725 chip->mixer_port = pci_resource_start(pci, 4); 1725 chip->mixer_port = pci_resource_start(pci, 4);
1726 1726
1727 if (request_irq(pci->irq, snd_azf3328_interrupt, IRQF_DISABLED|IRQF_SHARED, card->shortname, (void *)chip)) { 1727 if (request_irq(pci->irq, snd_azf3328_interrupt,
1728 IRQF_SHARED, card->shortname, chip)) {
1728 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1729 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1729 err = -EBUSY; 1730 err = -EBUSY;
1730 goto out_err; 1731 goto out_err;
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index d33a37086d..c3f3da2112 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -699,7 +699,7 @@ static int __devinit snd_bt87x_pcm(struct snd_bt87x *chip, int device, char *nam
699 SNDRV_DMA_TYPE_DEV_SG, 699 SNDRV_DMA_TYPE_DEV_SG,
700 snd_dma_pci_data(chip->pci), 700 snd_dma_pci_data(chip->pci),
701 128 * 1024, 701 128 * 1024,
702 (255 * 4092 + 1023) & ~1023); 702 ALIGN(255 * 4092, 1024));
703} 703}
704 704
705static int __devinit snd_bt87x_create(struct snd_card *card, 705static int __devinit snd_bt87x_create(struct snd_card *card,
@@ -747,7 +747,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card,
747 snd_bt87x_writel(chip, REG_INT_MASK, 0); 747 snd_bt87x_writel(chip, REG_INT_MASK, 0);
748 snd_bt87x_writel(chip, REG_INT_STAT, MY_INTERRUPTS); 748 snd_bt87x_writel(chip, REG_INT_STAT, MY_INTERRUPTS);
749 749
750 if (request_irq(pci->irq, snd_bt87x_interrupt, IRQF_DISABLED | IRQF_SHARED, 750 if (request_irq(pci->irq, snd_bt87x_interrupt, IRQF_SHARED,
751 "Bt87x audio", chip)) { 751 "Bt87x audio", chip)) {
752 snd_bt87x_free(chip); 752 snd_bt87x_free(chip);
753 snd_printk(KERN_ERR "cannot grab irq\n"); 753 snd_printk(KERN_ERR "cannot grab irq\n");
diff --git a/sound/pci/ca0106/ca0106.h b/sound/pci/ca0106/ca0106.h
index 9cb66c59f5..aaac6e5b47 100644
--- a/sound/pci/ca0106/ca0106.h
+++ b/sound/pci/ca0106/ca0106.h
@@ -590,7 +590,7 @@ struct snd_ca0106 {
590 struct resource *res_port; 590 struct resource *res_port;
591 int irq; 591 int irq;
592 592
593 unsigned int revision; /* chip revision */ 593 unsigned char revision; /* chip revision */
594 unsigned int serial; /* serial number */ 594 unsigned int serial; /* serial number */
595 unsigned short model; /* subsystem id */ 595 unsigned short model; /* subsystem id */
596 596
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 6fa4a302f7..f61f052f6d 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -154,6 +154,7 @@ MODULE_SUPPORTED_DEVICE("{{Creative,SB CA0106 chip}}");
154static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; 154static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
155static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; 155static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
156static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; 156static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
157static uint subsystem[SNDRV_CARDS]; /* Force card subsystem model */
157 158
158module_param_array(index, int, NULL, 0444); 159module_param_array(index, int, NULL, 0444);
159MODULE_PARM_DESC(index, "Index value for the CA0106 soundcard."); 160MODULE_PARM_DESC(index, "Index value for the CA0106 soundcard.");
@@ -161,6 +162,8 @@ module_param_array(id, charp, NULL, 0444);
161MODULE_PARM_DESC(id, "ID string for the CA0106 soundcard."); 162MODULE_PARM_DESC(id, "ID string for the CA0106 soundcard.");
162module_param_array(enable, bool, NULL, 0444); 163module_param_array(enable, bool, NULL, 0444);
163MODULE_PARM_DESC(enable, "Enable the CA0106 soundcard."); 164MODULE_PARM_DESC(enable, "Enable the CA0106 soundcard.");
165module_param_array(subsystem, uint, NULL, 0444);
166MODULE_PARM_DESC(subsystem, "Force card subsystem model.");
164 167
165#include "ca0106.h" 168#include "ca0106.h"
166 169
@@ -194,6 +197,17 @@ static struct snd_ca0106_details ca0106_chip_details[] = {
194 .gpio_type = 1, 197 .gpio_type = 1,
195 .i2c_adc = 1, 198 .i2c_adc = 1,
196 .spi_dac = 1 } , 199 .spi_dac = 1 } ,
200 /* New Audigy LS. Has a different DAC. */
201 /* SB0570:
202 * CTRL:CA0106-DAT
203 * ADC: WM8775EDS
204 * DAC: WM8768GEDS
205 */
206 { .serial = 0x10111102,
207 .name = "Audigy SE OEM [SB0570a]",
208 .gpio_type = 1,
209 .i2c_adc = 1,
210 .spi_dac = 1 } ,
197 /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */ 211 /* MSI K8N Diamond Motherboard with onboard SB Live 24bit without AC97 */
198 /* SB0438 212 /* SB0438
199 * CTRL:CA0106-DAT 213 * CTRL:CA0106-DAT
@@ -1046,7 +1060,7 @@ static int snd_ca0106_free(struct snd_ca0106 *chip)
1046 1060
1047 // release the irq 1061 // release the irq
1048 if (chip->irq >= 0) 1062 if (chip->irq >= 0)
1049 free_irq(chip->irq, (void *)chip); 1063 free_irq(chip->irq, chip);
1050 pci_disable_device(chip->pci); 1064 pci_disable_device(chip->pci);
1051 kfree(chip); 1065 kfree(chip);
1052 return 0; 1066 return 0;
@@ -1223,7 +1237,7 @@ static unsigned int i2c_adc_init[][2] = {
1223 { 0x15, ADC_MUX_LINEIN }, /* ADC Mixer control */ 1237 { 0x15, ADC_MUX_LINEIN }, /* ADC Mixer control */
1224}; 1238};
1225 1239
1226static int __devinit snd_ca0106_create(struct snd_card *card, 1240static int __devinit snd_ca0106_create(int dev, struct snd_card *card,
1227 struct pci_dev *pci, 1241 struct pci_dev *pci,
1228 struct snd_ca0106 **rchip) 1242 struct snd_ca0106 **rchip)
1229{ 1243{
@@ -1267,8 +1281,7 @@ static int __devinit snd_ca0106_create(struct snd_card *card,
1267 } 1281 }
1268 1282
1269 if (request_irq(pci->irq, snd_ca0106_interrupt, 1283 if (request_irq(pci->irq, snd_ca0106_interrupt,
1270 IRQF_DISABLED|IRQF_SHARED, "snd_ca0106", 1284 IRQF_SHARED, "snd_ca0106", chip)) {
1271 (void *)chip)) {
1272 snd_ca0106_free(chip); 1285 snd_ca0106_free(chip);
1273 printk(KERN_ERR "cannot grab irq\n"); 1286 printk(KERN_ERR "cannot grab irq\n");
1274 return -EBUSY; 1287 return -EBUSY;
@@ -1283,21 +1296,29 @@ static int __devinit snd_ca0106_create(struct snd_card *card,
1283 1296
1284 pci_set_master(pci); 1297 pci_set_master(pci);
1285 /* read revision & serial */ 1298 /* read revision & serial */
1286 pci_read_config_byte(pci, PCI_REVISION_ID, (char *)&chip->revision); 1299 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision);
1287 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 1300 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
1288 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 1301 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
1289#if 1 1302#if 1
1290 printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, 1303 printk(KERN_INFO "snd-ca0106: Model %04x Rev %08x Serial %08x\n", chip->model,
1291 chip->revision, chip->serial); 1304 chip->revision, chip->serial);
1292#endif 1305#endif
1293 strcpy(card->driver, "CA0106"); 1306 strcpy(card->driver, "CA0106");
1294 strcpy(card->shortname, "CA0106"); 1307 strcpy(card->shortname, "CA0106");
1295 1308
1296 for (c = ca0106_chip_details; c->serial; c++) { 1309 for (c = ca0106_chip_details; c->serial; c++) {
1297 if (c->serial == chip->serial) 1310 if (subsystem[dev]) {
1311 if (c->serial == subsystem[dev])
1312 break;
1313 } else if (c->serial == chip->serial)
1298 break; 1314 break;
1299 } 1315 }
1300 chip->details = c; 1316 chip->details = c;
1317 if (subsystem[dev]) {
1318 printk(KERN_INFO "snd-ca0106: Sound card name=%s, subsystem=0x%x. Forced to subsystem=0x%x\n",
1319 c->name, chip->serial, subsystem[dev]);
1320 }
1321
1301 sprintf(card->longname, "%s at 0x%lx irq %i", 1322 sprintf(card->longname, "%s at 0x%lx irq %i",
1302 c->name, chip->port, chip->irq); 1323 c->name, chip->port, chip->irq);
1303 1324
@@ -1540,7 +1561,7 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
1540 if (card == NULL) 1561 if (card == NULL)
1541 return -ENOMEM; 1562 return -ENOMEM;
1542 1563
1543 if ((err = snd_ca0106_create(card, pci, &chip)) < 0) { 1564 if ((err = snd_ca0106_create(dev, card, pci, &chip)) < 0) {
1544 snd_card_free(card); 1565 snd_card_free(card);
1545 return err; 1566 return err;
1546 } 1567 }
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index 0093cd1f92..71c58df4af 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -2862,7 +2862,7 @@ static int __devinit snd_cmipci_create(struct snd_card *card, struct pci_dev *pc
2862 cm->iobase = pci_resource_start(pci, 0); 2862 cm->iobase = pci_resource_start(pci, 0);
2863 2863
2864 if (request_irq(pci->irq, snd_cmipci_interrupt, 2864 if (request_irq(pci->irq, snd_cmipci_interrupt,
2865 IRQF_DISABLED|IRQF_SHARED, card->driver, cm)) { 2865 IRQF_SHARED, card->driver, cm)) {
2866 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2866 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2867 snd_cmipci_free(cm); 2867 snd_cmipci_free(cm);
2868 return -EBUSY; 2868 return -EBUSY;
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index 0905fa8812..8e5519de71 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -1391,7 +1391,7 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
1391 return -ENOMEM; 1391 return -ENOMEM;
1392 } 1392 }
1393 1393
1394 if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_DISABLED|IRQF_SHARED, 1394 if (request_irq(pci->irq, snd_cs4281_interrupt, IRQF_SHARED,
1395 "CS4281", chip)) { 1395 "CS4281", chip)) {
1396 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1396 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1397 snd_cs4281_free(chip); 1397 snd_cs4281_free(chip);
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 2807b9756e..2ae539b195 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -3867,7 +3867,7 @@ int __devinit snd_cs46xx_create(struct snd_card *card,
3867 } 3867 }
3868 } 3868 }
3869 3869
3870 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_DISABLED|IRQF_SHARED, 3870 if (request_irq(pci->irq, snd_cs46xx_interrupt, IRQF_SHARED,
3871 "CS46XX", chip)) { 3871 "CS46XX", chip)) {
3872 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3872 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
3873 snd_cs46xx_free(chip); 3873 snd_cs46xx_free(chip);
diff --git a/sound/pci/cs5535audio/cs5535audio.c b/sound/pci/cs5535audio/cs5535audio.c
index 2441238f20..b8e75ef9c1 100644
--- a/sound/pci/cs5535audio/cs5535audio.c
+++ b/sound/pci/cs5535audio/cs5535audio.c
@@ -320,7 +320,7 @@ static int __devinit snd_cs5535audio_create(struct snd_card *card,
320 cs5535au->port = pci_resource_start(pci, 0); 320 cs5535au->port = pci_resource_start(pci, 0);
321 321
322 if (request_irq(pci->irq, snd_cs5535audio_interrupt, 322 if (request_irq(pci->irq, snd_cs5535audio_interrupt,
323 IRQF_DISABLED|IRQF_SHARED, "CS5535 Audio", cs5535au)) { 323 IRQF_SHARED, "CS5535 Audio", cs5535au)) {
324 snd_printk("unable to grab IRQ %d\n", pci->irq); 324 snd_printk("unable to grab IRQ %d\n", pci->irq);
325 err = -EBUSY; 325 err = -EBUSY;
326 goto sndfail; 326 goto sndfail;
diff --git a/sound/pci/echoaudio/echoaudio.c b/sound/pci/echoaudio/echoaudio.c
index e5e88fe54d..047e0b5bf1 100644
--- a/sound/pci/echoaudio/echoaudio.c
+++ b/sound/pci/echoaudio/echoaudio.c
@@ -1872,7 +1872,7 @@ static int snd_echo_free(struct echoaudio *chip)
1872 DE_INIT(("Stopped.\n")); 1872 DE_INIT(("Stopped.\n"));
1873 1873
1874 if (chip->irq >= 0) 1874 if (chip->irq >= 0)
1875 free_irq(chip->irq, (void *)chip); 1875 free_irq(chip->irq, chip);
1876 1876
1877 if (chip->dsp_registers) 1877 if (chip->dsp_registers)
1878 iounmap(chip->dsp_registers); 1878 iounmap(chip->dsp_registers);
@@ -1950,8 +1950,8 @@ static __devinit int snd_echo_create(struct snd_card *card,
1950 chip->dsp_registers = (volatile u32 __iomem *) 1950 chip->dsp_registers = (volatile u32 __iomem *)
1951 ioremap_nocache(chip->dsp_registers_phys, sz); 1951 ioremap_nocache(chip->dsp_registers_phys, sz);
1952 1952
1953 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_DISABLED | IRQF_SHARED, 1953 if (request_irq(pci->irq, snd_echo_interrupt, IRQF_SHARED,
1954 ECHOCARD_NAME, (void *)chip)) { 1954 ECHOCARD_NAME, chip)) {
1955 snd_echo_free(chip); 1955 snd_echo_free(chip);
1956 snd_printk(KERN_ERR "cannot grab irq\n"); 1956 snd_printk(KERN_ERR "cannot grab irq\n");
1957 return -EBUSY; 1957 return -EBUSY;
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index 8bc4ffa622..972ec40d81 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -759,7 +759,7 @@ static int snd_emu10k1_free(struct snd_emu10k1 *emu)
759 free_pm_buffer(emu); 759 free_pm_buffer(emu);
760#endif 760#endif
761 if (emu->irq >= 0) 761 if (emu->irq >= 0)
762 free_irq(emu->irq, (void *)emu); 762 free_irq(emu->irq, emu);
763 if (emu->port) 763 if (emu->port)
764 pci_release_regions(emu->pci); 764 pci_release_regions(emu->pci);
765 if (emu->card_capabilities->ca0151_chip) /* P16V */ 765 if (emu->card_capabilities->ca0151_chip) /* P16V */
@@ -1246,7 +1246,8 @@ int __devinit snd_emu10k1_create(struct snd_card *card,
1246 } 1246 }
1247 emu->port = pci_resource_start(pci, 0); 1247 emu->port = pci_resource_start(pci, 0);
1248 1248
1249 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_DISABLED|IRQF_SHARED, "EMU10K1", (void *)emu)) { 1249 if (request_irq(pci->irq, snd_emu10k1_interrupt, IRQF_SHARED,
1250 "EMU10K1", emu)) {
1250 err = -EBUSY; 1251 err = -EBUSY;
1251 goto error; 1252 goto error;
1252 } 1253 }
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index c46905a111..2199b42a60 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -235,7 +235,7 @@ struct emu10k1x {
235 struct resource *res_port; 235 struct resource *res_port;
236 int irq; 236 int irq;
237 237
238 unsigned int revision; /* chip revision */ 238 unsigned char revision; /* chip revision */
239 unsigned int serial; /* serial number */ 239 unsigned int serial; /* serial number */
240 unsigned short model; /* subsystem id */ 240 unsigned short model; /* subsystem id */
241 241
@@ -760,7 +760,7 @@ static int snd_emu10k1x_free(struct emu10k1x *chip)
760 760
761 // release the irq 761 // release the irq
762 if (chip->irq >= 0) 762 if (chip->irq >= 0)
763 free_irq(chip->irq, (void *)chip); 763 free_irq(chip->irq, chip);
764 764
765 // release the DMA 765 // release the DMA
766 if (chip->dma_buffer.area) { 766 if (chip->dma_buffer.area) {
@@ -927,8 +927,7 @@ static int __devinit snd_emu10k1x_create(struct snd_card *card,
927 } 927 }
928 928
929 if (request_irq(pci->irq, snd_emu10k1x_interrupt, 929 if (request_irq(pci->irq, snd_emu10k1x_interrupt,
930 IRQF_DISABLED|IRQF_SHARED, "EMU10K1X", 930 IRQF_SHARED, "EMU10K1X", chip)) {
931 (void *)chip)) {
932 snd_printk(KERN_ERR "emu10k1x: cannot grab irq %d\n", pci->irq); 931 snd_printk(KERN_ERR "emu10k1x: cannot grab irq %d\n", pci->irq);
933 snd_emu10k1x_free(chip); 932 snd_emu10k1x_free(chip);
934 return -EBUSY; 933 return -EBUSY;
@@ -943,7 +942,7 @@ static int __devinit snd_emu10k1x_create(struct snd_card *card,
943 942
944 pci_set_master(pci); 943 pci_set_master(pci);
945 /* read revision & serial */ 944 /* read revision & serial */
946 pci_read_config_byte(pci, PCI_REVISION_ID, (char *)&chip->revision); 945 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->revision);
947 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial); 946 pci_read_config_dword(pci, PCI_SUBSYSTEM_VENDOR_ID, &chip->serial);
948 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model); 947 pci_read_config_word(pci, PCI_SUBSYSTEM_ID, &chip->model);
949 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model, 948 snd_printk(KERN_INFO "Model %04x Rev %08x Serial %08x\n", chip->model,
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index d2a811f222..a84f6b2102 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -2141,7 +2141,7 @@ static int __devinit snd_ensoniq_create(struct snd_card *card,
2141 return err; 2141 return err;
2142 } 2142 }
2143 ensoniq->port = pci_resource_start(pci, 0); 2143 ensoniq->port = pci_resource_start(pci, 0);
2144 if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_DISABLED|IRQF_SHARED, 2144 if (request_irq(pci->irq, snd_audiopci_interrupt, IRQF_SHARED,
2145 "Ensoniq AudioPCI", ensoniq)) { 2145 "Ensoniq AudioPCI", ensoniq)) {
2146 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2146 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2147 snd_ensoniq_free(ensoniq); 2147 snd_ensoniq_free(ensoniq);
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index 1a8d36df4b..66ac26c5a2 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -1508,7 +1508,7 @@ static int es1938_resume(struct pci_dev *pci)
1508 } 1508 }
1509 1509
1510 if (request_irq(pci->irq, snd_es1938_interrupt, 1510 if (request_irq(pci->irq, snd_es1938_interrupt,
1511 IRQF_DISABLED|IRQF_SHARED, "ES1938", chip)) { 1511 IRQF_SHARED, "ES1938", chip)) {
1512 printk(KERN_ERR "es1938: unable to grab IRQ %d, " 1512 printk(KERN_ERR "es1938: unable to grab IRQ %d, "
1513 "disabling device\n", pci->irq); 1513 "disabling device\n", pci->irq);
1514 snd_card_disconnect(card); 1514 snd_card_disconnect(card);
@@ -1631,7 +1631,7 @@ static int __devinit snd_es1938_create(struct snd_card *card,
1631 chip->vc_port = pci_resource_start(pci, 2); 1631 chip->vc_port = pci_resource_start(pci, 2);
1632 chip->mpu_port = pci_resource_start(pci, 3); 1632 chip->mpu_port = pci_resource_start(pci, 3);
1633 chip->game_port = pci_resource_start(pci, 4); 1633 chip->game_port = pci_resource_start(pci, 4);
1634 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_DISABLED|IRQF_SHARED, 1634 if (request_irq(pci->irq, snd_es1938_interrupt, IRQF_SHARED,
1635 "ES1938", chip)) { 1635 "ES1938", chip)) {
1636 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1636 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1637 snd_es1938_free(chip); 1637 snd_es1938_free(chip);
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 092da53e14..dc84c189b0 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -1337,7 +1337,7 @@ static struct esm_memory *snd_es1968_new_memory(struct es1968 *chip, int size)
1337 struct esm_memory *buf; 1337 struct esm_memory *buf;
1338 struct list_head *p; 1338 struct list_head *p;
1339 1339
1340 size = ((size + ESM_MEM_ALIGN - 1) / ESM_MEM_ALIGN) * ESM_MEM_ALIGN; 1340 size = ALIGN(size, ESM_MEM_ALIGN);
1341 mutex_lock(&chip->memory_mutex); 1341 mutex_lock(&chip->memory_mutex);
1342 list_for_each(p, &chip->buf_list) { 1342 list_for_each(p, &chip->buf_list) {
1343 buf = list_entry(p, struct esm_memory, list); 1343 buf = list_entry(p, struct esm_memory, list);
@@ -2462,7 +2462,7 @@ static int snd_es1968_free(struct es1968 *chip)
2462 } 2462 }
2463 2463
2464 if (chip->irq >= 0) 2464 if (chip->irq >= 0)
2465 free_irq(chip->irq, (void *)chip); 2465 free_irq(chip->irq, chip);
2466 snd_es1968_free_gameport(chip); 2466 snd_es1968_free_gameport(chip);
2467 chip->master_switch = NULL; 2467 chip->master_switch = NULL;
2468 chip->master_volume = NULL; 2468 chip->master_volume = NULL;
@@ -2552,8 +2552,8 @@ static int __devinit snd_es1968_create(struct snd_card *card,
2552 return err; 2552 return err;
2553 } 2553 }
2554 chip->io_port = pci_resource_start(pci, 0); 2554 chip->io_port = pci_resource_start(pci, 0);
2555 if (request_irq(pci->irq, snd_es1968_interrupt, IRQF_DISABLED|IRQF_SHARED, 2555 if (request_irq(pci->irq, snd_es1968_interrupt, IRQF_SHARED,
2556 "ESS Maestro", (void*)chip)) { 2556 "ESS Maestro", chip)) {
2557 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2557 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2558 snd_es1968_free(chip); 2558 snd_es1968_free(chip);
2559 return -EBUSY; 2559 return -EBUSY;
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 77e3d5c183..b7b361ce3a 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1395,7 +1395,7 @@ static int __devinit snd_fm801_create(struct snd_card *card,
1395 } 1395 }
1396 chip->port = pci_resource_start(pci, 0); 1396 chip->port = pci_resource_start(pci, 0);
1397 if ((tea575x_tuner & 0x0010) == 0) { 1397 if ((tea575x_tuner & 0x0010) == 0) {
1398 if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_DISABLED|IRQF_SHARED, 1398 if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED,
1399 "FM801", chip)) { 1399 "FM801", chip)) {
1400 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq); 1400 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->irq);
1401 snd_fm801_free(chip); 1401 snd_fm801_free(chip);
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 71482c15a8..18bbc87e37 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -1367,9 +1367,6 @@ static struct hda_rate_tbl rate_bits[] = {
1367 { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */ 1367 { 176400, SNDRV_PCM_RATE_176400, 0x5800 },/* 4 x 44 */
1368 { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */ 1368 { 192000, SNDRV_PCM_RATE_192000, 0x1800 }, /* 4 x 48 */
1369 1369
1370 /* not autodetected value */
1371 { 9600, SNDRV_PCM_RATE_KNOT, 0x0400 }, /* 1/5 x 48 */
1372
1373 { 0 } /* terminator */ 1370 { 0 } /* terminator */
1374}; 1371};
1375 1372
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index e35cfd326d..9fd34f85ca 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -1380,7 +1380,8 @@ static int __devinit azx_init_stream(struct azx *chip)
1380 1380
1381static int azx_acquire_irq(struct azx *chip, int do_disconnect) 1381static int azx_acquire_irq(struct azx *chip, int do_disconnect)
1382{ 1382{
1383 if (request_irq(chip->pci->irq, azx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1383 if (request_irq(chip->pci->irq, azx_interrupt,
1384 chip->msi ? 0 : IRQF_SHARED,
1384 "HDA Intel", chip)) { 1385 "HDA Intel", chip)) {
1385 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, " 1386 printk(KERN_ERR "hda-intel: unable to grab IRQ %d, "
1386 "disabling device\n", chip->pci->irq); 1387 "disabling device\n", chip->pci->irq);
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index d737f17695..17df4d0fe1 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -45,7 +45,7 @@ static const char *get_wid_type_name(unsigned int wid_value)
45 if (names[wid_value]) 45 if (names[wid_value])
46 return names[wid_value]; 46 return names[wid_value];
47 else 47 else
48 return "UNKOWN Widget"; 48 return "UNKNOWN Widget";
49} 49}
50 50
51static void print_amp_caps(struct snd_info_buffer *buffer, 51static void print_amp_caps(struct snd_info_buffer *buffer,
@@ -88,6 +88,48 @@ static void print_amp_vals(struct snd_info_buffer *buffer,
88 snd_iprintf(buffer, "\n"); 88 snd_iprintf(buffer, "\n");
89} 89}
90 90
91static void print_pcm_rates(struct snd_info_buffer *buffer, unsigned int pcm)
92{
93 static unsigned int rates[] = {
94 8000, 11025, 16000, 22050, 32000, 44100, 48000, 88200,
95 96000, 176400, 192000, 384000
96 };
97 int i;
98
99 pcm &= AC_SUPPCM_RATES;
100 snd_iprintf(buffer, " rates [0x%x]:", pcm);
101 for (i = 0; i < ARRAY_SIZE(rates); i++)
102 if (pcm & (1 << i))
103 snd_iprintf(buffer, " %d", rates[i]);
104 snd_iprintf(buffer, "\n");
105}
106
107static void print_pcm_bits(struct snd_info_buffer *buffer, unsigned int pcm)
108{
109 static unsigned int bits[] = { 8, 16, 20, 24, 32 };
110 int i;
111
112 pcm = (pcm >> 16) & 0xff;
113 snd_iprintf(buffer, " bits [0x%x]:", pcm);
114 for (i = 0; i < ARRAY_SIZE(bits); i++)
115 if (pcm & (1 << i))
116 snd_iprintf(buffer, " %d", bits[i]);
117 snd_iprintf(buffer, "\n");
118}
119
120static void print_pcm_formats(struct snd_info_buffer *buffer,
121 unsigned int streams)
122{
123 snd_iprintf(buffer, " formats [0x%x]:", streams & 0xf);
124 if (streams & AC_SUPFMT_PCM)
125 snd_iprintf(buffer, " PCM");
126 if (streams & AC_SUPFMT_FLOAT32)
127 snd_iprintf(buffer, " FLOAT");
128 if (streams & AC_SUPFMT_AC3)
129 snd_iprintf(buffer, " AC3");
130 snd_iprintf(buffer, "\n");
131}
132
91static void print_pcm_caps(struct snd_info_buffer *buffer, 133static void print_pcm_caps(struct snd_info_buffer *buffer,
92 struct hda_codec *codec, hda_nid_t nid) 134 struct hda_codec *codec, hda_nid_t nid)
93{ 135{
@@ -97,8 +139,9 @@ static void print_pcm_caps(struct snd_info_buffer *buffer,
97 snd_iprintf(buffer, "N/A\n"); 139 snd_iprintf(buffer, "N/A\n");
98 return; 140 return;
99 } 141 }
100 snd_iprintf(buffer, "rates 0x%03x, bits 0x%02x, types 0x%x\n", 142 print_pcm_rates(buffer, pcm);
101 pcm & AC_SUPPCM_RATES, (pcm >> 16) & 0xff, stream & 0xf); 143 print_pcm_bits(buffer, pcm);
144 print_pcm_formats(buffer, stream);
102} 145}
103 146
104static const char *get_jack_location(u32 cfg) 147static const char *get_jack_location(u32 cfg)
@@ -210,7 +253,7 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
210 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); 253 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
211 if (! codec->afg) 254 if (! codec->afg)
212 return; 255 return;
213 snd_iprintf(buffer, "Default PCM: "); 256 snd_iprintf(buffer, "Default PCM:\n");
214 print_pcm_caps(buffer, codec, codec->afg); 257 print_pcm_caps(buffer, codec, codec->afg);
215 snd_iprintf(buffer, "Default Amp-In caps: "); 258 snd_iprintf(buffer, "Default Amp-In caps: ");
216 print_amp_caps(buffer, codec, codec->afg, HDA_INPUT); 259 print_amp_caps(buffer, codec, codec->afg, HDA_INPUT);
@@ -278,7 +321,7 @@ static void print_codec_info(struct snd_info_entry *entry, struct snd_info_buffe
278 321
279 if ((wid_type == AC_WID_AUD_OUT || wid_type == AC_WID_AUD_IN) && 322 if ((wid_type == AC_WID_AUD_OUT || wid_type == AC_WID_AUD_IN) &&
280 (wid_caps & AC_WCAP_FORMAT_OVRD)) { 323 (wid_caps & AC_WCAP_FORMAT_OVRD)) {
281 snd_iprintf(buffer, " PCM: "); 324 snd_iprintf(buffer, " PCM:\n");
282 print_pcm_caps(buffer, codec, nid); 325 print_pcm_caps(buffer, codec, nid);
283 } 326 }
284 327
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index edd22dec82..076365bc10 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -794,6 +794,8 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
794 { .modelname = "3stack", .config = AD1986A_3STACK }, 794 { .modelname = "3stack", .config = AD1986A_3STACK },
795 { .pci_subvendor = 0x10de, .pci_subdevice = 0xcb84, 795 { .pci_subvendor = 0x10de, .pci_subdevice = 0xcb84,
796 .config = AD1986A_3STACK }, /* ASUS A8N-VM CSM */ 796 .config = AD1986A_3STACK }, /* ASUS A8N-VM CSM */
797 { .pci_subvendor = 0x1043, .pci_subdevice = 0x817f,
798 .config = AD1986A_3STACK }, /* ASUS P5P-L2 */
797 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b3, 799 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81b3,
798 .config = AD1986A_3STACK }, /* ASUS P5RD2-VM / P5GPL-X SE */ 800 .config = AD1986A_3STACK }, /* ASUS P5RD2-VM / P5GPL-X SE */
799 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81cb, 801 { .pci_subvendor = 0x1043, .pci_subdevice = 0x81cb,
@@ -811,7 +813,7 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
811 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc024, 813 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc024,
812 .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */ 814 .config = AD1986A_LAPTOP_EAPD }, /* Samsung R65-T2300 Charis */
813 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc026, 815 { .pci_subvendor = 0x144d, .pci_subdevice = 0xc026,
814 .config = AD1986A_LAPTOP_EAPD }, /* Samsung X10-T2300 Culesa */ 816 .config = AD1986A_LAPTOP_EAPD }, /* Samsung X11-T2300 Culesa */
815 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1153, 817 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1153,
816 .config = AD1986A_LAPTOP_EAPD }, /* ASUS M9 */ 818 .config = AD1986A_LAPTOP_EAPD }, /* ASUS M9 */
817 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213, 819 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1213,
@@ -822,6 +824,8 @@ static struct hda_board_config ad1986a_cfg_tbl[] = {
822 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */ 824 .config = AD1986A_LAPTOP_EAPD }, /* ASUS U5F */
823 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297, 825 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1297,
824 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */ 826 .config = AD1986A_LAPTOP_EAPD }, /* ASUS Z62F */
827 { .pci_subvendor = 0x1043, .pci_subdevice = 0x12b3,
828 .config = AD1986A_LAPTOP_EAPD }, /* ASUS V1j */
825 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af, 829 { .pci_subvendor = 0x103c, .pci_subdevice = 0x30af,
826 .config = AD1986A_LAPTOP_EAPD }, /* HP Compaq Presario B2800 */ 830 .config = AD1986A_LAPTOP_EAPD }, /* HP Compaq Presario B2800 */
827 { .pci_subvendor = 0x17aa, .pci_subdevice = 0x2066, 831 { .pci_subvendor = 0x17aa, .pci_subdevice = 0x2066,
@@ -1640,7 +1644,7 @@ static int ad198x_ch_mode_put(struct snd_kcontrol *kcontrol,
1640 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 1644 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
1641 spec->num_channel_mode, 1645 spec->num_channel_mode,
1642 &spec->multiout.max_channels); 1646 &spec->multiout.max_channels);
1643 if (! err && spec->need_dac_fix) 1647 if (err >= 0 && spec->need_dac_fix)
1644 spec->multiout.num_dacs = spec->multiout.max_channels / 2; 1648 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
1645 return err; 1649 return err;
1646} 1650}
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index fb961448db..29e4c48151 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -271,7 +271,7 @@ static int alc_ch_mode_put(struct snd_kcontrol *kcontrol,
271 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode, 271 int err = snd_hda_ch_mode_put(codec, ucontrol, spec->channel_mode,
272 spec->num_channel_mode, 272 spec->num_channel_mode,
273 &spec->multiout.max_channels); 273 &spec->multiout.max_channels);
274 if (! err && spec->need_dac_fix) 274 if (err >= 0 && spec->need_dac_fix)
275 spec->multiout.num_dacs = spec->multiout.max_channels / 2; 275 spec->multiout.num_dacs = spec->multiout.max_channels / 2;
276 return err; 276 return err;
277} 277}
@@ -5872,6 +5872,8 @@ static struct hda_board_config alc262_cfg_tbl[] = {
5872 { .modelname = "hp-bpc", .config = ALC262_HP_BPC }, 5872 { .modelname = "hp-bpc", .config = ALC262_HP_BPC },
5873 { .pci_subvendor = 0x103c, .pci_subdevice = 0x280c, 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 = 0x2801,
5876 .config = ALC262_HP_BPC }, /* q965 */
5875 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014, 5877 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3014,
5876 .config = ALC262_HP_BPC }, /* xw6400 */ 5878 .config = ALC262_HP_BPC }, /* xw6400 */
5877 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015, 5879 { .pci_subvendor = 0x103c, .pci_subdevice = 0x3015,
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index cc87dff1eb..ed5e45e359 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -243,7 +243,8 @@ static int si3054_init(struct hda_codec *codec)
243 243
244 if((val&SI3054_MEI_READY) != SI3054_MEI_READY) { 244 if((val&SI3054_MEI_READY) != SI3054_MEI_READY) {
245 snd_printk(KERN_ERR "si3054: cannot initialize. EXT MID = %04x\n", val); 245 snd_printk(KERN_ERR "si3054: cannot initialize. EXT MID = %04x\n", val);
246 return -EACCES; 246 /* let's pray that this is no fatal error */
247 /* return -EACCES; */
247 } 248 }
248 249
249 SET_REG(codec, SI3054_GPIO_POLARITY, 0xffff); 250 SET_REG(codec, SI3054_GPIO_POLARITY, 0xffff);
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index 8a576b78be..8ba31cfb90 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -2614,7 +2614,7 @@ static int __devinit snd_ice1712_create(struct snd_card *card,
2614 ice->dmapath_port = pci_resource_start(pci, 2); 2614 ice->dmapath_port = pci_resource_start(pci, 2);
2615 ice->profi_port = pci_resource_start(pci, 3); 2615 ice->profi_port = pci_resource_start(pci, 3);
2616 2616
2617 if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_DISABLED|IRQF_SHARED, 2617 if (request_irq(pci->irq, snd_ice1712_interrupt, IRQF_SHARED,
2618 "ICE1712", ice)) { 2618 "ICE1712", ice)) {
2619 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2619 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2620 snd_ice1712_free(ice); 2620 snd_ice1712_free(ice);
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index e9cbfdf370..3e3a102e6c 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -2253,7 +2253,7 @@ static int __devinit snd_vt1724_create(struct snd_card *card,
2253 ice->profi_port = pci_resource_start(pci, 1); 2253 ice->profi_port = pci_resource_start(pci, 1);
2254 2254
2255 if (request_irq(pci->irq, snd_vt1724_interrupt, 2255 if (request_irq(pci->irq, snd_vt1724_interrupt,
2256 IRQF_DISABLED|IRQF_SHARED, "ICE1724", ice)) { 2256 IRQF_SHARED, "ICE1724", ice)) {
2257 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2257 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2258 snd_vt1724_free(ice); 2258 snd_vt1724_free(ice);
2259 return -EIO; 2259 return -EIO;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 9c1bce7afa..30aaa6092a 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -2509,7 +2509,7 @@ static int intel8x0_resume(struct pci_dev *pci)
2509 } 2509 }
2510 pci_set_master(pci); 2510 pci_set_master(pci);
2511 if (request_irq(pci->irq, snd_intel8x0_interrupt, 2511 if (request_irq(pci->irq, snd_intel8x0_interrupt,
2512 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { 2512 IRQF_SHARED, card->shortname, chip)) {
2513 printk(KERN_ERR "intel8x0: unable to grab IRQ %d, " 2513 printk(KERN_ERR "intel8x0: unable to grab IRQ %d, "
2514 "disabling device\n", pci->irq); 2514 "disabling device\n", pci->irq);
2515 snd_card_disconnect(card); 2515 snd_card_disconnect(card);
@@ -2887,7 +2887,7 @@ static int __devinit snd_intel8x0_create(struct snd_card *card,
2887 2887
2888 /* request irq after initializaing int_sta_mask, etc */ 2888 /* request irq after initializaing int_sta_mask, etc */
2889 if (request_irq(pci->irq, snd_intel8x0_interrupt, 2889 if (request_irq(pci->irq, snd_intel8x0_interrupt,
2890 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { 2890 IRQF_SHARED, card->shortname, chip)) {
2891 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2891 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2892 snd_intel8x0_free(chip); 2892 snd_intel8x0_free(chip);
2893 return -EBUSY; 2893 return -EBUSY;
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index bd467c5011..09dcf923b5 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -1071,7 +1071,7 @@ static int intel8x0m_resume(struct pci_dev *pci)
1071 } 1071 }
1072 pci_set_master(pci); 1072 pci_set_master(pci);
1073 if (request_irq(pci->irq, snd_intel8x0_interrupt, 1073 if (request_irq(pci->irq, snd_intel8x0_interrupt,
1074 IRQF_DISABLED|IRQF_SHARED, card->shortname, chip)) { 1074 IRQF_SHARED, card->shortname, chip)) {
1075 printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, " 1075 printk(KERN_ERR "intel8x0m: unable to grab IRQ %d, "
1076 "disabling device\n", pci->irq); 1076 "disabling device\n", pci->irq);
1077 snd_card_disconnect(card); 1077 snd_card_disconnect(card);
@@ -1205,7 +1205,7 @@ static int __devinit snd_intel8x0m_create(struct snd_card *card,
1205 } 1205 }
1206 1206
1207 port_inited: 1207 port_inited:
1208 if (request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_DISABLED|IRQF_SHARED, 1208 if (request_irq(pci->irq, snd_intel8x0_interrupt, IRQF_SHARED,
1209 card->shortname, chip)) { 1209 card->shortname, chip)) {
1210 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1210 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1211 snd_intel8x0_free(chip); 1211 snd_intel8x0_free(chip);
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index fa8cd8cecc..345eefeedb 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2233,7 +2233,7 @@ static int __devinit snd_korg1212_create(struct snd_card *card, struct pci_dev *
2233 } 2233 }
2234 2234
2235 err = request_irq(pci->irq, snd_korg1212_interrupt, 2235 err = request_irq(pci->irq, snd_korg1212_interrupt,
2236 IRQF_DISABLED|IRQF_SHARED, 2236 IRQF_SHARED,
2237 "korg1212", korg1212); 2237 "korg1212", korg1212);
2238 2238
2239 if (err) { 2239 if (err) {
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 8cab342bba..6efe6d5ade 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -2377,7 +2377,7 @@ static int __devinit snd_m3_assp_client_init(struct snd_m3 *chip, struct m3_dma
2377 * shifted list address is aligned. 2377 * shifted list address is aligned.
2378 * list address = (mem address >> 1) >> 7; 2378 * list address = (mem address >> 1) >> 7;
2379 */ 2379 */
2380 data_bytes = (data_bytes + 255) & ~255; 2380 data_bytes = ALIGN(data_bytes, 256);
2381 address = 0x1100 + ((data_bytes/2) * index); 2381 address = 0x1100 + ((data_bytes/2) * index);
2382 2382
2383 if ((address + (data_bytes/2)) >= 0x1c00) { 2383 if ((address + (data_bytes/2)) >= 0x1c00) {
@@ -2762,7 +2762,7 @@ snd_m3_create(struct snd_card *card, struct pci_dev *pci,
2762 2762
2763 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip); 2763 tasklet_init(&chip->hwvol_tq, snd_m3_update_hw_volume, (unsigned long)chip);
2764 2764
2765 if (request_irq(pci->irq, snd_m3_interrupt, IRQF_DISABLED|IRQF_SHARED, 2765 if (request_irq(pci->irq, snd_m3_interrupt, IRQF_SHARED,
2766 card->driver, chip)) { 2766 card->driver, chip)) {
2767 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2767 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2768 snd_m3_free(chip); 2768 snd_m3_free(chip);
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 216aee5f93..21386da3bc 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1066,7 +1066,7 @@ static int snd_mixart_free(struct mixart_mgr *mgr)
1066 1066
1067 /* release irq */ 1067 /* release irq */
1068 if (mgr->irq >= 0) 1068 if (mgr->irq >= 0)
1069 free_irq(mgr->irq, (void *)mgr); 1069 free_irq(mgr->irq, mgr);
1070 1070
1071 /* reset board if some firmware was loaded */ 1071 /* reset board if some firmware was loaded */
1072 if(mgr->dsp_loaded) { 1072 if(mgr->dsp_loaded) {
@@ -1319,7 +1319,8 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
1319 pci_resource_len(pci, i)); 1319 pci_resource_len(pci, i));
1320 } 1320 }
1321 1321
1322 if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_DISABLED|IRQF_SHARED, CARD_NAME, (void *)mgr)) { 1322 if (request_irq(pci->irq, snd_mixart_interrupt, IRQF_SHARED,
1323 CARD_NAME, mgr)) {
1323 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1324 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1324 snd_mixart_free(mgr); 1325 snd_mixart_free(mgr);
1325 return -EBUSY; 1326 return -EBUSY;
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 945d21bf18..879e31a9f9 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -465,7 +465,7 @@ static int snd_nm256_acquire_irq(struct nm256 *chip)
465{ 465{
466 mutex_lock(&chip->irq_mutex); 466 mutex_lock(&chip->irq_mutex);
467 if (chip->irq < 0) { 467 if (chip->irq < 0) {
468 if (request_irq(chip->pci->irq, chip->interrupt, IRQF_DISABLED|IRQF_SHARED, 468 if (request_irq(chip->pci->irq, chip->interrupt, IRQF_SHARED,
469 chip->card->driver, chip)) { 469 chip->card->driver, chip)) {
470 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq); 470 snd_printk(KERN_ERR "unable to grab IRQ %d\n", chip->pci->irq);
471 mutex_unlock(&chip->irq_mutex); 471 mutex_unlock(&chip->irq_mutex);
diff --git a/sound/pci/pcxhr/pcxhr.c b/sound/pci/pcxhr/pcxhr.c
index 533c672ae8..d97413484a 100644
--- a/sound/pci/pcxhr/pcxhr.c
+++ b/sound/pci/pcxhr/pcxhr.c
@@ -1250,7 +1250,7 @@ static int __devinit pcxhr_probe(struct pci_dev *pci, const struct pci_device_id
1250 mgr->pci = pci; 1250 mgr->pci = pci;
1251 mgr->irq = -1; 1251 mgr->irq = -1;
1252 1252
1253 if (request_irq(pci->irq, pcxhr_interrupt, IRQF_DISABLED|IRQF_SHARED, 1253 if (request_irq(pci->irq, pcxhr_interrupt, IRQF_SHARED,
1254 card_name, mgr)) { 1254 card_name, mgr)) {
1255 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1255 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1256 pcxhr_free(mgr); 1256 pcxhr_free(mgr);
diff --git a/sound/pci/riptide/riptide.c b/sound/pci/riptide/riptide.c
index 56e0c01123..5e1d5d2b28 100644
--- a/sound/pci/riptide/riptide.c
+++ b/sound/pci/riptide/riptide.c
@@ -1899,9 +1899,8 @@ snd_riptide_create(struct snd_card *card, struct pci_dev *pci,
1899 hwport = (struct riptideport *)chip->port; 1899 hwport = (struct riptideport *)chip->port;
1900 UNSET_AIE(hwport); 1900 UNSET_AIE(hwport);
1901 1901
1902 if (request_irq 1902 if (request_irq(pci->irq, snd_riptide_interrupt, IRQF_SHARED,
1903 (pci->irq, snd_riptide_interrupt, IRQF_DISABLED | IRQF_SHARED, 1903 "RIPTIDE", chip)) {
1904 "RIPTIDE", chip)) {
1905 snd_printk(KERN_ERR "Riptide: unable to grab IRQ %d\n", 1904 snd_printk(KERN_ERR "Riptide: unable to grab IRQ %d\n",
1906 pci->irq); 1905 pci->irq);
1907 snd_riptide_free(chip); 1906 snd_riptide_free(chip);
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index dc8d1302e2..6bb7ac650e 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -1373,7 +1373,8 @@ static int __devinit snd_rme32_create(struct rme32 * rme32)
1373 return -ENOMEM; 1373 return -ENOMEM;
1374 } 1374 }
1375 1375
1376 if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_DISABLED | IRQF_SHARED, "RME32", (void *) rme32)) { 1376 if (request_irq(pci->irq, snd_rme32_interrupt, IRQF_SHARED,
1377 "RME32", rme32)) {
1377 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1378 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1378 return -EBUSY; 1379 return -EBUSY;
1379 } 1380 }
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 106110a89a..e3304b7ccb 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -1587,7 +1587,8 @@ snd_rme96_create(struct rme96 *rme96)
1587 return -ENOMEM; 1587 return -ENOMEM;
1588 } 1588 }
1589 1589
1590 if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_DISABLED|IRQF_SHARED, "RME96", (void *)rme96)) { 1590 if (request_irq(pci->irq, snd_rme96_interrupt, IRQF_SHARED,
1591 "RME96", rme96)) {
1591 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1592 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1592 return -EBUSY; 1593 return -EBUSY;
1593 } 1594 }
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 694aa057ed..6383987b46 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -3516,8 +3516,8 @@ static int __devinit snd_hdsp_initialize_memory(struct hdsp *hdsp)
3516 3516
3517 /* Align to bus-space 64K boundary */ 3517 /* Align to bus-space 64K boundary */
3518 3518
3519 cb_bus = (hdsp->capture_dma_buf.addr + 0xFFFF) & ~0xFFFFl; 3519 cb_bus = ALIGN(hdsp->capture_dma_buf.addr, 0x10000ul);
3520 pb_bus = (hdsp->playback_dma_buf.addr + 0xFFFF) & ~0xFFFFl; 3520 pb_bus = ALIGN(hdsp->playback_dma_buf.addr, 0x10000ul);
3521 3521
3522 /* Tell the card where it is */ 3522 /* Tell the card where it is */
3523 3523
@@ -4934,13 +4934,14 @@ static int __devinit snd_hdsp_create(struct snd_card *card,
4934 return -EBUSY; 4934 return -EBUSY;
4935 } 4935 }
4936 4936
4937 if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_DISABLED|IRQF_SHARED, "hdsp", (void *)hdsp)) { 4937 if (request_irq(pci->irq, snd_hdsp_interrupt, IRQF_SHARED,
4938 "hdsp", hdsp)) {
4938 snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq); 4939 snd_printk(KERN_ERR "Hammerfall-DSP: unable to use IRQ %d\n", pci->irq);
4939 return -EBUSY; 4940 return -EBUSY;
4940 } 4941 }
4941 4942
4942 hdsp->irq = pci->irq; 4943 hdsp->irq = pci->irq;
4943 hdsp->precise_ptr = 1; 4944 hdsp->precise_ptr = 0;
4944 hdsp->use_midi_tasklet = 1; 4945 hdsp->use_midi_tasklet = 1;
4945 4946
4946 if ((err = snd_hdsp_initialize_memory(hdsp)) < 0) 4947 if ((err = snd_hdsp_initialize_memory(hdsp)) < 0)
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 7055d89385..0547f6f04b 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -3496,8 +3496,7 @@ static int __devinit snd_hdspm_create(struct snd_card *card, struct hdspm * hdsp
3496 hdspm->port + io_extent - 1); 3496 hdspm->port + io_extent - 1);
3497 3497
3498 if (request_irq(pci->irq, snd_hdspm_interrupt, 3498 if (request_irq(pci->irq, snd_hdspm_interrupt,
3499 IRQF_DISABLED | IRQF_SHARED, "hdspm", 3499 IRQF_SHARED, "hdspm", hdspm)) {
3500 (void *) hdspm)) {
3501 snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq); 3500 snd_printk(KERN_ERR "HDSPM: unable to use IRQ %d\n", pci->irq);
3502 return -EBUSY; 3501 return -EBUSY;
3503 } 3502 }
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index cf0427b4bf..cc3bdececc 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -1827,8 +1827,8 @@ static int __devinit snd_rme9652_initialize_memory(struct snd_rme9652 *rme9652)
1827 1827
1828 /* Align to bus-space 64K boundary */ 1828 /* Align to bus-space 64K boundary */
1829 1829
1830 cb_bus = (rme9652->capture_dma_buf.addr + 0xFFFF) & ~0xFFFFl; 1830 cb_bus = ALIGN(rme9652->capture_dma_buf.addr, 0x10000ul);
1831 pb_bus = (rme9652->playback_dma_buf.addr + 0xFFFF) & ~0xFFFFl; 1831 pb_bus = ALIGN(rme9652->playback_dma_buf.addr, 0x10000ul);
1832 1832
1833 /* Tell the card where it is */ 1833 /* Tell the card where it is */
1834 1834
@@ -2500,7 +2500,8 @@ static int __devinit snd_rme9652_create(struct snd_card *card,
2500 return -EBUSY; 2500 return -EBUSY;
2501 } 2501 }
2502 2502
2503 if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_DISABLED|IRQF_SHARED, "rme9652", (void *)rme9652)) { 2503 if (request_irq(pci->irq, snd_rme9652_interrupt, IRQF_SHARED,
2504 "rme9652", rme9652)) {
2504 snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq); 2505 snd_printk(KERN_ERR "unable to request IRQ %d\n", pci->irq);
2505 return -EBUSY; 2506 return -EBUSY;
2506 } 2507 }
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index f9b8afabda..9f25d93cbe 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -1195,7 +1195,7 @@ static int snd_sonicvibes_free(struct sonicvibes *sonic)
1195 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port); 1195 pci_write_config_dword(sonic->pci, 0x40, sonic->dmaa_port);
1196 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port); 1196 pci_write_config_dword(sonic->pci, 0x48, sonic->dmac_port);
1197 if (sonic->irq >= 0) 1197 if (sonic->irq >= 0)
1198 free_irq(sonic->irq, (void *)sonic); 1198 free_irq(sonic->irq, sonic);
1199 release_and_free_resource(sonic->res_dmaa); 1199 release_and_free_resource(sonic->res_dmaa);
1200 release_and_free_resource(sonic->res_dmac); 1200 release_and_free_resource(sonic->res_dmac);
1201 pci_release_regions(sonic->pci); 1201 pci_release_regions(sonic->pci);
@@ -1257,7 +1257,8 @@ static int __devinit snd_sonicvibes_create(struct snd_card *card,
1257 sonic->midi_port = pci_resource_start(pci, 3); 1257 sonic->midi_port = pci_resource_start(pci, 3);
1258 sonic->game_port = pci_resource_start(pci, 4); 1258 sonic->game_port = pci_resource_start(pci, 4);
1259 1259
1260 if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_DISABLED|IRQF_SHARED, "S3 SonicVibes", (void *)sonic)) { 1260 if (request_irq(pci->irq, snd_sonicvibes_interrupt, IRQF_SHARED,
1261 "S3 SonicVibes", sonic)) {
1261 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1262 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1262 snd_sonicvibes_free(sonic); 1263 snd_sonicvibes_free(sonic);
1263 return -EBUSY; 1264 return -EBUSY;
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index 1fbc432112..474f2d451a 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -3380,8 +3380,8 @@ static int __devinit snd_trident_tlb_alloc(struct snd_trident *trident)
3380 snd_printk(KERN_ERR "trident: unable to allocate TLB buffer\n"); 3380 snd_printk(KERN_ERR "trident: unable to allocate TLB buffer\n");
3381 return -ENOMEM; 3381 return -ENOMEM;
3382 } 3382 }
3383 trident->tlb.entries = (unsigned int*)(((unsigned long)trident->tlb.buffer.area + SNDRV_TRIDENT_MAX_PAGES * 4 - 1) & ~(SNDRV_TRIDENT_MAX_PAGES * 4 - 1)); 3383 trident->tlb.entries = (unsigned int*)ALIGN((unsigned long)trident->tlb.buffer.area, SNDRV_TRIDENT_MAX_PAGES * 4);
3384 trident->tlb.entries_dmaaddr = (trident->tlb.buffer.addr + SNDRV_TRIDENT_MAX_PAGES * 4 - 1) & ~(SNDRV_TRIDENT_MAX_PAGES * 4 - 1); 3384 trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer.addr, SNDRV_TRIDENT_MAX_PAGES * 4);
3385 /* allocate shadow TLB page table (virtual addresses) */ 3385 /* allocate shadow TLB page table (virtual addresses) */
3386 trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long)); 3386 trident->tlb.shadow_entries = vmalloc(SNDRV_TRIDENT_MAX_PAGES*sizeof(unsigned long));
3387 if (trident->tlb.shadow_entries == NULL) { 3387 if (trident->tlb.shadow_entries == NULL) {
@@ -3608,7 +3608,7 @@ int __devinit snd_trident_create(struct snd_card *card,
3608 } 3608 }
3609 trident->port = pci_resource_start(pci, 0); 3609 trident->port = pci_resource_start(pci, 0);
3610 3610
3611 if (request_irq(pci->irq, snd_trident_interrupt, IRQF_DISABLED|IRQF_SHARED, 3611 if (request_irq(pci->irq, snd_trident_interrupt, IRQF_SHARED,
3612 "Trident Audio", trident)) { 3612 "Trident Audio", trident)) {
3613 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 3613 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
3614 snd_trident_free(trident); 3614 snd_trident_free(trident);
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 92b0736c0f..a572b01880 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -2307,7 +2307,7 @@ static int __devinit snd_via82xx_create(struct snd_card *card,
2307 if (request_irq(pci->irq, 2307 if (request_irq(pci->irq,
2308 chip_type == TYPE_VIA8233 ? 2308 chip_type == TYPE_VIA8233 ?
2309 snd_via8233_interrupt : snd_via686_interrupt, 2309 snd_via8233_interrupt : snd_via686_interrupt,
2310 IRQF_DISABLED|IRQF_SHARED, 2310 IRQF_SHARED,
2311 card->driver, chip)) { 2311 card->driver, chip)) {
2312 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2312 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2313 snd_via82xx_free(chip); 2313 snd_via82xx_free(chip);
@@ -2366,7 +2366,7 @@ struct dxs_whitelist {
2366 2366
2367static int __devinit check_dxs_list(struct pci_dev *pci, int revision) 2367static int __devinit check_dxs_list(struct pci_dev *pci, int revision)
2368{ 2368{
2369 static struct dxs_whitelist whitelist[] = { 2369 static struct dxs_whitelist whitelist[] __devinitdata = {
2370 { .subvendor = 0x1005, .subdevice = 0x4710, .action = VIA_DXS_ENABLE }, /* Avance Logic Mobo */ 2370 { .subvendor = 0x1005, .subdevice = 0x4710, .action = VIA_DXS_ENABLE }, /* Avance Logic Mobo */
2371 { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K }, 2371 { .subvendor = 0x1019, .subdevice = 0x0996, .action = VIA_DXS_48K },
2372 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */ 2372 { .subvendor = 0x1019, .subdevice = 0x0a81, .action = VIA_DXS_NO_VRA }, /* ECS K7VTA3 v8.0 */
@@ -2427,7 +2427,7 @@ static int __devinit check_dxs_list(struct pci_dev *pci, int revision)
2427 { .subvendor = 0x4005, .subdevice = 0x4710, .action = VIA_DXS_SRC }, /* MSI K7T266 Pro2 (MS-6380 V2.0) BIOS 3.7 */ 2427 { .subvendor = 0x4005, .subdevice = 0x4710, .action = VIA_DXS_SRC }, /* MSI K7T266 Pro2 (MS-6380 V2.0) BIOS 3.7 */
2428 { } /* terminator */ 2428 { } /* terminator */
2429 }; 2429 };
2430 struct dxs_whitelist *w; 2430 const struct dxs_whitelist *w;
2431 unsigned short subsystem_vendor; 2431 unsigned short subsystem_vendor;
2432 unsigned short subsystem_device; 2432 unsigned short subsystem_device;
2433 2433
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index feb27c9662..17d6b84758 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1124,7 +1124,7 @@ static int __devinit snd_via82xx_create(struct snd_card *card,
1124 return err; 1124 return err;
1125 } 1125 }
1126 chip->port = pci_resource_start(pci, 0); 1126 chip->port = pci_resource_start(pci, 0);
1127 if (request_irq(pci->irq, snd_via82xx_interrupt, IRQF_DISABLED|IRQF_SHARED, 1127 if (request_irq(pci->irq, snd_via82xx_interrupt, IRQF_SHARED,
1128 card->driver, chip)) { 1128 card->driver, chip)) {
1129 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 1129 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
1130 snd_via82xx_free(chip); 1130 snd_via82xx_free(chip);
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index af49e8aabf..89f58ea180 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -169,8 +169,8 @@ static int __devinit snd_vx222_create(struct snd_card *card, struct pci_dev *pci
169 for (i = 0; i < 2; i++) 169 for (i = 0; i < 2; i++)
170 vx->port[i] = pci_resource_start(pci, i + 1); 170 vx->port[i] = pci_resource_start(pci, i + 1);
171 171
172 if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_DISABLED|IRQF_SHARED, 172 if (request_irq(pci->irq, snd_vx_irq_handler, IRQF_SHARED,
173 CARD_NAME, (void *) chip)) { 173 CARD_NAME, chip)) {
174 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 174 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
175 snd_vx222_free(chip); 175 snd_vx222_free(chip);
176 return -EBUSY; 176 return -EBUSY;
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 186453f7ab..fd9b7b83a8 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -49,7 +49,6 @@ static long mpu_port[SNDRV_CARDS];
49static long joystick_port[SNDRV_CARDS]; 49static long joystick_port[SNDRV_CARDS];
50#endif 50#endif
51static int rear_switch[SNDRV_CARDS]; 51static int rear_switch[SNDRV_CARDS];
52static int rear_swap[SNDRV_CARDS] = { [0 ... (SNDRV_CARDS-1)] = 1 };
53 52
54module_param_array(index, int, NULL, 0444); 53module_param_array(index, int, NULL, 0444);
55MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard."); 54MODULE_PARM_DESC(index, "Index value for the Yamaha DS-1 PCI soundcard.");
@@ -67,8 +66,6 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address");
67#endif 66#endif
68module_param_array(rear_switch, bool, NULL, 0444); 67module_param_array(rear_switch, bool, NULL, 0444);
69MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch"); 68MODULE_PARM_DESC(rear_switch, "Enable shared rear/line-in switch");
70module_param_array(rear_swap, bool, NULL, 0444);
71MODULE_PARM_DESC(rear_swap, "Swap rear channels (must be enabled for correct IEC958 (S/PDIF)) output");
72 69
73static struct pci_device_id snd_ymfpci_ids[] = { 70static struct pci_device_id snd_ymfpci_ids[] = {
74 { 0x1073, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724 */ 71 { 0x1073, 0x0004, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0, }, /* YMF724 */
@@ -298,7 +295,7 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
298 snd_card_free(card); 295 snd_card_free(card);
299 return err; 296 return err;
300 } 297 }
301 if ((err = snd_ymfpci_mixer(chip, rear_switch[dev], rear_swap[dev])) < 0) { 298 if ((err = snd_ymfpci_mixer(chip, rear_switch[dev])) < 0) {
302 snd_card_free(card); 299 snd_card_free(card);
303 return err; 300 return err;
304 } 301 }
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index a40c1085fd..7881944a19 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -910,7 +910,7 @@ static int snd_ymfpci_playback_open(struct snd_pcm_substream *substream)
910 ypcm = runtime->private_data; 910 ypcm = runtime->private_data;
911 ypcm->output_front = 1; 911 ypcm->output_front = 1;
912 ypcm->output_rear = chip->mode_dup4ch ? 1 : 0; 912 ypcm->output_rear = chip->mode_dup4ch ? 1 : 0;
913 ypcm->swap_rear = chip->rear_swap; 913 ypcm->swap_rear = 0;
914 spin_lock_irq(&chip->reg_lock); 914 spin_lock_irq(&chip->reg_lock);
915 if (ypcm->output_rear) { 915 if (ypcm->output_rear) {
916 ymfpci_open_extension(chip); 916 ymfpci_open_extension(chip);
@@ -936,6 +936,7 @@ static int snd_ymfpci_playback_spdif_open(struct snd_pcm_substream *substream)
936 ypcm = runtime->private_data; 936 ypcm = runtime->private_data;
937 ypcm->output_front = 0; 937 ypcm->output_front = 0;
938 ypcm->output_rear = 1; 938 ypcm->output_rear = 1;
939 ypcm->swap_rear = 1;
939 spin_lock_irq(&chip->reg_lock); 940 spin_lock_irq(&chip->reg_lock);
940 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTCTRL, 941 snd_ymfpci_writew(chip, YDSXGR_SPDIFOUTCTRL,
941 snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) | 2); 942 snd_ymfpci_readw(chip, YDSXGR_SPDIFOUTCTRL) | 2);
@@ -963,6 +964,7 @@ static int snd_ymfpci_playback_4ch_open(struct snd_pcm_substream *substream)
963 ypcm = runtime->private_data; 964 ypcm = runtime->private_data;
964 ypcm->output_front = 0; 965 ypcm->output_front = 0;
965 ypcm->output_rear = 1; 966 ypcm->output_rear = 1;
967 ypcm->swap_rear = 0;
966 spin_lock_irq(&chip->reg_lock); 968 spin_lock_irq(&chip->reg_lock);
967 ymfpci_open_extension(chip); 969 ymfpci_open_extension(chip);
968 chip->rear_opened++; 970 chip->rear_opened++;
@@ -1755,7 +1757,7 @@ static void snd_ymfpci_mixer_free_ac97(struct snd_ac97 *ac97)
1755 chip->ac97 = NULL; 1757 chip->ac97 = NULL;
1756} 1758}
1757 1759
1758int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch, int rear_swap) 1760int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch)
1759{ 1761{
1760 struct snd_ac97_template ac97; 1762 struct snd_ac97_template ac97;
1761 struct snd_kcontrol *kctl; 1763 struct snd_kcontrol *kctl;
@@ -1767,7 +1769,6 @@ int __devinit snd_ymfpci_mixer(struct snd_ymfpci *chip, int rear_switch, int rea
1767 .read = snd_ymfpci_codec_read, 1769 .read = snd_ymfpci_codec_read,
1768 }; 1770 };
1769 1771
1770 chip->rear_swap = rear_swap;
1771 if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0) 1772 if ((err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus)) < 0)
1772 return err; 1773 return err;
1773 chip->ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus; 1774 chip->ac97_bus->private_free = snd_ymfpci_mixer_free_ac97_bus;
@@ -2025,10 +2026,10 @@ static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip)
2025 chip->bank_size_effect = snd_ymfpci_readl(chip, YDSXGR_EFFCTRLSIZE) << 2; 2026 chip->bank_size_effect = snd_ymfpci_readl(chip, YDSXGR_EFFCTRLSIZE) << 2;
2026 chip->work_size = YDSXG_DEFAULT_WORK_SIZE; 2027 chip->work_size = YDSXG_DEFAULT_WORK_SIZE;
2027 2028
2028 size = ((playback_ctrl_size + 0x00ff) & ~0x00ff) + 2029 size = ALIGN(playback_ctrl_size, 0x100) +
2029 ((chip->bank_size_playback * 2 * YDSXG_PLAYBACK_VOICES + 0x00ff) & ~0x00ff) + 2030 ALIGN(chip->bank_size_playback * 2 * YDSXG_PLAYBACK_VOICES, 0x100) +
2030 ((chip->bank_size_capture * 2 * YDSXG_CAPTURE_VOICES + 0x00ff) & ~0x00ff) + 2031 ALIGN(chip->bank_size_capture * 2 * YDSXG_CAPTURE_VOICES, 0x100) +
2031 ((chip->bank_size_effect * 2 * YDSXG_EFFECT_VOICES + 0x00ff) & ~0x00ff) + 2032 ALIGN(chip->bank_size_effect * 2 * YDSXG_EFFECT_VOICES, 0x100) +
2032 chip->work_size; 2033 chip->work_size;
2033 /* work_ptr must be aligned to 256 bytes, but it's already 2034 /* work_ptr must be aligned to 256 bytes, but it's already
2034 covered with the kernel page allocation mechanism */ 2035 covered with the kernel page allocation mechanism */
@@ -2043,8 +2044,8 @@ static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip)
2043 chip->bank_base_playback_addr = ptr_addr; 2044 chip->bank_base_playback_addr = ptr_addr;
2044 chip->ctrl_playback = (u32 *)ptr; 2045 chip->ctrl_playback = (u32 *)ptr;
2045 chip->ctrl_playback[0] = cpu_to_le32(YDSXG_PLAYBACK_VOICES); 2046 chip->ctrl_playback[0] = cpu_to_le32(YDSXG_PLAYBACK_VOICES);
2046 ptr += (playback_ctrl_size + 0x00ff) & ~0x00ff; 2047 ptr += ALIGN(playback_ctrl_size, 0x100);
2047 ptr_addr += (playback_ctrl_size + 0x00ff) & ~0x00ff; 2048 ptr_addr += ALIGN(playback_ctrl_size, 0x100);
2048 for (voice = 0; voice < YDSXG_PLAYBACK_VOICES; voice++) { 2049 for (voice = 0; voice < YDSXG_PLAYBACK_VOICES; voice++) {
2049 chip->voices[voice].number = voice; 2050 chip->voices[voice].number = voice;
2050 chip->voices[voice].bank = (struct snd_ymfpci_playback_bank *)ptr; 2051 chip->voices[voice].bank = (struct snd_ymfpci_playback_bank *)ptr;
@@ -2055,8 +2056,8 @@ static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip)
2055 ptr_addr += chip->bank_size_playback; 2056 ptr_addr += chip->bank_size_playback;
2056 } 2057 }
2057 } 2058 }
2058 ptr = (char *)(((unsigned long)ptr + 0x00ff) & ~0x00ff); 2059 ptr = (char *)ALIGN((unsigned long)ptr, 0x100);
2059 ptr_addr = (ptr_addr + 0x00ff) & ~0x00ff; 2060 ptr_addr = ALIGN(ptr_addr, 0x100);
2060 chip->bank_base_capture = ptr; 2061 chip->bank_base_capture = ptr;
2061 chip->bank_base_capture_addr = ptr_addr; 2062 chip->bank_base_capture_addr = ptr_addr;
2062 for (voice = 0; voice < YDSXG_CAPTURE_VOICES; voice++) 2063 for (voice = 0; voice < YDSXG_CAPTURE_VOICES; voice++)
@@ -2065,8 +2066,8 @@ static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip)
2065 ptr += chip->bank_size_capture; 2066 ptr += chip->bank_size_capture;
2066 ptr_addr += chip->bank_size_capture; 2067 ptr_addr += chip->bank_size_capture;
2067 } 2068 }
2068 ptr = (char *)(((unsigned long)ptr + 0x00ff) & ~0x00ff); 2069 ptr = (char *)ALIGN((unsigned long)ptr, 0x100);
2069 ptr_addr = (ptr_addr + 0x00ff) & ~0x00ff; 2070 ptr_addr = ALIGN(ptr_addr, 0x100);
2070 chip->bank_base_effect = ptr; 2071 chip->bank_base_effect = ptr;
2071 chip->bank_base_effect_addr = ptr_addr; 2072 chip->bank_base_effect_addr = ptr_addr;
2072 for (voice = 0; voice < YDSXG_EFFECT_VOICES; voice++) 2073 for (voice = 0; voice < YDSXG_EFFECT_VOICES; voice++)
@@ -2075,8 +2076,8 @@ static int __devinit snd_ymfpci_memalloc(struct snd_ymfpci *chip)
2075 ptr += chip->bank_size_effect; 2076 ptr += chip->bank_size_effect;
2076 ptr_addr += chip->bank_size_effect; 2077 ptr_addr += chip->bank_size_effect;
2077 } 2078 }
2078 ptr = (char *)(((unsigned long)ptr + 0x00ff) & ~0x00ff); 2079 ptr = (char *)ALIGN((unsigned long)ptr, 0x100);
2079 ptr_addr = (ptr_addr + 0x00ff) & ~0x00ff; 2080 ptr_addr = ALIGN(ptr_addr, 0x100);
2080 chip->work_base = ptr; 2081 chip->work_base = ptr;
2081 chip->work_base_addr = ptr_addr; 2082 chip->work_base_addr = ptr_addr;
2082 2083
@@ -2153,7 +2154,7 @@ static int snd_ymfpci_free(struct snd_ymfpci *chip)
2153 snd_dma_free_pages(&chip->work_ptr); 2154 snd_dma_free_pages(&chip->work_ptr);
2154 2155
2155 if (chip->irq >= 0) 2156 if (chip->irq >= 0)
2156 free_irq(chip->irq, (void *)chip); 2157 free_irq(chip->irq, chip);
2157 release_and_free_resource(chip->res_reg_area); 2158 release_and_free_resource(chip->res_reg_area);
2158 2159
2159 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl); 2160 pci_write_config_word(chip->pci, 0x40, chip->old_legacy_ctrl);
@@ -2290,7 +2291,7 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2290 chip->pci = pci; 2291 chip->pci = pci;
2291 chip->irq = -1; 2292 chip->irq = -1;
2292 chip->device_id = pci->device; 2293 chip->device_id = pci->device;
2293 pci_read_config_byte(pci, PCI_REVISION_ID, (u8 *)&chip->rev); 2294 pci_read_config_byte(pci, PCI_REVISION_ID, &chip->rev);
2294 chip->reg_area_phys = pci_resource_start(pci, 0); 2295 chip->reg_area_phys = pci_resource_start(pci, 0);
2295 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000); 2296 chip->reg_area_virt = ioremap_nocache(chip->reg_area_phys, 0x8000);
2296 pci_set_master(pci); 2297 pci_set_master(pci);
@@ -2300,7 +2301,8 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2300 snd_ymfpci_free(chip); 2301 snd_ymfpci_free(chip);
2301 return -EBUSY; 2302 return -EBUSY;
2302 } 2303 }
2303 if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_DISABLED|IRQF_SHARED, "YMFPCI", (void *) chip)) { 2304 if (request_irq(pci->irq, snd_ymfpci_interrupt, IRQF_SHARED,
2305 "YMFPCI", chip)) {
2304 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq); 2306 snd_printk(KERN_ERR "unable to grab IRQ %d\n", pci->irq);
2305 snd_ymfpci_free(chip); 2307 snd_ymfpci_free(chip);
2306 return -EBUSY; 2308 return -EBUSY;
@@ -2322,7 +2324,6 @@ int __devinit snd_ymfpci_create(struct snd_card *card,
2322 return -EIO; 2324 return -EIO;
2323 } 2325 }
2324 2326
2325 chip->rear_swap = 1;
2326 if ((err = snd_ymfpci_ac3_init(chip)) < 0) { 2327 if ((err = snd_ymfpci_ac3_init(chip)) < 0) {
2327 snd_ymfpci_free(chip); 2328 snd_ymfpci_free(chip);
2328 return err; 2329 return err;
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index 67202b9eeb..3d7f36fb4c 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -3577,8 +3577,7 @@ static int __init snd_usb_audio_init(void)
3577 printk(KERN_WARNING "invalid nrpacks value.\n"); 3577 printk(KERN_WARNING "invalid nrpacks value.\n");
3578 return -EINVAL; 3578 return -EINVAL;
3579 } 3579 }
3580 usb_register(&usb_audio_driver); 3580 return usb_register(&usb_audio_driver);
3581 return 0;
3582} 3581}
3583 3582
3584 3583