aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--Documentation/sound/alsa/ALSA-Configuration.txt124
-rw-r--r--Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl10
-rw-r--r--include/linux/pci_ids.h44
-rw-r--r--include/sound/core.h8
-rw-r--r--include/sound/cs46xx.h14
-rw-r--r--include/sound/emu10k1.h7
-rw-r--r--include/sound/pcm.h5
-rw-r--r--include/sound/pcm_oss.h3
-rw-r--r--include/sound/trident.h17
-rw-r--r--include/sound/version.h2
-rw-r--r--include/sound/ymfpci.h22
-rw-r--r--sound/arm/Kconfig1
-rw-r--r--sound/arm/aaci.c2
-rw-r--r--sound/arm/sa11xx-uda1341.c7
-rw-r--r--sound/core/Kconfig14
-rw-r--r--sound/core/control.c12
-rw-r--r--sound/core/control_compat.c8
-rw-r--r--sound/core/device.c2
-rw-r--r--sound/core/hwdep.c2
-rw-r--r--sound/core/info.c8
-rw-r--r--sound/core/init.c187
-rw-r--r--sound/core/memalloc.c3
-rw-r--r--sound/core/memory.c4
-rw-r--r--sound/core/oss/mixer_oss.c26
-rw-r--r--sound/core/oss/pcm_oss.c17
-rw-r--r--sound/core/oss/pcm_plugin.c2
-rw-r--r--sound/core/pcm.c6
-rw-r--r--sound/core/pcm_lib.c117
-rw-r--r--sound/core/pcm_memory.c4
-rw-r--r--sound/core/pcm_native.c11
-rw-r--r--sound/core/rawmidi.c16
-rw-r--r--sound/core/seq/instr/ainstr_gf1.c2
-rw-r--r--sound/core/seq/instr/ainstr_iw.c6
-rw-r--r--sound/core/seq/oss/seq_oss_init.c2
-rw-r--r--sound/core/seq/oss/seq_oss_midi.c6
-rw-r--r--sound/core/seq/oss/seq_oss_readq.c2
-rw-r--r--sound/core/seq/oss/seq_oss_synth.c4
-rw-r--r--sound/core/seq/oss/seq_oss_timer.c2
-rw-r--r--sound/core/seq/oss/seq_oss_writeq.c2
-rw-r--r--sound/core/seq/seq.c8
-rw-r--r--sound/core/seq/seq_clientmgr.c9
-rw-r--r--sound/core/seq/seq_device.c2
-rw-r--r--sound/core/seq/seq_dummy.c2
-rw-r--r--sound/core/seq/seq_fifo.c2
-rw-r--r--sound/core/seq/seq_instr.c4
-rw-r--r--sound/core/seq/seq_memory.c2
-rw-r--r--sound/core/seq/seq_midi.c2
-rw-r--r--sound/core/seq/seq_midi_event.c2
-rw-r--r--sound/core/seq/seq_ports.c4
-rw-r--r--sound/core/seq/seq_prioq.c2
-rw-r--r--sound/core/seq/seq_queue.c2
-rw-r--r--sound/core/seq/seq_system.c4
-rw-r--r--sound/core/seq/seq_timer.c2
-rw-r--r--sound/core/seq/seq_virmidi.c6
-rw-r--r--sound/core/sound.c15
-rw-r--r--sound/core/timer.c10
-rw-r--r--sound/drivers/Kconfig5
-rw-r--r--sound/drivers/dummy.c8
-rw-r--r--sound/drivers/mpu401/mpu401.c26
-rw-r--r--sound/drivers/mpu401/mpu401_uart.c2
-rw-r--r--sound/drivers/mtpav.c5
-rw-r--r--sound/drivers/opl3/opl3_lib.c2
-rw-r--r--sound/drivers/opl3/opl3_oss.c2
-rw-r--r--sound/drivers/opl4/opl4_lib.c2
-rw-r--r--sound/drivers/serial-u16550.c28
-rw-r--r--sound/drivers/virmidi.c4
-rw-r--r--sound/drivers/vx/vx_core.c2
-rw-r--r--sound/drivers/vx/vx_pcm.c2
-rw-r--r--sound/i2c/cs8427.c2
-rw-r--r--sound/i2c/i2c.c4
-rw-r--r--sound/i2c/l3/uda1341.c6
-rw-r--r--sound/i2c/other/ak4114.c2
-rw-r--r--sound/i2c/other/ak4117.c2
-rw-r--r--sound/i2c/tea6330t.c2
-rw-r--r--sound/isa/Kconfig18
-rw-r--r--sound/isa/ad1816a/ad1816a_lib.c2
-rw-r--r--sound/isa/ad1848/ad1848.c37
-rw-r--r--sound/isa/ad1848/ad1848_lib.c2
-rw-r--r--sound/isa/cmi8330.c77
-rw-r--r--sound/isa/cs423x/cs4231.c46
-rw-r--r--sound/isa/cs423x/cs4231_lib.c2
-rw-r--r--sound/isa/cs423x/cs4236.c97
-rw-r--r--sound/isa/es1688/es1688.c61
-rw-r--r--sound/isa/es1688/es1688_lib.c2
-rw-r--r--sound/isa/es18xx.c83
-rw-r--r--sound/isa/gus/gus_main.c2
-rw-r--r--sound/isa/gus/gus_mem_proc.c4
-rw-r--r--sound/isa/gus/gus_pcm.c2
-rw-r--r--sound/isa/gus/gusclassic.c115
-rw-r--r--sound/isa/gus/gusextreme.c49
-rw-r--r--sound/isa/gus/gusmax.c145
-rw-r--r--sound/isa/gus/interwave.c167
-rw-r--r--sound/isa/opl3sa2.c38
-rw-r--r--sound/isa/opti9xx/opti92x-ad1848.c13
-rw-r--r--sound/isa/sb/emu8000.c2
-rw-r--r--sound/isa/sb/emu8000_pcm.c2
-rw-r--r--sound/isa/sb/sb16.c144
-rw-r--r--sound/isa/sb/sb16_csp.c2
-rw-r--r--sound/isa/sb/sb8.c62
-rw-r--r--sound/isa/sb/sb_common.c2
-rw-r--r--sound/isa/sgalaxy.c65
-rw-r--r--sound/isa/sscape.c22
-rw-r--r--sound/isa/wavefront/wavefront.c5
-rw-r--r--sound/mips/Kconfig1
-rw-r--r--sound/mips/au1x00.c5
-rw-r--r--sound/parisc/harmony.c2
-rw-r--r--sound/pci/Kconfig12
-rw-r--r--sound/pci/Makefile2
-rw-r--r--sound/pci/ac97/ac97_codec.c5
-rw-r--r--sound/pci/ac97/ac97_id.h1
-rw-r--r--sound/pci/ac97/ac97_patch.c24
-rw-r--r--sound/pci/ac97/ak4531_codec.c2
-rw-r--r--sound/pci/ad1889.c1090
-rw-r--r--sound/pci/ad1889.h189
-rw-r--r--sound/pci/ali5451/ali5451.c27
-rw-r--r--sound/pci/als4000.c1
-rw-r--r--sound/pci/atiixp.c4
-rw-r--r--sound/pci/atiixp_modem.c3
-rw-r--r--sound/pci/au88x0/au88x0.c29
-rw-r--r--sound/pci/azt3328.c3
-rw-r--r--sound/pci/bt87x.c13
-rw-r--r--sound/pci/ca0106/ca0106_main.c7
-rw-r--r--sound/pci/ca0106/ca0106_mixer.c18
-rw-r--r--sound/pci/cmipci.c29
-rw-r--r--sound/pci/cs4281.c14
-rw-r--r--sound/pci/cs46xx/cs46xx.c1
-rw-r--r--sound/pci/cs46xx/cs46xx_lib.c28
-rw-r--r--sound/pci/emu10k1/emu10k1.c1
-rw-r--r--sound/pci/emu10k1/emu10k1_main.c7
-rw-r--r--sound/pci/emu10k1/emu10k1x.c7
-rw-r--r--sound/pci/emu10k1/emufx.c20
-rw-r--r--sound/pci/emu10k1/emupcm.c10
-rw-r--r--sound/pci/emu10k1/p16v.c4
-rw-r--r--sound/pci/ens1370.c10
-rw-r--r--sound/pci/es1938.c10
-rw-r--r--sound/pci/es1968.c26
-rw-r--r--sound/pci/fm801.c3
-rw-r--r--sound/pci/hda/hda_codec.c6
-rw-r--r--sound/pci/hda/hda_codec.h1
-rw-r--r--sound/pci/hda/hda_generic.c4
-rw-r--r--sound/pci/hda/hda_intel.c93
-rw-r--r--sound/pci/hda/hda_proc.c2
-rw-r--r--sound/pci/hda/patch_analog.c6
-rw-r--r--sound/pci/hda/patch_cmedia.c2
-rw-r--r--sound/pci/hda/patch_realtek.c8
-rw-r--r--sound/pci/hda/patch_si3054.c3
-rw-r--r--sound/pci/hda/patch_sigmatel.c4
-rw-r--r--sound/pci/ice1712/aureon.c2
-rw-r--r--sound/pci/ice1712/ice1712.c9
-rw-r--r--sound/pci/ice1712/ice1724.c9
-rw-r--r--sound/pci/ice1712/juli.c2
-rw-r--r--sound/pci/ice1712/phase.c4
-rw-r--r--sound/pci/ice1712/pontis.c2
-rw-r--r--sound/pci/intel8x0.c91
-rw-r--r--sound/pci/intel8x0m.c64
-rw-r--r--sound/pci/korg1212/korg1212.c3
-rw-r--r--sound/pci/maestro3.c32
-rw-r--r--sound/pci/mixart/mixart.c5
-rw-r--r--sound/pci/nm256/nm256.c20
-rw-r--r--sound/pci/rme32.c21
-rw-r--r--sound/pci/rme96.c26
-rw-r--r--sound/pci/rme9652/hdsp.c9
-rw-r--r--sound/pci/rme9652/hdspm.c13
-rw-r--r--sound/pci/rme9652/rme9652.c8
-rw-r--r--sound/pci/sonicvibes.c10
-rw-r--r--sound/pci/trident/trident.c1
-rw-r--r--sound/pci/trident/trident_main.c4
-rw-r--r--sound/pci/via82xx.c14
-rw-r--r--sound/pci/via82xx_modem.c3
-rw-r--r--sound/pci/vx222/vx222.c1
-rw-r--r--sound/pci/ymfpci/ymfpci.c1
-rw-r--r--sound/pci/ymfpci/ymfpci_main.c6
-rw-r--r--sound/pcmcia/pdaudiocf/pdaudiocf_core.c2
-rw-r--r--sound/ppc/Kconfig15
-rw-r--r--sound/ppc/pmac.c3
-rw-r--r--sound/ppc/powermac.c3
-rw-r--r--sound/ppc/tumbler.c23
-rw-r--r--sound/sparc/Kconfig3
-rw-r--r--sound/sparc/amd7930.c5
-rw-r--r--sound/sparc/cs4231.c7
-rw-r--r--sound/sparc/dbri.c234
-rw-r--r--sound/synth/emux/emux.c2
-rw-r--r--sound/synth/emux/emux_seq.c2
-rw-r--r--sound/synth/emux/soundfont.c8
-rw-r--r--sound/synth/util_mem.c2
-rw-r--r--sound/usb/usbaudio.c18
-rw-r--r--sound/usb/usbmidi.c6
-rw-r--r--sound/usb/usbmixer.c10
-rw-r--r--sound/usb/usx2y/usbusx2yaudio.c2
189 files changed, 2983 insertions, 1642 deletions
diff --git a/Documentation/sound/alsa/ALSA-Configuration.txt b/Documentation/sound/alsa/ALSA-Configuration.txt
index ebfcdf28485f..13cba955cb5a 100644
--- a/Documentation/sound/alsa/ALSA-Configuration.txt
+++ b/Documentation/sound/alsa/ALSA-Configuration.txt
@@ -75,7 +75,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
75 adsp_map - PCM device number maps assigned to the 2st OSS device. 75 adsp_map - PCM device number maps assigned to the 2st OSS device.
76 - Default: 1 76 - Default: 1
77 nonblock_open 77 nonblock_open
78 - Don't block opening busy PCM devices. 78 - Don't block opening busy PCM devices. Default: 1
79 79
80 For example, when dsp_map=2, /dev/dsp will be mapped to PCM #2 of 80 For example, when dsp_map=2, /dev/dsp will be mapped to PCM #2 of
81 the card #0. Similarly, when adsp_map=0, /dev/adsp will be mapped 81 the card #0. Similarly, when adsp_map=0, /dev/adsp will be mapped
@@ -148,6 +148,16 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
148 Module supports up to 8 cards. This module does not support autoprobe 148 Module supports up to 8 cards. This module does not support autoprobe
149 thus main port must be specified!!! Other ports are optional. 149 thus main port must be specified!!! Other ports are optional.
150 150
151 Module snd-ad1889
152 -----------------
153
154 Module for Analog Devices AD1889 chips.
155
156 ac97_quirk - AC'97 workaround for strange hardware
157 See the description of intel8x0 module for details.
158
159 This module supports up to 8 cards.
160
151 Module snd-ali5451 161 Module snd-ali5451
152 ------------------ 162 ------------------
153 163
@@ -189,15 +199,20 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
189 Module snd-atiixp 199 Module snd-atiixp
190 ----------------- 200 -----------------
191 201
192 Module for ATI IXP 150/200/250 AC97 controllers. 202 Module for ATI IXP 150/200/250/400 AC97 controllers.
193 203
194 ac97_clock - AC'97 clock (defalut = 48000) 204 ac97_clock - AC'97 clock (default = 48000)
195 ac97_quirk - AC'97 workaround for strange hardware 205 ac97_quirk - AC'97 workaround for strange hardware
196 See the description of intel8x0 module for details. 206 See "AC97 Quirk Option" section below.
197 spdif_aclink - S/PDIF transfer over AC-link (default = 1) 207 spdif_aclink - S/PDIF transfer over AC-link (default = 1)
198 208
199 This module supports up to 8 cards and autoprobe. 209 This module supports up to 8 cards and autoprobe.
200 210
211 ATI IXP has two different methods to control SPDIF output. One is
212 over AC-link and another is over the "direct" SPDIF output. The
213 implementation depends on the motherboard, and you'll need to
214 choose the correct one via spdif_aclink module option.
215
201 Module snd-atiixp-modem 216 Module snd-atiixp-modem
202 ----------------------- 217 -----------------------
203 218
@@ -230,7 +245,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
230 The hardware EQ hardware and SPDIF is only present in the Vortex2 and 245 The hardware EQ hardware and SPDIF is only present in the Vortex2 and
231 Advantage. 246 Advantage.
232 247
233 Note: Some ALSA mixer applicactions don't handle the SPDIF samplerate 248 Note: Some ALSA mixer applications don't handle the SPDIF sample rate
234 control correctly. If you have problems regarding this, try 249 control correctly. If you have problems regarding this, try
235 another ALSA compliant mixer (alsamixer works). 250 another ALSA compliant mixer (alsamixer works).
236 251
@@ -302,7 +317,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
302 317
303 mpu_port - 0x300,0x310,0x320,0x330, 0 = disable (default) 318 mpu_port - 0x300,0x310,0x320,0x330, 0 = disable (default)
304 fm_port - 0x388 (default), 0 = disable (default) 319 fm_port - 0x388 (default), 0 = disable (default)
305 soft_ac3 - Sofware-conversion of raw SPDIF packets (model 033 only) 320 soft_ac3 - Software-conversion of raw SPDIF packets (model 033 only)
306 (default = 1) 321 (default = 1)
307 joystick_port - Joystick port address (0 = disable, 1 = auto-detect) 322 joystick_port - Joystick port address (0 = disable, 1 = auto-detect)
308 323
@@ -384,7 +399,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
384 Module for PCI sound cards based on CS4610/CS4612/CS4614/CS4615/CS4622/ 399 Module for PCI sound cards based on CS4610/CS4612/CS4614/CS4615/CS4622/
385 CS4624/CS4630/CS4280 PCI chips. 400 CS4624/CS4630/CS4280 PCI chips.
386 401
387 external_amp - Force to enable external amplifer. 402 external_amp - Force to enable external amplifier.
388 thinkpad - Force to enable Thinkpad's CLKRUN control. 403 thinkpad - Force to enable Thinkpad's CLKRUN control.
389 mmap_valid - Support OSS mmap mode (default = 0). 404 mmap_valid - Support OSS mmap mode (default = 0).
390 405
@@ -620,7 +635,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
620 VIA VT8251/VT8237A 635 VIA VT8251/VT8237A
621 636
622 model - force the model name 637 model - force the model name
623 position_fix - Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF) 638 position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)
624 639
625 Module supports up to 8 cards. 640 Module supports up to 8 cards.
626 641
@@ -656,6 +671,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
656 allout 5-jack in back, 2-jack in front, SPDIF out 671 allout 5-jack in back, 2-jack in front, SPDIF out
657 auto auto-config reading BIOS (default) 672 auto auto-config reading BIOS (default)
658 673
674 If the default configuration doesn't work and one of the above
675 matches with your device, report it together with the PCI
676 subsystem ID (output of "lspci -nv") to ALSA BTS or alsa-devel
677 ML (see the section "Links and Addresses").
678
659 Note 2: If you get click noises on output, try the module option 679 Note 2: If you get click noises on output, try the module option
660 position_fix=1 or 2. position_fix=1 will use the SD_LPIB 680 position_fix=1 or 2. position_fix=1 will use the SD_LPIB
661 register value without FIFO size correction as the current 681 register value without FIFO size correction as the current
@@ -783,20 +803,13 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
783 803
784 ac97_clock - AC'97 codec clock base (0 = auto-detect) 804 ac97_clock - AC'97 codec clock base (0 = auto-detect)
785 ac97_quirk - AC'97 workaround for strange hardware 805 ac97_quirk - AC'97 workaround for strange hardware
786 The following strings are accepted: 806 See "AC97 Quirk Option" section below.
787 default = don't override the default setting
788 disable = disable the quirk
789 hp_only = use headphone control as master
790 swap_hp = swap headphone and master controls
791 swap_surround = swap master and surround controls
792 ad_sharing = for AD1985, turn on OMS bit and use headphone
793 alc_jack = for ALC65x, turn on the jack sense mode
794 inv_eapd = inverted EAPD implementation
795 mute_led = bind EAPD bit for turning on/off mute LED
796 For backward compatibility, the corresponding integer
797 value -1, 0, ... are accepted, too.
798 buggy_irq - Enable workaround for buggy interrupts on some 807 buggy_irq - Enable workaround for buggy interrupts on some
799 motherboards (default off) 808 motherboards (default yes on nForce chips,
809 otherwise off)
810 buggy_semaphore - Enable workaround for hardwares with buggy
811 semaphores (e.g. on some ASUS laptops)
812 (default off)
800 813
801 Module supports autoprobe and multiple bus-master chips (max 8). 814 Module supports autoprobe and multiple bus-master chips (max 8).
802 815
@@ -808,13 +821,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
808 motherboard has these devices, use the ns558 or snd-mpu401 821 motherboard has these devices, use the ns558 or snd-mpu401
809 modules, respectively. 822 modules, respectively.
810 823
811 The ac97_quirk option is used to enable/override the workaround
812 for specific devices. Some hardware have swapped output pins
813 between Master and Headphone, or Surround. The driver provides
814 the auto-detection of known problematic devices, but some might
815 be unknown or wrongly detected. In such a case, pass the proper
816 value with this option.
817
818 The power-management is supported. 824 The power-management is supported.
819 825
820 Module snd-intel8x0m 826 Module snd-intel8x0m
@@ -966,7 +972,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
966 with machines with other (most likely CS423x or OPL3SAx) chips, 972 with machines with other (most likely CS423x or OPL3SAx) chips,
967 even though the device is detected in lspci. In such a case, try 973 even though the device is detected in lspci. In such a case, try
968 other drivers, e.g. snd-cs4232 or snd-opl3sa2. Some has ISA-PnP 974 other drivers, e.g. snd-cs4232 or snd-opl3sa2. Some has ISA-PnP
969 but some doesn't have ISA PnP. You'll need to speicfy isapnp=0 975 but some doesn't have ISA PnP. You'll need to specify isapnp=0
970 and proper hardware parameters in the case without ISA PnP. 976 and proper hardware parameters in the case without ISA PnP.
971 977
972 Note: some laptops need a workaround for AC97 RESET. For the 978 Note: some laptops need a workaround for AC97 RESET. For the
@@ -1302,7 +1308,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1302 channels 1308 channels
1303 [VIA8233/C, 8235, 8237 only] 1309 [VIA8233/C, 8235, 8237 only]
1304 ac97_quirk - AC'97 workaround for strange hardware 1310 ac97_quirk - AC'97 workaround for strange hardware
1305 See the description of intel8x0 module for details. 1311 See "AC97 Quirk Option" section below.
1306 1312
1307 Module supports autoprobe and multiple bus-master chips (max 8). 1313 Module supports autoprobe and multiple bus-master chips (max 8).
1308 1314
@@ -1327,16 +1333,17 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1327 "lspci -nv"). 1333 "lspci -nv").
1328 If dxs_support=5 does not work, try dxs_support=4; if it 1334 If dxs_support=5 does not work, try dxs_support=4; if it
1329 doesn't work too, try dxs_support=1. (dxs_support=1 is 1335 doesn't work too, try dxs_support=1. (dxs_support=1 is
1330 usually for old motherboards. The correct implementated 1336 usually for old motherboards. The correct implemented
1331 board should work with 4 or 5.) If it still doesn't 1337 board should work with 4 or 5.) If it still doesn't
1332 work and the default setting is ok, dxs_support=3 is the 1338 work and the default setting is ok, dxs_support=3 is the
1333 right choice. If the default setting doesn't work at all, 1339 right choice. If the default setting doesn't work at all,
1334 try dxs_support=2 to disable the DXS channels. 1340 try dxs_support=2 to disable the DXS channels.
1335 In any cases, please let us know the result and the 1341 In any cases, please let us know the result and the
1336 subsystem vendor/device ids. 1342 subsystem vendor/device ids. See "Links and Addresses"
1343 below.
1337 1344
1338 Note: for the MPU401 on VIA823x, use snd-mpu401 driver 1345 Note: for the MPU401 on VIA823x, use snd-mpu401 driver
1339 additonally. The mpu_port option is for VIA686 chips only. 1346 additionally. The mpu_port option is for VIA686 chips only.
1340 1347
1341 Module snd-via82xx-modem 1348 Module snd-via82xx-modem
1342 ------------------------ 1349 ------------------------
@@ -1398,8 +1405,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1398 Module supports up to 8 cards. The module is compiled only when 1405 Module supports up to 8 cards. The module is compiled only when
1399 PCMCIA is supported on kernel. 1406 PCMCIA is supported on kernel.
1400 1407
1401 To activate the driver via the card manager, you'll need to set 1408 With the older 2.6.x kernel, to activate the driver via the card
1402 up /etc/pcmcia/vxpocket.conf. See the sound/pcmcia/vx/vxpocket.c. 1409 manager, you'll need to set up /etc/pcmcia/vxpocket.conf. See the
1410 sound/pcmcia/vx/vxpocket.c. 2.6.13 or later kernel requires no
1411 longer require a config file.
1403 1412
1404 When the driver is compiled as a module and the hotplug firmware 1413 When the driver is compiled as a module and the hotplug firmware
1405 is supported, the firmware data is loaded via hotplug automatically. 1414 is supported, the firmware data is loaded via hotplug automatically.
@@ -1411,6 +1420,9 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1411 1420
1412 Note: the driver is build only when CONFIG_ISA is set. 1421 Note: the driver is build only when CONFIG_ISA is set.
1413 1422
1423 Note2: snd-vxp440 driver is merged to snd-vxpocket driver since
1424 ALSA 1.0.10.
1425
1414 Module snd-ymfpci 1426 Module snd-ymfpci
1415 ----------------- 1427 -----------------
1416 1428
@@ -1436,6 +1448,37 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
1436 Note: the driver is build only when CONFIG_ISA is set. 1448 Note: the driver is build only when CONFIG_ISA is set.
1437 1449
1438 1450
1451AC97 Quirk Option
1452=================
1453
1454The ac97_quirk option is used to enable/override the workaround for
1455specific devices on drivers for on-board AC'97 controllers like
1456snd-intel8x0. Some hardware have swapped output pins between Master
1457and Headphone, or Surround (thanks to confusion of AC'97
1458specifications from version to version :-)
1459
1460The driver provides the auto-detection of known problematic devices,
1461but some might be unknown or wrongly detected. In such a case, pass
1462the proper value with this option.
1463
1464The following strings are accepted:
1465 - default Don't override the default setting
1466 - disable Disable the quirk
1467 - hp_only Bind Master and Headphone controls as a single control
1468 - swap_hp Swap headphone and master controls
1469 - swap_surround Swap master and surround controls
1470 - ad_sharing For AD1985, turn on OMS bit and use headphone
1471 - alc_jack For ALC65x, turn on the jack sense mode
1472 - inv_eapd Inverted EAPD implementation
1473 - mute_led Bind EAPD bit for turning on/off mute LED
1474
1475For backward compatibility, the corresponding integer value -1, 0,
1476... are accepted, too.
1477
1478For example, if "Master" volume control has no effect on your device
1479but only "Headphone" does, pass ac97_quirk=hp_only module option.
1480
1481
1439Configuring Non-ISAPNP Cards 1482Configuring Non-ISAPNP Cards
1440============================ 1483============================
1441 1484
@@ -1553,6 +1596,8 @@ Proc interfaces (/proc/asound)
1553 - whole-frag write only whole fragments (optimization affecting 1596 - whole-frag write only whole fragments (optimization affecting
1554 playback only) 1597 playback only)
1555 - no-silence do not fill silence ahead to avoid clicks 1598 - no-silence do not fill silence ahead to avoid clicks
1599 - buggy-ptr Returns the whitespace blocks in GETOPTR ioctl
1600 instead of filled blocks
1556 1601
1557 Example: echo "x11amp 128 16384" > /proc/asound/card0/pcm0p/oss 1602 Example: echo "x11amp 128 16384" > /proc/asound/card0/pcm0p/oss
1558 echo "squake 0 0 disable" > /proc/asound/card0/pcm0c/oss 1603 echo "squake 0 0 disable" > /proc/asound/card0/pcm0c/oss
@@ -1589,9 +1634,14 @@ commands to the snd-page-alloc driver:
1589 use. 1634 use.
1590 1635
1591 1636
1592Links 1637Links and Addresses
1593===== 1638===================
1594 1639
1595 ALSA project homepage 1640 ALSA project homepage
1596 http://www.alsa-project.org 1641 http://www.alsa-project.org
1597 1642
1643 ALSA Bug Tracking System
1644 https://bugtrack.alsa-project.org/bugs/
1645
1646 ALSA Developers ML
1647 mailto:alsa-devel@lists.sourceforge.net
diff --git a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
index 0475478c2484..24e85520890b 100644
--- a/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
+++ b/Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
@@ -447,7 +447,7 @@
447 .... 447 ....
448 448
449 /* allocate a chip-specific data with zero filled */ 449 /* allocate a chip-specific data with zero filled */
450 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 450 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
451 if (chip == NULL) 451 if (chip == NULL)
452 return -ENOMEM; 452 return -ENOMEM;
453 453
@@ -949,7 +949,7 @@
949 After allocating a card instance via 949 After allocating a card instance via
950 <function>snd_card_new()</function> (with 950 <function>snd_card_new()</function> (with
951 <constant>NULL</constant> on the 4th arg), call 951 <constant>NULL</constant> on the 4th arg), call
952 <function>kcalloc()</function>. 952 <function>kzalloc()</function>.
953 953
954 <informalexample> 954 <informalexample>
955 <programlisting> 955 <programlisting>
@@ -958,7 +958,7 @@
958 mychip_t *chip; 958 mychip_t *chip;
959 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); 959 card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
960 ..... 960 .....
961 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 961 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
962]]> 962]]>
963 </programlisting> 963 </programlisting>
964 </informalexample> 964 </informalexample>
@@ -1136,7 +1136,7 @@
1136 return -ENXIO; 1136 return -ENXIO;
1137 } 1137 }
1138 1138
1139 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1139 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1140 if (chip == NULL) { 1140 if (chip == NULL) {
1141 pci_disable_device(pci); 1141 pci_disable_device(pci);
1142 return -ENOMEM; 1142 return -ENOMEM;
@@ -1292,7 +1292,7 @@
1292 need to initialize this number as -1 before actual allocation, 1292 need to initialize this number as -1 before actual allocation,
1293 since irq 0 is valid. The port address and its resource pointer 1293 since irq 0 is valid. The port address and its resource pointer
1294 can be initialized as null by 1294 can be initialized as null by
1295 <function>kcalloc()</function> automatically, so you 1295 <function>kzalloc()</function> automatically, so you
1296 don't have to take care of resetting them. 1296 don't have to take care of resetting them.
1297 </para> 1297 </para>
1298 1298
diff --git a/include/linux/pci_ids.h b/include/linux/pci_ids.h
index 7fcb44bc9af9..f6c1a142286a 100644
--- a/include/linux/pci_ids.h
+++ b/include/linux/pci_ids.h
@@ -447,6 +447,10 @@
447#define PCI_DEVICE_ID_CIRRUS_7542 0x1200 447#define PCI_DEVICE_ID_CIRRUS_7542 0x1200
448#define PCI_DEVICE_ID_CIRRUS_7543 0x1202 448#define PCI_DEVICE_ID_CIRRUS_7543 0x1202
449#define PCI_DEVICE_ID_CIRRUS_7541 0x1204 449#define PCI_DEVICE_ID_CIRRUS_7541 0x1204
450#define PCI_DEVICE_ID_CIRRUS_4610 0x6001
451#define PCI_DEVICE_ID_CIRRUS_4612 0x6003
452#define PCI_DEVICE_ID_CIRRUS_4615 0x6004
453#define PCI_DEVICE_ID_CIRRUS_4281 0x6005
450 454
451#define PCI_VENDOR_ID_IBM 0x1014 455#define PCI_VENDOR_ID_IBM 0x1014
452#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a 456#define PCI_DEVICE_ID_IBM_FIRE_CORAL 0x000a
@@ -682,7 +686,9 @@
682#define PCI_DEVICE_ID_SI_6326 0x6326 686#define PCI_DEVICE_ID_SI_6326 0x6326
683#define PCI_DEVICE_ID_SI_7001 0x7001 687#define PCI_DEVICE_ID_SI_7001 0x7001
684#define PCI_DEVICE_ID_SI_7012 0x7012 688#define PCI_DEVICE_ID_SI_7012 0x7012
689#define PCI_DEVICE_ID_SI_7013 0x7013
685#define PCI_DEVICE_ID_SI_7016 0x7016 690#define PCI_DEVICE_ID_SI_7016 0x7016
691#define PCI_DEVICE_ID_SI_7018 0x7018
686 692
687#define PCI_VENDOR_ID_HP 0x103c 693#define PCI_VENDOR_ID_HP 0x103c
688#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005 694#define PCI_DEVICE_ID_HP_VISUALIZE_EG 0x1005
@@ -993,6 +999,7 @@
993#define PCI_DEVICE_ID_BROOKTREE_849A 0x0351 999#define PCI_DEVICE_ID_BROOKTREE_849A 0x0351
994#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e 1000#define PCI_DEVICE_ID_BROOKTREE_878_1 0x036e
995#define PCI_DEVICE_ID_BROOKTREE_878 0x0878 1001#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
1002#define PCI_DEVICE_ID_BROOKTREE_879 0x0879
996#define PCI_DEVICE_ID_BROOKTREE_8474 0x8474 1003#define PCI_DEVICE_ID_BROOKTREE_8474 0x8474
997 1004
998#define PCI_VENDOR_ID_SIERRA 0x10a8 1005#define PCI_VENDOR_ID_SIERRA 0x10a8
@@ -1111,6 +1118,9 @@
1111#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004 1118#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004
1112#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005 1119#define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV 0x0005
1113#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083 1120#define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS 0x0083
1121#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
1122#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
1123#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
1114 1124
1115#define PCI_VENDOR_ID_ASP 0x10cd 1125#define PCI_VENDOR_ID_ASP 0x10cd
1116#define PCI_DEVICE_ID_ASP_ABP940 0x1200 1126#define PCI_DEVICE_ID_ASP_ABP940 0x1200
@@ -1157,10 +1167,13 @@
1157#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064 1167#define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS 0x0064
1158#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065 1168#define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE 0x0065
1159#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066 1169#define PCI_DEVICE_ID_NVIDIA_NVENET_2 0x0066
1170#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069
1160#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a 1171#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
1161#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084 1172#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS 0x0084
1162#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085 1173#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE 0x0085
1163#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086 1174#define PCI_DEVICE_ID_NVIDIA_NVENET_4 0x0086
1175#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
1176#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
1164#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c 1177#define PCI_DEVICE_ID_NVIDIA_NVENET_5 0x008c
1165#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e 1178#define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA 0x008e
1166#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0 1179#define PCI_DEVICE_ID_NVIDIA_ITNT2 0x00A0
@@ -1175,6 +1188,7 @@
1175#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4 1188#define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS 0x00d4
1176#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5 1189#define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE 0x00d5
1177#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6 1190#define PCI_DEVICE_ID_NVIDIA_NVENET_3 0x00d6
1191#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9
1178#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da 1192#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
1179#define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df 1193#define PCI_DEVICE_ID_NVIDIA_NVENET_7 0x00df
1180#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1 1194#define PCI_DEVICE_ID_NVIDIA_NFORCE3S 0x00e1
@@ -1182,6 +1196,7 @@
1182#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4 1196#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS 0x00e4
1183#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5 1197#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE 0x00e5
1184#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6 1198#define PCI_DEVICE_ID_NVIDIA_NVENET_6 0x00e6
1199#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
1185#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee 1200#define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2 0x00ee
1186#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100 1201#define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR 0x0100
1187#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101 1202#define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR 0x0101
@@ -1232,6 +1247,7 @@
1232#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1 1247#define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO 0x01b1
1233#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4 1248#define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS 0x01b4
1234#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc 1249#define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE 0x01bc
1250#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM 0x01c1
1235#define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3 1251#define PCI_DEVICE_ID_NVIDIA_NVENET_1 0x01c3
1236#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0 1252#define PCI_DEVICE_ID_NVIDIA_NFORCE2 0x01e0
1237#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200 1253#define PCI_DEVICE_ID_NVIDIA_GEFORCE3 0x0200
@@ -1336,6 +1352,13 @@
1336#define PCI_DEVICE_ID_REALTEK_8169 0x8169 1352#define PCI_DEVICE_ID_REALTEK_8169 0x8169
1337 1353
1338#define PCI_VENDOR_ID_XILINX 0x10ee 1354#define PCI_VENDOR_ID_XILINX 0x10ee
1355#define PCI_DEVICE_ID_RME_DIGI96 0x3fc0
1356#define PCI_DEVICE_ID_RME_DIGI96_8 0x3fc1
1357#define PCI_DEVICE_ID_RME_DIGI96_8_PRO 0x3fc2
1358#define PCI_DEVICE_IDRME__DIGI96_8_PAD_OR_PST 0x3fc3
1359#define PCI_DEVICE_ID_XILINX_HAMMERFALL 0x3fc4
1360#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
1361#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
1339#define PCI_DEVICE_ID_TURBOPAM 0x4020 1362#define PCI_DEVICE_ID_TURBOPAM 0x4020
1340 1363
1341#define PCI_VENDOR_ID_TRUEVISION 0x10fa 1364#define PCI_VENDOR_ID_TRUEVISION 0x10fa
@@ -1811,6 +1834,14 @@
1811#define PCI_DEVICE_ID_ESS_ESS1968 0x1968 1834#define PCI_DEVICE_ID_ESS_ESS1968 0x1968
1812#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969 1835#define PCI_DEVICE_ID_ESS_AUDIOPCI 0x1969
1813#define PCI_DEVICE_ID_ESS_ESS1978 0x1978 1836#define PCI_DEVICE_ID_ESS_ESS1978 0x1978
1837#define PCI_DEVICE_ID_ESS_ALLEGRO_1 0x1988
1838#define PCI_DEVICE_ID_ESS_ALLEGRO 0x1989
1839#define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990
1840#define PCI_DEVICE_ID_ESS_CANYON3D_2 0x1992
1841#define PCI_DEVICE_ID_ESS_MAESTRO3 0x1998
1842#define PCI_DEVICE_ID_ESS_MAESTRO3_1 0x1999
1843#define PCI_DEVICE_ID_ESS_MAESTRO3_HW 0x199a
1844#define PCI_DEVICE_ID_ESS_MAESTRO3_2 0x199b
1814 1845
1815#define PCI_VENDOR_ID_SATSAGEM 0x1267 1846#define PCI_VENDOR_ID_SATSAGEM 0x1267
1816#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016 1847#define PCI_DEVICE_ID_SATSAGEM_NICCY 0x1016
@@ -1970,6 +2001,9 @@
1970#define PCI_DEVICE_ID_LMC_SSI 0x0005 2001#define PCI_DEVICE_ID_LMC_SSI 0x0005
1971#define PCI_DEVICE_ID_LMC_T1 0x0006 2002#define PCI_DEVICE_ID_LMC_T1 0x0006
1972 2003
2004#define PCI_VENDOR_ID_MARIAN 0x1382
2005#define PCI_DEVICE_ID_MARIAN_PRODIF_PLUS 0x2048
2006
1973#define PCI_VENDOR_ID_NETGEAR 0x1385 2007#define PCI_VENDOR_ID_NETGEAR 0x1385
1974#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a 2008#define PCI_DEVICE_ID_NETGEAR_GA620 0x620a
1975#define PCI_DEVICE_ID_NETGEAR_GA622 0x622a 2009#define PCI_DEVICE_ID_NETGEAR_GA622 0x622a
@@ -2058,6 +2092,10 @@
2058#define PCI_VENDOR_ID_TIMEDIA 0x1409 2092#define PCI_VENDOR_ID_TIMEDIA 0x1409
2059#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168 2093#define PCI_DEVICE_ID_TIMEDIA_1889 0x7168
2060 2094
2095#define PCI_VENDOR_ID_ICE 0x1412
2096#define PCI_DEVICE_ID_ICE_1712 0x1712
2097#define PCI_DEVICE_ID_VT1724 0x1724
2098
2061#define PCI_VENDOR_ID_OXSEMI 0x1415 2099#define PCI_VENDOR_ID_OXSEMI 0x1415
2062#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403 2100#define PCI_DEVICE_ID_OXSEMI_12PCI840 0x8403
2063#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501 2101#define PCI_DEVICE_ID_OXSEMI_16PCI954 0x9501
@@ -2538,6 +2576,7 @@
2538#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191 2576#define PCI_DEVICE_ID_INTEL_82443BX_1 0x7191
2539#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192 2577#define PCI_DEVICE_ID_INTEL_82443BX_2 0x7192
2540#define PCI_DEVICE_ID_INTEL_440MX 0x7195 2578#define PCI_DEVICE_ID_INTEL_440MX 0x7195
2579#define PCI_DEVICE_ID_INTEL_440MX_6 0x7196
2541#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198 2580#define PCI_DEVICE_ID_INTEL_82443MX_0 0x7198
2542#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199 2581#define PCI_DEVICE_ID_INTEL_82443MX_1 0x7199
2543#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a 2582#define PCI_DEVICE_ID_INTEL_82443MX_2 0x719a
@@ -2644,6 +2683,11 @@
2644#define PCI_VENDOR_ID_TTTECH 0x0357 2683#define PCI_VENDOR_ID_TTTECH 0x0357
2645#define PCI_DEVICE_ID_TTTECH_MC322 0x000A 2684#define PCI_DEVICE_ID_TTTECH_MC322 0x000A
2646 2685
2686#define PCI_VENDOR_ID_XILINX_RME 0xea60
2687#define PCI_DEVICE_ID_RME_DIGI32 0x9896
2688#define PCI_DEVICE_ID_RME_DIGI32_PRO 0x9897
2689#define PCI_DEVICE_ID_RME_DIGI32_8 0x9898
2690
2647#define PCI_VENDOR_ID_ARK 0xedd8 2691#define PCI_VENDOR_ID_ARK 0xedd8
2648#define PCI_DEVICE_ID_ARK_STING 0xa091 2692#define PCI_DEVICE_ID_ARK_STING 0xa091
2649#define PCI_DEVICE_ID_ARK_STINGARK 0xa099 2693#define PCI_DEVICE_ID_ARK_STINGARK 0xa099
diff --git a/include/sound/core.h b/include/sound/core.h
index 3dc41fd5c54d..26160adcdffc 100644
--- a/include/sound/core.h
+++ b/include/sound/core.h
@@ -168,6 +168,9 @@ struct _snd_card {
168 wait_queue_head_t shutdown_sleep; 168 wait_queue_head_t shutdown_sleep;
169 struct work_struct free_workq; /* for free in workqueue */ 169 struct work_struct free_workq; /* for free in workqueue */
170 struct device *dev; 170 struct device *dev;
171#ifdef CONFIG_SND_GENERIC_DRIVER
172 struct snd_generic_device *generic_dev;
173#endif
171 174
172#ifdef CONFIG_PM 175#ifdef CONFIG_PM
173 int (*pm_suspend)(snd_card_t *card, pm_message_t state); 176 int (*pm_suspend)(snd_card_t *card, pm_message_t state);
@@ -176,9 +179,6 @@ struct _snd_card {
176 unsigned int power_state; /* power state */ 179 unsigned int power_state; /* power state */
177 struct semaphore power_lock; /* power lock */ 180 struct semaphore power_lock; /* power lock */
178 wait_queue_head_t power_sleep; 181 wait_queue_head_t power_sleep;
179#ifdef CONFIG_SND_GENERIC_PM
180 struct snd_generic_device *pm_dev; /* for ISA */
181#endif
182#endif 182#endif
183 183
184#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE) 184#if defined(CONFIG_SND_MIXER_OSS) || defined(CONFIG_SND_MIXER_OSS_MODULE)
@@ -348,6 +348,8 @@ int snd_card_file_remove(snd_card_t *card, struct file *file);
348#ifndef snd_card_set_dev 348#ifndef snd_card_set_dev
349#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr)) 349#define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
350#endif 350#endif
351/* register a generic device (for ISA, etc) */
352int snd_card_set_generic_dev(snd_card_t *card);
351 353
352/* device.c */ 354/* device.c */
353 355
diff --git a/include/sound/cs46xx.h b/include/sound/cs46xx.h
index 9b94510eda60..b0c0e192eb56 100644
--- a/include/sound/cs46xx.h
+++ b/include/sound/cs46xx.h
@@ -29,19 +29,6 @@
29#include "ac97_codec.h" 29#include "ac97_codec.h"
30#include "cs46xx_dsp_spos.h" 30#include "cs46xx_dsp_spos.h"
31 31
32#ifndef PCI_VENDOR_ID_CIRRUS
33#define PCI_VENDOR_ID_CIRRUS 0x1013
34#endif
35#ifndef PCI_DEVICE_ID_CIRRUS_4610
36#define PCI_DEVICE_ID_CIRRUS_4610 0x6001
37#endif
38#ifndef PCI_DEVICE_ID_CIRRUS_4612
39#define PCI_DEVICE_ID_CIRRUS_4612 0x6003
40#endif
41#ifndef PCI_DEVICE_ID_CIRRUS_4615
42#define PCI_DEVICE_ID_CIRRUS_4615 0x6004
43#endif
44
45/* 32/*
46 * Direct registers 33 * Direct registers
47 */ 34 */
@@ -1715,7 +1702,6 @@ struct _snd_cs46xx {
1715 void (*active_ctrl)(cs46xx_t *, int); 1702 void (*active_ctrl)(cs46xx_t *, int);
1716 void (*mixer_init)(cs46xx_t *); 1703 void (*mixer_init)(cs46xx_t *);
1717 1704
1718 struct pci_dev *acpi_dev;
1719 int acpi_port; 1705 int acpi_port;
1720 snd_kcontrol_t *eapd_switch; /* for amplifier hack */ 1706 snd_kcontrol_t *eapd_switch; /* for amplifier hack */
1721 int accept_valid; /* accept mmap valid (for OSS) */ 1707 int accept_valid; /* accept mmap valid (for OSS) */
diff --git a/include/sound/emu10k1.h b/include/sound/emu10k1.h
index 4e3993dfcefe..67bf3f18e96a 100644
--- a/include/sound/emu10k1.h
+++ b/include/sound/emu10k1.h
@@ -35,13 +35,6 @@
35#include <linux/interrupt.h> 35#include <linux/interrupt.h>
36#include <asm/io.h> 36#include <asm/io.h>
37 37
38#ifndef PCI_VENDOR_ID_CREATIVE
39#define PCI_VENDOR_ID_CREATIVE 0x1102
40#endif
41#ifndef PCI_DEVICE_ID_CREATIVE_EMU10K1
42#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
43#endif
44
45/* ------------------- DEFINES -------------------- */ 38/* ------------------- DEFINES -------------------- */
46 39
47#define EMUPAGESIZE 4096 40#define EMUPAGESIZE 4096
diff --git a/include/sound/pcm.h b/include/sound/pcm.h
index d6361dab0370..2b23a5967071 100644
--- a/include/sound/pcm.h
+++ b/include/sound/pcm.h
@@ -903,13 +903,16 @@ int snd_pcm_format_unsigned(snd_pcm_format_t format);
903int snd_pcm_format_linear(snd_pcm_format_t format); 903int snd_pcm_format_linear(snd_pcm_format_t format);
904int snd_pcm_format_little_endian(snd_pcm_format_t format); 904int snd_pcm_format_little_endian(snd_pcm_format_t format);
905int snd_pcm_format_big_endian(snd_pcm_format_t format); 905int snd_pcm_format_big_endian(snd_pcm_format_t format);
906/* 906#if 0 /* just for DocBook */
907/**
907 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian 908 * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
908 * @format: the format to check 909 * @format: the format to check
909 * 910 *
910 * Returns 1 if the given PCM format is CPU-endian, 0 if 911 * Returns 1 if the given PCM format is CPU-endian, 0 if
911 * opposite, or a negative error code if endian not specified. 912 * opposite, or a negative error code if endian not specified.
912 */ 913 */
914int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
915#endif /* DocBook */
913#ifdef SNDRV_LITTLE_ENDIAN 916#ifdef SNDRV_LITTLE_ENDIAN
914#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format) 917#define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format)
915#else 918#else
diff --git a/include/sound/pcm_oss.h b/include/sound/pcm_oss.h
index 518728536bc6..0b67c9d105af 100644
--- a/include/sound/pcm_oss.h
+++ b/include/sound/pcm_oss.h
@@ -32,7 +32,8 @@ struct _snd_pcm_oss_setup {
32 block:1, 32 block:1,
33 nonblock:1, 33 nonblock:1,
34 partialfrag:1, 34 partialfrag:1,
35 nosilence:1; 35 nosilence:1,
36 buggyptr:1;
36 unsigned int periods; 37 unsigned int periods;
37 unsigned int period_size; 38 unsigned int period_size;
38 snd_pcm_oss_setup_t *next; 39 snd_pcm_oss_setup_t *next;
diff --git a/include/sound/trident.h b/include/sound/trident.h
index f5254ec36e6a..a408d3925050 100644
--- a/include/sound/trident.h
+++ b/include/sound/trident.h
@@ -33,23 +33,6 @@
33//#include "ainstr_gf1.h" 33//#include "ainstr_gf1.h"
34#include "ainstr_simple.h" 34#include "ainstr_simple.h"
35 35
36#ifndef PCI_VENDOR_ID_TRIDENT
37#define PCI_VENDOR_ID_TRIDENT 0x1023
38#endif
39#ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_DX
40#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 0x2000
41#endif
42#ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_NX
43#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 0x2001
44#endif
45
46#ifndef PCI_VENDOR_ID_SI
47#define PCI_VENDOR_ID_SI 0x1039
48#endif
49#ifndef PCI_DEVICE_ID_SI_7018
50#define PCI_DEVICE_ID_SI_7018 0x7018
51#endif
52
53#define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX) 36#define TRIDENT_DEVICE_ID_DX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX)
54#define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX) 37#define TRIDENT_DEVICE_ID_NX ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX)
55#define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018) 38#define TRIDENT_DEVICE_ID_SI7018 ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018)
diff --git a/include/sound/version.h b/include/sound/version.h
index 8d19bfabb7e0..ee32af20dba9 100644
--- a/include/sound/version.h
+++ b/include/sound/version.h
@@ -1,3 +1,3 @@
1/* include/version.h. Generated by configure. */ 1/* include/version.h. Generated by configure. */
2#define CONFIG_SND_VERSION "1.0.10rc1" 2#define CONFIG_SND_VERSION "1.0.10rc1"
3#define CONFIG_SND_DATE " (Tue Aug 30 05:31:08 2005 UTC)" 3#define CONFIG_SND_DATE " (Mon Sep 12 08:13:09 2005 UTC)"
diff --git a/include/sound/ymfpci.h b/include/sound/ymfpci.h
index 9a3c1e6c820a..c3bccbfd8d4c 100644
--- a/include/sound/ymfpci.h
+++ b/include/sound/ymfpci.h
@@ -28,28 +28,6 @@
28#include "timer.h" 28#include "timer.h"
29#include <linux/gameport.h> 29#include <linux/gameport.h>
30 30
31#ifndef PCI_VENDOR_ID_YAMAHA
32#define PCI_VENDOR_ID_YAMAHA 0x1073
33#endif
34#ifndef PCI_DEVICE_ID_YAMAHA_724
35#define PCI_DEVICE_ID_YAMAHA_724 0x0004
36#endif
37#ifndef PCI_DEVICE_ID_YAMAHA_724F
38#define PCI_DEVICE_ID_YAMAHA_724F 0x000d
39#endif
40#ifndef PCI_DEVICE_ID_YAMAHA_740
41#define PCI_DEVICE_ID_YAMAHA_740 0x000a
42#endif
43#ifndef PCI_DEVICE_ID_YAMAHA_740C
44#define PCI_DEVICE_ID_YAMAHA_740C 0x000c
45#endif
46#ifndef PCI_DEVICE_ID_YAMAHA_744
47#define PCI_DEVICE_ID_YAMAHA_744 0x0010
48#endif
49#ifndef PCI_DEVICE_ID_YAMAHA_754
50#define PCI_DEVICE_ID_YAMAHA_754 0x0012
51#endif
52
53/* 31/*
54 * Direct registers 32 * Direct registers
55 */ 33 */
diff --git a/sound/arm/Kconfig b/sound/arm/Kconfig
index 2e4a5e0d16db..0864a7ce414d 100644
--- a/sound/arm/Kconfig
+++ b/sound/arm/Kconfig
@@ -7,6 +7,7 @@ config SND_SA11XX_UDA1341
7 tristate "SA11xx UDA1341TS driver (iPaq H3600)" 7 tristate "SA11xx UDA1341TS driver (iPaq H3600)"
8 depends on ARCH_SA1100 && SND && L3 8 depends on ARCH_SA1100 && SND && L3
9 select SND_PCM 9 select SND_PCM
10 select SND_GENERIC_DRIVER
10 help 11 help
11 Say Y here if you have a Compaq iPaq H3x00 handheld computer 12 Say Y here if you have a Compaq iPaq H3x00 handheld computer
12 and want to use its Philips UDA 1341 audio chip. 13 and want to use its Philips UDA 1341 audio chip.
diff --git a/sound/arm/aaci.c b/sound/arm/aaci.c
index 98877030d579..34195b748608 100644
--- a/sound/arm/aaci.c
+++ b/sound/arm/aaci.c
@@ -900,6 +900,8 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id)
900 if (ret) 900 if (ret)
901 goto out; 901 goto out;
902 902
903 snd_card_set_dev(aaci->card, &dev->dev);
904
903 ret = snd_card_register(aaci->card); 905 ret = snd_card_register(aaci->card);
904 if (ret == 0) { 906 if (ret == 0) {
905 dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname, 907 dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname,
diff --git a/sound/arm/sa11xx-uda1341.c b/sound/arm/sa11xx-uda1341.c
index 174bc032d1ad..6ee912259cc5 100644
--- a/sound/arm/sa11xx-uda1341.c
+++ b/sound/arm/sa11xx-uda1341.c
@@ -21,7 +21,7 @@
21 * merged HAL layer (patches from Brian) 21 * merged HAL layer (patches from Brian)
22 */ 22 */
23 23
24/* $Id: sa11xx-uda1341.c,v 1.21 2005/01/28 19:34:04 tiwai Exp $ */ 24/* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */
25 25
26/*************************************************************************************************** 26/***************************************************************************************************
27* 27*
@@ -918,7 +918,7 @@ static int __init sa11xx_uda1341_init(void)
918 if (card == NULL) 918 if (card == NULL)
919 return -ENOMEM; 919 return -ENOMEM;
920 920
921 sa11xx_uda1341 = kcalloc(1, sizeof(*sa11xx_uda1341), GFP_KERNEL); 921 sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL);
922 if (sa11xx_uda1341 == NULL) 922 if (sa11xx_uda1341 == NULL)
923 return -ENOMEM; 923 return -ENOMEM;
924 spin_lock_init(&chip->s[0].dma_lock); 924 spin_lock_init(&chip->s[0].dma_lock);
@@ -946,6 +946,9 @@ static int __init sa11xx_uda1341_init(void)
946 strcpy(card->shortname, "H3600 UDA1341TS"); 946 strcpy(card->shortname, "H3600 UDA1341TS");
947 sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS"); 947 sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS");
948 948
949 if ((err = snd_card_set_generic_dev(card)) < 0)
950 goto nodev;
951
949 if ((err = snd_card_register(card)) == 0) { 952 if ((err = snd_card_register(card)) == 0) {
950 printk( KERN_INFO "iPAQ audio support initialized\n" ); 953 printk( KERN_INFO "iPAQ audio support initialized\n" );
951 return 0; 954 return 0;
diff --git a/sound/core/Kconfig b/sound/core/Kconfig
index d1e800b9866d..48cf45cfd0b7 100644
--- a/sound/core/Kconfig
+++ b/sound/core/Kconfig
@@ -99,6 +99,18 @@ config SND_RTCTIMER
99 To compile this driver as a module, choose M here: the module 99 To compile this driver as a module, choose M here: the module
100 will be called snd-rtctimer. 100 will be called snd-rtctimer.
101 101
102config SND_SEQ_RTCTIMER_DEFAULT
103 bool "Use RTC as default sequencer timer"
104 depends on SND_RTCTIMER && SND_SEQUENCER
105 default y
106 help
107 Say Y here to use the RTC timer as the default sequencer
108 timer. This is strongly recommended because it ensures
109 precise MIDI timing even when the system timer runs at less
110 than 1000 Hz.
111
112 If in doubt, say Y.
113
102config SND_VERBOSE_PRINTK 114config SND_VERBOSE_PRINTK
103 bool "Verbose printk" 115 bool "Verbose printk"
104 depends on SND 116 depends on SND
@@ -128,6 +140,6 @@ config SND_DEBUG_DETECT
128 Say Y here to enable extra-verbose log messages printed when 140 Say Y here to enable extra-verbose log messages printed when
129 detecting devices. 141 detecting devices.
130 142
131config SND_GENERIC_PM 143config SND_GENERIC_DRIVER
132 bool 144 bool
133 depends on SND 145 depends on SND
diff --git a/sound/core/control.c b/sound/core/control.c
index 227f3cf02771..736edf358e05 100644
--- a/sound/core/control.c
+++ b/sound/core/control.c
@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
69 err = -EFAULT; 69 err = -EFAULT;
70 goto __error2; 70 goto __error2;
71 } 71 }
72 ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL); 72 ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
73 if (ctl == NULL) { 73 if (ctl == NULL) {
74 err = -ENOMEM; 74 err = -ENOMEM;
75 goto __error; 75 goto __error;
@@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id)
162 goto _found; 162 goto _found;
163 } 163 }
164 } 164 }
165 ev = kcalloc(1, sizeof(*ev), GFP_ATOMIC); 165 ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
166 if (ev) { 166 if (ev) {
167 ev->id = *id; 167 ev->id = *id;
168 ev->mask = mask; 168 ev->mask = mask;
@@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access)
195 195
196 snd_runtime_check(control != NULL, return NULL); 196 snd_runtime_check(control != NULL, return NULL);
197 snd_runtime_check(control->count > 0, return NULL); 197 snd_runtime_check(control->count > 0, return NULL);
198 kctl = kcalloc(1, sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL); 198 kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL);
199 if (kctl == NULL) 199 if (kctl == NULL)
200 return NULL; 200 return NULL;
201 *kctl = *control; 201 *kctl = *control;
@@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
521{ 521{
522 snd_ctl_card_info_t *info; 522 snd_ctl_card_info_t *info;
523 523
524 info = kcalloc(1, sizeof(*info), GFP_KERNEL); 524 info = kzalloc(sizeof(*info), GFP_KERNEL);
525 if (! info) 525 if (! info)
526 return -ENOMEM; 526 return -ENOMEM;
527 down_read(&snd_ioctl_rwsem); 527 down_read(&snd_ioctl_rwsem);
@@ -929,7 +929,7 @@ static int snd_ctl_elem_add(snd_ctl_file_t *file, snd_ctl_elem_info_t *info, int
929 return -EINVAL; 929 return -EINVAL;
930 } 930 }
931 private_size *= info->count; 931 private_size *= info->count;
932 ue = kcalloc(1, sizeof(struct user_element) + private_size, GFP_KERNEL); 932 ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL);
933 if (ue == NULL) 933 if (ue == NULL)
934 return -ENOMEM; 934 return -ENOMEM;
935 ue->info = *info; 935 ue->info = *info;
@@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *
1185{ 1185{
1186 snd_kctl_ioctl_t *pn; 1186 snd_kctl_ioctl_t *pn;
1187 1187
1188 pn = kcalloc(1, sizeof(snd_kctl_ioctl_t), GFP_KERNEL); 1188 pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL);
1189 if (pn == NULL) 1189 if (pn == NULL)
1190 return -ENOMEM; 1190 return -ENOMEM;
1191 pn->fioctl = fcn; 1191 pn->fioctl = fcn;
diff --git a/sound/core/control_compat.c b/sound/core/control_compat.c
index 7fdabea4bfc8..207c7de5129c 100644
--- a/sound/core/control_compat.c
+++ b/sound/core/control_compat.c
@@ -92,7 +92,7 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i
92 struct sndrv_ctl_elem_info *data; 92 struct sndrv_ctl_elem_info *data;
93 int err; 93 int err;
94 94
95 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 95 data = kzalloc(sizeof(*data), GFP_KERNEL);
96 if (! data) 96 if (! data)
97 return -ENOMEM; 97 return -ENOMEM;
98 98
@@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card,
271 struct sndrv_ctl_elem_value *data; 271 struct sndrv_ctl_elem_value *data;
272 int err, type, count; 272 int err, type, count;
273 273
274 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 274 data = kzalloc(sizeof(*data), GFP_KERNEL);
275 if (data == NULL) 275 if (data == NULL)
276 return -ENOMEM; 276 return -ENOMEM;
277 277
@@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
291 struct sndrv_ctl_elem_value *data; 291 struct sndrv_ctl_elem_value *data;
292 int err, type, count; 292 int err, type, count;
293 293
294 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 294 data = kzalloc(sizeof(*data), GFP_KERNEL);
295 if (data == NULL) 295 if (data == NULL)
296 return -ENOMEM; 296 return -ENOMEM;
297 297
@@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
313 struct sndrv_ctl_elem_info *data; 313 struct sndrv_ctl_elem_info *data;
314 int err; 314 int err;
315 315
316 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 316 data = kzalloc(sizeof(*data), GFP_KERNEL);
317 if (! data) 317 if (! data)
318 return -ENOMEM; 318 return -ENOMEM;
319 319
diff --git a/sound/core/device.c b/sound/core/device.c
index ca00ad7740c9..1f509f56e60c 100644
--- a/sound/core/device.c
+++ b/sound/core/device.c
@@ -49,7 +49,7 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type,
49 snd_assert(card != NULL, return -ENXIO); 49 snd_assert(card != NULL, return -ENXIO);
50 snd_assert(device_data != NULL, return -ENXIO); 50 snd_assert(device_data != NULL, return -ENXIO);
51 snd_assert(ops != NULL, return -ENXIO); 51 snd_assert(ops != NULL, return -ENXIO);
52 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); 52 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
53 if (dev == NULL) 53 if (dev == NULL)
54 return -ENOMEM; 54 return -ENOMEM;
55 dev->card = card; 55 dev->card = card;
diff --git a/sound/core/hwdep.c b/sound/core/hwdep.c
index 997dd41c584e..9383f1294fb5 100644
--- a/sound/core/hwdep.c
+++ b/sound/core/hwdep.c
@@ -359,7 +359,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep
359 snd_assert(rhwdep != NULL, return -EINVAL); 359 snd_assert(rhwdep != NULL, return -EINVAL);
360 *rhwdep = NULL; 360 *rhwdep = NULL;
361 snd_assert(card != NULL, return -ENXIO); 361 snd_assert(card != NULL, return -ENXIO);
362 hwdep = kcalloc(1, sizeof(*hwdep), GFP_KERNEL); 362 hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
363 if (hwdep == NULL) 363 if (hwdep == NULL)
364 return -ENOMEM; 364 return -ENOMEM;
365 hwdep->card = card; 365 hwdep->card = card;
diff --git a/sound/core/info.c b/sound/core/info.c
index 7f8bdf7b0058..37024d68a26e 100644
--- a/sound/core/info.c
+++ b/sound/core/info.c
@@ -295,7 +295,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
295 goto __error; 295 goto __error;
296 } 296 }
297 } 297 }
298 data = kcalloc(1, sizeof(*data), GFP_KERNEL); 298 data = kzalloc(sizeof(*data), GFP_KERNEL);
299 if (data == NULL) { 299 if (data == NULL) {
300 err = -ENOMEM; 300 err = -ENOMEM;
301 goto __error; 301 goto __error;
@@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
304 switch (entry->content) { 304 switch (entry->content) {
305 case SNDRV_INFO_CONTENT_TEXT: 305 case SNDRV_INFO_CONTENT_TEXT:
306 if (mode == O_RDONLY || mode == O_RDWR) { 306 if (mode == O_RDONLY || mode == O_RDWR) {
307 buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); 307 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
308 if (buffer == NULL) { 308 if (buffer == NULL) {
309 kfree(data); 309 kfree(data);
310 err = -ENOMEM; 310 err = -ENOMEM;
@@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
323 data->rbuffer = buffer; 323 data->rbuffer = buffer;
324 } 324 }
325 if (mode == O_WRONLY || mode == O_RDWR) { 325 if (mode == O_WRONLY || mode == O_RDWR) {
326 buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL); 326 buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
327 if (buffer == NULL) { 327 if (buffer == NULL) {
328 if (mode == O_RDWR) { 328 if (mode == O_RDWR) {
329 vfree(data->rbuffer->buffer); 329 vfree(data->rbuffer->buffer);
@@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len)
752static snd_info_entry_t *snd_info_create_entry(const char *name) 752static snd_info_entry_t *snd_info_create_entry(const char *name)
753{ 753{
754 snd_info_entry_t *entry; 754 snd_info_entry_t *entry;
755 entry = kcalloc(1, sizeof(*entry), GFP_KERNEL); 755 entry = kzalloc(sizeof(*entry), GFP_KERNEL);
756 if (entry == NULL) 756 if (entry == NULL)
757 return NULL; 757 return NULL;
758 entry->name = kstrdup(name, GFP_KERNEL); 758 entry->name = kstrdup(name, GFP_KERNEL);
diff --git a/sound/core/init.c b/sound/core/init.c
index d72f58f450ce..a5702014a704 100644
--- a/sound/core/init.c
+++ b/sound/core/init.c
@@ -72,7 +72,7 @@ snd_card_t *snd_card_new(int idx, const char *xid,
72 72
73 if (extra_size < 0) 73 if (extra_size < 0)
74 extra_size = 0; 74 extra_size = 0;
75 card = kcalloc(1, sizeof(*card) + extra_size, GFP_KERNEL); 75 card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
76 if (card == NULL) 76 if (card == NULL)
77 return NULL; 77 return NULL;
78 if (xid) { 78 if (xid) {
@@ -226,8 +226,10 @@ int snd_card_disconnect(snd_card_t * card)
226 return 0; 226 return 0;
227} 227}
228 228
229#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) 229#ifdef CONFIG_SND_GENERIC_DRIVER
230static void snd_generic_device_unregister(struct snd_generic_device *dev); 230static void snd_generic_device_unregister(snd_card_t *card);
231#else
232#define snd_generic_device_unregister(x) /*NOP*/
231#endif 233#endif
232 234
233/** 235/**
@@ -253,14 +255,7 @@ int snd_card_free(snd_card_t * card)
253 255
254#ifdef CONFIG_PM 256#ifdef CONFIG_PM
255 wake_up(&card->power_sleep); 257 wake_up(&card->power_sleep);
256#ifdef CONFIG_SND_GENERIC_PM
257 if (card->pm_dev) {
258 snd_generic_device_unregister(card->pm_dev);
259 card->pm_dev = NULL;
260 }
261#endif
262#endif 258#endif
263
264 /* wait, until all devices are ready for the free operation */ 259 /* wait, until all devices are ready for the free operation */
265 wait_event(card->shutdown_sleep, card->files == NULL); 260 wait_event(card->shutdown_sleep, card->files == NULL);
266 261
@@ -288,6 +283,7 @@ int snd_card_free(snd_card_t * card)
288 snd_printk(KERN_WARNING "unable to free card info\n"); 283 snd_printk(KERN_WARNING "unable to free card info\n");
289 /* Not fatal error */ 284 /* Not fatal error */
290 } 285 }
286 snd_generic_device_unregister(card);
291 while (card->s_f_ops) { 287 while (card->s_f_ops) {
292 s_f_ops = card->s_f_ops; 288 s_f_ops = card->s_f_ops;
293 card->s_f_ops = s_f_ops->next; 289 card->s_f_ops = s_f_ops->next;
@@ -665,6 +661,96 @@ int snd_card_file_remove(snd_card_t *card, struct file *file)
665 return 0; 661 return 0;
666} 662}
667 663
664#ifdef CONFIG_SND_GENERIC_DRIVER
665/*
666 * generic device without a proper bus using platform_device
667 * (e.g. ISA)
668 */
669struct snd_generic_device {
670 struct platform_device pdev;
671 snd_card_t *card;
672};
673
674#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card
675
676#define SND_GENERIC_NAME "snd_generic"
677
678#ifdef CONFIG_PM
679static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
680static int snd_generic_resume(struct device *dev, u32 level);
681#endif
682
683/* initialized in sound.c */
684struct device_driver snd_generic_driver = {
685 .name = SND_GENERIC_NAME,
686 .bus = &platform_bus_type,
687#ifdef CONFIG_PM
688 .suspend = snd_generic_suspend,
689 .resume = snd_generic_resume,
690#endif
691};
692
693void snd_generic_device_release(struct device *dev)
694{
695}
696
697static int snd_generic_device_register(snd_card_t *card)
698{
699 struct snd_generic_device *dev;
700 int err;
701
702 if (card->generic_dev)
703 return 0; /* already registered */
704
705 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
706 if (! dev) {
707 snd_printk(KERN_ERR "can't allocate generic_device\n");
708 return -ENOMEM;
709 }
710
711 dev->pdev.name = SND_GENERIC_NAME;
712 dev->pdev.id = card->number;
713 dev->pdev.dev.release = snd_generic_device_release;
714 dev->card = card;
715 if ((err = platform_device_register(&dev->pdev)) < 0) {
716 kfree(dev);
717 return err;
718 }
719 card->generic_dev = dev;
720 return 0;
721}
722
723static void snd_generic_device_unregister(snd_card_t *card)
724{
725 struct snd_generic_device *dev = card->generic_dev;
726 if (dev) {
727 platform_device_unregister(&dev->pdev);
728 kfree(dev);
729 card->generic_dev = NULL;
730 }
731}
732
733/**
734 * snd_card_set_generic_dev - assign the generic device to the card
735 * @card: soundcard structure
736 *
737 * Assigns a generic device to the card. This function is provided as the
738 * last resort, for devices without any proper bus. Thus this won't override
739 * the device already assigned to the card.
740 *
741 * Returns zero if successful, or a negative error code.
742 */
743int snd_card_set_generic_dev(snd_card_t *card)
744{
745 int err;
746 if ((err = snd_generic_device_register(card)) < 0)
747 return err;
748 if (! card->dev)
749 snd_card_set_dev(card, &card->generic_dev->pdev.dev);
750 return 0;
751}
752#endif /* CONFIG_SND_GENERIC_DRIVER */
753
668#ifdef CONFIG_PM 754#ifdef CONFIG_PM
669/** 755/**
670 * snd_power_wait - wait until the power-state is changed. 756 * snd_power_wait - wait until the power-state is changed.
@@ -730,75 +816,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
730 return 0; 816 return 0;
731} 817}
732 818
733#ifdef CONFIG_SND_GENERIC_PM 819#ifdef CONFIG_SND_GENERIC_DRIVER
734/*
735 * use platform_device for generic power-management without a proper bus
736 * (e.g. ISA)
737 */
738struct snd_generic_device {
739 struct platform_device pdev;
740 snd_card_t *card;
741};
742
743#define get_snd_generic_card(dev) container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card
744
745#define SND_GENERIC_NAME "snd_generic_pm"
746
747static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
748static int snd_generic_resume(struct device *dev, u32 level);
749
750static struct device_driver snd_generic_driver = {
751 .name = SND_GENERIC_NAME,
752 .bus = &platform_bus_type,
753 .suspend = snd_generic_suspend,
754 .resume = snd_generic_resume,
755};
756
757static int generic_driver_registered;
758
759static void generic_driver_unregister(void)
760{
761 if (generic_driver_registered) {
762 generic_driver_registered--;
763 if (! generic_driver_registered)
764 driver_unregister(&snd_generic_driver);
765 }
766}
767
768static struct snd_generic_device *snd_generic_device_register(snd_card_t *card)
769{
770 struct snd_generic_device *dev;
771
772 if (! generic_driver_registered) {
773 if (driver_register(&snd_generic_driver) < 0)
774 return NULL;
775 }
776 generic_driver_registered++;
777
778 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL);
779 if (! dev) {
780 generic_driver_unregister();
781 return NULL;
782 }
783
784 dev->pdev.name = SND_GENERIC_NAME;
785 dev->pdev.id = card->number;
786 dev->card = card;
787 if (platform_device_register(&dev->pdev) < 0) {
788 kfree(dev);
789 generic_driver_unregister();
790 return NULL;
791 }
792 return dev;
793}
794
795static void snd_generic_device_unregister(struct snd_generic_device *dev)
796{
797 platform_device_unregister(&dev->pdev);
798 kfree(dev);
799 generic_driver_unregister();
800}
801
802/* suspend/resume callbacks for snd_generic platform device */ 820/* suspend/resume callbacks for snd_generic platform device */
803static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level) 821static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level)
804{ 822{
@@ -846,13 +864,12 @@ int snd_card_set_generic_pm_callback(snd_card_t *card,
846 int (*resume)(snd_card_t *), 864 int (*resume)(snd_card_t *),
847 void *private_data) 865 void *private_data)
848{ 866{
849 card->pm_dev = snd_generic_device_register(card); 867 int err;
850 if (! card->pm_dev) 868 if ((err = snd_generic_device_register(card)) < 0)
851 return -ENOMEM; 869 return err;
852 snd_card_set_pm_callback(card, suspend, resume, private_data); 870 return snd_card_set_pm_callback(card, suspend, resume, private_data);
853 return 0;
854} 871}
855#endif /* CONFIG_SND_GENERIC_PM */ 872#endif /* CONFIG_SND_GENERIC_DRIVER */
856 873
857#ifdef CONFIG_PCI 874#ifdef CONFIG_PCI
858int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state) 875int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state)
diff --git a/sound/core/memalloc.c b/sound/core/memalloc.c
index 39a54a415528..91124ddbdda9 100644
--- a/sound/core/memalloc.c
+++ b/sound/core/memalloc.c
@@ -590,7 +590,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
590 590
591 alloced = 0; 591 alloced = 0;
592 pci = NULL; 592 pci = NULL;
593 while ((pci = pci_find_device(vendor, device, pci)) != NULL) { 593 while ((pci = pci_get_device(vendor, device, pci)) != NULL) {
594 if (mask > 0 && mask < 0xffffffff) { 594 if (mask > 0 && mask < 0xffffffff) {
595 if (pci_set_dma_mask(pci, mask) < 0 || 595 if (pci_set_dma_mask(pci, mask) < 0 ||
596 pci_set_consistent_dma_mask(pci, mask) < 0) { 596 pci_set_consistent_dma_mask(pci, mask) < 0) {
@@ -604,6 +604,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
604 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci), 604 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
605 size, &dmab) < 0) { 605 size, &dmab) < 0) {
606 printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size); 606 printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size);
607 pci_dev_put(pci);
607 return (int)count; 608 return (int)count;
608 } 609 }
609 snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci)); 610 snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci));
diff --git a/sound/core/memory.c b/sound/core/memory.c
index 291b4769bde3..8fa888fc53a0 100644
--- a/sound/core/memory.c
+++ b/sound/core/memory.c
@@ -249,7 +249,7 @@ int __exit snd_memory_info_done(void)
249int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count) 249int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count)
250{ 250{
251#if defined(__i386__) || defined(CONFIG_SPARC32) 251#if defined(__i386__) || defined(CONFIG_SPARC32)
252 return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0; 252 return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0;
253#else 253#else
254 char buf[256]; 254 char buf[256];
255 while (count) { 255 while (count) {
@@ -280,7 +280,7 @@ int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size
280int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count) 280int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count)
281{ 281{
282#if defined(__i386__) || defined(CONFIG_SPARC32) 282#if defined(__i386__) || defined(CONFIG_SPARC32)
283 return copy_from_user((void*)dst, src, count) ? -EFAULT : 0; 283 return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0;
284#else 284#else
285 char buf[256]; 285 char buf[256];
286 while (count) { 286 while (count) {
diff --git a/sound/core/oss/mixer_oss.c b/sound/core/oss/mixer_oss.c
index 98fc0766f885..69e1059112d1 100644
--- a/sound/core/oss/mixer_oss.c
+++ b/sound/core/oss/mixer_oss.c
@@ -53,7 +53,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
53 err = snd_card_file_add(card, file); 53 err = snd_card_file_add(card, file);
54 if (err < 0) 54 if (err < 0)
55 return err; 55 return err;
56 fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL); 56 fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
57 if (fmixer == NULL) { 57 if (fmixer == NULL) {
58 snd_card_file_remove(card, file); 58 snd_card_file_remove(card, file);
59 return -ENOMEM; 59 return -ENOMEM;
@@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer,
517 up_read(&card->controls_rwsem); 517 up_read(&card->controls_rwsem);
518 return; 518 return;
519 } 519 }
520 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 520 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
521 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 521 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
522 if (uinfo == NULL || uctl == NULL) 522 if (uinfo == NULL || uctl == NULL)
523 goto __unalloc; 523 goto __unalloc;
524 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 524 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
@@ -551,8 +551,8 @@ static void snd_mixer_oss_get_volume1_sw(snd_mixer_oss_file_t *fmixer,
551 up_read(&card->controls_rwsem); 551 up_read(&card->controls_rwsem);
552 return; 552 return;
553 } 553 }
554 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 554 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
555 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 555 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
556 if (uinfo == NULL || uctl == NULL) 556 if (uinfo == NULL || uctl == NULL)
557 goto __unalloc; 557 goto __unalloc;
558 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 558 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
@@ -612,8 +612,8 @@ static void snd_mixer_oss_put_volume1_vol(snd_mixer_oss_file_t *fmixer,
612 down_read(&card->controls_rwsem); 612 down_read(&card->controls_rwsem);
613 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL) 613 if ((kctl = snd_ctl_find_numid(card, numid)) == NULL)
614 return; 614 return;
615 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 615 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
616 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 616 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
617 if (uinfo == NULL || uctl == NULL) 617 if (uinfo == NULL || uctl == NULL)
618 goto __unalloc; 618 goto __unalloc;
619 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 619 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
@@ -649,8 +649,8 @@ static void snd_mixer_oss_put_volume1_sw(snd_mixer_oss_file_t *fmixer,
649 up_read(&fmixer->card->controls_rwsem); 649 up_read(&fmixer->card->controls_rwsem);
650 return; 650 return;
651 } 651 }
652 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 652 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
653 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 653 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
654 if (uinfo == NULL || uctl == NULL) 654 if (uinfo == NULL || uctl == NULL)
655 goto __unalloc; 655 goto __unalloc;
656 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc); 656 snd_runtime_check(!kctl->info(kctl, uinfo), goto __unalloc);
@@ -768,8 +768,8 @@ static int snd_mixer_oss_get_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
768 snd_ctl_elem_value_t *uctl; 768 snd_ctl_elem_value_t *uctl;
769 int err, idx; 769 int err, idx;
770 770
771 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 771 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
772 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 772 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
773 if (uinfo == NULL || uctl == NULL) { 773 if (uinfo == NULL || uctl == NULL) {
774 err = -ENOMEM; 774 err = -ENOMEM;
775 goto __unlock; 775 goto __unlock;
@@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
813 int err; 813 int err;
814 unsigned int idx; 814 unsigned int idx;
815 815
816 uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL); 816 uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
817 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 817 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
818 if (uinfo == NULL || uctl == NULL) { 818 if (uinfo == NULL || uctl == NULL) {
819 err = -ENOMEM; 819 err = -ENOMEM;
820 goto __unlock; 820 goto __unlock;
diff --git a/sound/core/oss/pcm_oss.c b/sound/core/oss/pcm_oss.c
index a13bd7bb4c9f..842c28b2ed55 100644
--- a/sound/core/oss/pcm_oss.c
+++ b/sound/core/oss/pcm_oss.c
@@ -850,7 +850,9 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __u
850 return xfer > 0 ? xfer : -EAGAIN; 850 return xfer > 0 ? xfer : -EAGAIN;
851 } 851 }
852 } else { 852 } else {
853 tmp = snd_pcm_oss_write2(substream, (const char *)buf, runtime->oss.period_bytes, 0); 853 tmp = snd_pcm_oss_write2(substream,
854 (const char __force *)buf,
855 runtime->oss.period_bytes, 0);
854 if (tmp <= 0) 856 if (tmp <= 0)
855 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 857 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
856 runtime->oss.bytes += tmp; 858 runtime->oss.bytes += tmp;
@@ -926,7 +928,8 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu
926 xfer += tmp; 928 xfer += tmp;
927 runtime->oss.buffer_used -= tmp; 929 runtime->oss.buffer_used -= tmp;
928 } else { 930 } else {
929 tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0); 931 tmp = snd_pcm_oss_read2(substream, (char __force *)buf,
932 runtime->oss.period_bytes, 0);
930 if (tmp <= 0) 933 if (tmp <= 0)
931 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp; 934 return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
932 runtime->oss.bytes += tmp; 935 runtime->oss.bytes += tmp;
@@ -1540,7 +1543,11 @@ static int snd_pcm_oss_get_ptr(snd_pcm_oss_file_t *pcm_oss_file, int stream, str
1540 } else { 1543 } else {
1541 delay = snd_pcm_oss_bytes(substream, delay); 1544 delay = snd_pcm_oss_bytes(substream, delay);
1542 if (stream == SNDRV_PCM_STREAM_PLAYBACK) { 1545 if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
1543 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes; 1546 snd_pcm_oss_setup_t *setup = substream->oss.setup;
1547 if (setup && setup->buggyptr)
1548 info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
1549 else
1550 info.blocks = (delay + fixup) / runtime->oss.period_bytes;
1544 info.bytes = (runtime->oss.bytes - delay) & INT_MAX; 1551 info.bytes = (runtime->oss.bytes - delay) & INT_MAX;
1545 } else { 1552 } else {
1546 delay += fixup; 1553 delay += fixup;
@@ -1733,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file,
1733 snd_assert(rpcm_oss_file != NULL, return -EINVAL); 1740 snd_assert(rpcm_oss_file != NULL, return -EINVAL);
1734 *rpcm_oss_file = NULL; 1741 *rpcm_oss_file = NULL;
1735 1742
1736 pcm_oss_file = kcalloc(1, sizeof(*pcm_oss_file), GFP_KERNEL); 1743 pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
1737 if (pcm_oss_file == NULL) 1744 if (pcm_oss_file == NULL)
1738 return -ENOMEM; 1745 return -ENOMEM;
1739 1746
@@ -2347,6 +2354,8 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
2347 template.partialfrag = 1; 2354 template.partialfrag = 1;
2348 } else if (!strcmp(str, "no-silence")) { 2355 } else if (!strcmp(str, "no-silence")) {
2349 template.nosilence = 1; 2356 template.nosilence = 1;
2357 } else if (!strcmp(str, "buggy-ptr")) {
2358 template.buggyptr = 1;
2350 } 2359 }
2351 } while (*str); 2360 } while (*str);
2352 if (setup == NULL) { 2361 if (setup == NULL) {
diff --git a/sound/core/oss/pcm_plugin.c b/sound/core/oss/pcm_plugin.c
index 6430410c6c04..fc23373c000d 100644
--- a/sound/core/oss/pcm_plugin.c
+++ b/sound/core/oss/pcm_plugin.c
@@ -171,7 +171,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug,
171 171
172 snd_assert(plug != NULL, return -ENXIO); 172 snd_assert(plug != NULL, return -ENXIO);
173 snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO); 173 snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO);
174 plugin = kcalloc(1, sizeof(*plugin) + extra, GFP_KERNEL); 174 plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL);
175 if (plugin == NULL) 175 if (plugin == NULL)
176 return -ENOMEM; 176 return -ENOMEM;
177 plugin->name = name; 177 plugin->name = name;
diff --git a/sound/core/pcm.c b/sound/core/pcm.c
index 9f4c9209b271..1be470e942ef 100644
--- a/sound/core/pcm.c
+++ b/sound/core/pcm.c
@@ -597,7 +597,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
597 } 597 }
598 prev = NULL; 598 prev = NULL;
599 for (idx = 0, prev = NULL; idx < substream_count; idx++) { 599 for (idx = 0, prev = NULL; idx < substream_count; idx++) {
600 substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); 600 substream = kzalloc(sizeof(*substream), GFP_KERNEL);
601 if (substream == NULL) 601 if (substream == NULL)
602 return -ENOMEM; 602 return -ENOMEM;
603 substream->pcm = pcm; 603 substream->pcm = pcm;
@@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device,
657 snd_assert(rpcm != NULL, return -EINVAL); 657 snd_assert(rpcm != NULL, return -EINVAL);
658 *rpcm = NULL; 658 *rpcm = NULL;
659 snd_assert(card != NULL, return -ENXIO); 659 snd_assert(card != NULL, return -ENXIO);
660 pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL); 660 pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
661 if (pcm == NULL) 661 if (pcm == NULL)
662 return -ENOMEM; 662 return -ENOMEM;
663 pcm->card = card; 663 pcm->card = card;
@@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
795 if (substream == NULL) 795 if (substream == NULL)
796 return -EAGAIN; 796 return -EAGAIN;
797 797
798 runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL); 798 runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
799 if (runtime == NULL) 799 if (runtime == NULL)
800 return -ENOMEM; 800 return -ENOMEM;
801 801
diff --git a/sound/core/pcm_lib.c b/sound/core/pcm_lib.c
index 0082914a7e33..0503980c23d9 100644
--- a/sound/core/pcm_lib.c
+++ b/sound/core/pcm_lib.c
@@ -524,6 +524,9 @@ void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_inte
524 524
525/** 525/**
526 * snd_interval_div - refine the interval value with division 526 * snd_interval_div - refine the interval value with division
527 * @a: dividend
528 * @b: divisor
529 * @c: quotient
527 * 530 *
528 * c = a / b 531 * c = a / b
529 * 532 *
@@ -555,7 +558,11 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte
555 558
556/** 559/**
557 * snd_interval_muldivk - refine the interval value 560 * snd_interval_muldivk - refine the interval value
558 * 561 * @a: dividend 1
562 * @b: dividend 2
563 * @k: divisor (as integer)
564 * @c: result
565 *
559 * c = a * b / k 566 * c = a * b / k
560 * 567 *
561 * Returns non-zero if the value is changed, zero if not changed. 568 * Returns non-zero if the value is changed, zero if not changed.
@@ -582,6 +589,10 @@ void snd_interval_muldivk(const snd_interval_t *a, const snd_interval_t *b,
582 589
583/** 590/**
584 * snd_interval_mulkdiv - refine the interval value 591 * snd_interval_mulkdiv - refine the interval value
592 * @a: dividend 1
593 * @k: dividend 2 (as integer)
594 * @b: divisor
595 * @c: result
585 * 596 *
586 * c = a * k / b 597 * c = a * k / b
587 * 598 *
@@ -618,6 +629,11 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
618 629
619/** 630/**
620 * snd_interval_ratnum - refine the interval value 631 * snd_interval_ratnum - refine the interval value
632 * @i: interval to refine
633 * @rats_count: number of ratnum_t
634 * @rats: ratnum_t array
635 * @nump: pointer to store the resultant numerator
636 * @denp: pointer to store the resultant denominator
621 * 637 *
622 * Returns non-zero if the value is changed, zero if not changed. 638 * Returns non-zero if the value is changed, zero if not changed.
623 */ 639 */
@@ -715,6 +731,11 @@ int snd_interval_ratnum(snd_interval_t *i,
715 731
716/** 732/**
717 * snd_interval_ratden - refine the interval value 733 * snd_interval_ratden - refine the interval value
734 * @i: interval to refine
735 * @rats_count: number of ratden_t
736 * @rats: ratden_t array
737 * @nump: pointer to store the resultant numerator
738 * @denp: pointer to store the resultant denominator
718 * 739 *
719 * Returns non-zero if the value is changed, zero if not changed. 740 * Returns non-zero if the value is changed, zero if not changed.
720 */ 741 */
@@ -936,6 +957,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond,
936 957
937/** 958/**
938 * snd_pcm_hw_constraint_mask 959 * snd_pcm_hw_constraint_mask
960 * @runtime: PCM runtime instance
961 * @var: hw_params variable to apply the mask
962 * @mask: the bitmap mask
963 *
964 * Apply the constraint of the given bitmap mask to a mask parameter.
939 */ 965 */
940int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 966int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
941 u_int32_t mask) 967 u_int32_t mask)
@@ -951,6 +977,11 @@ int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t va
951 977
952/** 978/**
953 * snd_pcm_hw_constraint_mask64 979 * snd_pcm_hw_constraint_mask64
980 * @runtime: PCM runtime instance
981 * @var: hw_params variable to apply the mask
982 * @mask: the 64bit bitmap mask
983 *
984 * Apply the constraint of the given bitmap mask to a mask parameter.
954 */ 985 */
955int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 986int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
956 u_int64_t mask) 987 u_int64_t mask)
@@ -967,6 +998,10 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
967 998
968/** 999/**
969 * snd_pcm_hw_constraint_integer 1000 * snd_pcm_hw_constraint_integer
1001 * @runtime: PCM runtime instance
1002 * @var: hw_params variable to apply the integer constraint
1003 *
1004 * Apply the constraint of integer to an interval parameter.
970 */ 1005 */
971int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var) 1006int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var)
972{ 1007{
@@ -976,6 +1011,12 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
976 1011
977/** 1012/**
978 * snd_pcm_hw_constraint_minmax 1013 * snd_pcm_hw_constraint_minmax
1014 * @runtime: PCM runtime instance
1015 * @var: hw_params variable to apply the range
1016 * @min: the minimal value
1017 * @max: the maximal value
1018 *
1019 * Apply the min/max range constraint to an interval parameter.
979 */ 1020 */
980int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var, 1021int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
981 unsigned int min, unsigned int max) 1022 unsigned int min, unsigned int max)
@@ -999,6 +1040,12 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params,
999 1040
1000/** 1041/**
1001 * snd_pcm_hw_constraint_list 1042 * snd_pcm_hw_constraint_list
1043 * @runtime: PCM runtime instance
1044 * @cond: condition bits
1045 * @var: hw_params variable to apply the list constraint
1046 * @l: list
1047 *
1048 * Apply the list of constraints to an interval parameter.
1002 */ 1049 */
1003int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime, 1050int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime,
1004 unsigned int cond, 1051 unsigned int cond,
@@ -1027,6 +1074,10 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params,
1027 1074
1028/** 1075/**
1029 * snd_pcm_hw_constraint_ratnums 1076 * snd_pcm_hw_constraint_ratnums
1077 * @runtime: PCM runtime instance
1078 * @cond: condition bits
1079 * @var: hw_params variable to apply the ratnums constraint
1080 * @r: ratnums_t constriants
1030 */ 1081 */
1031int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, 1082int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime,
1032 unsigned int cond, 1083 unsigned int cond,
@@ -1054,6 +1105,10 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params,
1054 1105
1055/** 1106/**
1056 * snd_pcm_hw_constraint_ratdens 1107 * snd_pcm_hw_constraint_ratdens
1108 * @runtime: PCM runtime instance
1109 * @cond: condition bits
1110 * @var: hw_params variable to apply the ratdens constraint
1111 * @r: ratdens_t constriants
1057 */ 1112 */
1058int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, 1113int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime,
1059 unsigned int cond, 1114 unsigned int cond,
@@ -1079,6 +1134,10 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params,
1079 1134
1080/** 1135/**
1081 * snd_pcm_hw_constraint_msbits 1136 * snd_pcm_hw_constraint_msbits
1137 * @runtime: PCM runtime instance
1138 * @cond: condition bits
1139 * @width: sample bits width
1140 * @msbits: msbits width
1082 */ 1141 */
1083int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, 1142int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime,
1084 unsigned int cond, 1143 unsigned int cond,
@@ -1101,6 +1160,10 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params,
1101 1160
1102/** 1161/**
1103 * snd_pcm_hw_constraint_step 1162 * snd_pcm_hw_constraint_step
1163 * @runtime: PCM runtime instance
1164 * @cond: condition bits
1165 * @var: hw_params variable to apply the step constraint
1166 * @step: step size
1104 */ 1167 */
1105int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime, 1168int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime,
1106 unsigned int cond, 1169 unsigned int cond,
@@ -1126,6 +1189,9 @@ static int snd_pcm_hw_rule_pow2(snd_pcm_hw_params_t *params, snd_pcm_hw_rule_t *
1126 1189
1127/** 1190/**
1128 * snd_pcm_hw_constraint_pow2 1191 * snd_pcm_hw_constraint_pow2
1192 * @runtime: PCM runtime instance
1193 * @cond: condition bits
1194 * @var: hw_params variable to apply the power-of-2 constraint
1129 */ 1195 */
1130int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime, 1196int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime,
1131 unsigned int cond, 1197 unsigned int cond,
@@ -1162,7 +1228,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params,
1162} 1228}
1163 1229
1164#if 0 1230#if 0
1165/** 1231/*
1166 * snd_pcm_hw_param_any 1232 * snd_pcm_hw_param_any
1167 */ 1233 */
1168int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params, 1234int snd_pcm_hw_param_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
@@ -1185,7 +1251,7 @@ void _snd_pcm_hw_params_any(snd_pcm_hw_params_t *params)
1185} 1251}
1186 1252
1187#if 0 1253#if 0
1188/** 1254/*
1189 * snd_pcm_hw_params_any 1255 * snd_pcm_hw_params_any
1190 * 1256 *
1191 * Fill PARAMS with full configuration space boundaries 1257 * Fill PARAMS with full configuration space boundaries
@@ -1199,6 +1265,9 @@ int snd_pcm_hw_params_any(snd_pcm_t *pcm, snd_pcm_hw_params_t *params)
1199 1265
1200/** 1266/**
1201 * snd_pcm_hw_param_value 1267 * snd_pcm_hw_param_value
1268 * @params: the hw_params instance
1269 * @var: parameter to retrieve
1270 * @dir: pointer to the direction (-1,0,1) or NULL
1202 * 1271 *
1203 * Return the value for field PAR if it's fixed in configuration space 1272 * Return the value for field PAR if it's fixed in configuration space
1204 * defined by PARAMS. Return -EINVAL otherwise 1273 * defined by PARAMS. Return -EINVAL otherwise
@@ -1228,6 +1297,9 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params,
1228 1297
1229/** 1298/**
1230 * snd_pcm_hw_param_value_min 1299 * snd_pcm_hw_param_value_min
1300 * @params: the hw_params instance
1301 * @var: parameter to retrieve
1302 * @dir: pointer to the direction (-1,0,1) or NULL
1231 * 1303 *
1232 * Return the minimum value for field PAR. 1304 * Return the minimum value for field PAR.
1233 */ 1305 */
@@ -1251,6 +1323,9 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
1251 1323
1252/** 1324/**
1253 * snd_pcm_hw_param_value_max 1325 * snd_pcm_hw_param_value_max
1326 * @params: the hw_params instance
1327 * @var: parameter to retrieve
1328 * @dir: pointer to the direction (-1,0,1) or NULL
1254 * 1329 *
1255 * Return the maximum value for field PAR. 1330 * Return the maximum value for field PAR.
1256 */ 1331 */
@@ -1302,7 +1377,7 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params,
1302} 1377}
1303 1378
1304#if 0 1379#if 0
1305/** 1380/*
1306 * snd_pcm_hw_param_setinteger 1381 * snd_pcm_hw_param_setinteger
1307 * 1382 *
1308 * Inside configuration space defined by PARAMS remove from PAR all 1383 * Inside configuration space defined by PARAMS remove from PAR all
@@ -1347,6 +1422,10 @@ static int _snd_pcm_hw_param_first(snd_pcm_hw_params_t *params,
1347 1422
1348/** 1423/**
1349 * snd_pcm_hw_param_first 1424 * snd_pcm_hw_param_first
1425 * @pcm: PCM instance
1426 * @params: the hw_params instance
1427 * @var: parameter to retrieve
1428 * @dir: pointer to the direction (-1,0,1) or NULL
1350 * 1429 *
1351 * Inside configuration space defined by PARAMS remove from PAR all 1430 * Inside configuration space defined by PARAMS remove from PAR all
1352 * values > minimum. Reduce configuration space accordingly. 1431 * values > minimum. Reduce configuration space accordingly.
@@ -1388,6 +1467,10 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params,
1388 1467
1389/** 1468/**
1390 * snd_pcm_hw_param_last 1469 * snd_pcm_hw_param_last
1470 * @pcm: PCM instance
1471 * @params: the hw_params instance
1472 * @var: parameter to retrieve
1473 * @dir: pointer to the direction (-1,0,1) or NULL
1391 * 1474 *
1392 * Inside configuration space defined by PARAMS remove from PAR all 1475 * Inside configuration space defined by PARAMS remove from PAR all
1393 * values < maximum. Reduce configuration space accordingly. 1476 * values < maximum. Reduce configuration space accordingly.
@@ -1439,6 +1522,11 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params,
1439 1522
1440/** 1523/**
1441 * snd_pcm_hw_param_min 1524 * snd_pcm_hw_param_min
1525 * @pcm: PCM instance
1526 * @params: the hw_params instance
1527 * @var: parameter to retrieve
1528 * @val: minimal value
1529 * @dir: pointer to the direction (-1,0,1) or NULL
1442 * 1530 *
1443 * Inside configuration space defined by PARAMS remove from PAR all 1531 * Inside configuration space defined by PARAMS remove from PAR all
1444 * values < VAL. Reduce configuration space accordingly. 1532 * values < VAL. Reduce configuration space accordingly.
@@ -1494,6 +1582,11 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params,
1494 1582
1495/** 1583/**
1496 * snd_pcm_hw_param_max 1584 * snd_pcm_hw_param_max
1585 * @pcm: PCM instance
1586 * @params: the hw_params instance
1587 * @var: parameter to retrieve
1588 * @val: maximal value
1589 * @dir: pointer to the direction (-1,0,1) or NULL
1497 * 1590 *
1498 * Inside configuration space defined by PARAMS remove from PAR all 1591 * Inside configuration space defined by PARAMS remove from PAR all
1499 * values >= VAL + 1. Reduce configuration space accordingly. 1592 * values >= VAL + 1. Reduce configuration space accordingly.
@@ -1565,6 +1658,11 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
1565 1658
1566/** 1659/**
1567 * snd_pcm_hw_param_set 1660 * snd_pcm_hw_param_set
1661 * @pcm: PCM instance
1662 * @params: the hw_params instance
1663 * @var: parameter to retrieve
1664 * @val: value to set
1665 * @dir: pointer to the direction (-1,0,1) or NULL
1568 * 1666 *
1569 * Inside configuration space defined by PARAMS remove from PAR all 1667 * Inside configuration space defined by PARAMS remove from PAR all
1570 * values != VAL. Reduce configuration space accordingly. 1668 * values != VAL. Reduce configuration space accordingly.
@@ -1599,6 +1697,10 @@ static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params,
1599 1697
1600/** 1698/**
1601 * snd_pcm_hw_param_mask 1699 * snd_pcm_hw_param_mask
1700 * @pcm: PCM instance
1701 * @params: the hw_params instance
1702 * @var: parameter to retrieve
1703 * @val: mask to apply
1602 * 1704 *
1603 * Inside configuration space defined by PARAMS remove from PAR all values 1705 * Inside configuration space defined by PARAMS remove from PAR all values
1604 * not contained in MASK. Reduce configuration space accordingly. 1706 * not contained in MASK. Reduce configuration space accordingly.
@@ -1671,6 +1773,11 @@ static int boundary_nearer(int min, int mindir,
1671 1773
1672/** 1774/**
1673 * snd_pcm_hw_param_near 1775 * snd_pcm_hw_param_near
1776 * @pcm: PCM instance
1777 * @params: the hw_params instance
1778 * @var: parameter to retrieve
1779 * @best: value to set
1780 * @dir: pointer to the direction (-1,0,1) or NULL
1674 * 1781 *
1675 * Inside configuration space defined by PARAMS set PAR to the available value 1782 * Inside configuration space defined by PARAMS set PAR to the available value
1676 * nearest to VAL. Reduce configuration space accordingly. 1783 * nearest to VAL. Reduce configuration space accordingly.
@@ -1747,6 +1854,8 @@ int snd_pcm_hw_param_near(snd_pcm_t *pcm, snd_pcm_hw_params_t *params,
1747 1854
1748/** 1855/**
1749 * snd_pcm_hw_param_choose 1856 * snd_pcm_hw_param_choose
1857 * @pcm: PCM instance
1858 * @params: the hw_params instance
1750 * 1859 *
1751 * Choose one configuration from configuration space defined by PARAMS 1860 * Choose one configuration from configuration space defined by PARAMS
1752 * The configuration chosen is that obtained fixing in this order: 1861 * The configuration chosen is that obtained fixing in this order:
diff --git a/sound/core/pcm_memory.c b/sound/core/pcm_memory.c
index 9a174fb96565..b3f5344f60be 100644
--- a/sound/core/pcm_memory.c
+++ b/sound/core/pcm_memory.c
@@ -244,7 +244,7 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream,
244 244
245/** 245/**
246 * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams) 246 * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams)
247 * @substream: the pcm substream instance 247 * @pcm: the pcm instance
248 * @type: DMA type (SNDRV_DMA_TYPE_*) 248 * @type: DMA type (SNDRV_DMA_TYPE_*)
249 * @data: DMA type dependant data 249 * @data: DMA type dependant data
250 * @size: the requested pre-allocation size in bytes 250 * @size: the requested pre-allocation size in bytes
@@ -321,7 +321,7 @@ int snd_pcm_lib_malloc_pages(snd_pcm_substream_t *substream, size_t size)
321 if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) { 321 if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) {
322 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */ 322 dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
323 } else { 323 } else {
324 dmab = kcalloc(1, sizeof(*dmab), GFP_KERNEL); 324 dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
325 if (! dmab) 325 if (! dmab)
326 return -ENOMEM; 326 return -ENOMEM;
327 dmab->dev = substream->dma_buffer.dev; 327 dmab->dev = substream->dma_buffer.dev;
diff --git a/sound/core/pcm_native.c b/sound/core/pcm_native.c
index 03c17159dd8e..67abebabf83e 100644
--- a/sound/core/pcm_native.c
+++ b/sound/core/pcm_native.c
@@ -859,6 +859,7 @@ static struct action_ops snd_pcm_action_start = {
859 859
860/** 860/**
861 * snd_pcm_start 861 * snd_pcm_start
862 * @substream: the PCM substream instance
862 * 863 *
863 * Start all linked streams. 864 * Start all linked streams.
864 */ 865 */
@@ -908,6 +909,8 @@ static struct action_ops snd_pcm_action_stop = {
908 909
909/** 910/**
910 * snd_pcm_stop 911 * snd_pcm_stop
912 * @substream: the PCM substream instance
913 * @state: PCM state after stopping the stream
911 * 914 *
912 * Try to stop all running streams in the substream group. 915 * Try to stop all running streams in the substream group.
913 * The state of each stream is changed to the given value after that unconditionally. 916 * The state of each stream is changed to the given value after that unconditionally.
@@ -919,6 +922,7 @@ int snd_pcm_stop(snd_pcm_substream_t *substream, int state)
919 922
920/** 923/**
921 * snd_pcm_drain_done 924 * snd_pcm_drain_done
925 * @substream: the PCM substream
922 * 926 *
923 * Stop the DMA only when the given stream is playback. 927 * Stop the DMA only when the given stream is playback.
924 * The state is changed to SETUP. 928 * The state is changed to SETUP.
@@ -1040,6 +1044,7 @@ static struct action_ops snd_pcm_action_suspend = {
1040 1044
1041/** 1045/**
1042 * snd_pcm_suspend 1046 * snd_pcm_suspend
1047 * @substream: the PCM substream
1043 * 1048 *
1044 * Trigger SUSPEND to all linked streams. 1049 * Trigger SUSPEND to all linked streams.
1045 * After this call, all streams are changed to SUSPENDED state. 1050 * After this call, all streams are changed to SUSPENDED state.
@@ -1057,6 +1062,7 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream)
1057 1062
1058/** 1063/**
1059 * snd_pcm_suspend_all 1064 * snd_pcm_suspend_all
1065 * @pcm: the PCM instance
1060 * 1066 *
1061 * Trigger SUSPEND to all substreams in the given pcm. 1067 * Trigger SUSPEND to all substreams in the given pcm.
1062 * After this call, all streams are changed to SUSPENDED state. 1068 * After this call, all streams are changed to SUSPENDED state.
@@ -1272,6 +1278,9 @@ static struct action_ops snd_pcm_action_prepare = {
1272 1278
1273/** 1279/**
1274 * snd_pcm_prepare 1280 * snd_pcm_prepare
1281 * @substream: the PCM substream instance
1282 *
1283 * Prepare the PCM substream to be triggerable.
1275 */ 1284 */
1276int snd_pcm_prepare(snd_pcm_substream_t *substream) 1285int snd_pcm_prepare(snd_pcm_substream_t *substream)
1277{ 1286{
@@ -1992,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file,
1992 snd_assert(rpcm_file != NULL, return -EINVAL); 2001 snd_assert(rpcm_file != NULL, return -EINVAL);
1993 *rpcm_file = NULL; 2002 *rpcm_file = NULL;
1994 2003
1995 pcm_file = kcalloc(1, sizeof(*pcm_file), GFP_KERNEL); 2004 pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL);
1996 if (pcm_file == NULL) { 2005 if (pcm_file == NULL) {
1997 return -ENOMEM; 2006 return -ENOMEM;
1998 } 2007 }
diff --git a/sound/core/rawmidi.c b/sound/core/rawmidi.c
index edba4118271c..7c20eafecb8a 100644
--- a/sound/core/rawmidi.c
+++ b/sound/core/rawmidi.c
@@ -101,7 +101,7 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream)
101{ 101{
102 snd_rawmidi_runtime_t *runtime; 102 snd_rawmidi_runtime_t *runtime;
103 103
104 if ((runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL)) == NULL) 104 if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL)
105 return -ENOMEM; 105 return -ENOMEM;
106 spin_lock_init(&runtime->lock); 106 spin_lock_init(&runtime->lock);
107 init_waitqueue_head(&runtime->sleep); 107 init_waitqueue_head(&runtime->sleep);
@@ -984,7 +984,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
984 spin_lock_irq(&runtime->lock); 984 spin_lock_irq(&runtime->lock);
985 } 985 }
986 spin_unlock_irq(&runtime->lock); 986 spin_unlock_irq(&runtime->lock);
987 count1 = snd_rawmidi_kernel_read1(substream, (unsigned char *)buf, count, 0); 987 count1 = snd_rawmidi_kernel_read1(substream,
988 (unsigned char __force *)buf,
989 count, 0);
988 if (count1 < 0) 990 if (count1 < 0)
989 return result > 0 ? result : count1; 991 return result > 0 ? result : count1;
990 result += count1; 992 result += count1;
@@ -1107,7 +1109,7 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count)
1107/** 1109/**
1108 * snd_rawmidi_transmit - copy from the buffer to the device 1110 * snd_rawmidi_transmit - copy from the buffer to the device
1109 * @substream: the rawmidi substream 1111 * @substream: the rawmidi substream
1110 * @buf: the buffer pointer 1112 * @buffer: the buffer pointer
1111 * @count: the data size to transfer 1113 * @count: the data size to transfer
1112 * 1114 *
1113 * Copies data from the buffer to the device and advances the pointer. 1115 * Copies data from the buffer to the device and advances the pointer.
@@ -1213,7 +1215,9 @@ static ssize_t snd_rawmidi_write(struct file *file, const char __user *buf, size
1213 spin_lock_irq(&runtime->lock); 1215 spin_lock_irq(&runtime->lock);
1214 } 1216 }
1215 spin_unlock_irq(&runtime->lock); 1217 spin_unlock_irq(&runtime->lock);
1216 count1 = snd_rawmidi_kernel_write1(substream, (unsigned char *)buf, count, 0); 1218 count1 = snd_rawmidi_kernel_write1(substream,
1219 (unsigned char __force *)buf,
1220 count, 0);
1217 if (count1 < 0) 1221 if (count1 < 0)
1218 return result > 0 ? result : count1; 1222 return result > 0 ? result : count1;
1219 result += count1; 1223 result += count1;
@@ -1370,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi,
1370 1374
1371 INIT_LIST_HEAD(&stream->substreams); 1375 INIT_LIST_HEAD(&stream->substreams);
1372 for (idx = 0; idx < count; idx++) { 1376 for (idx = 0; idx < count; idx++) {
1373 substream = kcalloc(1, sizeof(*substream), GFP_KERNEL); 1377 substream = kzalloc(sizeof(*substream), GFP_KERNEL);
1374 if (substream == NULL) 1378 if (substream == NULL)
1375 return -ENOMEM; 1379 return -ENOMEM;
1376 substream->stream = direction; 1380 substream->stream = direction;
@@ -1413,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device,
1413 snd_assert(rrawmidi != NULL, return -EINVAL); 1417 snd_assert(rrawmidi != NULL, return -EINVAL);
1414 *rrawmidi = NULL; 1418 *rrawmidi = NULL;
1415 snd_assert(card != NULL, return -ENXIO); 1419 snd_assert(card != NULL, return -ENXIO);
1416 rmidi = kcalloc(1, sizeof(*rmidi), GFP_KERNEL); 1420 rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
1417 if (rmidi == NULL) 1421 if (rmidi == NULL)
1418 return -ENOMEM; 1422 return -ENOMEM;
1419 rmidi->card = card; 1423 rmidi->card = card;
diff --git a/sound/core/seq/instr/ainstr_gf1.c b/sound/core/seq/instr/ainstr_gf1.c
index 32e91c6b25fe..207c2c54bf1d 100644
--- a/sound/core/seq/instr/ainstr_gf1.c
+++ b/sound/core/seq/instr/ainstr_gf1.c
@@ -61,7 +61,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
61 return -EFAULT; 61 return -EFAULT;
62 *data += sizeof(xp); 62 *data += sizeof(xp);
63 *len -= sizeof(xp); 63 *len -= sizeof(xp);
64 wp = kcalloc(1, sizeof(*wp), gfp_mask); 64 wp = kzalloc(sizeof(*wp), gfp_mask);
65 if (wp == NULL) 65 if (wp == NULL)
66 return -ENOMEM; 66 return -ENOMEM;
67 wp->share_id[0] = le32_to_cpu(xp.share_id[0]); 67 wp->share_id[0] = le32_to_cpu(xp.share_id[0]);
diff --git a/sound/core/seq/instr/ainstr_iw.c b/sound/core/seq/instr/ainstr_iw.c
index 2622b8679ca7..b3cee092b1a4 100644
--- a/sound/core/seq/instr/ainstr_iw.c
+++ b/sound/core/seq/instr/ainstr_iw.c
@@ -92,7 +92,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
92 points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16); 92 points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16);
93 if (points_size > *len) 93 if (points_size > *len)
94 return -EINVAL; 94 return -EINVAL;
95 rp = kcalloc(1, sizeof(*rp) + points_size, gfp_mask); 95 rp = kzalloc(sizeof(*rp) + points_size, gfp_mask);
96 if (rp == NULL) 96 if (rp == NULL)
97 return -ENOMEM; 97 return -ENOMEM;
98 rp->nattack = le16_to_cpu(rx.nattack); 98 rp->nattack = le16_to_cpu(rx.nattack);
@@ -139,7 +139,7 @@ static int snd_seq_iwffff_copy_wave_from_stream(snd_iwffff_ops_t *ops,
139 return -EFAULT; 139 return -EFAULT;
140 *data += sizeof(xp); 140 *data += sizeof(xp);
141 *len -= sizeof(xp); 141 *len -= sizeof(xp);
142 wp = kcalloc(1, sizeof(*wp), gfp_mask); 142 wp = kzalloc(sizeof(*wp), gfp_mask);
143 if (wp == NULL) 143 if (wp == NULL)
144 return -ENOMEM; 144 return -ENOMEM;
145 wp->share_id[0] = le32_to_cpu(xp.share_id[0]); 145 wp->share_id[0] = le32_to_cpu(xp.share_id[0]);
@@ -273,7 +273,7 @@ static int snd_seq_iwffff_put(void *private_data, snd_seq_kinstr_t *instr,
273 snd_seq_iwffff_instr_free(ops, ip, atomic); 273 snd_seq_iwffff_instr_free(ops, ip, atomic);
274 return -EINVAL; 274 return -EINVAL;
275 } 275 }
276 lp = kcalloc(1, sizeof(*lp), gfp_mask); 276 lp = kzalloc(sizeof(*lp), gfp_mask);
277 if (lp == NULL) { 277 if (lp == NULL) {
278 snd_seq_iwffff_instr_free(ops, ip, atomic); 278 snd_seq_iwffff_instr_free(ops, ip, atomic);
279 return -ENOMEM; 279 return -ENOMEM;
diff --git a/sound/core/seq/oss/seq_oss_init.c b/sound/core/seq/oss/seq_oss_init.c
index bac4b4f1a94e..1ab1cf8158c8 100644
--- a/sound/core/seq/oss/seq_oss_init.c
+++ b/sound/core/seq/oss/seq_oss_init.c
@@ -193,7 +193,7 @@ snd_seq_oss_open(struct file *file, int level)
193 int i, rc; 193 int i, rc;
194 seq_oss_devinfo_t *dp; 194 seq_oss_devinfo_t *dp;
195 195
196 if ((dp = kcalloc(1, sizeof(*dp), GFP_KERNEL)) == NULL) { 196 if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) {
197 snd_printk(KERN_ERR "can't malloc device info\n"); 197 snd_printk(KERN_ERR "can't malloc device info\n");
198 return -ENOMEM; 198 return -ENOMEM;
199 } 199 }
diff --git a/sound/core/seq/oss/seq_oss_midi.c b/sound/core/seq/oss/seq_oss_midi.c
index 9aece6c65dbc..f0e95c8f2eef 100644
--- a/sound/core/seq/oss/seq_oss_midi.c
+++ b/sound/core/seq/oss/seq_oss_midi.c
@@ -76,8 +76,8 @@ snd_seq_oss_midi_lookup_ports(int client)
76 snd_seq_client_info_t *clinfo; 76 snd_seq_client_info_t *clinfo;
77 snd_seq_port_info_t *pinfo; 77 snd_seq_port_info_t *pinfo;
78 78
79 clinfo = kcalloc(1, sizeof(*clinfo), GFP_KERNEL); 79 clinfo = kzalloc(sizeof(*clinfo), GFP_KERNEL);
80 pinfo = kcalloc(1, sizeof(*pinfo), GFP_KERNEL); 80 pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL);
81 if (! clinfo || ! pinfo) { 81 if (! clinfo || ! pinfo) {
82 kfree(clinfo); 82 kfree(clinfo);
83 kfree(pinfo); 83 kfree(pinfo);
@@ -172,7 +172,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo)
172 /* 172 /*
173 * allocate midi info record 173 * allocate midi info record
174 */ 174 */
175 if ((mdev = kcalloc(1, sizeof(*mdev), GFP_KERNEL)) == NULL) { 175 if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) {
176 snd_printk(KERN_ERR "can't malloc midi info\n"); 176 snd_printk(KERN_ERR "can't malloc midi info\n");
177 return -ENOMEM; 177 return -ENOMEM;
178 } 178 }
diff --git a/sound/core/seq/oss/seq_oss_readq.c b/sound/core/seq/oss/seq_oss_readq.c
index 0a6f2a64f692..55571e15cd38 100644
--- a/sound/core/seq/oss/seq_oss_readq.c
+++ b/sound/core/seq/oss/seq_oss_readq.c
@@ -46,7 +46,7 @@ snd_seq_oss_readq_new(seq_oss_devinfo_t *dp, int maxlen)
46{ 46{
47 seq_oss_readq_t *q; 47 seq_oss_readq_t *q;
48 48
49 if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) { 49 if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) {
50 snd_printk(KERN_ERR "can't malloc read queue\n"); 50 snd_printk(KERN_ERR "can't malloc read queue\n");
51 return NULL; 51 return NULL;
52 } 52 }
diff --git a/sound/core/seq/oss/seq_oss_synth.c b/sound/core/seq/oss/seq_oss_synth.c
index 1a7736cbf3a4..8257fce2ca1b 100644
--- a/sound/core/seq/oss/seq_oss_synth.c
+++ b/sound/core/seq/oss/seq_oss_synth.c
@@ -103,7 +103,7 @@ snd_seq_oss_synth_register(snd_seq_device_t *dev)
103 snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev); 103 snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
104 unsigned long flags; 104 unsigned long flags;
105 105
106 if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) { 106 if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) {
107 snd_printk(KERN_ERR "can't malloc synth info\n"); 107 snd_printk(KERN_ERR "can't malloc synth info\n");
108 return -ENOMEM; 108 return -ENOMEM;
109 } 109 }
@@ -499,7 +499,7 @@ snd_seq_oss_synth_sysex(seq_oss_devinfo_t *dp, int dev, unsigned char *buf, snd_
499 499
500 sysex = dp->synths[dev].sysex; 500 sysex = dp->synths[dev].sysex;
501 if (sysex == NULL) { 501 if (sysex == NULL) {
502 sysex = kcalloc(1, sizeof(*sysex), GFP_KERNEL); 502 sysex = kzalloc(sizeof(*sysex), GFP_KERNEL);
503 if (sysex == NULL) 503 if (sysex == NULL)
504 return -ENOMEM; 504 return -ENOMEM;
505 dp->synths[dev].sysex = sysex; 505 dp->synths[dev].sysex = sysex;
diff --git a/sound/core/seq/oss/seq_oss_timer.c b/sound/core/seq/oss/seq_oss_timer.c
index 42ca9493fa60..64d594b3170f 100644
--- a/sound/core/seq/oss/seq_oss_timer.c
+++ b/sound/core/seq/oss/seq_oss_timer.c
@@ -46,7 +46,7 @@ snd_seq_oss_timer_new(seq_oss_devinfo_t *dp)
46{ 46{
47 seq_oss_timer_t *rec; 47 seq_oss_timer_t *rec;
48 48
49 rec = kcalloc(1, sizeof(*rec), GFP_KERNEL); 49 rec = kzalloc(sizeof(*rec), GFP_KERNEL);
50 if (rec == NULL) 50 if (rec == NULL)
51 return NULL; 51 return NULL;
52 52
diff --git a/sound/core/seq/oss/seq_oss_writeq.c b/sound/core/seq/oss/seq_oss_writeq.c
index 87f85f7ee814..b20378024547 100644
--- a/sound/core/seq/oss/seq_oss_writeq.c
+++ b/sound/core/seq/oss/seq_oss_writeq.c
@@ -38,7 +38,7 @@ snd_seq_oss_writeq_new(seq_oss_devinfo_t *dp, int maxlen)
38 seq_oss_writeq_t *q; 38 seq_oss_writeq_t *q;
39 snd_seq_client_pool_t pool; 39 snd_seq_client_pool_t pool;
40 40
41 if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) 41 if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL)
42 return NULL; 42 return NULL;
43 q->dp = dp; 43 q->dp = dp;
44 q->maxlen = maxlen; 44 q->maxlen = maxlen;
diff --git a/sound/core/seq/seq.c b/sound/core/seq/seq.c
index 7449d2a62629..24644150f24b 100644
--- a/sound/core/seq/seq.c
+++ b/sound/core/seq/seq.c
@@ -43,7 +43,13 @@ int seq_client_load[64] = {[0 ... 63] = -1};
43int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL; 43int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
44int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE; 44int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
45int seq_default_timer_card = -1; 45int seq_default_timer_card = -1;
46int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM; 46int seq_default_timer_device =
47#ifdef CONFIG_SND_SEQ_RTCTIMER_DEFAULT
48 SNDRV_TIMER_GLOBAL_RTC
49#else
50 SNDRV_TIMER_GLOBAL_SYSTEM
51#endif
52 ;
47int seq_default_timer_subdevice = 0; 53int seq_default_timer_subdevice = 0;
48int seq_default_timer_resolution = 0; /* Hz */ 54int seq_default_timer_resolution = 0; /* Hz */
49 55
diff --git a/sound/core/seq/seq_clientmgr.c b/sound/core/seq/seq_clientmgr.c
index d8f76afd284b..a886db94b1fa 100644
--- a/sound/core/seq/seq_clientmgr.c
+++ b/sound/core/seq/seq_clientmgr.c
@@ -203,7 +203,7 @@ static client_t *seq_create_client1(int client_index, int poolsize)
203 client_t *client; 203 client_t *client;
204 204
205 /* init client data */ 205 /* init client data */
206 client = kcalloc(1, sizeof(*client), GFP_KERNEL); 206 client = kzalloc(sizeof(*client), GFP_KERNEL);
207 if (client == NULL) 207 if (client == NULL)
208 return NULL; 208 return NULL;
209 client->pool = snd_seq_pool_new(poolsize); 209 client->pool = snd_seq_pool_new(poolsize);
@@ -413,7 +413,9 @@ static ssize_t snd_seq_read(struct file *file, char __user *buf, size_t count, l
413 } 413 }
414 count -= sizeof(snd_seq_event_t); 414 count -= sizeof(snd_seq_event_t);
415 buf += sizeof(snd_seq_event_t); 415 buf += sizeof(snd_seq_event_t);
416 err = snd_seq_expand_var_event(&cell->event, count, (char *)buf, 0, sizeof(snd_seq_event_t)); 416 err = snd_seq_expand_var_event(&cell->event, count,
417 (char __force *)buf, 0,
418 sizeof(snd_seq_event_t));
417 if (err < 0) 419 if (err < 0)
418 break; 420 break;
419 result += err; 421 result += err;
@@ -1009,7 +1011,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
1009 } 1011 }
1010 /* set user space pointer */ 1012 /* set user space pointer */
1011 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR; 1013 event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
1012 event.data.ext.ptr = (char*)buf + sizeof(snd_seq_event_t); 1014 event.data.ext.ptr = (char __force *)buf
1015 + sizeof(snd_seq_event_t);
1013 len += extlen; /* increment data length */ 1016 len += extlen; /* increment data length */
1014 } else { 1017 } else {
1015#ifdef CONFIG_COMPAT 1018#ifdef CONFIG_COMPAT
diff --git a/sound/core/seq/seq_device.c b/sound/core/seq/seq_device.c
index 4d80f39612e8..252b52731003 100644
--- a/sound/core/seq/seq_device.c
+++ b/sound/core/seq/seq_device.c
@@ -200,7 +200,7 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize,
200 if (ops == NULL) 200 if (ops == NULL)
201 return -ENOMEM; 201 return -ENOMEM;
202 202
203 dev = kcalloc(1, sizeof(*dev)*2 + argsize, GFP_KERNEL); 203 dev = kzalloc(sizeof(*dev)*2 + argsize, GFP_KERNEL);
204 if (dev == NULL) { 204 if (dev == NULL) {
205 unlock_driver(ops); 205 unlock_driver(ops);
206 return -ENOMEM; 206 return -ENOMEM;
diff --git a/sound/core/seq/seq_dummy.c b/sound/core/seq/seq_dummy.c
index ea945a5d2a0b..5dd0e6a19e50 100644
--- a/sound/core/seq/seq_dummy.c
+++ b/sound/core/seq/seq_dummy.c
@@ -153,7 +153,7 @@ create_port(int idx, int type)
153 snd_seq_port_callback_t pcb; 153 snd_seq_port_callback_t pcb;
154 snd_seq_dummy_port_t *rec; 154 snd_seq_dummy_port_t *rec;
155 155
156 if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) 156 if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL)
157 return NULL; 157 return NULL;
158 158
159 rec->client = my_client; 159 rec->client = my_client;
diff --git a/sound/core/seq/seq_fifo.c b/sound/core/seq/seq_fifo.c
index 3b7647ca7ad9..4767cfdc361f 100644
--- a/sound/core/seq/seq_fifo.c
+++ b/sound/core/seq/seq_fifo.c
@@ -33,7 +33,7 @@ fifo_t *snd_seq_fifo_new(int poolsize)
33{ 33{
34 fifo_t *f; 34 fifo_t *f;
35 35
36 f = kcalloc(1, sizeof(*f), GFP_KERNEL); 36 f = kzalloc(sizeof(*f), GFP_KERNEL);
37 if (f == NULL) { 37 if (f == NULL) {
38 snd_printd("malloc failed for snd_seq_fifo_new() \n"); 38 snd_printd("malloc failed for snd_seq_fifo_new() \n");
39 return NULL; 39 return NULL;
diff --git a/sound/core/seq/seq_instr.c b/sound/core/seq/seq_instr.c
index 5b40ea2ba8f4..019d43a462d7 100644
--- a/sound/core/seq/seq_instr.c
+++ b/sound/core/seq/seq_instr.c
@@ -53,7 +53,7 @@ static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic)
53{ 53{
54 snd_seq_kinstr_t *instr; 54 snd_seq_kinstr_t *instr;
55 55
56 instr = kcalloc(1, sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL); 56 instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
57 if (instr == NULL) 57 if (instr == NULL)
58 return NULL; 58 return NULL;
59 instr->add_len = add_len; 59 instr->add_len = add_len;
@@ -77,7 +77,7 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void)
77{ 77{
78 snd_seq_kinstr_list_t *list; 78 snd_seq_kinstr_list_t *list;
79 79
80 list = kcalloc(1, sizeof(snd_seq_kinstr_list_t), GFP_KERNEL); 80 list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL);
81 if (list == NULL) 81 if (list == NULL)
82 return NULL; 82 return NULL;
83 spin_lock_init(&list->lock); 83 spin_lock_init(&list->lock);
diff --git a/sound/core/seq/seq_memory.c b/sound/core/seq/seq_memory.c
index 03acb2d519ba..d4d7d326c4b1 100644
--- a/sound/core/seq/seq_memory.c
+++ b/sound/core/seq/seq_memory.c
@@ -452,7 +452,7 @@ pool_t *snd_seq_pool_new(int poolsize)
452 pool_t *pool; 452 pool_t *pool;
453 453
454 /* create pool block */ 454 /* create pool block */
455 pool = kcalloc(1, sizeof(*pool), GFP_KERNEL); 455 pool = kzalloc(sizeof(*pool), GFP_KERNEL);
456 if (pool == NULL) { 456 if (pool == NULL) {
457 snd_printd("seq: malloc failed for pool\n"); 457 snd_printd("seq: malloc failed for pool\n");
458 return NULL; 458 return NULL;
diff --git a/sound/core/seq/seq_midi.c b/sound/core/seq/seq_midi.c
index 4374829ea770..b4674ae3bc30 100644
--- a/sound/core/seq/seq_midi.c
+++ b/sound/core/seq/seq_midi.c
@@ -322,7 +322,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
322 client = synths[card->number]; 322 client = synths[card->number];
323 if (client == NULL) { 323 if (client == NULL) {
324 newclient = 1; 324 newclient = 1;
325 client = kcalloc(1, sizeof(*client), GFP_KERNEL); 325 client = kzalloc(sizeof(*client), GFP_KERNEL);
326 if (client == NULL) { 326 if (client == NULL) {
327 up(&register_mutex); 327 up(&register_mutex);
328 kfree(info); 328 kfree(info);
diff --git a/sound/core/seq/seq_midi_event.c b/sound/core/seq/seq_midi_event.c
index 603b63716db6..2dc1aecfb426 100644
--- a/sound/core/seq/seq_midi_event.c
+++ b/sound/core/seq/seq_midi_event.c
@@ -118,7 +118,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev)
118 snd_midi_event_t *dev; 118 snd_midi_event_t *dev;
119 119
120 *rdev = NULL; 120 *rdev = NULL;
121 dev = kcalloc(1, sizeof(*dev), GFP_KERNEL); 121 dev = kzalloc(sizeof(*dev), GFP_KERNEL);
122 if (dev == NULL) 122 if (dev == NULL)
123 return -ENOMEM; 123 return -ENOMEM;
124 if (bufsize > 0) { 124 if (bufsize > 0) {
diff --git a/sound/core/seq/seq_ports.c b/sound/core/seq/seq_ports.c
index b976951fc100..57ec31df0d15 100644
--- a/sound/core/seq/seq_ports.c
+++ b/sound/core/seq/seq_ports.c
@@ -141,7 +141,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port)
141 } 141 }
142 142
143 /* create a new port */ 143 /* create a new port */
144 new_port = kcalloc(1, sizeof(*new_port), GFP_KERNEL); 144 new_port = kzalloc(sizeof(*new_port), GFP_KERNEL);
145 if (! new_port) { 145 if (! new_port) {
146 snd_printd("malloc failed for registering client port\n"); 146 snd_printd("malloc failed for registering client port\n");
147 return NULL; /* failure, out of memory */ 147 return NULL; /* failure, out of memory */
@@ -488,7 +488,7 @@ int snd_seq_port_connect(client_t *connector,
488 unsigned long flags; 488 unsigned long flags;
489 int exclusive; 489 int exclusive;
490 490
491 subs = kcalloc(1, sizeof(*subs), GFP_KERNEL); 491 subs = kzalloc(sizeof(*subs), GFP_KERNEL);
492 if (! subs) 492 if (! subs)
493 return -ENOMEM; 493 return -ENOMEM;
494 494
diff --git a/sound/core/seq/seq_prioq.c b/sound/core/seq/seq_prioq.c
index a519732ed833..cd641bca9945 100644
--- a/sound/core/seq/seq_prioq.c
+++ b/sound/core/seq/seq_prioq.c
@@ -59,7 +59,7 @@ prioq_t *snd_seq_prioq_new(void)
59{ 59{
60 prioq_t *f; 60 prioq_t *f;
61 61
62 f = kcalloc(1, sizeof(*f), GFP_KERNEL); 62 f = kzalloc(sizeof(*f), GFP_KERNEL);
63 if (f == NULL) { 63 if (f == NULL) {
64 snd_printd("oops: malloc failed for snd_seq_prioq_new()\n"); 64 snd_printd("oops: malloc failed for snd_seq_prioq_new()\n");
65 return NULL; 65 return NULL;
diff --git a/sound/core/seq/seq_queue.c b/sound/core/seq/seq_queue.c
index 98de2e711fde..5f5c3cb37cbf 100644
--- a/sound/core/seq/seq_queue.c
+++ b/sound/core/seq/seq_queue.c
@@ -111,7 +111,7 @@ static queue_t *queue_new(int owner, int locked)
111{ 111{
112 queue_t *q; 112 queue_t *q;
113 113
114 q = kcalloc(1, sizeof(*q), GFP_KERNEL); 114 q = kzalloc(sizeof(*q), GFP_KERNEL);
115 if (q == NULL) { 115 if (q == NULL) {
116 snd_printd("malloc failed for snd_seq_queue_new()\n"); 116 snd_printd("malloc failed for snd_seq_queue_new()\n");
117 return NULL; 117 return NULL;
diff --git a/sound/core/seq/seq_system.c b/sound/core/seq/seq_system.c
index e8f0a6683d50..0d9eff85ab88 100644
--- a/sound/core/seq/seq_system.c
+++ b/sound/core/seq/seq_system.c
@@ -126,8 +126,8 @@ int __init snd_seq_system_client_init(void)
126 snd_seq_client_info_t *inf; 126 snd_seq_client_info_t *inf;
127 snd_seq_port_info_t *port; 127 snd_seq_port_info_t *port;
128 128
129 inf = kcalloc(1, sizeof(*inf), GFP_KERNEL); 129 inf = kzalloc(sizeof(*inf), GFP_KERNEL);
130 port = kcalloc(1, sizeof(*port), GFP_KERNEL); 130 port = kzalloc(sizeof(*port), GFP_KERNEL);
131 if (! inf || ! port) { 131 if (! inf || ! port) {
132 kfree(inf); 132 kfree(inf);
133 kfree(port); 133 kfree(port);
diff --git a/sound/core/seq/seq_timer.c b/sound/core/seq/seq_timer.c
index a7f76fc95280..b57a3c07ff6f 100644
--- a/sound/core/seq/seq_timer.c
+++ b/sound/core/seq/seq_timer.c
@@ -60,7 +60,7 @@ seq_timer_t *snd_seq_timer_new(void)
60{ 60{
61 seq_timer_t *tmr; 61 seq_timer_t *tmr;
62 62
63 tmr = kcalloc(1, sizeof(*tmr), GFP_KERNEL); 63 tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
64 if (tmr == NULL) { 64 if (tmr == NULL) {
65 snd_printd("malloc failed for snd_seq_timer_new() \n"); 65 snd_printd("malloc failed for snd_seq_timer_new() \n");
66 return NULL; 66 return NULL;
diff --git a/sound/core/seq/seq_virmidi.c b/sound/core/seq/seq_virmidi.c
index a66484b5cf0e..e4f512aa7426 100644
--- a/sound/core/seq/seq_virmidi.c
+++ b/sound/core/seq/seq_virmidi.c
@@ -205,7 +205,7 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream)
205 snd_virmidi_t *vmidi; 205 snd_virmidi_t *vmidi;
206 unsigned long flags; 206 unsigned long flags;
207 207
208 vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); 208 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
209 if (vmidi == NULL) 209 if (vmidi == NULL)
210 return -ENOMEM; 210 return -ENOMEM;
211 vmidi->substream = substream; 211 vmidi->substream = substream;
@@ -233,7 +233,7 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream)
233 snd_rawmidi_runtime_t *runtime = substream->runtime; 233 snd_rawmidi_runtime_t *runtime = substream->runtime;
234 snd_virmidi_t *vmidi; 234 snd_virmidi_t *vmidi;
235 235
236 vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL); 236 vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
237 if (vmidi == NULL) 237 if (vmidi == NULL)
238 return -ENOMEM; 238 return -ENOMEM;
239 vmidi->substream = substream; 239 vmidi->substream = substream;
@@ -508,7 +508,7 @@ int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi)
508 &rmidi)) < 0) 508 &rmidi)) < 0)
509 return err; 509 return err;
510 strcpy(rmidi->name, rmidi->id); 510 strcpy(rmidi->name, rmidi->id);
511 rdev = kcalloc(1, sizeof(*rdev), GFP_KERNEL); 511 rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
512 if (rdev == NULL) { 512 if (rdev == NULL) {
513 snd_device_free(card, rmidi); 513 snd_device_free(card, rmidi);
514 return -ENOMEM; 514 return -ENOMEM;
diff --git a/sound/core/sound.c b/sound/core/sound.c
index 3271e9245490..9e76bddb2c0b 100644
--- a/sound/core/sound.c
+++ b/sound/core/sound.c
@@ -328,6 +328,10 @@ int __exit snd_minor_info_done(void)
328 * INIT PART 328 * INIT PART
329 */ 329 */
330 330
331#ifdef CONFIG_SND_GENERIC_DRIVER
332extern struct device_driver snd_generic_driver;
333#endif
334
331static int __init alsa_sound_init(void) 335static int __init alsa_sound_init(void)
332{ 336{
333 short controlnum; 337 short controlnum;
@@ -354,6 +358,9 @@ static int __init alsa_sound_init(void)
354 return -ENOMEM; 358 return -ENOMEM;
355 } 359 }
356 snd_info_minor_register(); 360 snd_info_minor_register();
361#ifdef CONFIG_SND_GENERIC_DRIVER
362 driver_register(&snd_generic_driver);
363#endif
357 for (controlnum = 0; controlnum < cards_limit; controlnum++) 364 for (controlnum = 0; controlnum < cards_limit; controlnum++)
358 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum); 365 devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
359#ifndef MODULE 366#ifndef MODULE
@@ -369,6 +376,9 @@ static void __exit alsa_sound_exit(void)
369 for (controlnum = 0; controlnum < cards_limit; controlnum++) 376 for (controlnum = 0; controlnum < cards_limit; controlnum++)
370 devfs_remove("snd/controlC%d", controlnum); 377 devfs_remove("snd/controlC%d", controlnum);
371 378
379#ifdef CONFIG_SND_GENERIC_DRIVER
380 driver_unregister(&snd_generic_driver);
381#endif
372 snd_info_minor_unregister(); 382 snd_info_minor_unregister();
373 snd_info_done(); 383 snd_info_done();
374 snd_memory_done(); 384 snd_memory_done();
@@ -416,10 +426,13 @@ EXPORT_SYMBOL(snd_card_register);
416EXPORT_SYMBOL(snd_component_add); 426EXPORT_SYMBOL(snd_component_add);
417EXPORT_SYMBOL(snd_card_file_add); 427EXPORT_SYMBOL(snd_card_file_add);
418EXPORT_SYMBOL(snd_card_file_remove); 428EXPORT_SYMBOL(snd_card_file_remove);
429#ifdef CONFIG_SND_GENERIC_DRIVER
430EXPORT_SYMBOL(snd_card_set_generic_dev);
431#endif
419#ifdef CONFIG_PM 432#ifdef CONFIG_PM
420EXPORT_SYMBOL(snd_power_wait); 433EXPORT_SYMBOL(snd_power_wait);
421EXPORT_SYMBOL(snd_card_set_pm_callback); 434EXPORT_SYMBOL(snd_card_set_pm_callback);
422#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM) 435#ifdef CONFIG_SND_GENERIC_DRIVER
423EXPORT_SYMBOL(snd_card_set_generic_pm_callback); 436EXPORT_SYMBOL(snd_card_set_generic_pm_callback);
424#endif 437#endif
425#ifdef CONFIG_PCI 438#ifdef CONFIG_PCI
diff --git a/sound/core/timer.c b/sound/core/timer.c
index 4104f6e292e9..22b104624084 100644
--- a/sound/core/timer.c
+++ b/sound/core/timer.c
@@ -98,7 +98,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left);
98static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer) 98static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer)
99{ 99{
100 snd_timer_instance_t *timeri; 100 snd_timer_instance_t *timeri;
101 timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL); 101 timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
102 if (timeri == NULL) 102 if (timeri == NULL)
103 return NULL; 103 return NULL;
104 timeri->owner = kstrdup(owner, GFP_KERNEL); 104 timeri->owner = kstrdup(owner, GFP_KERNEL);
@@ -764,7 +764,7 @@ int snd_timer_new(snd_card_t *card, char *id, snd_timer_id_t *tid, snd_timer_t *
764 snd_assert(tid != NULL, return -EINVAL); 764 snd_assert(tid != NULL, return -EINVAL);
765 snd_assert(rtimer != NULL, return -EINVAL); 765 snd_assert(rtimer != NULL, return -EINVAL);
766 *rtimer = NULL; 766 *rtimer = NULL;
767 timer = kcalloc(1, sizeof(*timer), GFP_KERNEL); 767 timer = kzalloc(sizeof(*timer), GFP_KERNEL);
768 if (timer == NULL) 768 if (timer == NULL)
769 return -ENOMEM; 769 return -ENOMEM;
770 timer->tmr_class = tid->dev_class; 770 timer->tmr_class = tid->dev_class;
@@ -1017,7 +1017,7 @@ static int snd_timer_register_system(void)
1017 return err; 1017 return err;
1018 strcpy(timer->name, "system timer"); 1018 strcpy(timer->name, "system timer");
1019 timer->hw = snd_timer_system; 1019 timer->hw = snd_timer_system;
1020 priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); 1020 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
1021 if (priv == NULL) { 1021 if (priv == NULL) {
1022 snd_timer_free(timer); 1022 snd_timer_free(timer);
1023 return -ENOMEM; 1023 return -ENOMEM;
@@ -1202,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
1202{ 1202{
1203 snd_timer_user_t *tu; 1203 snd_timer_user_t *tu;
1204 1204
1205 tu = kcalloc(1, sizeof(*tu), GFP_KERNEL); 1205 tu = kzalloc(sizeof(*tu), GFP_KERNEL);
1206 if (tu == NULL) 1206 if (tu == NULL)
1207 return -ENOMEM; 1207 return -ENOMEM;
1208 spin_lock_init(&tu->qlock); 1208 spin_lock_init(&tu->qlock);
@@ -1513,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info
1513 t = tu->timeri->timer; 1513 t = tu->timeri->timer;
1514 snd_assert(t != NULL, return -ENXIO); 1514 snd_assert(t != NULL, return -ENXIO);
1515 1515
1516 info = kcalloc(1, sizeof(*info), GFP_KERNEL); 1516 info = kzalloc(sizeof(*info), GFP_KERNEL);
1517 if (! info) 1517 if (! info)
1518 return -ENOMEM; 1518 return -ENOMEM;
1519 info->card = t->card ? t->card->number : -1; 1519 info->card = t->card ? t->card->number : -1;
diff --git a/sound/drivers/Kconfig b/sound/drivers/Kconfig
index 3b2bee19e2c0..efcb4eb2d1a0 100644
--- a/sound/drivers/Kconfig
+++ b/sound/drivers/Kconfig
@@ -29,6 +29,7 @@ config SND_DUMMY
29 tristate "Dummy (/dev/null) soundcard" 29 tristate "Dummy (/dev/null) soundcard"
30 depends on SND 30 depends on SND
31 select SND_PCM 31 select SND_PCM
32 select SND_GENERIC_DRIVER
32 help 33 help
33 Say Y here to include the dummy driver. This driver does 34 Say Y here to include the dummy driver. This driver does
34 nothing, but emulates various mixer controls and PCM devices. 35 nothing, but emulates various mixer controls and PCM devices.
@@ -44,6 +45,7 @@ config SND_VIRMIDI
44 depends on SND_SEQUENCER 45 depends on SND_SEQUENCER
45 select SND_TIMER 46 select SND_TIMER
46 select SND_RAWMIDI 47 select SND_RAWMIDI
48 select SND_GENERIC_DRIVER
47 help 49 help
48 Say Y here to include the virtual MIDI driver. This driver 50 Say Y here to include the virtual MIDI driver. This driver
49 allows to connect applications using raw MIDI devices to 51 allows to connect applications using raw MIDI devices to
@@ -59,6 +61,7 @@ config SND_MTPAV
59 depends on SND 61 depends on SND
60 select SND_TIMER 62 select SND_TIMER
61 select SND_RAWMIDI 63 select SND_RAWMIDI
64 select SND_GENERIC_DRIVER
62 help 65 help
63 To use a MOTU MidiTimePiece AV multiport MIDI adapter 66 To use a MOTU MidiTimePiece AV multiport MIDI adapter
64 connected to the parallel port, say Y here and make sure that 67 connected to the parallel port, say Y here and make sure that
@@ -72,6 +75,7 @@ config SND_SERIAL_U16550
72 depends on SND 75 depends on SND
73 select SND_TIMER 76 select SND_TIMER
74 select SND_RAWMIDI 77 select SND_RAWMIDI
78 select SND_GENERIC_DRIVER
75 help 79 help
76 To include support for MIDI serial port interfaces, say Y here 80 To include support for MIDI serial port interfaces, say Y here
77 and read <file:Documentation/sound/alsa/serial-u16550.txt>. 81 and read <file:Documentation/sound/alsa/serial-u16550.txt>.
@@ -88,6 +92,7 @@ config SND_MPU401
88 tristate "Generic MPU-401 UART driver" 92 tristate "Generic MPU-401 UART driver"
89 depends on SND 93 depends on SND
90 select SND_MPU401_UART 94 select SND_MPU401_UART
95 select SND_GENERIC_DRIVER
91 help 96 help
92 Say Y here to include support for MIDI ports compatible with 97 Say Y here to include support for MIDI ports compatible with
93 the Roland MPU-401 interface in UART mode. 98 the Roland MPU-401 interface in UART mode.
diff --git a/sound/drivers/dummy.c b/sound/drivers/dummy.c
index a61640cf7ae7..64ef7f62851d 100644
--- a/sound/drivers/dummy.c
+++ b/sound/drivers/dummy.c
@@ -337,7 +337,7 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream)
337 snd_card_dummy_pcm_t *dpcm; 337 snd_card_dummy_pcm_t *dpcm;
338 int err; 338 int err;
339 339
340 dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL); 340 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
341 if (dpcm == NULL) 341 if (dpcm == NULL)
342 return -ENOMEM; 342 return -ENOMEM;
343 init_timer(&dpcm->timer); 343 init_timer(&dpcm->timer);
@@ -368,7 +368,7 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream)
368 snd_card_dummy_pcm_t *dpcm; 368 snd_card_dummy_pcm_t *dpcm;
369 int err; 369 int err;
370 370
371 dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL); 371 dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
372 if (dpcm == NULL) 372 if (dpcm == NULL)
373 return -ENOMEM; 373 return -ENOMEM;
374 init_timer(&dpcm->timer); 374 init_timer(&dpcm->timer);
@@ -600,6 +600,10 @@ static int __init snd_card_dummy_probe(int dev)
600 strcpy(card->driver, "Dummy"); 600 strcpy(card->driver, "Dummy");
601 strcpy(card->shortname, "Dummy"); 601 strcpy(card->shortname, "Dummy");
602 sprintf(card->longname, "Dummy %i", dev + 1); 602 sprintf(card->longname, "Dummy %i", dev + 1);
603
604 if ((err = snd_card_set_generic_dev(card)) < 0)
605 goto __nodev;
606
603 if ((err = snd_card_register(card)) == 0) { 607 if ((err = snd_card_register(card)) == 0) {
604 snd_dummy_cards[dev] = card; 608 snd_dummy_cards[dev] = card;
605 return 0; 609 return 0;
diff --git a/sound/drivers/mpu401/mpu401.c b/sound/drivers/mpu401/mpu401.c
index cb36ecb78697..54e2ff9b5ca1 100644
--- a/sound/drivers/mpu401/mpu401.c
+++ b/sound/drivers/mpu401/mpu401.c
@@ -77,20 +77,26 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard)
77 strcat(card->longname, "polled"); 77 strcat(card->longname, "polled");
78 } 78 }
79 79
80 if (snd_mpu401_uart_new(card, 0, 80 if ((err = snd_mpu401_uart_new(card, 0,
81 MPU401_HW_MPU401, 81 MPU401_HW_MPU401,
82 port[dev], 0, 82 port[dev], 0,
83 irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) { 83 irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL)) < 0) {
84 printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]); 84 printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
85 snd_card_free(card); 85 goto _err;
86 return -ENODEV;
87 }
88 if ((err = snd_card_register(card)) < 0) {
89 snd_card_free(card);
90 return err;
91 } 86 }
87
88 if ((err = snd_card_set_generic_dev(card)) < 0)
89 goto _err;
90
91 if ((err = snd_card_register(card)) < 0)
92 goto _err;
93
92 *rcard = card; 94 *rcard = card;
93 return 0; 95 return 0;
96
97 _err:
98 snd_card_free(card);
99 return err;
94} 100}
95 101
96static int __devinit snd_mpu401_probe(int dev) 102static int __devinit snd_mpu401_probe(int dev)
diff --git a/sound/drivers/mpu401/mpu401_uart.c b/sound/drivers/mpu401/mpu401_uart.c
index 0f83c5241b6b..fe3f921ffbe3 100644
--- a/sound/drivers/mpu401/mpu401_uart.c
+++ b/sound/drivers/mpu401/mpu401_uart.c
@@ -463,7 +463,7 @@ int snd_mpu401_uart_new(snd_card_t * card, int device,
463 *rrawmidi = NULL; 463 *rrawmidi = NULL;
464 if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0) 464 if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0)
465 return err; 465 return err;
466 mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL); 466 mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
467 if (mpu == NULL) { 467 if (mpu == NULL) {
468 snd_device_free(card, rmidi); 468 snd_device_free(card, rmidi);
469 return -ENOMEM; 469 return -ENOMEM;
diff --git a/sound/drivers/mtpav.c b/sound/drivers/mtpav.c
index 1280a57c49eb..3a25c89d2983 100644
--- a/sound/drivers/mtpav.c
+++ b/sound/drivers/mtpav.c
@@ -688,7 +688,7 @@ static int snd_mtpav_get_RAWMIDI(mtpav_t * mcard)
688 688
689static mtpav_t *new_mtpav(void) 689static mtpav_t *new_mtpav(void)
690{ 690{
691 mtpav_t *ncrd = kcalloc(1, sizeof(*ncrd), GFP_KERNEL); 691 mtpav_t *ncrd = kzalloc(sizeof(*ncrd), GFP_KERNEL);
692 if (ncrd != NULL) { 692 if (ncrd != NULL) {
693 spin_lock_init(&ncrd->spinlock); 693 spin_lock_init(&ncrd->spinlock);
694 694
@@ -757,6 +757,9 @@ static int __init alsa_card_mtpav_init(void)
757 if (err < 0) 757 if (err < 0)
758 goto __error; 758 goto __error;
759 759
760 if ((err = snd_card_set_generic_dev(mtp_card->card)) < 0)
761 goto __error;
762
760 err = snd_card_register(mtp_card->card); // don't snd_card_register until AFTER all cards reources done! 763 err = snd_card_register(mtp_card->card); // don't snd_card_register until AFTER all cards reources done!
761 764
762 //printk("snd_card_register returned %d\n", err); 765 //printk("snd_card_register returned %d\n", err);
diff --git a/sound/drivers/opl3/opl3_lib.c b/sound/drivers/opl3/opl3_lib.c
index c313e5205cb8..1f84d78260de 100644
--- a/sound/drivers/opl3/opl3_lib.c
+++ b/sound/drivers/opl3/opl3_lib.c
@@ -354,7 +354,7 @@ int snd_opl3_new(snd_card_t *card,
354 int err; 354 int err;
355 355
356 *ropl3 = NULL; 356 *ropl3 = NULL;
357 opl3 = kcalloc(1, sizeof(*opl3), GFP_KERNEL); 357 opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL);
358 if (opl3 == NULL) 358 if (opl3 == NULL)
359 return -ENOMEM; 359 return -ENOMEM;
360 360
diff --git a/sound/drivers/opl3/opl3_oss.c b/sound/drivers/opl3/opl3_oss.c
index 33da334ae981..21a2b409d6d3 100644
--- a/sound/drivers/opl3/opl3_oss.c
+++ b/sound/drivers/opl3/opl3_oss.c
@@ -241,7 +241,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
241 } 241 }
242 242
243 size = sizeof(*put) + sizeof(fm_xinstrument_t); 243 size = sizeof(*put) + sizeof(fm_xinstrument_t);
244 put = kcalloc(1, size, GFP_KERNEL); 244 put = kzalloc(size, GFP_KERNEL);
245 if (put == NULL) 245 if (put == NULL)
246 return -ENOMEM; 246 return -ENOMEM;
247 /* build header */ 247 /* build header */
diff --git a/sound/drivers/opl4/opl4_lib.c b/sound/drivers/opl4/opl4_lib.c
index 8261464dade8..380c2c704c54 100644
--- a/sound/drivers/opl4/opl4_lib.c
+++ b/sound/drivers/opl4/opl4_lib.c
@@ -204,7 +204,7 @@ int snd_opl4_create(snd_card_t *card,
204 if (ropl4) 204 if (ropl4)
205 *ropl4 = NULL; 205 *ropl4 = NULL;
206 206
207 opl4 = kcalloc(1, sizeof(*opl4), GFP_KERNEL); 207 opl4 = kzalloc(sizeof(*opl4), GFP_KERNEL);
208 if (!opl4) 208 if (!opl4)
209 return -ENOMEM; 209 return -ENOMEM;
210 210
diff --git a/sound/drivers/serial-u16550.c b/sound/drivers/serial-u16550.c
index 986df35fb829..416172ea1f47 100644
--- a/sound/drivers/serial-u16550.c
+++ b/sound/drivers/serial-u16550.c
@@ -779,7 +779,7 @@ static int __init snd_uart16550_create(snd_card_t * card,
779 int err; 779 int err;
780 780
781 781
782 if ((uart = kcalloc(1, sizeof(*uart), GFP_KERNEL)) == NULL) 782 if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL)
783 return -ENOMEM; 783 return -ENOMEM;
784 uart->adaptor = adaptor; 784 uart->adaptor = adaptor;
785 uart->card = card; 785 uart->card = card;
@@ -928,15 +928,11 @@ static int __init snd_serial_probe(int dev)
928 base[dev], 928 base[dev],
929 adaptor[dev], 929 adaptor[dev],
930 droponfull[dev], 930 droponfull[dev],
931 &uart)) < 0) { 931 &uart)) < 0)
932 snd_card_free(card); 932 goto _err;
933 return err;
934 }
935 933
936 if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0) { 934 if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0)
937 snd_card_free(card); 935 goto _err;
938 return err;
939 }
940 936
941 sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d", 937 sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d",
942 card->shortname, 938 card->shortname,
@@ -949,12 +945,18 @@ static int __init snd_serial_probe(int dev)
949 adaptor_names[uart->adaptor], 945 adaptor_names[uart->adaptor],
950 uart->drop_on_full); 946 uart->drop_on_full);
951 947
952 if ((err = snd_card_register(card)) < 0) { 948 if ((err = snd_card_set_generic_dev(card)) < 0)
953 snd_card_free(card); 949 goto _err;
954 return err; 950
955 } 951 if ((err = snd_card_register(card)) < 0)
952 goto _err;
953
956 snd_serial_cards[dev] = card; 954 snd_serial_cards[dev] = card;
957 return 0; 955 return 0;
956
957 _err:
958 snd_card_free(card);
959 return err;
958} 960}
959 961
960static int __init alsa_card_serial_init(void) 962static int __init alsa_card_serial_init(void)
diff --git a/sound/drivers/virmidi.c b/sound/drivers/virmidi.c
index 5937711e9505..af12185ab8a2 100644
--- a/sound/drivers/virmidi.c
+++ b/sound/drivers/virmidi.c
@@ -116,6 +116,10 @@ static int __init snd_card_virmidi_probe(int dev)
116 strcpy(card->driver, "VirMIDI"); 116 strcpy(card->driver, "VirMIDI");
117 strcpy(card->shortname, "VirMIDI"); 117 strcpy(card->shortname, "VirMIDI");
118 sprintf(card->longname, "Virtual MIDI Card %i", dev + 1); 118 sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
119
120 if ((err = snd_card_set_generic_dev(card)) < 0)
121 goto __nodev;
122
119 if ((err = snd_card_register(card)) == 0) { 123 if ((err = snd_card_register(card)) == 0) {
120 snd_virmidi_cards[dev] = card; 124 snd_virmidi_cards[dev] = card;
121 return 0; 125 return 0;
diff --git a/sound/drivers/vx/vx_core.c b/sound/drivers/vx/vx_core.c
index c6fa5afa3e9a..4697b1d75cbb 100644
--- a/sound/drivers/vx/vx_core.c
+++ b/sound/drivers/vx/vx_core.c
@@ -782,7 +782,7 @@ vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw,
782 782
783 snd_assert(card && hw && ops, return NULL); 783 snd_assert(card && hw && ops, return NULL);
784 784
785 chip = kcalloc(1, sizeof(*chip) + extra_size, GFP_KERNEL); 785 chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL);
786 if (! chip) { 786 if (! chip) {
787 snd_printk(KERN_ERR "vx_core: no memory\n"); 787 snd_printk(KERN_ERR "vx_core: no memory\n");
788 return NULL; 788 return NULL;
diff --git a/sound/drivers/vx/vx_pcm.c b/sound/drivers/vx/vx_pcm.c
index d4becf44e247..c2312d912fc7 100644
--- a/sound/drivers/vx/vx_pcm.c
+++ b/sound/drivers/vx/vx_pcm.c
@@ -473,7 +473,7 @@ static int vx_alloc_pipe(vx_core_t *chip, int capture,
473 return err; 473 return err;
474 474
475 /* initialize the pipe record */ 475 /* initialize the pipe record */
476 pipe = kcalloc(1, sizeof(*pipe), GFP_KERNEL); 476 pipe = kzalloc(sizeof(*pipe), GFP_KERNEL);
477 if (! pipe) { 477 if (! pipe) {
478 /* release the pipe */ 478 /* release the pipe */
479 vx_init_rmh(&rmh, CMD_FREE_PIPE); 479 vx_init_rmh(&rmh, CMD_FREE_PIPE);
diff --git a/sound/i2c/cs8427.c b/sound/i2c/cs8427.c
index a3fda859dd15..a21f7d541f86 100644
--- a/sound/i2c/cs8427.c
+++ b/sound/i2c/cs8427.c
@@ -200,7 +200,7 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
200 200
201 if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0) 201 if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0)
202 return err; 202 return err;
203 chip = device->private_data = kcalloc(1, sizeof(*chip), GFP_KERNEL); 203 chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
204 if (chip == NULL) { 204 if (chip == NULL) {
205 snd_i2c_device_free(device); 205 snd_i2c_device_free(device);
206 return -ENOMEM; 206 return -ENOMEM;
diff --git a/sound/i2c/i2c.c b/sound/i2c/i2c.c
index e8fa7e1a68e8..e4e505b9d88b 100644
--- a/sound/i2c/i2c.c
+++ b/sound/i2c/i2c.c
@@ -81,7 +81,7 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master
81 }; 81 };
82 82
83 *ri2c = NULL; 83 *ri2c = NULL;
84 bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); 84 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
85 if (bus == NULL) 85 if (bus == NULL)
86 return -ENOMEM; 86 return -ENOMEM;
87 init_MUTEX(&bus->lock_mutex); 87 init_MUTEX(&bus->lock_mutex);
@@ -108,7 +108,7 @@ int snd_i2c_device_create(snd_i2c_bus_t *bus, const char *name, unsigned char ad
108 108
109 *rdevice = NULL; 109 *rdevice = NULL;
110 snd_assert(bus != NULL, return -EINVAL); 110 snd_assert(bus != NULL, return -EINVAL);
111 device = kcalloc(1, sizeof(*device), GFP_KERNEL); 111 device = kzalloc(sizeof(*device), GFP_KERNEL);
112 if (device == NULL) 112 if (device == NULL)
113 return -ENOMEM; 113 return -ENOMEM;
114 device->addr = addr; 114 device->addr = addr;
diff --git a/sound/i2c/l3/uda1341.c b/sound/i2c/l3/uda1341.c
index e13122f3fc50..103a7dcd0dde 100644
--- a/sound/i2c/l3/uda1341.c
+++ b/sound/i2c/l3/uda1341.c
@@ -17,7 +17,7 @@
17 * 2002-05-12 Tomas Kasparek another code cleanup 17 * 2002-05-12 Tomas Kasparek another code cleanup
18 */ 18 */
19 19
20/* $Id: uda1341.c,v 1.15 2005/01/03 12:05:20 tiwai Exp $ */ 20/* $Id: uda1341.c,v 1.16 2005/09/09 13:22:34 tiwai Exp $ */
21 21
22#include <sound/driver.h> 22#include <sound/driver.h>
23#include <linux/module.h> 23#include <linux/module.h>
@@ -670,7 +670,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt)
670 670
671 snd_assert(card != NULL, return -EINVAL); 671 snd_assert(card != NULL, return -EINVAL);
672 672
673 uda1341 = kcalloc(1, sizeof(*uda1341), GFP_KERNEL); 673 uda1341 = kzalloc(sizeof(*uda1341), GFP_KERNEL);
674 if (uda1341 == NULL) 674 if (uda1341 == NULL)
675 return -ENOMEM; 675 return -ENOMEM;
676 676
@@ -707,7 +707,7 @@ static int uda1341_attach(struct l3_client *clnt)
707{ 707{
708 struct uda1341 *uda; 708 struct uda1341 *uda;
709 709
710 uda = kcalloc(1, sizeof(*uda), 0, GFP_KERNEL); 710 uda = kzalloc(sizeof(*uda), 0, GFP_KERNEL);
711 if (!uda) 711 if (!uda)
712 return -ENOMEM; 712 return -ENOMEM;
713 713
diff --git a/sound/i2c/other/ak4114.c b/sound/i2c/other/ak4114.c
index 5adde308a00f..af5eadcddd92 100644
--- a/sound/i2c/other/ak4114.c
+++ b/sound/i2c/other/ak4114.c
@@ -92,7 +92,7 @@ int snd_ak4114_create(snd_card_t *card,
92 .dev_free = snd_ak4114_dev_free, 92 .dev_free = snd_ak4114_dev_free,
93 }; 93 };
94 94
95 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 95 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
96 if (chip == NULL) 96 if (chip == NULL)
97 return -ENOMEM; 97 return -ENOMEM;
98 spin_lock_init(&chip->lock); 98 spin_lock_init(&chip->lock);
diff --git a/sound/i2c/other/ak4117.c b/sound/i2c/other/ak4117.c
index 0419c4336a55..d51b51dd86d6 100644
--- a/sound/i2c/other/ak4117.c
+++ b/sound/i2c/other/ak4117.c
@@ -83,7 +83,7 @@ int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *wri
83 .dev_free = snd_ak4117_dev_free, 83 .dev_free = snd_ak4117_dev_free,
84 }; 84 };
85 85
86 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 86 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
87 if (chip == NULL) 87 if (chip == NULL)
88 return -ENOMEM; 88 return -ENOMEM;
89 spin_lock_init(&chip->lock); 89 spin_lock_init(&chip->lock);
diff --git a/sound/i2c/tea6330t.c b/sound/i2c/tea6330t.c
index 2da8d7f157f4..fd65da654267 100644
--- a/sound/i2c/tea6330t.c
+++ b/sound/i2c/tea6330t.c
@@ -281,7 +281,7 @@ int snd_tea6330t_update_mixer(snd_card_t * card,
281 u8 default_treble, default_bass; 281 u8 default_treble, default_bass;
282 unsigned char bytes[7]; 282 unsigned char bytes[7];
283 283
284 tea = kcalloc(1, sizeof(*tea), GFP_KERNEL); 284 tea = kzalloc(sizeof(*tea), GFP_KERNEL);
285 if (tea == NULL) 285 if (tea == NULL)
286 return -ENOMEM; 286 return -ENOMEM;
287 if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) { 287 if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) {
diff --git a/sound/isa/Kconfig b/sound/isa/Kconfig
index 5c3948311528..5d6c300ac0d5 100644
--- a/sound/isa/Kconfig
+++ b/sound/isa/Kconfig
@@ -6,12 +6,12 @@ menu "ISA devices"
6config SND_AD1848_LIB 6config SND_AD1848_LIB
7 tristate 7 tristate
8 select SND_PCM 8 select SND_PCM
9 select SND_GENERIC_PM 9 select SND_GENERIC_DRIVER
10 10
11config SND_CS4231_LIB 11config SND_CS4231_LIB
12 tristate 12 tristate
13 select SND_PCM 13 select SND_PCM
14 select SND_GENERIC_PM 14 select SND_GENERIC_DRIVER
15 15
16config SND_AD1816A 16config SND_AD1816A
17 tristate "Analog Devices SoundPort AD1816A" 17 tristate "Analog Devices SoundPort AD1816A"
@@ -97,6 +97,7 @@ config SND_ES1688
97 select SND_OPL3_LIB 97 select SND_OPL3_LIB
98 select SND_MPU401_UART 98 select SND_MPU401_UART
99 select SND_PCM 99 select SND_PCM
100 select SND_GENERIC_DRIVER
100 help 101 help
101 Say Y here to include support for ESS AudioDrive ES688 or 102 Say Y here to include support for ESS AudioDrive ES688 or
102 ES1688 chips. 103 ES1688 chips.
@@ -110,7 +111,7 @@ config SND_ES18XX
110 select SND_OPL3_LIB 111 select SND_OPL3_LIB
111 select SND_MPU401_UART 112 select SND_MPU401_UART
112 select SND_PCM 113 select SND_PCM
113 select SND_GENERIC_PM 114 select SND_GENERIC_DRIVER
114 help 115 help
115 Say Y here to include support for ESS AudioDrive ES18xx chips. 116 Say Y here to include support for ESS AudioDrive ES18xx chips.
116 117
@@ -126,6 +127,7 @@ config SND_GUSCLASSIC
126 select SND_RAWMIDI 127 select SND_RAWMIDI
127 select SND_PCM 128 select SND_PCM
128 select SND_GUS_SYNTH 129 select SND_GUS_SYNTH
130 select SND_GENERIC_DRIVER
129 help 131 help
130 Say Y here to include support for Gravis UltraSound Classic 132 Say Y here to include support for Gravis UltraSound Classic
131 soundcards. 133 soundcards.
@@ -140,6 +142,7 @@ config SND_GUSEXTREME
140 select SND_MPU401_UART 142 select SND_MPU401_UART
141 select SND_PCM 143 select SND_PCM
142 select SND_GUS_SYNTH 144 select SND_GUS_SYNTH
145 select SND_GENERIC_DRIVER
143 help 146 help
144 Say Y here to include support for Gravis UltraSound Extreme 147 Say Y here to include support for Gravis UltraSound Extreme
145 soundcards. 148 soundcards.
@@ -153,6 +156,7 @@ config SND_GUSMAX
153 select SND_RAWMIDI 156 select SND_RAWMIDI
154 select SND_CS4231_LIB 157 select SND_CS4231_LIB
155 select SND_GUS_SYNTH 158 select SND_GUS_SYNTH
159 select SND_GENERIC_DRIVER
156 help 160 help
157 Say Y here to include support for Gravis UltraSound MAX 161 Say Y here to include support for Gravis UltraSound MAX
158 soundcards. 162 soundcards.
@@ -166,7 +170,7 @@ config SND_INTERWAVE
166 select SND_RAWMIDI 170 select SND_RAWMIDI
167 select SND_CS4231_LIB 171 select SND_CS4231_LIB
168 select SND_GUS_SYNTH 172 select SND_GUS_SYNTH
169 select ISAPNP 173 select SND_GENERIC_DRIVER
170 help 174 help
171 Say Y here to include support for AMD InterWave based 175 Say Y here to include support for AMD InterWave based
172 soundcards (Gravis UltraSound Plug & Play, STB SoundRage32, 176 soundcards (Gravis UltraSound Plug & Play, STB SoundRage32,
@@ -181,7 +185,7 @@ config SND_INTERWAVE_STB
181 select SND_RAWMIDI 185 select SND_RAWMIDI
182 select SND_CS4231_LIB 186 select SND_CS4231_LIB
183 select SND_GUS_SYNTH 187 select SND_GUS_SYNTH
184 select ISAPNP 188 select SND_GENERIC_DRIVER
185 help 189 help
186 Say Y here to include support for AMD InterWave based 190 Say Y here to include support for AMD InterWave based
187 soundcards with a TEA6330T bass and treble regulator 191 soundcards with a TEA6330T bass and treble regulator
@@ -224,6 +228,7 @@ config SND_OPTI93X
224 select SND_OPL3_LIB 228 select SND_OPL3_LIB
225 select SND_MPU401_UART 229 select SND_MPU401_UART
226 select SND_PCM 230 select SND_PCM
231 select SND_GENERIC_DRIVER
227 help 232 help
228 Say Y here to include support for soundcards based on Opti 233 Say Y here to include support for soundcards based on Opti
229 82C93x chips. 234 82C93x chips.
@@ -237,6 +242,7 @@ config SND_SB8
237 select SND_OPL3_LIB 242 select SND_OPL3_LIB
238 select SND_RAWMIDI 243 select SND_RAWMIDI
239 select SND_PCM 244 select SND_PCM
245 select SND_GENERIC_DRIVER
240 help 246 help
241 Say Y here to include support for Creative Sound Blaster 1.0/ 247 Say Y here to include support for Creative Sound Blaster 1.0/
242 2.0/Pro (8-bit) or 100% compatible soundcards. 248 2.0/Pro (8-bit) or 100% compatible soundcards.
@@ -250,6 +256,7 @@ config SND_SB16
250 select SND_OPL3_LIB 256 select SND_OPL3_LIB
251 select SND_MPU401_UART 257 select SND_MPU401_UART
252 select SND_PCM 258 select SND_PCM
259 select SND_GENERIC_DRIVER
253 help 260 help
254 Say Y here to include support for Sound Blaster 16 soundcards 261 Say Y here to include support for Sound Blaster 16 soundcards
255 (including the Plug and Play version). 262 (including the Plug and Play version).
@@ -263,6 +270,7 @@ config SND_SBAWE
263 select SND_OPL3_LIB 270 select SND_OPL3_LIB
264 select SND_MPU401_UART 271 select SND_MPU401_UART
265 select SND_PCM 272 select SND_PCM
273 select SND_GENERIC_DRIVER
266 help 274 help
267 Say Y here to include support for Sound Blaster AWE soundcards 275 Say Y here to include support for Sound Blaster AWE soundcards
268 (including the Plug and Play version). 276 (including the Plug and Play version).
diff --git a/sound/isa/ad1816a/ad1816a_lib.c b/sound/isa/ad1816a/ad1816a_lib.c
index ae860360ecf9..27a9dcfbba00 100644
--- a/sound/isa/ad1816a/ad1816a_lib.c
+++ b/sound/isa/ad1816a/ad1816a_lib.c
@@ -591,7 +591,7 @@ int snd_ad1816a_create(snd_card_t *card,
591 591
592 *rchip = NULL; 592 *rchip = NULL;
593 593
594 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 594 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
595 if (chip == NULL) 595 if (chip == NULL)
596 return -ENOMEM; 596 return -ENOMEM;
597 chip->irq = -1; 597 chip->irq = -1;
diff --git a/sound/isa/ad1848/ad1848.c b/sound/isa/ad1848/ad1848.c
index 8c399340cd72..3ebcc482b07a 100644
--- a/sound/isa/ad1848/ad1848.c
+++ b/sound/isa/ad1848/ad1848.c
@@ -91,35 +91,36 @@ static int __init snd_card_ad1848_probe(int dev)
91 irq[dev], 91 irq[dev],
92 dma1[dev], 92 dma1[dev],
93 thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT, 93 thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT,
94 &chip)) < 0) { 94 &chip)) < 0)
95 snd_card_free(card); 95 goto _err;
96 return err; 96
97 } 97 if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0)
98 goto _err;
99
100 if ((err = snd_ad1848_mixer(chip)) < 0)
101 goto _err;
98 102
99 if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) {
100 snd_card_free(card);
101 return err;
102 }
103 if ((err = snd_ad1848_mixer(chip)) < 0) {
104 snd_card_free(card);
105 return err;
106 }
107 strcpy(card->driver, "AD1848"); 103 strcpy(card->driver, "AD1848");
108 strcpy(card->shortname, pcm->name); 104 strcpy(card->shortname, pcm->name);
109 105
110 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d", 106 sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
111 pcm->name, chip->port, irq[dev], dma1[dev]); 107 pcm->name, chip->port, irq[dev], dma1[dev]);
112 108
113 if (thinkpad[dev]) { 109 if (thinkpad[dev])
114 strcat(card->longname, " [Thinkpad]"); 110 strcat(card->longname, " [Thinkpad]");
115 }
116 111
117 if ((err = snd_card_register(card)) < 0) { 112 if ((err = snd_card_set_generic_dev(card)) < 0)
118 snd_card_free(card); 113 goto _err;
119 return err; 114
120 } 115 if ((err = snd_card_register(card)) < 0)
116 goto _err;
117
121 snd_ad1848_cards[dev] = card; 118 snd_ad1848_cards[dev] = card;
122 return 0; 119 return 0;
120
121 _err:
122 snd_card_free(card);
123 return err;
123} 124}
124 125
125static int __init alsa_card_ad1848_init(void) 126static int __init alsa_card_ad1848_init(void)
diff --git a/sound/isa/ad1848/ad1848_lib.c b/sound/isa/ad1848/ad1848_lib.c
index bc642dc94547..303861cd03cd 100644
--- a/sound/isa/ad1848/ad1848_lib.c
+++ b/sound/isa/ad1848/ad1848_lib.c
@@ -890,7 +890,7 @@ int snd_ad1848_create(snd_card_t * card,
890 int err; 890 int err;
891 891
892 *rchip = NULL; 892 *rchip = NULL;
893 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 893 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
894 if (chip == NULL) 894 if (chip == NULL)
895 return -ENOMEM; 895 return -ENOMEM;
896 spin_lock_init(&chip->reg_lock); 896 spin_lock_init(&chip->reg_lock);
diff --git a/sound/isa/cmi8330.c b/sound/isa/cmi8330.c
index 1fce8b9f37cf..5252206ea388 100644
--- a/sound/isa/cmi8330.c
+++ b/sound/isa/cmi8330.c
@@ -438,33 +438,37 @@ static int __devinit snd_cmi8330_pcm(snd_card_t *card, struct snd_cmi8330 *chip)
438/* 438/*
439 */ 439 */
440 440
441#ifdef CONFIG_PNP
442#define is_isapnp_selected(dev) isapnp[dev]
443#else
444#define is_isapnp_selected(dev) 0
445#endif
446
447#define PFX "cmi8330: "
448
441static int __devinit snd_cmi8330_probe(int dev, 449static int __devinit snd_cmi8330_probe(int dev,
442 struct pnp_card_link *pcard, 450 struct pnp_card_link *pcard,
443 const struct pnp_card_device_id *pid) 451 const struct pnp_card_device_id *pid)
444{ 452{
445 snd_card_t *card; 453 snd_card_t *card;
446 struct snd_cmi8330 *acard; 454 struct snd_cmi8330 *acard;
447 unsigned long flags;
448 int i, err; 455 int i, err;
449 456
450#ifdef CONFIG_PNP 457 if (! is_isapnp_selected(dev)) {
451 if (!isapnp[dev]) {
452#endif
453 if (wssport[dev] == SNDRV_AUTO_PORT) { 458 if (wssport[dev] == SNDRV_AUTO_PORT) {
454 snd_printk("specify wssport\n"); 459 snd_printk(KERN_ERR PFX "specify wssport\n");
455 return -EINVAL; 460 return -EINVAL;
456 } 461 }
457 if (sbport[dev] == SNDRV_AUTO_PORT) { 462 if (sbport[dev] == SNDRV_AUTO_PORT) {
458 snd_printk("specify sbport\n"); 463 snd_printk(KERN_ERR PFX "specify sbport\n");
459 return -EINVAL; 464 return -EINVAL;
460 } 465 }
461#ifdef CONFIG_PNP
462 } 466 }
463#endif 467
464 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 468 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
465 sizeof(struct snd_cmi8330)); 469 sizeof(struct snd_cmi8330));
466 if (card == NULL) { 470 if (card == NULL) {
467 snd_printk("could not get a new card\n"); 471 snd_printk(KERN_ERR PFX "could not get a new card\n");
468 return -ENOMEM; 472 return -ENOMEM;
469 } 473 }
470 acard = (struct snd_cmi8330 *)card->private_data; 474 acard = (struct snd_cmi8330 *)card->private_data;
@@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev,
473#ifdef CONFIG_PNP 477#ifdef CONFIG_PNP
474 if (isapnp[dev]) { 478 if (isapnp[dev]) {
475 if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) { 479 if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) {
476 snd_printk("PnP detection failed\n"); 480 snd_printk(KERN_ERR PFX "PnP detection failed\n");
477 snd_card_free(card); 481 goto _err;
478 return err;
479 } 482 }
480 snd_card_set_dev(card, &pcard->card->dev); 483 snd_card_set_dev(card, &pcard->card->dev);
481 } 484 }
@@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev,
487 wssdma[dev], 490 wssdma[dev],
488 AD1848_HW_DETECT, 491 AD1848_HW_DETECT,
489 &acard->wss)) < 0) { 492 &acard->wss)) < 0) {
490 snd_printk("(AD1848) device busy??\n"); 493 snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
491 snd_card_free(card); 494 goto _err;
492 return err;
493 } 495 }
494 if (acard->wss->hardware != AD1848_HW_CMI8330) { 496 if (acard->wss->hardware != AD1848_HW_CMI8330) {
495 snd_printk("(AD1848) not found during probe\n"); 497 snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
496 snd_card_free(card); 498 err = -ENODEV;
497 return -ENODEV; 499 goto _err;
498 } 500 }
499 501
500 if ((err = snd_sbdsp_create(card, sbport[dev], 502 if ((err = snd_sbdsp_create(card, sbport[dev],
@@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev,
503 sbdma8[dev], 505 sbdma8[dev],
504 sbdma16[dev], 506 sbdma16[dev],
505 SB_HW_AUTO, &acard->sb)) < 0) { 507 SB_HW_AUTO, &acard->sb)) < 0) {
506 snd_printk("(SB16) device busy??\n"); 508 snd_printk(KERN_ERR PFX "(SB16) device busy??\n");
507 snd_card_free(card); 509 goto _err;
508 return err;
509 } 510 }
510 if (acard->sb->hardware != SB_HW_16) { 511 if (acard->sb->hardware != SB_HW_16) {
511 snd_printk("(SB16) not found during probe\n"); 512 snd_printk(KERN_ERR PFX "(SB16) not found during probe\n");
512 snd_card_free(card); 513 goto _err;
513 return -ENODEV;
514 } 514 }
515 515
516 spin_lock_irqsave(&acard->wss->reg_lock, flags);
517 snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */ 516 snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */
518 for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++) 517 for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++)
519 snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]); 518 snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]);
520 spin_unlock_irqrestore(&acard->wss->reg_lock, flags);
521 519
522 if ((err = snd_cmi8330_mixer(card, acard)) < 0) { 520 if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
523 snd_printk("failed to create mixers\n"); 521 snd_printk(KERN_ERR PFX "failed to create mixers\n");
524 snd_card_free(card); 522 goto _err;
525 return err;
526 } 523 }
527 524
528 if ((err = snd_cmi8330_pcm(card, acard)) < 0) { 525 if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
529 snd_printk("failed to create pcms\n"); 526 snd_printk(KERN_ERR PFX "failed to create pcms\n");
530 snd_card_free(card); 527 goto _err;
531 return err;
532 } 528 }
533 529
534 strcpy(card->driver, "CMI8330/C3D"); 530 strcpy(card->driver, "CMI8330/C3D");
@@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev,
539 wssirq[dev], 535 wssirq[dev],
540 wssdma[dev]); 536 wssdma[dev]);
541 537
542 if ((err = snd_card_register(card)) < 0) { 538 if ((err = snd_card_set_generic_dev(card)) < 0)
543 snd_card_free(card); 539 goto _err;
544 return err; 540
545 } 541 if ((err = snd_card_register(card)) < 0)
542 goto _err;
546 543
547 if (pcard) 544 if (pcard)
548 pnp_set_card_drvdata(pcard, card); 545 pnp_set_card_drvdata(pcard, card);
549 else 546 else
550 snd_cmi8330_legacy[dev] = card; 547 snd_cmi8330_legacy[dev] = card;
551 return 0; 548 return 0;
549
550 _err:
551 snd_card_free(card);
552 return err;
552} 553}
553 554
554#ifdef CONFIG_PNP 555#ifdef CONFIG_PNP
@@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void)
594 for (dev = 0; dev < SNDRV_CARDS; dev++) { 595 for (dev = 0; dev < SNDRV_CARDS; dev++) {
595 if (!enable[dev]) 596 if (!enable[dev])
596 continue; 597 continue;
597#ifdef CONFIG_PNP 598 if (is_isapnp_selected(dev))
598 if (isapnp[dev])
599 continue; 599 continue;
600#endif
601 if (snd_cmi8330_probe(dev, NULL, NULL) >= 0) 600 if (snd_cmi8330_probe(dev, NULL, NULL) >= 0)
602 cards++; 601 cards++;
603 } 602 }
diff --git a/sound/isa/cs423x/cs4231.c b/sound/isa/cs423x/cs4231.c
index 7640837659ea..9be5416bcb92 100644
--- a/sound/isa/cs423x/cs4231.c
+++ b/sound/isa/cs423x/cs4231.c
@@ -76,15 +76,15 @@ static int __init snd_card_cs4231_probe(int dev)
76 int err; 76 int err;
77 77
78 if (port[dev] == SNDRV_AUTO_PORT) { 78 if (port[dev] == SNDRV_AUTO_PORT) {
79 snd_printk("specify port\n"); 79 snd_printk(KERN_ERR "specify port\n");
80 return -EINVAL; 80 return -EINVAL;
81 } 81 }
82 if (irq[dev] == SNDRV_AUTO_IRQ) { 82 if (irq[dev] == SNDRV_AUTO_IRQ) {
83 snd_printk("specify irq\n"); 83 snd_printk(KERN_ERR "specify irq\n");
84 return -EINVAL; 84 return -EINVAL;
85 } 85 }
86 if (dma1[dev] == SNDRV_AUTO_DMA) { 86 if (dma1[dev] == SNDRV_AUTO_DMA) {
87 snd_printk("specify dma1\n"); 87 snd_printk(KERN_ERR "specify dma1\n");
88 return -EINVAL; 88 return -EINVAL;
89 } 89 }
90 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 90 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
@@ -96,15 +96,11 @@ static int __init snd_card_cs4231_probe(int dev)
96 dma1[dev], 96 dma1[dev],
97 dma2[dev], 97 dma2[dev],
98 CS4231_HW_DETECT, 98 CS4231_HW_DETECT,
99 0, &chip)) < 0) { 99 0, &chip)) < 0)
100 snd_card_free(card); 100 goto _err;
101 return err;
102 }
103 101
104 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { 102 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
105 snd_card_free(card); 103 goto _err;
106 return err;
107 }
108 104
109 strcpy(card->driver, "CS4231"); 105 strcpy(card->driver, "CS4231");
110 strcpy(card->shortname, pcm->name); 106 strcpy(card->shortname, pcm->name);
@@ -113,14 +109,10 @@ static int __init snd_card_cs4231_probe(int dev)
113 if (dma2[dev] >= 0) 109 if (dma2[dev] >= 0)
114 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 110 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
115 111
116 if ((err = snd_cs4231_mixer(chip)) < 0) { 112 if ((err = snd_cs4231_mixer(chip)) < 0)
117 snd_card_free(card); 113 goto _err;
118 return err; 114 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
119 } 115 goto _err;
120 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
121 snd_card_free(card);
122 return err;
123 }
124 116
125 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) { 117 if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
126 if (mpu_irq[dev] == SNDRV_AUTO_IRQ) 118 if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
@@ -130,14 +122,20 @@ static int __init snd_card_cs4231_probe(int dev)
130 mpu_irq[dev], 122 mpu_irq[dev],
131 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, 123 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0,
132 NULL) < 0) 124 NULL) < 0)
133 printk(KERN_ERR "cs4231: MPU401 not detected\n"); 125 printk(KERN_WARNING "cs4231: MPU401 not detected\n");
134 }
135 if ((err = snd_card_register(card)) < 0) {
136 snd_card_free(card);
137 return err;
138 } 126 }
127
128 if ((err = snd_card_set_generic_dev(card)) < 0)
129 goto _err;
130
131 if ((err = snd_card_register(card)) < 0)
132 goto _err;
139 snd_cs4231_cards[dev] = card; 133 snd_cs4231_cards[dev] = card;
140 return 0; 134 return 0;
135
136 _err:
137 snd_card_free(card);
138 return err;
141} 139}
142 140
143static int __init alsa_card_cs4231_init(void) 141static int __init alsa_card_cs4231_init(void)
diff --git a/sound/isa/cs423x/cs4231_lib.c b/sound/isa/cs423x/cs4231_lib.c
index 3199941edd9b..32318258cd8e 100644
--- a/sound/isa/cs423x/cs4231_lib.c
+++ b/sound/isa/cs423x/cs4231_lib.c
@@ -1480,7 +1480,7 @@ static int snd_cs4231_new(snd_card_t * card,
1480 cs4231_t *chip; 1480 cs4231_t *chip;
1481 1481
1482 *rchip = NULL; 1482 *rchip = NULL;
1483 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1483 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1484 if (chip == NULL) 1484 if (chip == NULL)
1485 return -ENOMEM; 1485 return -ENOMEM;
1486 chip->hardware = hardware; 1486 chip->hardware = hardware;
diff --git a/sound/isa/cs423x/cs4236.c b/sound/isa/cs423x/cs4236.c
index 39f4eff44f5c..d28315dc72f7 100644
--- a/sound/isa/cs423x/cs4236.c
+++ b/sound/isa/cs423x/cs4236.c
@@ -387,6 +387,12 @@ static void snd_card_cs4236_free(snd_card_t *card)
387 } 387 }
388} 388}
389 389
390#ifdef CONFIG_PNP
391#define is_isapnp_selected(dev) isapnp[dev]
392#else
393#define is_isapnp_selected(dev) 0
394#endif
395
390static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard, 396static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
391 const struct pnp_card_device_id *pid) 397 const struct pnp_card_device_id *pid)
392{ 398{
@@ -397,20 +403,16 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
397 opl3_t *opl3; 403 opl3_t *opl3;
398 int err; 404 int err;
399 405
400#ifdef CONFIG_PNP 406 if (! is_isapnp_selected(dev)) {
401 if (!isapnp[dev]) {
402#endif
403 if (port[dev] == SNDRV_AUTO_PORT) { 407 if (port[dev] == SNDRV_AUTO_PORT) {
404 snd_printk("specify port\n"); 408 snd_printk(KERN_ERR "specify port\n");
405 return -EINVAL; 409 return -EINVAL;
406 } 410 }
407 if (cport[dev] == SNDRV_AUTO_PORT) { 411 if (cport[dev] == SNDRV_AUTO_PORT) {
408 snd_printk("specify cport\n"); 412 snd_printk(KERN_ERR "specify cport\n");
409 return -EINVAL; 413 return -EINVAL;
410 } 414 }
411#ifdef CONFIG_PNP
412 } 415 }
413#endif
414 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 416 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
415 sizeof(struct snd_card_cs4236)); 417 sizeof(struct snd_card_cs4236));
416 if (card == NULL) 418 if (card == NULL)
@@ -421,8 +423,7 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
421 if (isapnp[dev]) { 423 if (isapnp[dev]) {
422 if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) { 424 if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) {
423 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n"); 425 printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n");
424 snd_card_free(card); 426 goto _err;
425 return -ENXIO;
426 } 427 }
427 snd_card_set_dev(card, &pcard->card->dev); 428 snd_card_set_dev(card, &pcard->card->dev);
428 } 429 }
@@ -430,8 +431,8 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
430 if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT) 431 if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT)
431 if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) { 432 if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) {
432 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]); 433 printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
433 snd_card_free(card); 434 err = -EBUSY;
434 return -ENOMEM; 435 goto _err;
435 } 436 }
436 437
437#ifdef CS4232 438#ifdef CS4232
@@ -443,18 +444,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
443 dma2[dev], 444 dma2[dev],
444 CS4231_HW_DETECT, 445 CS4231_HW_DETECT,
445 0, 446 0,
446 &chip)) < 0) { 447 &chip)) < 0)
447 snd_card_free(card); 448 goto _err;
448 return err; 449
449 } 450 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
450 if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) { 451 goto _err;
451 snd_card_free(card); 452
452 return err; 453 if ((err = snd_cs4231_mixer(chip)) < 0)
453 } 454 goto _err;
454 if ((err = snd_cs4231_mixer(chip)) < 0) {
455 snd_card_free(card);
456 return err;
457 }
458 455
459#else /* CS4236 */ 456#else /* CS4236 */
460 if ((err = snd_cs4236_create(card, 457 if ((err = snd_cs4236_create(card,
@@ -465,18 +462,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
465 dma2[dev], 462 dma2[dev],
466 CS4231_HW_DETECT, 463 CS4231_HW_DETECT,
467 0, 464 0,
468 &chip)) < 0) { 465 &chip)) < 0)
469 snd_card_free(card); 466 goto _err;
470 return err; 467
471 } 468 if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0)
472 if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) { 469 goto _err;
473 snd_card_free(card); 470
474 return err; 471 if ((err = snd_cs4236_mixer(chip)) < 0)
475 } 472 goto _err;
476 if ((err = snd_cs4236_mixer(chip)) < 0) {
477 snd_card_free(card);
478 return err;
479 }
480#endif 473#endif
481 strcpy(card->driver, pcm->name); 474 strcpy(card->driver, pcm->name);
482 strcpy(card->shortname, pcm->name); 475 strcpy(card->shortname, pcm->name);
@@ -488,21 +481,17 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
488 if (dma2[dev] >= 0) 481 if (dma2[dev] >= 0)
489 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]); 482 sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
490 483
491 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) { 484 if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
492 snd_card_free(card); 485 goto _err;
493 return err;
494 }
495 486
496 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 487 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
497 if (snd_opl3_create(card, 488 if (snd_opl3_create(card,
498 fm_port[dev], fm_port[dev] + 2, 489 fm_port[dev], fm_port[dev] + 2,
499 OPL3_HW_OPL3_CS, 0, &opl3) < 0) { 490 OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
500 printk(KERN_ERR IDENT ": OPL3 not detected\n"); 491 printk(KERN_WARNING IDENT ": OPL3 not detected\n");
501 } else { 492 } else {
502 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 493 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
503 snd_card_free(card); 494 goto _err;
504 return err;
505 }
506 } 495 }
507 } 496 }
508 497
@@ -513,17 +502,23 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
513 mpu_port[dev], 0, 502 mpu_port[dev], 0,
514 mpu_irq[dev], 503 mpu_irq[dev],
515 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) 504 mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
516 printk(KERN_ERR IDENT ": MPU401 not detected\n"); 505 printk(KERN_WARNING IDENT ": MPU401 not detected\n");
517 }
518 if ((err = snd_card_register(card)) < 0) {
519 snd_card_free(card);
520 return err;
521 } 506 }
507
508 if ((err = snd_card_set_generic_dev(card)) < 0)
509 goto _err;
510
511 if ((err = snd_card_register(card)) < 0)
512 goto _err;
522 if (pcard) 513 if (pcard)
523 pnp_set_card_drvdata(pcard, card); 514 pnp_set_card_drvdata(pcard, card);
524 else 515 else
525 snd_cs4236_legacy[dev] = card; 516 snd_cs4236_legacy[dev] = card;
526 return 0; 517 return 0;
518
519 _err:
520 snd_card_free(card);
521 return err;
527} 522}
528 523
529#ifdef CONFIG_PNP 524#ifdef CONFIG_PNP
@@ -569,10 +564,8 @@ static int __init alsa_card_cs423x_init(void)
569 for (dev = 0; dev < SNDRV_CARDS; dev++) { 564 for (dev = 0; dev < SNDRV_CARDS; dev++) {
570 if (!enable[dev]) 565 if (!enable[dev])
571 continue; 566 continue;
572#ifdef CONFIG_PNP 567 if (is_isapnp_selected(dev))
573 if (isapnp[dev])
574 continue; 568 continue;
575#endif
576 if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0) 569 if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0)
577 cards++; 570 cards++;
578 } 571 }
diff --git a/sound/isa/es1688/es1688.c b/sound/isa/es1688/es1688.c
index c5eaec087b46..26a7d335ed8e 100644
--- a/sound/isa/es1688/es1688.c
+++ b/sound/isa/es1688/es1688.c
@@ -70,6 +70,7 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver.");
70 70
71static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 71static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
72 72
73#define PFX "es1688: "
73 74
74static int __init snd_audiodrive_probe(int dev) 75static int __init snd_audiodrive_probe(int dev)
75{ 76{
@@ -89,47 +90,41 @@ static int __init snd_audiodrive_probe(int dev)
89 xirq = irq[dev]; 90 xirq = irq[dev];
90 if (xirq == SNDRV_AUTO_IRQ) { 91 if (xirq == SNDRV_AUTO_IRQ) {
91 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 92 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
92 snd_card_free(card); 93 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
93 snd_printk("unable to find a free IRQ\n"); 94 err = -EBUSY;
94 return -EBUSY; 95 goto _err;
95 } 96 }
96 } 97 }
97 xmpu_irq = mpu_irq[dev]; 98 xmpu_irq = mpu_irq[dev];
98 xdma = dma8[dev]; 99 xdma = dma8[dev];
99 if (xdma == SNDRV_AUTO_DMA) { 100 if (xdma == SNDRV_AUTO_DMA) {
100 if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) { 101 if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) {
101 snd_card_free(card); 102 snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
102 snd_printk("unable to find a free DMA\n"); 103 err = -EBUSY;
103 return -EBUSY; 104 goto _err;
104 } 105 }
105 } 106 }
106 107
107 if ((err = snd_es1688_create(card, port[dev], mpu_port[dev], 108 if ((err = snd_es1688_create(card, port[dev], mpu_port[dev],
108 xirq, xmpu_irq, xdma, 109 xirq, xmpu_irq, xdma,
109 ES1688_HW_AUTO, &chip)) < 0) { 110 ES1688_HW_AUTO, &chip)) < 0)
110 snd_card_free(card); 111 goto _err;
111 return err; 112
112 } 113 if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0)
113 if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) { 114 goto _err;
114 snd_card_free(card); 115
115 return err; 116 if ((err = snd_es1688_mixer(chip)) < 0)
116 } 117 goto _err;
117 if ((err = snd_es1688_mixer(chip)) < 0) {
118 snd_card_free(card);
119 return err;
120 }
121 118
122 strcpy(card->driver, "ES1688"); 119 strcpy(card->driver, "ES1688");
123 strcpy(card->shortname, pcm->name); 120 strcpy(card->shortname, pcm->name);
124 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma); 121 sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma);
125 122
126 if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) { 123 if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) {
127 printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port); 124 printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port);
128 } else { 125 } else {
129 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 126 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
130 snd_card_free(card); 127 goto _err;
131 return err;
132 }
133 } 128 }
134 129
135 if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) { 130 if (xmpu_irq >= 0 && xmpu_irq != SNDRV_AUTO_IRQ && chip->mpu_port > 0) {
@@ -137,18 +132,22 @@ static int __init snd_audiodrive_probe(int dev)
137 chip->mpu_port, 0, 132 chip->mpu_port, 0,
138 xmpu_irq, 133 xmpu_irq,
139 SA_INTERRUPT, 134 SA_INTERRUPT,
140 NULL)) < 0) { 135 NULL)) < 0)
141 snd_card_free(card); 136 goto _err;
142 return err;
143 }
144 }
145 if ((err = snd_card_register(card)) < 0) {
146 snd_card_free(card);
147 return err;
148 } 137 }
138
139 if ((err = snd_card_set_generic_dev(card)) < 0)
140 goto _err;
141
142 if ((err = snd_card_register(card)) < 0)
143 goto _err;
144
149 snd_audiodrive_cards[dev] = card; 145 snd_audiodrive_cards[dev] = card;
150 return 0; 146 return 0;
151 147
148 _err:
149 snd_card_free(card);
150 return err;
152} 151}
153 152
154static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport) 153static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport)
diff --git a/sound/isa/es1688/es1688_lib.c b/sound/isa/es1688/es1688_lib.c
index 17f68d07d9b2..aac898765c02 100644
--- a/sound/isa/es1688/es1688_lib.c
+++ b/sound/isa/es1688/es1688_lib.c
@@ -649,7 +649,7 @@ int snd_es1688_create(snd_card_t * card,
649 int err; 649 int err;
650 650
651 *rchip = NULL; 651 *rchip = NULL;
652 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 652 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
653 if (chip == NULL) 653 if (chip == NULL)
654 return -ENOMEM; 654 return -ENOMEM;
655 chip->irq = -1; 655 chip->irq = -1;
diff --git a/sound/isa/es18xx.c b/sound/isa/es18xx.c
index 1d832b2adb7c..d0ea19f42703 100644
--- a/sound/isa/es18xx.c
+++ b/sound/isa/es18xx.c
@@ -1686,7 +1686,7 @@ static int __devinit snd_es18xx_new_device(snd_card_t * card,
1686 int err; 1686 int err;
1687 1687
1688 *rchip = NULL; 1688 *rchip = NULL;
1689 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1689 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1690 if (chip == NULL) 1690 if (chip == NULL)
1691 return -ENOMEM; 1691 return -ENOMEM;
1692 spin_lock_init(&chip->reg_lock); 1692 spin_lock_init(&chip->reg_lock);
@@ -1988,6 +1988,12 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard,
1988} 1988}
1989#endif /* CONFIG_PNP */ 1989#endif /* CONFIG_PNP */
1990 1990
1991#ifdef CONFIG_PNP
1992#define is_isapnp_selected(dev) isapnp[dev]
1993#else
1994#define is_isapnp_selected(dev) 0
1995#endif
1996
1991static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard, 1997static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
1992 const struct pnp_card_device_id *pid) 1998 const struct pnp_card_device_id *pid)
1993{ 1999{
@@ -1996,7 +2002,6 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
1996 int xirq, xdma1, xdma2; 2002 int xirq, xdma1, xdma2;
1997 snd_card_t *card; 2003 snd_card_t *card;
1998 struct snd_audiodrive *acard; 2004 struct snd_audiodrive *acard;
1999 snd_rawmidi_t *rmidi = NULL;
2000 es18xx_t *chip; 2005 es18xx_t *chip;
2001 opl3_t *opl3; 2006 opl3_t *opl3;
2002 int err; 2007 int err;
@@ -2019,25 +2024,25 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2019 xirq = irq[dev]; 2024 xirq = irq[dev];
2020 if (xirq == SNDRV_AUTO_IRQ) { 2025 if (xirq == SNDRV_AUTO_IRQ) {
2021 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 2026 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
2022 snd_card_free(card); 2027 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
2023 snd_printk("unable to find a free IRQ\n"); 2028 err = -EBUSY;
2024 return -EBUSY; 2029 goto _err;
2025 } 2030 }
2026 } 2031 }
2027 xdma1 = dma1[dev]; 2032 xdma1 = dma1[dev];
2028 if (xdma1 == SNDRV_AUTO_DMA) { 2033 if (xdma1 == SNDRV_AUTO_DMA) {
2029 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 2034 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
2030 snd_card_free(card); 2035 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
2031 snd_printk("unable to find a free DMA1\n"); 2036 err = -EBUSY;
2032 return -EBUSY; 2037 goto _err;
2033 } 2038 }
2034 } 2039 }
2035 xdma2 = dma2[dev]; 2040 xdma2 = dma2[dev];
2036 if (xdma2 == SNDRV_AUTO_DMA) { 2041 if (xdma2 == SNDRV_AUTO_DMA) {
2037 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 2042 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
2038 snd_card_free(card); 2043 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
2039 snd_printk("unable to find a free DMA2\n"); 2044 err = -EBUSY;
2040 return -EBUSY; 2045 goto _err;
2041 } 2046 }
2042 } 2047 }
2043 2048
@@ -2046,10 +2051,8 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2046 mpu_port[dev], 2051 mpu_port[dev],
2047 fm_port[dev], 2052 fm_port[dev],
2048 xirq, xdma1, xdma2, 2053 xirq, xdma1, xdma2,
2049 &chip)) < 0) { 2054 &chip)) < 0)
2050 snd_card_free(card); 2055 goto _err;
2051 return err;
2052 }
2053 2056
2054 sprintf(card->driver, "ES%x", chip->version); 2057 sprintf(card->driver, "ES%x", chip->version);
2055 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version); 2058 sprintf(card->shortname, "ESS AudioDrive ES%x", chip->version);
@@ -2064,23 +2067,18 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2064 chip->port, 2067 chip->port,
2065 xirq, xdma1); 2068 xirq, xdma1);
2066 2069
2067 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) { 2070 if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0)
2068 snd_card_free(card); 2071 goto _err;
2069 return err; 2072
2070 } 2073 if ((err = snd_es18xx_mixer(chip)) < 0)
2071 if ((err = snd_es18xx_mixer(chip)) < 0) { 2074 goto _err;
2072 snd_card_free(card);
2073 return err;
2074 }
2075 2075
2076 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) { 2076 if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
2077 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) { 2077 if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) {
2078 snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port); 2078 snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
2079 } else { 2079 } else {
2080 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 2080 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
2081 snd_card_free(card); 2081 goto _err;
2082 return err;
2083 }
2084 } 2082 }
2085 } 2083 }
2086 2084
@@ -2088,25 +2086,28 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
2088 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX, 2086 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
2089 chip->mpu_port, 0, 2087 chip->mpu_port, 0,
2090 xirq, 0, 2088 xirq, 0,
2091 &rmidi)) < 0) { 2089 &chip->rmidi)) < 0)
2092 snd_card_free(card); 2090 goto _err;
2093 return err;
2094 }
2095 chip->rmidi = rmidi;
2096 } 2091 }
2097 2092
2093 if ((err = snd_card_set_generic_dev(card)) < 0)
2094 goto _err;
2095
2098 /* Power Management */ 2096 /* Power Management */
2099 snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip); 2097 snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip);
2100 2098
2101 if ((err = snd_card_register(card)) < 0) { 2099 if ((err = snd_card_register(card)) < 0)
2102 snd_card_free(card); 2100 goto _err;
2103 return err; 2101
2104 }
2105 if (pcard) 2102 if (pcard)
2106 pnp_set_card_drvdata(pcard, card); 2103 pnp_set_card_drvdata(pcard, card);
2107 else 2104 else
2108 snd_audiodrive_legacy[dev] = card; 2105 snd_audiodrive_legacy[dev] = card;
2109 return 0; 2106 return 0;
2107
2108 _err:
2109 snd_card_free(card);
2110 return err;
2110} 2111}
2111 2112
2112static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport) 2113static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
@@ -2117,10 +2118,8 @@ static int __devinit snd_audiodrive_probe_legacy_port(unsigned long xport)
2117 for ( ; dev < SNDRV_CARDS; dev++) { 2118 for ( ; dev < SNDRV_CARDS; dev++) {
2118 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) 2119 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
2119 continue; 2120 continue;
2120#ifdef CONFIG_PNP 2121 if (is_isapnp_selected(dev))
2121 if (isapnp[dev])
2122 continue; 2122 continue;
2123#endif
2124 port[dev] = xport; 2123 port[dev] = xport;
2125 res = snd_audiodrive_probe(dev, NULL, NULL); 2124 res = snd_audiodrive_probe(dev, NULL, NULL);
2126 if (res < 0) 2125 if (res < 0)
@@ -2177,10 +2176,8 @@ static int __init alsa_card_es18xx_init(void)
2177 for (dev = 0; dev < SNDRV_CARDS; dev++) { 2176 for (dev = 0; dev < SNDRV_CARDS; dev++) {
2178 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) 2177 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
2179 continue; 2178 continue;
2180#ifdef CONFIG_PNP 2179 if (is_isapnp_selected(dev))
2181 if (isapnp[dev])
2182 continue; 2180 continue;
2183#endif
2184 if (snd_audiodrive_probe(dev, NULL, NULL) >= 0) 2181 if (snd_audiodrive_probe(dev, NULL, NULL) >= 0)
2185 cards++; 2182 cards++;
2186 } 2183 }
diff --git a/sound/isa/gus/gus_main.c b/sound/isa/gus/gus_main.c
index a636d9ce3502..8f2872f8e8f6 100644
--- a/sound/isa/gus/gus_main.c
+++ b/sound/isa/gus/gus_main.c
@@ -157,7 +157,7 @@ int snd_gus_create(snd_card_t * card,
157 }; 157 };
158 158
159 *rgus = NULL; 159 *rgus = NULL;
160 gus = kcalloc(1, sizeof(*gus), GFP_KERNEL); 160 gus = kzalloc(sizeof(*gus), GFP_KERNEL);
161 if (gus == NULL) 161 if (gus == NULL)
162 return -ENOMEM; 162 return -ENOMEM;
163 gus->gf1.irq = -1; 163 gus->gf1.irq = -1;
diff --git a/sound/isa/gus/gus_mem_proc.c b/sound/isa/gus/gus_mem_proc.c
index 886763f12132..7f96ac237f3c 100644
--- a/sound/isa/gus/gus_mem_proc.c
+++ b/sound/isa/gus/gus_mem_proc.c
@@ -98,7 +98,7 @@ int snd_gf1_mem_proc_init(snd_gus_card_t * gus)
98 98
99 for (idx = 0; idx < 4; idx++) { 99 for (idx = 0; idx < 4; idx++) {
100 if (gus->gf1.mem_alloc.banks_8[idx].size > 0) { 100 if (gus->gf1.mem_alloc.banks_8[idx].size > 0) {
101 priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); 101 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
102 if (priv == NULL) 102 if (priv == NULL)
103 return -ENOMEM; 103 return -ENOMEM;
104 priv->gus = gus; 104 priv->gus = gus;
@@ -115,7 +115,7 @@ int snd_gf1_mem_proc_init(snd_gus_card_t * gus)
115 } 115 }
116 for (idx = 0; idx < 4; idx++) { 116 for (idx = 0; idx < 4; idx++) {
117 if (gus->gf1.rom_present & (1 << idx)) { 117 if (gus->gf1.rom_present & (1 << idx)) {
118 priv = kcalloc(1, sizeof(*priv), GFP_KERNEL); 118 priv = kzalloc(sizeof(*priv), GFP_KERNEL);
119 if (priv == NULL) 119 if (priv == NULL)
120 return -ENOMEM; 120 return -ENOMEM;
121 priv->rom = 1; 121 priv->rom = 1;
diff --git a/sound/isa/gus/gus_pcm.c b/sound/isa/gus/gus_pcm.c
index b75066ab46fc..beb01365dc46 100644
--- a/sound/isa/gus/gus_pcm.c
+++ b/sound/isa/gus/gus_pcm.c
@@ -666,7 +666,7 @@ static int snd_gf1_pcm_playback_open(snd_pcm_substream_t *substream)
666 snd_pcm_runtime_t *runtime = substream->runtime; 666 snd_pcm_runtime_t *runtime = substream->runtime;
667 int err; 667 int err;
668 668
669 pcmp = kcalloc(1, sizeof(*pcmp), GFP_KERNEL); 669 pcmp = kzalloc(sizeof(*pcmp), GFP_KERNEL);
670 if (pcmp == NULL) 670 if (pcmp == NULL)
671 return -ENOMEM; 671 return -ENOMEM;
672 pcmp->gus = gus; 672 pcmp->gus = gus;
diff --git a/sound/isa/gus/gusclassic.c b/sound/isa/gus/gusclassic.c
index a99fa5040b46..39cef38835ca 100644
--- a/sound/isa/gus/gusclassic.c
+++ b/sound/isa/gus/gusclassic.c
@@ -72,40 +72,24 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver.");
72 72
73static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 73static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
74 74
75#define PFX "gusclassic: "
75 76
76static int __init snd_gusclassic_detect(snd_gus_card_t * gus) 77static int __init snd_gusclassic_detect(snd_gus_card_t * gus)
77{ 78{
78 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 79 unsigned char d;
79#ifdef CONFIG_SND_DEBUG_DETECT
80 {
81 unsigned char d;
82 80
83 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { 81 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
84 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); 82 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
85 return -ENODEV; 83 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
86 }
87 }
88#else
89 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
90 return -ENODEV; 84 return -ENODEV;
91#endif 85 }
92 udelay(160); 86 udelay(160);
93 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 87 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
94 udelay(160); 88 udelay(160);
95#ifdef CONFIG_SND_DEBUG_DETECT 89 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
96 { 90 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
97 unsigned char d;
98
99 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
100 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
101 return -ENODEV;
102 }
103 }
104#else
105 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
106 return -ENODEV; 91 return -ENODEV;
107#endif 92 }
108
109 return 0; 93 return 0;
110} 94}
111 95
@@ -137,25 +121,25 @@ static int __init snd_gusclassic_probe(int dev)
137 xirq = irq[dev]; 121 xirq = irq[dev];
138 if (xirq == SNDRV_AUTO_IRQ) { 122 if (xirq == SNDRV_AUTO_IRQ) {
139 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 123 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
140 snd_card_free(card); 124 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
141 snd_printk("unable to find a free IRQ\n"); 125 err = -EBUSY;
142 return -EBUSY; 126 goto _err;
143 } 127 }
144 } 128 }
145 xdma1 = dma1[dev]; 129 xdma1 = dma1[dev];
146 if (xdma1 == SNDRV_AUTO_DMA) { 130 if (xdma1 == SNDRV_AUTO_DMA) {
147 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 131 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
148 snd_card_free(card); 132 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
149 snd_printk("unable to find a free DMA1\n"); 133 err = -EBUSY;
150 return -EBUSY; 134 goto _err;
151 } 135 }
152 } 136 }
153 xdma2 = dma2[dev]; 137 xdma2 = dma2[dev];
154 if (xdma2 == SNDRV_AUTO_DMA) { 138 if (xdma2 == SNDRV_AUTO_DMA) {
155 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 139 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
156 snd_card_free(card); 140 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
157 snd_printk("unable to find a free DMA2\n"); 141 err = -EBUSY;
158 return -EBUSY; 142 goto _err;
159 } 143 }
160 } 144 }
161 145
@@ -164,47 +148,48 @@ static int __init snd_gusclassic_probe(int dev)
164 port[dev], 148 port[dev],
165 xirq, xdma1, xdma2, 149 xirq, xdma1, xdma2,
166 0, channels[dev], pcm_channels[dev], 150 0, channels[dev], pcm_channels[dev],
167 0, &gus)) < 0) { 151 0, &gus)) < 0)
168 snd_card_free(card); 152 goto _err;
169 return err; 153
170 } 154 if ((err = snd_gusclassic_detect(gus)) < 0)
171 if ((err = snd_gusclassic_detect(gus)) < 0) { 155 goto _err;
172 snd_card_free(card); 156
173 return err;
174 }
175 snd_gusclassic_init(dev, gus); 157 snd_gusclassic_init(dev, gus);
176 if ((err = snd_gus_initialize(gus)) < 0) { 158 if ((err = snd_gus_initialize(gus)) < 0)
177 snd_card_free(card); 159 goto _err;
178 return err; 160
179 }
180 if (gus->max_flag || gus->ess_flag) { 161 if (gus->max_flag || gus->ess_flag) {
181 snd_printdd("GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port); 162 snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port);
182 snd_card_free(card); 163 err = -ENODEV;
183 return -ENODEV; 164 goto _err;
184 }
185 if ((err = snd_gf1_new_mixer(gus)) < 0) {
186 snd_card_free(card);
187 return err;
188 }
189 if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) {
190 snd_card_free(card);
191 return err;
192 } 165 }
166
167 if ((err = snd_gf1_new_mixer(gus)) < 0)
168 goto _err;
169
170 if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0)
171 goto _err;
172
193 if (!gus->ace_flag) { 173 if (!gus->ace_flag) {
194 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { 174 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
195 snd_card_free(card); 175 goto _err;
196 return err;
197 }
198 } 176 }
199 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1); 177 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1);
200 if (dma2 >= 0) 178 if (dma2 >= 0)
201 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 179 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
202 if ((err = snd_card_register(card)) < 0) { 180
203 snd_card_free(card); 181 if ((err = snd_card_set_generic_dev(card)) < 0)
204 return err; 182 goto _err;
205 } 183
184 if ((err = snd_card_register(card)) < 0)
185 goto _err;
186
206 snd_gusclassic_cards[dev] = card; 187 snd_gusclassic_cards[dev] = card;
207 return 0; 188 return 0;
189
190 _err:
191 snd_card_free(card);
192 return err;
208} 193}
209 194
210static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport) 195static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport)
diff --git a/sound/isa/gus/gusextreme.c b/sound/isa/gus/gusextreme.c
index bc6fecb18dcf..d2e7cb1df537 100644
--- a/sound/isa/gus/gusextreme.c
+++ b/sound/isa/gus/gusextreme.c
@@ -87,6 +87,7 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver.");
87 87
88static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 88static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
89 89
90#define PFX "gusextreme: "
90 91
91static int __init snd_gusextreme_detect(int dev, 92static int __init snd_gusextreme_detect(int dev,
92 snd_card_t * card, 93 snd_card_t * card,
@@ -94,6 +95,7 @@ static int __init snd_gusextreme_detect(int dev,
94 es1688_t *es1688) 95 es1688_t *es1688)
95{ 96{
96 unsigned long flags; 97 unsigned long flags;
98 unsigned char d;
97 99
98 /* 100 /*
99 * This is main stuff - enable access to GF1 chip... 101 * This is main stuff - enable access to GF1 chip...
@@ -123,36 +125,17 @@ static int __init snd_gusextreme_detect(int dev,
123 udelay(100); 125 udelay(100);
124 126
125 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 127 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
126#ifdef CONFIG_SND_DEBUG_DETECT 128 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
127 { 129 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
128 unsigned char d;
129
130 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
131 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
132 return -EIO;
133 }
134 }
135#else
136 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
137 return -EIO; 130 return -EIO;
138#endif 131 }
139 udelay(160); 132 udelay(160);
140 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 133 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
141 udelay(160); 134 udelay(160);
142#ifdef CONFIG_SND_DEBUG_DETECT 135 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
143 { 136 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
144 unsigned char d;
145
146 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
147 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
148 return -EIO;
149 }
150 }
151#else
152 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
153 return -EIO; 137 return -EIO;
154#endif 138 }
155
156 return 0; 139 return 0;
157} 140}
158 141
@@ -205,7 +188,7 @@ static int __init snd_gusextreme_probe(int dev)
205 xgf1_irq = gf1_irq[dev]; 188 xgf1_irq = gf1_irq[dev];
206 if (xgf1_irq == SNDRV_AUTO_IRQ) { 189 if (xgf1_irq == SNDRV_AUTO_IRQ) {
207 if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) { 190 if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) {
208 snd_printk("unable to find a free IRQ for GF1\n"); 191 snd_printk(KERN_ERR PFX "unable to find a free IRQ for GF1\n");
209 err = -EBUSY; 192 err = -EBUSY;
210 goto out; 193 goto out;
211 } 194 }
@@ -213,7 +196,7 @@ static int __init snd_gusextreme_probe(int dev)
213 xess_irq = irq[dev]; 196 xess_irq = irq[dev];
214 if (xess_irq == SNDRV_AUTO_IRQ) { 197 if (xess_irq == SNDRV_AUTO_IRQ) {
215 if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) { 198 if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) {
216 snd_printk("unable to find a free IRQ for ES1688\n"); 199 snd_printk(KERN_ERR PFX "unable to find a free IRQ for ES1688\n");
217 err = -EBUSY; 200 err = -EBUSY;
218 goto out; 201 goto out;
219 } 202 }
@@ -226,7 +209,7 @@ static int __init snd_gusextreme_probe(int dev)
226 xgf1_dma = dma1[dev]; 209 xgf1_dma = dma1[dev];
227 if (xgf1_dma == SNDRV_AUTO_DMA) { 210 if (xgf1_dma == SNDRV_AUTO_DMA) {
228 if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) { 211 if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) {
229 snd_printk("unable to find a free DMA for GF1\n"); 212 snd_printk(KERN_ERR PFX "unable to find a free DMA for GF1\n");
230 err = -EBUSY; 213 err = -EBUSY;
231 goto out; 214 goto out;
232 } 215 }
@@ -234,7 +217,7 @@ static int __init snd_gusextreme_probe(int dev)
234 xess_dma = dma8[dev]; 217 xess_dma = dma8[dev];
235 if (xess_dma == SNDRV_AUTO_DMA) { 218 if (xess_dma == SNDRV_AUTO_DMA) {
236 if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) { 219 if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) {
237 snd_printk("unable to find a free DMA for ES1688\n"); 220 snd_printk(KERN_ERR PFX "unable to find a free DMA for ES1688\n");
238 err = -EBUSY; 221 err = -EBUSY;
239 goto out; 222 goto out;
240 } 223 }
@@ -264,7 +247,7 @@ static int __init snd_gusextreme_probe(int dev)
264 goto out; 247 goto out;
265 248
266 if (!gus->ess_flag) { 249 if (!gus->ess_flag) {
267 snd_printdd("GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port); 250 snd_printk(KERN_ERR PFX "GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
268 err = -ENODEV; 251 err = -ENODEV;
269 goto out; 252 goto out;
270 } 253 }
@@ -287,7 +270,7 @@ static int __init snd_gusextreme_probe(int dev)
287 270
288 if (snd_opl3_create(card, es1688->port, es1688->port + 2, 271 if (snd_opl3_create(card, es1688->port, es1688->port + 2,
289 OPL3_HW_OPL3, 0, &opl3) < 0) { 272 OPL3_HW_OPL3, 0, &opl3) < 0) {
290 printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port); 273 printk(KERN_ERR PFX "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
291 } else { 274 } else {
292 if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0) 275 if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0)
293 goto out; 276 goto out;
@@ -303,6 +286,10 @@ static int __init snd_gusextreme_probe(int dev)
303 286
304 sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i", 287 sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i",
305 es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma); 288 es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma);
289
290 if ((err = snd_card_set_generic_dev(card)) < 0)
291 goto out;
292
306 if ((err = snd_card_register(card)) < 0) 293 if ((err = snd_card_register(card)) < 0)
307 goto out; 294 goto out;
308 295
diff --git a/sound/isa/gus/gusmax.c b/sound/isa/gus/gusmax.c
index 400ff34710fb..0bb44b519340 100644
--- a/sound/isa/gus/gusmax.c
+++ b/sound/isa/gus/gusmax.c
@@ -82,39 +82,25 @@ struct snd_gusmax {
82 82
83static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 83static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
84 84
85#define PFX "gusmax: "
85 86
86static int __init snd_gusmax_detect(snd_gus_card_t * gus) 87static int __init snd_gusmax_detect(snd_gus_card_t * gus)
87{ 88{
88 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 89 unsigned char d;
89#ifdef CONFIG_SND_DEBUG_DETECT
90 {
91 unsigned char d;
92 90
93 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) { 91 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
94 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d); 92 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
95 return -ENODEV; 93 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
96 }
97 }
98#else
99 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
100 return -ENODEV; 94 return -ENODEV;
101#endif 95 }
102 udelay(160); 96 udelay(160);
103 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 97 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
104 udelay(160); 98 udelay(160);
105#ifdef CONFIG_SND_DEBUG_DETECT 99 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
106 { 100 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
107 unsigned char d;
108
109 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
110 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
111 return -ENODEV;
112 }
113 }
114#else
115 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
116 return -ENODEV; 101 return -ENODEV;
117#endif 102 }
103
118 return 0; 104 return 0;
119} 105}
120 106
@@ -239,25 +225,25 @@ static int __init snd_gusmax_probe(int dev)
239 xirq = irq[dev]; 225 xirq = irq[dev];
240 if (xirq == SNDRV_AUTO_IRQ) { 226 if (xirq == SNDRV_AUTO_IRQ) {
241 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 227 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
242 snd_card_free(card); 228 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
243 snd_printk("unable to find a free IRQ\n"); 229 err = -EBUSY;
244 return -EBUSY; 230 goto _err;
245 } 231 }
246 } 232 }
247 xdma1 = dma1[dev]; 233 xdma1 = dma1[dev];
248 if (xdma1 == SNDRV_AUTO_DMA) { 234 if (xdma1 == SNDRV_AUTO_DMA) {
249 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 235 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
250 snd_card_free(card); 236 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
251 snd_printk("unable to find a free DMA1\n"); 237 err = -EBUSY;
252 return -EBUSY; 238 goto _err;
253 } 239 }
254 } 240 }
255 xdma2 = dma2[dev]; 241 xdma2 = dma2[dev];
256 if (xdma2 == SNDRV_AUTO_DMA) { 242 if (xdma2 == SNDRV_AUTO_DMA) {
257 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 243 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
258 snd_card_free(card); 244 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
259 snd_printk("unable to find a free DMA2\n"); 245 err = -EBUSY;
260 return -EBUSY; 246 goto _err;
261 } 247 }
262 } 248 }
263 249
@@ -266,31 +252,28 @@ static int __init snd_gusmax_probe(int dev)
266 -xirq, xdma1, xdma2, 252 -xirq, xdma1, xdma2,
267 0, channels[dev], 253 0, channels[dev],
268 pcm_channels[dev], 254 pcm_channels[dev],
269 0, &gus)) < 0) { 255 0, &gus)) < 0)
270 snd_card_free(card); 256 goto _err;
271 return err; 257
272 } 258 if ((err = snd_gusmax_detect(gus)) < 0)
273 if ((err = snd_gusmax_detect(gus)) < 0) { 259 goto _err;
274 snd_card_free(card); 260
275 return err;
276 }
277 maxcard->gus_status_reg = gus->gf1.reg_irqstat; 261 maxcard->gus_status_reg = gus->gf1.reg_irqstat;
278 maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; 262 maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
279 snd_gusmax_init(dev, card, gus); 263 snd_gusmax_init(dev, card, gus);
280 if ((err = snd_gus_initialize(gus)) < 0) { 264 if ((err = snd_gus_initialize(gus)) < 0)
281 snd_card_free(card); 265 goto _err;
282 return err; 266
283 }
284 if (!gus->max_flag) { 267 if (!gus->max_flag) {
285 printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port); 268 snd_printk(KERN_ERR PFX "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
286 snd_card_free(card); 269 err = -ENODEV;
287 return -ENODEV; 270 goto _err;
288 } 271 }
289 272
290 if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) { 273 if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) {
291 snd_card_free(card); 274 snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
292 printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq); 275 err = -EBUSY;
293 return -EBUSY; 276 goto _err;
294 } 277 }
295 maxcard->irq = xirq; 278 maxcard->irq = xirq;
296 279
@@ -301,50 +284,46 @@ static int __init snd_gusmax_probe(int dev)
301 CS4231_HWSHARE_IRQ | 284 CS4231_HWSHARE_IRQ |
302 CS4231_HWSHARE_DMA1 | 285 CS4231_HWSHARE_DMA1 |
303 CS4231_HWSHARE_DMA2, 286 CS4231_HWSHARE_DMA2,
304 &cs4231)) < 0) { 287 &cs4231)) < 0)
305 snd_card_free(card); 288 goto _err;
306 return err; 289
307 } 290 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
308 if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) { 291 goto _err;
309 snd_card_free(card); 292
310 return err; 293 if ((err = snd_cs4231_mixer(cs4231)) < 0)
311 } 294 goto _err;
312 if ((err = snd_cs4231_mixer(cs4231)) < 0) { 295
313 snd_card_free(card); 296 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
314 return err; 297 goto _err;
315 } 298
316 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
317 snd_card_free(card);
318 return err;
319 }
320 if (pcm_channels[dev] > 0) { 299 if (pcm_channels[dev] > 0) {
321 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { 300 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
322 snd_card_free(card); 301 goto _err;
323 return err;
324 }
325 }
326 if ((err = snd_gusmax_mixer(cs4231)) < 0) {
327 snd_card_free(card);
328 return err;
329 } 302 }
303 if ((err = snd_gusmax_mixer(cs4231)) < 0)
304 goto _err;
330 305
331 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { 306 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
332 snd_card_free(card); 307 goto _err;
333 return err;
334 }
335 308
336 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1); 309 sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1);
337 if (xdma2 >= 0) 310 if (xdma2 >= 0)
338 sprintf(card->longname + strlen(card->longname), "&%i", xdma2); 311 sprintf(card->longname + strlen(card->longname), "&%i", xdma2);
339 if ((err = snd_card_register(card)) < 0) { 312
340 snd_card_free(card); 313 if ((err = snd_card_set_generic_dev(card)) < 0)
341 return err; 314 goto _err;
342 } 315
316 if ((err = snd_card_register(card)) < 0)
317 goto _err;
343 318
344 maxcard->gus = gus; 319 maxcard->gus = gus;
345 maxcard->cs4231 = cs4231; 320 maxcard->cs4231 = cs4231;
346 snd_gusmax_cards[dev] = card; 321 snd_gusmax_cards[dev] = card;
347 return 0; 322 return 0;
323
324 _err:
325 snd_card_free(card);
326 return err;
348} 327}
349 328
350static int __init snd_gusmax_legacy_auto_probe(unsigned long xport) 329static int __init snd_gusmax_legacy_auto_probe(unsigned long xport)
diff --git a/sound/isa/gus/interwave.c b/sound/isa/gus/interwave.c
index 46e867daba6a..358cba9d738f 100644
--- a/sound/isa/gus/interwave.c
+++ b/sound/isa/gus/interwave.c
@@ -73,6 +73,12 @@ static int midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
73static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2}; 73static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
74static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 74static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
75 75
76#ifdef SNDRV_STB
77#define PFX "interwave-stb: "
78#else
79#define PFX "interwave: "
80#endif
81
76module_param_array(index, int, NULL, 0444); 82module_param_array(index, int, NULL, 0444);
77MODULE_PARM_DESC(index, "Index value for InterWave soundcard."); 83MODULE_PARM_DESC(index, "Index value for InterWave soundcard.");
78module_param_array(id, charp, NULL, 0444); 84module_param_array(id, charp, NULL, 0444);
@@ -249,38 +255,20 @@ static int __devinit snd_interwave_detect(struct snd_interwave *iwcard,
249{ 255{
250 unsigned long flags; 256 unsigned long flags;
251 unsigned char rev1, rev2; 257 unsigned char rev1, rev2;
258 int d;
252 259
253 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */ 260 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0); /* reset GF1 */
254#ifdef CONFIG_SND_DEBUG_DETECT 261 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
255 { 262 snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
256 int d;
257
258 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
259 snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
260 return -ENODEV;
261 }
262 }
263#else
264 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
265 return -ENODEV; 263 return -ENODEV;
266#endif 264 }
267 udelay(160); 265 udelay(160);
268 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */ 266 snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1); /* release reset */
269 udelay(160); 267 udelay(160);
270#ifdef CONFIG_SND_DEBUG_DETECT 268 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
271 { 269 snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
272 int d;
273
274 if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
275 snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
276 return -ENODEV;
277 }
278 }
279#else
280 if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
281 return -ENODEV; 270 return -ENODEV;
282#endif 271 }
283
284 spin_lock_irqsave(&gus->reg_lock, flags); 272 spin_lock_irqsave(&gus->reg_lock, flags);
285 rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER); 273 rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER);
286 snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1); 274 snd_gf1_write8(gus, SNDRV_GF1_GB_VERSION_NUMBER, ~rev1);
@@ -686,35 +674,33 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
686 card->private_free = snd_interwave_free; 674 card->private_free = snd_interwave_free;
687#ifdef CONFIG_PNP 675#ifdef CONFIG_PNP
688 if (isapnp[dev]) { 676 if (isapnp[dev]) {
689 if (snd_interwave_pnp(dev, iwcard, pcard, pid)) { 677 if ((err = snd_interwave_pnp(dev, iwcard, pcard, pid)) < 0)
690 snd_card_free(card); 678 goto _err;
691 return -ENODEV;
692 }
693 snd_card_set_dev(card, &pcard->card->dev); 679 snd_card_set_dev(card, &pcard->card->dev);
694 } 680 }
695#endif 681#endif
696 xirq = irq[dev]; 682 xirq = irq[dev];
697 if (xirq == SNDRV_AUTO_IRQ) { 683 if (xirq == SNDRV_AUTO_IRQ) {
698 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 684 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
699 snd_card_free(card); 685 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
700 snd_printk("unable to find a free IRQ\n"); 686 err = -EBUSY;
701 return -EBUSY; 687 goto _err;
702 } 688 }
703 } 689 }
704 xdma1 = dma1[dev]; 690 xdma1 = dma1[dev];
705 if (xdma1 == SNDRV_AUTO_DMA) { 691 if (xdma1 == SNDRV_AUTO_DMA) {
706 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 692 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
707 snd_card_free(card); 693 snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
708 snd_printk("unable to find a free DMA1\n"); 694 err = -EBUSY;
709 return -EBUSY; 695 goto _err;
710 } 696 }
711 } 697 }
712 xdma2 = dma2[dev]; 698 xdma2 = dma2[dev];
713 if (xdma2 == SNDRV_AUTO_DMA) { 699 if (xdma2 == SNDRV_AUTO_DMA) {
714 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 700 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
715 snd_card_free(card); 701 snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
716 snd_printk("unable to find a free DMA2\n"); 702 err = -EBUSY;
717 return -EBUSY; 703 goto _err;
718 } 704 }
719 } 705 }
720 706
@@ -722,32 +708,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
722 port[dev], 708 port[dev],
723 -xirq, xdma1, xdma2, 709 -xirq, xdma1, xdma2,
724 0, 32, 710 0, 32,
725 pcm_channels[dev], effect[dev], &gus)) < 0) { 711 pcm_channels[dev], effect[dev], &gus)) < 0)
726 snd_card_free(card); 712 goto _err;
727 return err; 713
728 }
729 if ((err = snd_interwave_detect(iwcard, gus, dev 714 if ((err = snd_interwave_detect(iwcard, gus, dev
730#ifdef SNDRV_STB 715#ifdef SNDRV_STB
731 , &i2c_bus 716 , &i2c_bus
732#endif 717#endif
733 )) < 0) { 718 )) < 0)
734 snd_card_free(card); 719 goto _err;
735 return err; 720
736 }
737 iwcard->gus_status_reg = gus->gf1.reg_irqstat; 721 iwcard->gus_status_reg = gus->gf1.reg_irqstat;
738 iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2; 722 iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
739 723
740 snd_interwave_init(dev, gus); 724 snd_interwave_init(dev, gus);
741 snd_interwave_detect_memory(gus); 725 snd_interwave_detect_memory(gus);
742 if ((err = snd_gus_initialize(gus)) < 0) { 726 if ((err = snd_gus_initialize(gus)) < 0)
743 snd_card_free(card); 727 goto _err;
744 return err;
745 }
746 728
747 if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) { 729 if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) {
748 snd_card_free(card); 730 snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
749 snd_printk("unable to grab IRQ %d\n", xirq); 731 err = -EBUSY;
750 return -EBUSY; 732 goto _err;
751 } 733 }
752 iwcard->irq = xirq; 734 iwcard->irq = xirq;
753 735
@@ -758,34 +740,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
758 CS4231_HWSHARE_IRQ | 740 CS4231_HWSHARE_IRQ |
759 CS4231_HWSHARE_DMA1 | 741 CS4231_HWSHARE_DMA1 |
760 CS4231_HWSHARE_DMA2, 742 CS4231_HWSHARE_DMA2,
761 &cs4231)) < 0) { 743 &cs4231)) < 0)
762 snd_card_free(card); 744 goto _err;
763 return err; 745
764 } 746 if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0)
765 if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) { 747 goto _err;
766 snd_card_free(card); 748
767 return err;
768 }
769 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A'); 749 sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
770 strcat(pcm->name, " (codec)"); 750 strcat(pcm->name, " (codec)");
771 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) { 751
772 snd_card_free(card); 752 if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
773 return err; 753 goto _err;
774 } 754
775 if ((err = snd_cs4231_mixer(cs4231)) < 0) { 755 if ((err = snd_cs4231_mixer(cs4231)) < 0)
776 snd_card_free(card); 756 goto _err;
777 return err; 757
778 }
779 if (pcm_channels[dev] > 0) { 758 if (pcm_channels[dev] > 0) {
780 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) { 759 if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
781 snd_card_free(card); 760 goto _err;
782 return err;
783 }
784 }
785 if ((err = snd_interwave_mixer(cs4231)) < 0) {
786 snd_card_free(card);
787 return err;
788 } 761 }
762 if ((err = snd_interwave_mixer(cs4231)) < 0)
763 goto _err;
764
789#ifdef SNDRV_STB 765#ifdef SNDRV_STB
790 { 766 {
791 snd_ctl_elem_id_t id1, id2; 767 snd_ctl_elem_id_t id1, id2;
@@ -795,28 +771,20 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
795 strcpy(id1.name, "Master Playback Switch"); 771 strcpy(id1.name, "Master Playback Switch");
796 strcpy(id2.name, id1.name); 772 strcpy(id2.name, id1.name);
797 id2.index = 1; 773 id2.index = 1;
798 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { 774 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
799 snd_card_free(card); 775 goto _err;
800 return err;
801 }
802 strcpy(id1.name, "Master Playback Volume"); 776 strcpy(id1.name, "Master Playback Volume");
803 strcpy(id2.name, id1.name); 777 strcpy(id2.name, id1.name);
804 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) { 778 if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
805 snd_card_free(card); 779 goto _err;
806 return err; 780 if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0)
807 } 781 goto _err;
808 if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) {
809 snd_card_free(card);
810 return err;
811 }
812 } 782 }
813#endif 783#endif
814 784
815 gus->uart_enable = midi[dev]; 785 gus->uart_enable = midi[dev];
816 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) { 786 if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
817 snd_card_free(card); 787 goto _err;
818 return err;
819 }
820 788
821#ifndef SNDRV_STB 789#ifndef SNDRV_STB
822 str = "AMD InterWave"; 790 str = "AMD InterWave";
@@ -835,10 +803,11 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
835 if (xdma2 >= 0) 803 if (xdma2 >= 0)
836 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 804 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
837 805
838 if ((err = snd_card_register(card)) < 0) { 806 if ((err = snd_card_set_generic_dev(card)) < 0)
839 snd_card_free(card); 807 goto _err;
840 return err; 808
841 } 809 if ((err = snd_card_register(card)) < 0)
810 goto _err;
842 811
843 iwcard->cs4231 = cs4231; 812 iwcard->cs4231 = cs4231;
844 iwcard->gus = gus; 813 iwcard->gus = gus;
@@ -847,6 +816,10 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
847 else 816 else
848 snd_interwave_legacy[dev++] = card; 817 snd_interwave_legacy[dev++] = card;
849 return 0; 818 return 0;
819
820 _err:
821 snd_card_free(card);
822 return err;
850} 823}
851 824
852static int __devinit snd_interwave_probe_legacy_port(unsigned long xport) 825static int __devinit snd_interwave_probe_legacy_port(unsigned long xport)
diff --git a/sound/isa/opl3sa2.c b/sound/isa/opl3sa2.c
index 75bd6eca63e7..e2d2babcd20b 100644
--- a/sound/isa/opl3sa2.c
+++ b/sound/isa/opl3sa2.c
@@ -143,6 +143,8 @@ struct snd_opl3sa2 {
143 143
144static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 144static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
145 145
146#define PFX "opl3sa2: "
147
146#ifdef CONFIG_PNP 148#ifdef CONFIG_PNP
147 149
148static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = { 150static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
@@ -231,7 +233,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip)
231 card = chip->card; 233 card = chip->card;
232 port = chip->port; 234 port = chip->port;
233 if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) { 235 if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) {
234 snd_printk(KERN_ERR "opl3sa2: can't grab port 0x%lx\n", port); 236 snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port);
235 return -EBUSY; 237 return -EBUSY;
236 } 238 }
237 // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a)); 239 // snd_printk("REG 0A = 0x%x\n", snd_opl3sa2_read(chip, 0x0a));
@@ -668,6 +670,12 @@ static int snd_opl3sa2_dev_free(snd_device_t *device)
668 return snd_opl3sa2_free(chip); 670 return snd_opl3sa2_free(chip);
669} 671}
670 672
673#ifdef CONFIG_PNP
674#define is_isapnp_selected(dev) isapnp[dev]
675#else
676#define is_isapnp_selected(dev) 0
677#endif
678
671static int __devinit snd_opl3sa2_probe(int dev, 679static int __devinit snd_opl3sa2_probe(int dev,
672 struct pnp_dev *pdev, 680 struct pnp_dev *pdev,
673 struct pnp_card_link *pcard, 681 struct pnp_card_link *pcard,
@@ -683,34 +691,31 @@ static int __devinit snd_opl3sa2_probe(int dev,
683 }; 691 };
684 int err; 692 int err;
685 693
686#ifdef CONFIG_PNP 694 if (! is_isapnp_selected(dev)) {
687 if (!isapnp[dev]) {
688#endif
689 if (port[dev] == SNDRV_AUTO_PORT) { 695 if (port[dev] == SNDRV_AUTO_PORT) {
690 snd_printk("specify port\n"); 696 snd_printk(KERN_ERR PFX "specify port\n");
691 return -EINVAL; 697 return -EINVAL;
692 } 698 }
693 if (wss_port[dev] == SNDRV_AUTO_PORT) { 699 if (wss_port[dev] == SNDRV_AUTO_PORT) {
694 snd_printk("specify wss_port\n"); 700 snd_printk(KERN_ERR PFX "specify wss_port\n");
695 return -EINVAL; 701 return -EINVAL;
696 } 702 }
697 if (fm_port[dev] == SNDRV_AUTO_PORT) { 703 if (fm_port[dev] == SNDRV_AUTO_PORT) {
698 snd_printk("specify fm_port\n"); 704 snd_printk(KERN_ERR PFX "specify fm_port\n");
699 return -EINVAL; 705 return -EINVAL;
700 } 706 }
701 if (midi_port[dev] == SNDRV_AUTO_PORT) { 707 if (midi_port[dev] == SNDRV_AUTO_PORT) {
702 snd_printk("specify midi_port\n"); 708 snd_printk(KERN_ERR PFX "specify midi_port\n");
703 return -EINVAL; 709 return -EINVAL;
704 } 710 }
705#ifdef CONFIG_PNP
706 } 711 }
707#endif 712
708 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 713 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
709 if (card == NULL) 714 if (card == NULL)
710 return -ENOMEM; 715 return -ENOMEM;
711 strcpy(card->driver, "OPL3SA2"); 716 strcpy(card->driver, "OPL3SA2");
712 strcpy(card->shortname, "Yamaha OPL3-SA2"); 717 strcpy(card->shortname, "Yamaha OPL3-SA2");
713 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 718 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
714 if (chip == NULL) { 719 if (chip == NULL) {
715 err = -ENOMEM; 720 err = -ENOMEM;
716 goto __error; 721 goto __error;
@@ -742,7 +747,7 @@ static int __devinit snd_opl3sa2_probe(int dev,
742 if ((err = snd_opl3sa2_detect(chip)) < 0) 747 if ((err = snd_opl3sa2_detect(chip)) < 0)
743 goto __error; 748 goto __error;
744 if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) { 749 if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) {
745 snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq); 750 snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq);
746 err = -ENODEV; 751 err = -ENODEV;
747 goto __error; 752 goto __error;
748 } 753 }
@@ -795,6 +800,9 @@ static int __devinit snd_opl3sa2_probe(int dev,
795 if (dma2 >= 0) 800 if (dma2 >= 0)
796 sprintf(card->longname + strlen(card->longname), "&%d", xdma2); 801 sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
797 802
803 if ((err = snd_card_set_generic_dev(card)) < 0)
804 goto __error;
805
798 if ((err = snd_card_register(card)) < 0) 806 if ((err = snd_card_register(card)) < 0)
799 goto __error; 807 goto __error;
800 808
@@ -852,8 +860,10 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card,
852 int res; 860 int res;
853 861
854 for ( ; dev < SNDRV_CARDS; dev++) { 862 for ( ; dev < SNDRV_CARDS; dev++) {
855 if (!enable[dev] || !isapnp[dev]) 863 if (!enable[dev])
856 continue; 864 continue;
865 if (is_isapnp_selected(dev))
866 continue;
857 res = snd_opl3sa2_probe(dev, NULL, card, id); 867 res = snd_opl3sa2_probe(dev, NULL, card, id);
858 if (res < 0) 868 if (res < 0)
859 return res; 869 return res;
diff --git a/sound/isa/opti9xx/opti92x-ad1848.c b/sound/isa/opti9xx/opti92x-ad1848.c
index 411a702d85ba..73573cb1db6a 100644
--- a/sound/isa/opti9xx/opti92x-ad1848.c
+++ b/sound/isa/opti9xx/opti92x-ad1848.c
@@ -1038,8 +1038,7 @@ static int snd_opti93x_capture_prepare(snd_pcm_substream_t *substream)
1038 1038
1039 chip->c_dma_size = size; 1039 chip->c_dma_size = size;
1040 snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF, 1040 snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF,
1041 OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, 1041 OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, 0);
1042 (unsigned char)~(OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO));
1043 1042
1044 snd_dma_program(chip->dma2, runtime->dma_addr, size, 1043 snd_dma_program(chip->dma2, runtime->dma_addr, size,
1045 DMA_MODE_READ | DMA_AUTOINIT); 1044 DMA_MODE_READ | DMA_AUTOINIT);
@@ -1274,7 +1273,7 @@ static int snd_opti93x_create(snd_card_t *card, opti9xx_t *chip,
1274 opti93x_t *codec; 1273 opti93x_t *codec;
1275 1274
1276 *rcodec = NULL; 1275 *rcodec = NULL;
1277 codec = kcalloc(1, sizeof(*codec), GFP_KERNEL); 1276 codec = kzalloc(sizeof(*codec), GFP_KERNEL);
1278 if (codec == NULL) 1277 if (codec == NULL)
1279 return -ENOMEM; 1278 return -ENOMEM;
1280 codec->irq = -1; 1279 codec->irq = -1;
@@ -1895,8 +1894,8 @@ static void snd_card_opti9xx_free(snd_card_t *card)
1895 } 1894 }
1896} 1895}
1897 1896
1898static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard, 1897static int snd_card_opti9xx_probe(struct pnp_card_link *pcard,
1899 const struct pnp_card_device_id *pid) 1898 const struct pnp_card_device_id *pid)
1900{ 1899{
1901 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1}; 1900 static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
1902 static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1}; 1901 static long possible_mpu_ports[] = {0x300, 0x310, 0x320, 0x330, -1};
@@ -1966,6 +1965,10 @@ static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard,
1966 snd_card_free(card); 1965 snd_card_free(card);
1967 return error; 1966 return error;
1968 } 1967 }
1968 if ((error = snd_card_set_generic_dev(card)) < 0) {
1969 snd_card_free(card);
1970 return error;
1971 }
1969#ifdef CONFIG_PNP 1972#ifdef CONFIG_PNP
1970 } 1973 }
1971#endif /* CONFIG_PNP */ 1974#endif /* CONFIG_PNP */
diff --git a/sound/isa/sb/emu8000.c b/sound/isa/sb/emu8000.c
index 028af4066595..5375705c054b 100644
--- a/sound/isa/sb/emu8000.c
+++ b/sound/isa/sb/emu8000.c
@@ -1097,7 +1097,7 @@ snd_emu8000_new(snd_card_t *card, int index, long port, int seq_ports, snd_seq_d
1097 if (seq_ports <= 0) 1097 if (seq_ports <= 0)
1098 return 0; 1098 return 0;
1099 1099
1100 hw = kcalloc(1, sizeof(*hw), GFP_KERNEL); 1100 hw = kzalloc(sizeof(*hw), GFP_KERNEL);
1101 if (hw == NULL) 1101 if (hw == NULL)
1102 return -ENOMEM; 1102 return -ENOMEM;
1103 spin_lock_init(&hw->reg_lock); 1103 spin_lock_init(&hw->reg_lock);
diff --git a/sound/isa/sb/emu8000_pcm.c b/sound/isa/sb/emu8000_pcm.c
index db5eb8b55058..0209790dc4b5 100644
--- a/sound/isa/sb/emu8000_pcm.c
+++ b/sound/isa/sb/emu8000_pcm.c
@@ -233,7 +233,7 @@ static int emu8k_pcm_open(snd_pcm_substream_t *subs)
233 emu8k_pcm_t *rec; 233 emu8k_pcm_t *rec;
234 snd_pcm_runtime_t *runtime = subs->runtime; 234 snd_pcm_runtime_t *runtime = subs->runtime;
235 235
236 rec = kcalloc(1, sizeof(*rec), GFP_KERNEL); 236 rec = kzalloc(sizeof(*rec), GFP_KERNEL);
237 if (! rec) 237 if (! rec)
238 return -ENOMEM; 238 return -ENOMEM;
239 239
diff --git a/sound/isa/sb/sb16.c b/sound/isa/sb/sb16.c
index 60e2c53c49fc..7888783d68f5 100644
--- a/sound/isa/sb/sb16.c
+++ b/sound/isa/sb/sb16.c
@@ -351,6 +351,12 @@ static void snd_sb16_free(snd_card_t *card)
351 } 351 }
352} 352}
353 353
354#ifdef CONFIG_PNP
355#define is_isapnp_selected(dev) isapnp[dev]
356#else
357#define is_isapnp_selected(dev) 0
358#endif
359
354static int __init snd_sb16_probe(int dev, 360static int __init snd_sb16_probe(int dev,
355 struct pnp_card_link *pcard, 361 struct pnp_card_link *pcard,
356 const struct pnp_card_device_id *pid) 362 const struct pnp_card_device_id *pid)
@@ -378,10 +384,8 @@ static int __init snd_sb16_probe(int dev,
378 card->private_free = snd_sb16_free; 384 card->private_free = snd_sb16_free;
379#ifdef CONFIG_PNP 385#ifdef CONFIG_PNP
380 if (isapnp[dev]) { 386 if (isapnp[dev]) {
381 if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) { 387 if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid)))
382 snd_card_free(card); 388 goto _err;
383 return err;
384 }
385 snd_card_set_dev(card, &pcard->card->dev); 389 snd_card_set_dev(card, &pcard->card->dev);
386 } 390 }
387#endif 391#endif
@@ -389,41 +393,37 @@ static int __init snd_sb16_probe(int dev,
389 xirq = irq[dev]; 393 xirq = irq[dev];
390 xdma8 = dma8[dev]; 394 xdma8 = dma8[dev];
391 xdma16 = dma16[dev]; 395 xdma16 = dma16[dev];
392#ifdef CONFIG_PNP 396 if (! is_isapnp_selected(dev)) {
393 if (!isapnp[dev]) { 397 if (xirq == SNDRV_AUTO_IRQ) {
394#endif 398 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
395 if (xirq == SNDRV_AUTO_IRQ) { 399 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
396 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 400 err = -EBUSY;
397 snd_card_free(card); 401 goto _err;
398 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n"); 402 }
399 return -EBUSY;
400 } 403 }
401 } 404 if (xdma8 == SNDRV_AUTO_DMA) {
402 if (xdma8 == SNDRV_AUTO_DMA) { 405 if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
403 if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) { 406 snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n");
404 snd_card_free(card); 407 err = -EBUSY;
405 snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n"); 408 goto _err;
406 return -EBUSY; 409 }
407 } 410 }
408 } 411 if (xdma16 == SNDRV_AUTO_DMA) {
409 if (xdma16 == SNDRV_AUTO_DMA) { 412 if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
410 if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) { 413 snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n");
411 snd_card_free(card); 414 err = -EBUSY;
412 snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n"); 415 goto _err;
413 return -EBUSY; 416 }
414 } 417 }
415 } 418 /* non-PnP FM port address is hardwired with base port address */
416 /* non-PnP FM port address is hardwired with base port address */ 419 fm_port[dev] = port[dev];
417 fm_port[dev] = port[dev]; 420 /* block the 0x388 port to avoid PnP conflicts */
418 /* block the 0x388 port to avoid PnP conflicts */ 421 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
419 acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
420#ifdef SNDRV_SBAWE_EMU8000 422#ifdef SNDRV_SBAWE_EMU8000
421 /* non-PnP AWE port address is hardwired with base port address */ 423 /* non-PnP AWE port address is hardwired with base port address */
422 awe_port[dev] = port[dev] + 0x400; 424 awe_port[dev] = port[dev] + 0x400;
423#endif 425#endif
424#ifdef CONFIG_PNP
425 } 426 }
426#endif
427 427
428 if ((err = snd_sbdsp_create(card, 428 if ((err = snd_sbdsp_create(card,
429 port[dev], 429 port[dev],
@@ -432,28 +432,20 @@ static int __init snd_sb16_probe(int dev,
432 xdma8, 432 xdma8,
433 xdma16, 433 xdma16,
434 SB_HW_AUTO, 434 SB_HW_AUTO,
435 &chip)) < 0) { 435 &chip)) < 0)
436 snd_card_free(card); 436 goto _err;
437 return err; 437
438 }
439 if (chip->hardware != SB_HW_16) { 438 if (chip->hardware != SB_HW_16) {
440 snd_card_free(card); 439 snd_printk(KERN_ERR PFX "SB 16 chip was not detected at 0x%lx\n", port[dev]);
441 snd_printdd("SB 16 chip was not detected at 0x%lx\n", port[dev]); 440 err = -ENODEV;
442 return -ENODEV; 441 goto _err;
443 } 442 }
444 chip->mpu_port = mpu_port[dev]; 443 chip->mpu_port = mpu_port[dev];
445#ifdef CONFIG_PNP 444 if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
446 if (!isapnp[dev] && (err = snd_sb16dsp_configure(chip)) < 0) { 445 goto _err;
447#else 446
448 if ((err = snd_sb16dsp_configure(chip)) < 0) { 447 if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0)
449#endif 448 goto _err;
450 snd_card_free(card);
451 return -ENXIO;
452 }
453 if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) {
454 snd_card_free(card);
455 return -ENXIO;
456 }
457 449
458 strcpy(card->driver, 450 strcpy(card->driver,
459#ifdef SNDRV_SBAWE_EMU8000 451#ifdef SNDRV_SBAWE_EMU8000
@@ -474,10 +466,8 @@ static int __init snd_sb16_probe(int dev,
474 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) { 466 if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {
475 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB, 467 if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB,
476 chip->mpu_port, 0, 468 chip->mpu_port, 0,
477 xirq, 0, &chip->rmidi)) < 0) { 469 xirq, 0, &chip->rmidi)) < 0)
478 snd_card_free(card); 470 goto _err;
479 return -ENXIO;
480 }
481 chip->rmidi_callback = snd_mpu401_uart_interrupt; 471 chip->rmidi_callback = snd_mpu401_uart_interrupt;
482 } 472 }
483 473
@@ -499,17 +489,13 @@ static int __init snd_sb16_probe(int dev,
499#else 489#else
500 int seqdev = 1; 490 int seqdev = 1;
501#endif 491#endif
502 if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0) { 492 if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0)
503 snd_card_free(card); 493 goto _err;
504 return -ENXIO;
505 }
506 } 494 }
507 } 495 }
508 496
509 if ((err = snd_sbmixer_new(chip)) < 0) { 497 if ((err = snd_sbmixer_new(chip)) < 0)
510 snd_card_free(card); 498 goto _err;
511 return -ENXIO;
512 }
513 499
514#ifdef CONFIG_SND_SB16_CSP 500#ifdef CONFIG_SND_SB16_CSP
515 /* CSP chip on SB16ASP/AWE32 */ 501 /* CSP chip on SB16ASP/AWE32 */
@@ -525,11 +511,11 @@ static int __init snd_sb16_probe(int dev,
525#endif 511#endif
526#ifdef SNDRV_SBAWE_EMU8000 512#ifdef SNDRV_SBAWE_EMU8000
527 if (awe_port[dev] > 0) { 513 if (awe_port[dev] > 0) {
528 if (snd_emu8000_new(card, 1, awe_port[dev], 514 if ((err = snd_emu8000_new(card, 1, awe_port[dev],
529 seq_ports[dev], NULL) < 0) { 515 seq_ports[dev], NULL)) < 0) {
530 snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]); 516 snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]);
531 snd_card_free(card); 517
532 return -ENXIO; 518 goto _err;
533 } 519 }
534 } 520 }
535#endif 521#endif
@@ -541,15 +527,21 @@ static int __init snd_sb16_probe(int dev,
541 (mic_agc[dev] ? 0x00 : 0x01)); 527 (mic_agc[dev] ? 0x00 : 0x01));
542 spin_unlock_irqrestore(&chip->mixer_lock, flags); 528 spin_unlock_irqrestore(&chip->mixer_lock, flags);
543 529
544 if ((err = snd_card_register(card)) < 0) { 530 if ((err = snd_card_set_generic_dev(card)) < 0)
545 snd_card_free(card); 531 goto _err;
546 return err; 532
547 } 533 if ((err = snd_card_register(card)) < 0)
534 goto _err;
535
548 if (pcard) 536 if (pcard)
549 pnp_set_card_drvdata(pcard, card); 537 pnp_set_card_drvdata(pcard, card);
550 else 538 else
551 snd_sb16_legacy[dev] = card; 539 snd_sb16_legacy[dev] = card;
552 return 0; 540 return 0;
541
542 _err:
543 snd_card_free(card);
544 return err;
553} 545}
554 546
555static int __init snd_sb16_probe_legacy_port(unsigned long xport) 547static int __init snd_sb16_probe_legacy_port(unsigned long xport)
@@ -560,10 +552,8 @@ static int __init snd_sb16_probe_legacy_port(unsigned long xport)
560 for ( ; dev < SNDRV_CARDS; dev++) { 552 for ( ; dev < SNDRV_CARDS; dev++) {
561 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT) 553 if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
562 continue; 554 continue;
563#ifdef CONFIG_PNP 555 if (is_isapnp_selected(dev))
564 if (isapnp[dev])
565 continue; 556 continue;
566#endif
567 port[dev] = xport; 557 port[dev] = xport;
568 res = snd_sb16_probe(dev, NULL, NULL); 558 res = snd_sb16_probe(dev, NULL, NULL);
569 if (res < 0) 559 if (res < 0)
@@ -621,10 +611,8 @@ static int __init alsa_card_sb16_init(void)
621 for (dev = 0; dev < SNDRV_CARDS; dev++) { 611 for (dev = 0; dev < SNDRV_CARDS; dev++) {
622 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT) 612 if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
623 continue; 613 continue;
624#ifdef CONFIG_PNP 614 if (is_isapnp_selected(dev))
625 if (isapnp[dev])
626 continue; 615 continue;
627#endif
628 if (!snd_sb16_probe(dev, NULL, NULL)) { 616 if (!snd_sb16_probe(dev, NULL, NULL)) {
629 cards++; 617 cards++;
630 continue; 618 continue;
diff --git a/sound/isa/sb/sb16_csp.c b/sound/isa/sb/sb16_csp.c
index d64790bcd831..7192d4c758e6 100644
--- a/sound/isa/sb/sb16_csp.c
+++ b/sound/isa/sb/sb16_csp.c
@@ -122,7 +122,7 @@ int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep)
122 if ((err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw)) < 0) 122 if ((err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw)) < 0)
123 return err; 123 return err;
124 124
125 if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) { 125 if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) {
126 snd_device_free(chip->card, hw); 126 snd_device_free(chip->card, hw);
127 return -ENOMEM; 127 return -ENOMEM;
128 } 128 }
diff --git a/sound/isa/sb/sb8.c b/sound/isa/sb/sb8.c
index e2cbc4202b3d..c41ac25e85ca 100644
--- a/sound/isa/sb/sb8.c
+++ b/sound/isa/sb/sb8.c
@@ -107,54 +107,47 @@ static int __init snd_sb8_probe(int dev)
107 dma8[dev], 107 dma8[dev],
108 -1, 108 -1,
109 SB_HW_AUTO, 109 SB_HW_AUTO,
110 &chip)) < 0) { 110 &chip)) < 0)
111 snd_card_free(card); 111 goto _err;
112 return err; 112
113 }
114 if (chip->hardware >= SB_HW_16) { 113 if (chip->hardware >= SB_HW_16) {
115 snd_card_free(card);
116 if (chip->hardware == SB_HW_ALS100) 114 if (chip->hardware == SB_HW_ALS100)
117 snd_printdd("ALS100 chip detected at 0x%lx, try snd-als100 module\n", 115 snd_printk(KERN_WARNING "ALS100 chip detected at 0x%lx, try snd-als100 module\n",
118 port[dev]); 116 port[dev]);
119 else 117 else
120 snd_printdd("SB 16 chip detected at 0x%lx, try snd-sb16 module\n", 118 snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
121 port[dev]); 119 port[dev]);
122 return -ENODEV; 120 err = -ENODEV;
121 goto _err;
123 } 122 }
124 123
125 if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) { 124 if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0)
126 snd_card_free(card); 125 goto _err;
127 return err; 126
128 } 127 if ((err = snd_sbmixer_new(chip)) < 0)
129 if ((err = snd_sbmixer_new(chip)) < 0) { 128 goto _err;
130 snd_card_free(card); 129
131 return err;
132 }
133 if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) { 130 if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) {
134 if ((err = snd_opl3_create(card, chip->port + 8, 0, 131 if ((err = snd_opl3_create(card, chip->port + 8, 0,
135 OPL3_HW_AUTO, 1, 132 OPL3_HW_AUTO, 1,
136 &opl3)) < 0) { 133 &opl3)) < 0) {
137 snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8); 134 snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx\n", chip->port + 8);
138 } 135 }
139 } else { 136 } else {
140 if ((err = snd_opl3_create(card, chip->port, chip->port + 2, 137 if ((err = snd_opl3_create(card, chip->port, chip->port + 2,
141 OPL3_HW_AUTO, 1, 138 OPL3_HW_AUTO, 1,
142 &opl3)) < 0) { 139 &opl3)) < 0) {
143 snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n", 140 snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx-0x%lx\n",
144 chip->port, chip->port + 2); 141 chip->port, chip->port + 2);
145 } 142 }
146 } 143 }
147 if (err >= 0) { 144 if (err >= 0) {
148 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) { 145 if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
149 snd_card_free(card); 146 goto _err;
150 return err;
151 }
152 } 147 }
153 148
154 if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0) { 149 if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0)
155 snd_card_free(card); 150 goto _err;
156 return err;
157 }
158 151
159 strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8"); 152 strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
160 strcpy(card->shortname, chip->name); 153 strcpy(card->shortname, chip->name);
@@ -162,12 +155,19 @@ static int __init snd_sb8_probe(int dev)
162 chip->name, 155 chip->name,
163 chip->port, 156 chip->port,
164 irq[dev], dma8[dev]); 157 irq[dev], dma8[dev]);
165 if ((err = snd_card_register(card)) < 0) { 158
166 snd_card_free(card); 159 if ((err = snd_card_set_generic_dev(card)) < 0)
167 return err; 160 goto _err;
168 } 161
162 if ((err = snd_card_register(card)) < 0)
163 goto _err;
164
169 snd_sb8_cards[dev] = card; 165 snd_sb8_cards[dev] = card;
170 return 0; 166 return 0;
167
168 _err:
169 snd_card_free(card);
170 return err;
171} 171}
172 172
173static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport) 173static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport)
diff --git a/sound/isa/sb/sb_common.c b/sound/isa/sb/sb_common.c
index 5b6bde213ea0..f0f205ae425f 100644
--- a/sound/isa/sb/sb_common.c
+++ b/sound/isa/sb/sb_common.c
@@ -221,7 +221,7 @@ int snd_sbdsp_create(snd_card_t *card,
221 221
222 snd_assert(r_chip != NULL, return -EINVAL); 222 snd_assert(r_chip != NULL, return -EINVAL);
223 *r_chip = NULL; 223 *r_chip = NULL;
224 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 224 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
225 if (chip == NULL) 225 if (chip == NULL)
226 return -ENOMEM; 226 return -ENOMEM;
227 spin_lock_init(&chip->reg_lock); 227 spin_lock_init(&chip->reg_lock);
diff --git a/sound/isa/sgalaxy.c b/sound/isa/sgalaxy.c
index 17f585b0ddc1..52f2294da62b 100644
--- a/sound/isa/sgalaxy.c
+++ b/sound/isa/sgalaxy.c
@@ -67,6 +67,8 @@ MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver.");
67 67
68static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR; 68static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
69 69
70#define PFX "sgalaxy: "
71
70/* 72/*
71 73
72 */ 74 */
@@ -135,7 +137,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
135 } 137 }
136 138
137#if 0 139#if 0
138 snd_printdd("sgalaxy - setting up IRQ/DMA for WSS\n"); 140 snd_printdd(PFX "setting up IRQ/DMA for WSS\n");
139#endif 141#endif
140 142
141 /* initialize IRQ for WSS codec */ 143 /* initialize IRQ for WSS codec */
@@ -160,7 +162,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
160static int __init snd_sgalaxy_detect(int dev, int irq, int dma) 162static int __init snd_sgalaxy_detect(int dev, int irq, int dma)
161{ 163{
162#if 0 164#if 0
163 snd_printdd("sgalaxy - switching to WSS mode\n"); 165 snd_printdd(PFX "switching to WSS mode\n");
164#endif 166#endif
165 167
166 /* switch to WSS mode */ 168 /* switch to WSS mode */
@@ -223,11 +225,11 @@ static int __init snd_sgalaxy_probe(int dev)
223 ad1848_t *chip; 225 ad1848_t *chip;
224 226
225 if (sbport[dev] == SNDRV_AUTO_PORT) { 227 if (sbport[dev] == SNDRV_AUTO_PORT) {
226 snd_printk("specify SB port\n"); 228 snd_printk(KERN_ERR PFX "specify SB port\n");
227 return -EINVAL; 229 return -EINVAL;
228 } 230 }
229 if (wssport[dev] == SNDRV_AUTO_PORT) { 231 if (wssport[dev] == SNDRV_AUTO_PORT) {
230 snd_printk("specify WSS port\n"); 232 snd_printk(KERN_ERR PFX "specify WSS port\n");
231 return -EINVAL; 233 return -EINVAL;
232 } 234 }
233 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); 235 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
@@ -237,46 +239,39 @@ static int __init snd_sgalaxy_probe(int dev)
237 xirq = irq[dev]; 239 xirq = irq[dev];
238 if (xirq == SNDRV_AUTO_IRQ) { 240 if (xirq == SNDRV_AUTO_IRQ) {
239 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) { 241 if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
240 snd_card_free(card); 242 snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
241 snd_printk("unable to find a free IRQ\n"); 243 err = -EBUSY;
242 return -EBUSY; 244 goto _err;
243 } 245 }
244 } 246 }
245 xdma1 = dma1[dev]; 247 xdma1 = dma1[dev];
246 if (xdma1 == SNDRV_AUTO_DMA) { 248 if (xdma1 == SNDRV_AUTO_DMA) {
247 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) { 249 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
248 snd_card_free(card); 250 snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
249 snd_printk("unable to find a free DMA\n"); 251 err = -EBUSY;
250 return -EBUSY; 252 goto _err;
251 } 253 }
252 } 254 }
253 255
254 if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) { 256 if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0)
255 snd_card_free(card); 257 goto _err;
256 return err;
257 }
258 258
259 if ((err = snd_ad1848_create(card, wssport[dev] + 4, 259 if ((err = snd_ad1848_create(card, wssport[dev] + 4,
260 xirq, xdma1, 260 xirq, xdma1,
261 AD1848_HW_DETECT, &chip)) < 0) { 261 AD1848_HW_DETECT, &chip)) < 0)
262 snd_card_free(card); 262 goto _err;
263 return err;
264 }
265 263
266 if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) { 264 if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) {
267 snd_printdd("sgalaxy - error creating new ad1848 PCM device\n"); 265 snd_printdd(PFX "error creating new ad1848 PCM device\n");
268 snd_card_free(card); 266 goto _err;
269 return err;
270 } 267 }
271 if ((err = snd_ad1848_mixer(chip)) < 0) { 268 if ((err = snd_ad1848_mixer(chip)) < 0) {
272 snd_printdd("sgalaxy - error creating new ad1848 mixer\n"); 269 snd_printdd(PFX "error creating new ad1848 mixer\n");
273 snd_card_free(card); 270 goto _err;
274 return err;
275 } 271 }
276 if (snd_sgalaxy_mixer(chip) < 0) { 272 if ((err = snd_sgalaxy_mixer(chip)) < 0) {
277 snd_printdd("sgalaxy - the mixer rewrite failed\n"); 273 snd_printdd(PFX "the mixer rewrite failed\n");
278 snd_card_free(card); 274 goto _err;
279 return err;
280 } 275 }
281 276
282 strcpy(card->driver, "Sound Galaxy"); 277 strcpy(card->driver, "Sound Galaxy");
@@ -284,12 +279,18 @@ static int __init snd_sgalaxy_probe(int dev)
284 sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d", 279 sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d",
285 wssport[dev], xirq, xdma1); 280 wssport[dev], xirq, xdma1);
286 281
287 if ((err = snd_card_register(card)) < 0) { 282 if ((err = snd_card_set_generic_dev(card)) < 0)
288 snd_card_free(card); 283 goto _err;
289 return err; 284
290 } 285 if ((err = snd_card_register(card)) < 0)
286 goto _err;
287
291 snd_sgalaxy_cards[dev] = card; 288 snd_sgalaxy_cards[dev] = card;
292 return 0; 289 return 0;
290
291 _err:
292 snd_card_free(card);
293 return err;
293} 294}
294 295
295static int __init alsa_card_sgalaxy_init(void) 296static int __init alsa_card_sgalaxy_init(void)
diff --git a/sound/isa/sscape.c b/sound/isa/sscape.c
index 3959ed694eec..9f6b58c79209 100644
--- a/sound/isa/sscape.c
+++ b/sound/isa/sscape.c
@@ -1262,11 +1262,6 @@ static int __devinit create_sscape(const struct params *params, snd_card_t **rca
1262 */ 1262 */
1263 sscape_write(sscape, GA_INTENA_REG, 0x80); 1263 sscape_write(sscape, GA_INTENA_REG, 0x80);
1264 1264
1265 if ((err = snd_card_register(card)) < 0) {
1266 printk(KERN_ERR "sscape: Failed to register sound card\n");
1267 goto _release_card;
1268 }
1269
1270 /* 1265 /*
1271 * Initialize mixer 1266 * Initialize mixer
1272 */ 1267 */
@@ -1396,6 +1391,13 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard,
1396 if (ret < 0) 1391 if (ret < 0)
1397 return ret; 1392 return ret;
1398 snd_card_set_dev(card, &pcard->card->dev); 1393 snd_card_set_dev(card, &pcard->card->dev);
1394
1395 if ((ret = snd_card_register(card)) < 0) {
1396 printk(KERN_ERR "sscape: Failed to register sound card\n");
1397 snd_card_free(card);
1398 return ret;
1399 }
1400
1399 pnp_set_card_drvdata(pcard, card); 1401 pnp_set_card_drvdata(pcard, card);
1400 ++sscape_cards; 1402 ++sscape_cards;
1401 ++idx; 1403 ++idx;
@@ -1460,6 +1462,16 @@ static int __init sscape_manual_probe(struct params *params)
1460 if (ret < 0) 1462 if (ret < 0)
1461 return ret; 1463 return ret;
1462 1464
1465 if ((ret = snd_card_set_generic_dev(card)) < 0) {
1466 snd_card_free(card);
1467 return ret;
1468 }
1469 if ((ret = snd_card_register(card)) < 0) {
1470 printk(KERN_ERR "sscape: Failed to register sound card\n");
1471 snd_card_free(card);
1472 return ret;
1473 }
1474
1463 sscape_card[sscape_cards] = card; 1475 sscape_card[sscape_cards] = card;
1464 params++; 1476 params++;
1465 sscape_cards++; 1477 sscape_cards++;
diff --git a/sound/isa/wavefront/wavefront.c b/sound/isa/wavefront/wavefront.c
index 79b022070ba3..0a572e0a47e6 100644
--- a/sound/isa/wavefront/wavefront.c
+++ b/sound/isa/wavefront/wavefront.c
@@ -622,6 +622,11 @@ snd_wavefront_probe (int dev, struct pnp_card_link *pcard,
622 ics2115_port[dev], 622 ics2115_port[dev],
623 ics2115_irq[dev]); 623 ics2115_irq[dev]);
624 624
625 if ((err = snd_card_set_generic_dev(card)) < 0) {
626 snd_card_free(card);
627 return err;
628 }
629
625 if ((err = snd_card_register(card)) < 0) { 630 if ((err = snd_card_register(card)) < 0) {
626 snd_card_free(card); 631 snd_card_free(card);
627 return err; 632 return err;
diff --git a/sound/mips/Kconfig b/sound/mips/Kconfig
index 531f8ba96a71..2433b7727404 100644
--- a/sound/mips/Kconfig
+++ b/sound/mips/Kconfig
@@ -8,6 +8,7 @@ config SND_AU1X00
8 depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND 8 depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND
9 select SND_PCM 9 select SND_PCM
10 select SND_AC97_CODEC 10 select SND_AC97_CODEC
11 select SND_GENERIC_DRIVER
11 help 12 help
12 ALSA Sound driver for the Au1x00's AC97 port. 13 ALSA Sound driver for the Au1x00's AC97 port.
13 14
diff --git a/sound/mips/au1x00.c b/sound/mips/au1x00.c
index c20522b02134..3f9684f1d1d2 100644
--- a/sound/mips/au1x00.c
+++ b/sound/mips/au1x00.c
@@ -667,6 +667,11 @@ au1000_init(void)
667 strcpy(au1000->card->shortname, "Au1000-AC97"); 667 strcpy(au1000->card->shortname, "Au1000-AC97");
668 sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver"); 668 sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver");
669 669
670 if ((err = snd_card_set_generic_dev(au1000->card)) < 0) {
671 snd_card_free(au1000->card);
672 return err;
673 }
674
670 if ((err = snd_card_register(au1000->card)) < 0) { 675 if ((err = snd_card_register(au1000->card)) < 0) {
671 snd_card_free(au1000->card); 676 snd_card_free(au1000->card);
672 return err; 677 return err;
diff --git a/sound/parisc/harmony.c b/sound/parisc/harmony.c
index d7a8f9f5896f..f560dd8cdb90 100644
--- a/sound/parisc/harmony.c
+++ b/sound/parisc/harmony.c
@@ -880,6 +880,8 @@ snd_harmony_create(snd_card_t *card,
880 goto free_and_ret; 880 goto free_and_ret;
881 } 881 }
882 882
883 snd_card_set_dev(card, &padev->dev);
884
883 *rchip = h; 885 *rchip = h;
884 886
885 return 0; 887 return 0;
diff --git a/sound/pci/Kconfig b/sound/pci/Kconfig
index 1e458919cce6..a5d593c66f9f 100644
--- a/sound/pci/Kconfig
+++ b/sound/pci/Kconfig
@@ -316,6 +316,18 @@ config SND_YMFPCI
316 To compile this driver as a module, choose M here: the module 316 To compile this driver as a module, choose M here: the module
317 will be called snd-ymfpci. 317 will be called snd-ymfpci.
318 318
319config SND_AD1889
320 tristate "Analog Devices AD1889"
321 depends on SND
322 select SND_AC97_CODEC
323 help
324 Say Y here to include support for the integrated AC97 sound
325 device found in particular on the Hewlett-Packard [BCJ]-xxx0
326 class PA-RISC workstations, using the AD1819 codec.
327
328 To compile this as a module, choose M here: the module
329 will be called snd-ad1889.
330
319config SND_ALS4000 331config SND_ALS4000
320 tristate "Avance Logic ALS4000" 332 tristate "Avance Logic ALS4000"
321 depends on SND && ISA_DMA_API 333 depends on SND && ISA_DMA_API
diff --git a/sound/pci/Makefile b/sound/pci/Makefile
index b40575c3349a..42fabfcfc2a9 100644
--- a/sound/pci/Makefile
+++ b/sound/pci/Makefile
@@ -3,6 +3,7 @@
3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz> 3# Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
4# 4#
5 5
6snd-ad1889-objs := ad1889.o
6snd-als4000-objs := als4000.o 7snd-als4000-objs := als4000.o
7snd-atiixp-objs := atiixp.o 8snd-atiixp-objs := atiixp.o
8snd-atiixp-modem-objs := atiixp_modem.o 9snd-atiixp-modem-objs := atiixp_modem.o
@@ -25,6 +26,7 @@ snd-via82xx-objs := via82xx.o
25snd-via82xx-modem-objs := via82xx_modem.o 26snd-via82xx-modem-objs := via82xx_modem.o
26 27
27# Toplevel Module Dependency 28# Toplevel Module Dependency
29obj-$(CONFIG_SND_AD1889) += snd-ad1889.o
28obj-$(CONFIG_SND_ALS4000) += snd-als4000.o 30obj-$(CONFIG_SND_ALS4000) += snd-als4000.o
29obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o 31obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o
30obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o 32obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o
diff --git a/sound/pci/ac97/ac97_codec.c b/sound/pci/ac97/ac97_codec.c
index 5501f4440c92..e64cb07a39c2 100644
--- a/sound/pci/ac97/ac97_codec.c
+++ b/sound/pci/ac97/ac97_codec.c
@@ -112,6 +112,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
112{ 0x414c4723, 0xffffffff, "ALC650F", NULL, NULL }, /* already patched */ 112{ 0x414c4723, 0xffffffff, "ALC650F", NULL, NULL }, /* already patched */
113{ 0x414c4720, 0xfffffff0, "ALC650", patch_alc650, NULL }, 113{ 0x414c4720, 0xfffffff0, "ALC650", patch_alc650, NULL },
114{ 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL }, 114{ 0x414c4760, 0xfffffff0, "ALC655", patch_alc655, NULL },
115{ 0x414c4781, 0xffffffff, "ALC658D", NULL, NULL }, /* already patched */
115{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL }, 116{ 0x414c4780, 0xfffffff0, "ALC658", patch_alc655, NULL },
116{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL }, 117{ 0x414c4790, 0xfffffff0, "ALC850", patch_alc850, NULL },
117{ 0x414c4730, 0xffffffff, "ALC101", NULL, NULL }, 118{ 0x414c4730, 0xffffffff, "ALC101", NULL, NULL },
@@ -1796,7 +1797,7 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops,
1796 1797
1797 snd_assert(card != NULL, return -EINVAL); 1798 snd_assert(card != NULL, return -EINVAL);
1798 snd_assert(rbus != NULL, return -EINVAL); 1799 snd_assert(rbus != NULL, return -EINVAL);
1799 bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); 1800 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
1800 if (bus == NULL) 1801 if (bus == NULL)
1801 return -ENOMEM; 1802 return -ENOMEM;
1802 bus->card = card; 1803 bus->card = card;
@@ -1905,7 +1906,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
1905 } 1906 }
1906 1907
1907 card = bus->card; 1908 card = bus->card;
1908 ac97 = kcalloc(1, sizeof(*ac97), GFP_KERNEL); 1909 ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);
1909 if (ac97 == NULL) 1910 if (ac97 == NULL)
1910 return -ENOMEM; 1911 return -ENOMEM;
1911 ac97->private_data = template->private_data; 1912 ac97->private_data = template->private_data;
diff --git a/sound/pci/ac97/ac97_id.h b/sound/pci/ac97/ac97_id.h
index dadf387ad0b8..6d73514dc49e 100644
--- a/sound/pci/ac97/ac97_id.h
+++ b/sound/pci/ac97/ac97_id.h
@@ -52,6 +52,7 @@
52#define AC97_ID_ALC650F 0x414c4723 52#define AC97_ID_ALC650F 0x414c4723
53#define AC97_ID_ALC655 0x414c4760 53#define AC97_ID_ALC655 0x414c4760
54#define AC97_ID_ALC658 0x414c4780 54#define AC97_ID_ALC658 0x414c4780
55#define AC97_ID_ALC658D 0x414c4781
55#define AC97_ID_ALC850 0x414c4790 56#define AC97_ID_ALC850 0x414c4790
56#define AC97_ID_YMF753 0x594d4803 57#define AC97_ID_YMF753 0x594d4803
57#define AC97_ID_VT1616 0x49434551 58#define AC97_ID_VT1616 0x49434551
diff --git a/sound/pci/ac97/ac97_patch.c b/sound/pci/ac97/ac97_patch.c
index b584172c1104..045ddc743edc 100644
--- a/sound/pci/ac97/ac97_patch.c
+++ b/sound/pci/ac97/ac97_patch.c
@@ -2134,7 +2134,13 @@ int patch_alc655(ac97_t * ac97)
2134{ 2134{
2135 unsigned int val; 2135 unsigned int val;
2136 2136
2137 ac97->spec.dev_flags = (ac97->id == 0x414c4780); /* ALC658 */ 2137 if (ac97->id == AC97_ID_ALC658) {
2138 ac97->spec.dev_flags = 1; /* ALC658 */
2139 if ((snd_ac97_read(ac97, AC97_ALC650_REVISION) & 0x3f) == 2) {
2140 ac97->id = AC97_ID_ALC658D;
2141 ac97->spec.dev_flags = 2;
2142 }
2143 }
2138 2144
2139 ac97->build_ops = &patch_alc655_ops; 2145 ac97->build_ops = &patch_alc655_ops;
2140 2146
@@ -2143,10 +2149,15 @@ int patch_alc655(ac97_t * ac97)
2143 2149
2144 /* adjust default values */ 2150 /* adjust default values */
2145 val = snd_ac97_read(ac97, 0x7a); /* misc control */ 2151 val = snd_ac97_read(ac97, 0x7a); /* misc control */
2146 if (ac97->id == 0x414c4780) /* ALC658 */ 2152 if (ac97->spec.dev_flags) /* ALC658 */
2147 val &= ~(1 << 1); /* Pin 47 is spdif input pin */ 2153 val &= ~(1 << 1); /* Pin 47 is spdif input pin */
2148 else /* ALC655 */ 2154 else { /* ALC655 */
2149 val |= (1 << 1); /* Pin 47 is spdif input pin */ 2155 if (ac97->subsystem_vendor == 0x1462 &&
2156 ac97->subsystem_device == 0x0131) /* MSI S270 laptop */
2157 val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */
2158 else
2159 val |= (1 << 1); /* Pin 47 is spdif input pin */
2160 }
2150 val &= ~(1 << 12); /* vref enable */ 2161 val &= ~(1 << 12); /* vref enable */
2151 snd_ac97_write_cache(ac97, 0x7a, val); 2162 snd_ac97_write_cache(ac97, 0x7a, val);
2152 /* set default: spdif-in enabled, 2163 /* set default: spdif-in enabled,
@@ -2159,6 +2170,11 @@ int patch_alc655(ac97_t * ac97)
2159 /* full DAC volume */ 2170 /* full DAC volume */
2160 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808); 2171 snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808);
2161 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808); 2172 snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808);
2173
2174 /* update undocumented bit... */
2175 if (ac97->id == AC97_ID_ALC658D)
2176 snd_ac97_update_bits(ac97, 0x74, 0x0800, 0x0800);
2177
2162 return 0; 2178 return 0;
2163} 2179}
2164 2180
diff --git a/sound/pci/ac97/ak4531_codec.c b/sound/pci/ac97/ak4531_codec.c
index f9ce0fd2f52f..4032c5748370 100644
--- a/sound/pci/ac97/ak4531_codec.c
+++ b/sound/pci/ac97/ak4531_codec.c
@@ -357,7 +357,7 @@ int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531)
357 snd_assert(rak4531 != NULL, return -EINVAL); 357 snd_assert(rak4531 != NULL, return -EINVAL);
358 *rak4531 = NULL; 358 *rak4531 = NULL;
359 snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL); 359 snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL);
360 ak4531 = kcalloc(1, sizeof(*ak4531), GFP_KERNEL); 360 ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL);
361 if (ak4531 == NULL) 361 if (ak4531 == NULL)
362 return -ENOMEM; 362 return -ENOMEM;
363 *ak4531 = *_ak4531; 363 *ak4531 = *_ak4531;
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
new file mode 100644
index 000000000000..d7d99a25c5e5
--- /dev/null
+++ b/sound/pci/ad1889.c
@@ -0,0 +1,1090 @@
1/* Analog Devices 1889 audio driver
2 *
3 * This is a driver for the AD1889 PCI audio chipset found
4 * on the HP PA-RISC [BCJ]-xxx0 workstations.
5 *
6 * Copyright (C) 2004-2005, Kyle McMartin <kyle@parisc-linux.org>
7 * Copyright (C) 2005, Thibaut Varene <varenet@parisc-linux.org>
8 * Based on the OSS AD1889 driver by Randolph Chung <tausq@debian.org>
9 *
10 * This program is free software; you can redistribute it and/or modify
11 * it under the terms of the GNU General Public License, version 2, as
12 * published by the Free Software Foundation.
13 *
14 * This program is distributed in the hope that it will be useful,
15 * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 * GNU General Public License for more details.
18 *
19 * You should have received a copy of the GNU General Public License
20 * along with this program; if not, write to the Free Software
21 * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
22 *
23 * TODO:
24 * Do we need to take care of CCS register?
25 * Maybe we could use finer grained locking (separate locks for pb/cap)?
26 * Wishlist:
27 * Control Interface (mixer) support
28 * Better AC97 support (VSR...)?
29 * PM support
30 * MIDI support
31 * Game Port support
32 * SG DMA support (this will need *alot* of work)
33 */
34
35#include <linux/init.h>
36#include <linux/pci.h>
37#include <linux/slab.h>
38#include <linux/interrupt.h>
39#include <linux/compiler.h>
40#include <linux/delay.h>
41
42#include <sound/driver.h>
43#include <sound/core.h>
44#include <sound/pcm.h>
45#include <sound/initval.h>
46#include <sound/ac97_codec.h>
47
48#include <asm/io.h>
49
50#include "ad1889.h"
51#include "ac97/ac97_id.h"
52
53#define AD1889_DRVVER "$Revision: 1.3 $"
54
55MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>");
56MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver");
57MODULE_LICENSE("GPL");
58MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1889}}");
59
60static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
61module_param_array(index, int, NULL, 0444);
62MODULE_PARM_DESC(index, "Index value for the AD1889 soundcard.");
63
64static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
65module_param_array(id, charp, NULL, 0444);
66MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard.");
67
68static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
69module_param_array(enable, bool, NULL, 0444);
70MODULE_PARM_DESC(enable, "Enable AD1889 soundcard.");
71
72static char *ac97_quirk[SNDRV_CARDS];
73module_param_array(ac97_quirk, charp, NULL, 0444);
74MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
75
76#define DEVNAME "ad1889"
77#define PFX DEVNAME ": "
78
79/* let's use the global sound debug interfaces */
80#define ad1889_debug(fmt, arg...) snd_printd(KERN_DEBUG fmt, ## arg)
81
82/* keep track of some hw registers */
83struct ad1889_register_state {
84 u16 reg; /* reg setup */
85 u32 addr; /* dma base address */
86 unsigned long size; /* DMA buffer size */
87};
88
89struct snd_ad1889 {
90 snd_card_t *card;
91 struct pci_dev *pci;
92
93 int irq;
94 unsigned long bar;
95 void __iomem *iobase;
96
97 ac97_t *ac97;
98 ac97_bus_t *ac97_bus;
99 snd_pcm_t *pcm;
100 snd_info_entry_t *proc;
101
102 snd_pcm_substream_t *psubs;
103 snd_pcm_substream_t *csubs;
104
105 /* playback register state */
106 struct ad1889_register_state wave;
107 struct ad1889_register_state ramc;
108
109 spinlock_t lock;
110};
111
112static inline u16
113ad1889_readw(struct snd_ad1889 *chip, unsigned reg)
114{
115 return readw(chip->iobase + reg);
116}
117
118static inline void
119ad1889_writew(struct snd_ad1889 *chip, unsigned reg, u16 val)
120{
121 writew(val, chip->iobase + reg);
122}
123
124static inline u32
125ad1889_readl(struct snd_ad1889 *chip, unsigned reg)
126{
127 return readl(chip->iobase + reg);
128}
129
130static inline void
131ad1889_writel(struct snd_ad1889 *chip, unsigned reg, u32 val)
132{
133 writel(val, chip->iobase + reg);
134}
135
136static inline void
137ad1889_unmute(struct snd_ad1889 *chip)
138{
139 u16 st;
140 st = ad1889_readw(chip, AD_DS_WADA) &
141 ~(AD_DS_WADA_RWAM | AD_DS_WADA_LWAM);
142 ad1889_writew(chip, AD_DS_WADA, st);
143 ad1889_readw(chip, AD_DS_WADA);
144}
145
146static inline void
147ad1889_mute(struct snd_ad1889 *chip)
148{
149 u16 st;
150 st = ad1889_readw(chip, AD_DS_WADA) | AD_DS_WADA_RWAM | AD_DS_WADA_LWAM;
151 ad1889_writew(chip, AD_DS_WADA, st);
152 ad1889_readw(chip, AD_DS_WADA);
153}
154
155static inline void
156ad1889_load_adc_buffer_address(struct snd_ad1889 *chip, u32 address)
157{
158 ad1889_writel(chip, AD_DMA_ADCBA, address);
159 ad1889_writel(chip, AD_DMA_ADCCA, address);
160}
161
162static inline void
163ad1889_load_adc_buffer_count(struct snd_ad1889 *chip, u32 count)
164{
165 ad1889_writel(chip, AD_DMA_ADCBC, count);
166 ad1889_writel(chip, AD_DMA_ADCCC, count);
167}
168
169static inline void
170ad1889_load_adc_interrupt_count(struct snd_ad1889 *chip, u32 count)
171{
172 ad1889_writel(chip, AD_DMA_ADCIB, count);
173 ad1889_writel(chip, AD_DMA_ADCIC, count);
174}
175
176static inline void
177ad1889_load_wave_buffer_address(struct snd_ad1889 *chip, u32 address)
178{
179 ad1889_writel(chip, AD_DMA_WAVBA, address);
180 ad1889_writel(chip, AD_DMA_WAVCA, address);
181}
182
183static inline void
184ad1889_load_wave_buffer_count(struct snd_ad1889 *chip, u32 count)
185{
186 ad1889_writel(chip, AD_DMA_WAVBC, count);
187 ad1889_writel(chip, AD_DMA_WAVCC, count);
188}
189
190static inline void
191ad1889_load_wave_interrupt_count(struct snd_ad1889 *chip, u32 count)
192{
193 ad1889_writel(chip, AD_DMA_WAVIB, count);
194 ad1889_writel(chip, AD_DMA_WAVIC, count);
195}
196
197static void
198ad1889_channel_reset(struct snd_ad1889 *chip, unsigned int channel)
199{
200 u16 reg;
201
202 if (channel & AD_CHAN_WAV) {
203 /* Disable wave channel */
204 reg = ad1889_readw(chip, AD_DS_WSMC) & ~AD_DS_WSMC_WAEN;
205 ad1889_writew(chip, AD_DS_WSMC, reg);
206 chip->wave.reg = reg;
207
208 /* disable IRQs */
209 reg = ad1889_readw(chip, AD_DMA_WAV);
210 reg &= AD_DMA_IM_DIS;
211 reg &= ~AD_DMA_LOOP;
212 ad1889_writew(chip, AD_DMA_WAV, reg);
213
214 /* clear IRQ and address counters and pointers */
215 ad1889_load_wave_buffer_address(chip, 0x0);
216 ad1889_load_wave_buffer_count(chip, 0x0);
217 ad1889_load_wave_interrupt_count(chip, 0x0);
218
219 /* flush */
220 ad1889_readw(chip, AD_DMA_WAV);
221 }
222
223 if (channel & AD_CHAN_ADC) {
224 /* Disable ADC channel */
225 reg = ad1889_readw(chip, AD_DS_RAMC) & ~AD_DS_RAMC_ADEN;
226 ad1889_writew(chip, AD_DS_RAMC, reg);
227 chip->ramc.reg = reg;
228
229 reg = ad1889_readw(chip, AD_DMA_ADC);
230 reg &= AD_DMA_IM_DIS;
231 reg &= ~AD_DMA_LOOP;
232 ad1889_writew(chip, AD_DMA_ADC, reg);
233
234 ad1889_load_adc_buffer_address(chip, 0x0);
235 ad1889_load_adc_buffer_count(chip, 0x0);
236 ad1889_load_adc_interrupt_count(chip, 0x0);
237
238 /* flush */
239 ad1889_readw(chip, AD_DMA_ADC);
240 }
241}
242
243static inline u16
244snd_ad1889_ac97_read(ac97_t *ac97, unsigned short reg)
245{
246 struct snd_ad1889 *chip = ac97->private_data;
247 return ad1889_readw(chip, AD_AC97_BASE + reg);
248}
249
250static inline void
251snd_ad1889_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
252{
253 struct snd_ad1889 *chip = ac97->private_data;
254 ad1889_writew(chip, AD_AC97_BASE + reg, val);
255}
256
257static int
258snd_ad1889_ac97_ready(struct snd_ad1889 *chip)
259{
260 int retry = 400; /* average needs 352 msec */
261
262 while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY)
263 && --retry)
264 mdelay(1);
265 if (!retry) {
266 snd_printk(KERN_ERR PFX "[%s] Link is not ready.\n",
267 __FUNCTION__);
268 return -EIO;
269 }
270 ad1889_debug("[%s] ready after %d ms\n", __FUNCTION__, 400 - retry);
271
272 return 0;
273}
274
275static int
276snd_ad1889_hw_params(snd_pcm_substream_t *substream,
277 snd_pcm_hw_params_t *hw_params)
278{
279 return snd_pcm_lib_malloc_pages(substream,
280 params_buffer_bytes(hw_params));
281}
282
283static int
284snd_ad1889_hw_free(snd_pcm_substream_t *substream)
285{
286 return snd_pcm_lib_free_pages(substream);
287}
288
289static snd_pcm_hardware_t snd_ad1889_playback_hw = {
290 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
291 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER,
292 .formats = SNDRV_PCM_FMTBIT_S16_LE,
293 .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
294 .rate_min = 8000, /* docs say 7000, but we're lazy */
295 .rate_max = 48000,
296 .channels_min = 1,
297 .channels_max = 2,
298 .buffer_bytes_max = BUFFER_BYTES_MAX,
299 .period_bytes_min = PERIOD_BYTES_MIN,
300 .period_bytes_max = PERIOD_BYTES_MAX,
301 .periods_min = PERIODS_MIN,
302 .periods_max = PERIODS_MAX,
303 /*.fifo_size = 0,*/
304};
305
306static snd_pcm_hardware_t snd_ad1889_capture_hw = {
307 .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
308 SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER,
309 .formats = SNDRV_PCM_FMTBIT_S16_LE,
310 .rates = SNDRV_PCM_RATE_48000,
311 .rate_min = 48000, /* docs say we could to VSR, but we're lazy */
312 .rate_max = 48000,
313 .channels_min = 1,
314 .channels_max = 2,
315 .buffer_bytes_max = BUFFER_BYTES_MAX,
316 .period_bytes_min = PERIOD_BYTES_MIN,
317 .period_bytes_max = PERIOD_BYTES_MAX,
318 .periods_min = PERIODS_MIN,
319 .periods_max = PERIODS_MAX,
320 /*.fifo_size = 0,*/
321};
322
323static int
324snd_ad1889_playback_open(snd_pcm_substream_t *ss)
325{
326 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
327 snd_pcm_runtime_t *rt = ss->runtime;
328
329 chip->psubs = ss;
330 rt->hw = snd_ad1889_playback_hw;
331
332 return 0;
333}
334
335static int
336snd_ad1889_capture_open(snd_pcm_substream_t *ss)
337{
338 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
339 snd_pcm_runtime_t *rt = ss->runtime;
340
341 chip->csubs = ss;
342 rt->hw = snd_ad1889_capture_hw;
343
344 return 0;
345}
346
347static int
348snd_ad1889_playback_close(snd_pcm_substream_t *ss)
349{
350 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
351 chip->psubs = NULL;
352 return 0;
353}
354
355static int
356snd_ad1889_capture_close(snd_pcm_substream_t *ss)
357{
358 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
359 chip->csubs = NULL;
360 return 0;
361}
362
363static int
364snd_ad1889_playback_prepare(snd_pcm_substream_t *ss)
365{
366 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
367 snd_pcm_runtime_t *rt = ss->runtime;
368 unsigned int size = snd_pcm_lib_buffer_bytes(ss);
369 unsigned int count = snd_pcm_lib_period_bytes(ss);
370 u16 reg;
371
372 ad1889_channel_reset(chip, AD_CHAN_WAV);
373
374 reg = ad1889_readw(chip, AD_DS_WSMC);
375
376 /* Mask out 16-bit / Stereo */
377 reg &= ~(AD_DS_WSMC_WA16 | AD_DS_WSMC_WAST);
378
379 if (snd_pcm_format_width(rt->format) == 16)
380 reg |= AD_DS_WSMC_WA16;
381
382 if (rt->channels > 1)
383 reg |= AD_DS_WSMC_WAST;
384
385 /* let's make sure we don't clobber ourselves */
386 spin_lock_irq(&chip->lock);
387
388 chip->wave.size = size;
389 chip->wave.reg = reg;
390 chip->wave.addr = rt->dma_addr;
391
392 ad1889_writew(chip, AD_DS_WSMC, chip->wave.reg);
393
394 /* Set sample rates on the codec */
395 ad1889_writew(chip, AD_DS_WAS, rt->rate);
396
397 /* Set up DMA */
398 ad1889_load_wave_buffer_address(chip, chip->wave.addr);
399 ad1889_load_wave_buffer_count(chip, size);
400 ad1889_load_wave_interrupt_count(chip, count);
401
402 /* writes flush */
403 ad1889_readw(chip, AD_DS_WSMC);
404
405 spin_unlock_irq(&chip->lock);
406
407 ad1889_debug("prepare playback: addr = 0x%x, count = %u, "
408 "size = %u, reg = 0x%x, rate = %u\n", chip->wave.addr,
409 count, size, reg, rt->rate);
410 return 0;
411}
412
413static int
414snd_ad1889_capture_prepare(snd_pcm_substream_t *ss)
415{
416 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
417 snd_pcm_runtime_t *rt = ss->runtime;
418 unsigned int size = snd_pcm_lib_buffer_bytes(ss);
419 unsigned int count = snd_pcm_lib_period_bytes(ss);
420 u16 reg;
421
422 ad1889_channel_reset(chip, AD_CHAN_ADC);
423
424 reg = ad1889_readw(chip, AD_DS_RAMC);
425
426 /* Mask out 16-bit / Stereo */
427 reg &= ~(AD_DS_RAMC_AD16 | AD_DS_RAMC_ADST);
428
429 if (snd_pcm_format_width(rt->format) == 16)
430 reg |= AD_DS_RAMC_AD16;
431
432 if (rt->channels > 1)
433 reg |= AD_DS_RAMC_ADST;
434
435 /* let's make sure we don't clobber ourselves */
436 spin_lock_irq(&chip->lock);
437
438 chip->ramc.size = size;
439 chip->ramc.reg = reg;
440 chip->ramc.addr = rt->dma_addr;
441
442 ad1889_writew(chip, AD_DS_RAMC, chip->ramc.reg);
443
444 /* Set up DMA */
445 ad1889_load_adc_buffer_address(chip, chip->ramc.addr);
446 ad1889_load_adc_buffer_count(chip, size);
447 ad1889_load_adc_interrupt_count(chip, count);
448
449 /* writes flush */
450 ad1889_readw(chip, AD_DS_RAMC);
451
452 spin_unlock_irq(&chip->lock);
453
454 ad1889_debug("prepare capture: addr = 0x%x, count = %u, "
455 "size = %u, reg = 0x%x, rate = %u\n", chip->ramc.addr,
456 count, size, reg, rt->rate);
457 return 0;
458}
459
460/* this is called in atomic context with IRQ disabled.
461 Must be as fast as possible and not sleep.
462 DMA should be *triggered* by this call.
463 The WSMC "WAEN" bit triggers DMA Wave On/Off */
464static int
465snd_ad1889_playback_trigger(snd_pcm_substream_t *ss, int cmd)
466{
467 u16 wsmc;
468 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
469
470 wsmc = ad1889_readw(chip, AD_DS_WSMC);
471
472 switch (cmd) {
473 case SNDRV_PCM_TRIGGER_START:
474 /* enable DMA loop & interrupts */
475 ad1889_writew(chip, AD_DMA_WAV, AD_DMA_LOOP | AD_DMA_IM_CNT);
476 wsmc |= AD_DS_WSMC_WAEN;
477 /* 1 to clear CHSS bit */
478 ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_WAVS);
479 ad1889_unmute(chip);
480 break;
481 case SNDRV_PCM_TRIGGER_STOP:
482 ad1889_mute(chip);
483 wsmc &= ~AD_DS_WSMC_WAEN;
484 break;
485 default:
486 snd_BUG();
487 return -EINVAL;
488 }
489
490 chip->wave.reg = wsmc;
491 ad1889_writew(chip, AD_DS_WSMC, wsmc);
492 ad1889_readw(chip, AD_DS_WSMC); /* flush */
493
494 /* reset the chip when STOP - will disable IRQs */
495 if (cmd == SNDRV_PCM_TRIGGER_STOP)
496 ad1889_channel_reset(chip, AD_CHAN_WAV);
497
498 return 0;
499}
500
501/* this is called in atomic context with IRQ disabled.
502 Must be as fast as possible and not sleep.
503 DMA should be *triggered* by this call.
504 The RAMC "ADEN" bit triggers DMA ADC On/Off */
505static int
506snd_ad1889_capture_trigger(snd_pcm_substream_t *ss, int cmd)
507{
508 u16 ramc;
509 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
510
511 ramc = ad1889_readw(chip, AD_DS_RAMC);
512
513 switch (cmd) {
514 case SNDRV_PCM_TRIGGER_START:
515 /* enable DMA loop & interrupts */
516 ad1889_writew(chip, AD_DMA_ADC, AD_DMA_LOOP | AD_DMA_IM_CNT);
517 ramc |= AD_DS_RAMC_ADEN;
518 /* 1 to clear CHSS bit */
519 ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_ADCS);
520 break;
521 case SNDRV_PCM_TRIGGER_STOP:
522 ramc &= ~AD_DS_RAMC_ADEN;
523 break;
524 default:
525 return -EINVAL;
526 }
527
528 chip->ramc.reg = ramc;
529 ad1889_writew(chip, AD_DS_RAMC, ramc);
530 ad1889_readw(chip, AD_DS_RAMC); /* flush */
531
532 /* reset the chip when STOP - will disable IRQs */
533 if (cmd == SNDRV_PCM_TRIGGER_STOP)
534 ad1889_channel_reset(chip, AD_CHAN_ADC);
535
536 return 0;
537}
538
539/* Called in atomic context with IRQ disabled */
540static snd_pcm_uframes_t
541snd_ad1889_playback_pointer(snd_pcm_substream_t *ss)
542{
543 size_t ptr = 0;
544 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
545
546 if (unlikely(!(chip->wave.reg & AD_DS_WSMC_WAEN)))
547 return 0;
548
549 ptr = ad1889_readl(chip, AD_DMA_WAVCA);
550 ptr -= chip->wave.addr;
551
552 snd_assert((ptr >= 0) && (ptr < chip->wave.size), return 0);
553
554 return bytes_to_frames(ss->runtime, ptr);
555}
556
557/* Called in atomic context with IRQ disabled */
558static snd_pcm_uframes_t
559snd_ad1889_capture_pointer(snd_pcm_substream_t *ss)
560{
561 size_t ptr = 0;
562 struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
563
564 if (unlikely(!(chip->ramc.reg & AD_DS_RAMC_ADEN)))
565 return 0;
566
567 ptr = ad1889_readl(chip, AD_DMA_ADCCA);
568 ptr -= chip->ramc.addr;
569
570 snd_assert((ptr >= 0) && (ptr < chip->ramc.size), return 0);
571
572 return bytes_to_frames(ss->runtime, ptr);
573}
574
575static snd_pcm_ops_t snd_ad1889_playback_ops = {
576 .open = snd_ad1889_playback_open,
577 .close = snd_ad1889_playback_close,
578 .ioctl = snd_pcm_lib_ioctl,
579 .hw_params = snd_ad1889_hw_params,
580 .hw_free = snd_ad1889_hw_free,
581 .prepare = snd_ad1889_playback_prepare,
582 .trigger = snd_ad1889_playback_trigger,
583 .pointer = snd_ad1889_playback_pointer,
584};
585
586static snd_pcm_ops_t snd_ad1889_capture_ops = {
587 .open = snd_ad1889_capture_open,
588 .close = snd_ad1889_capture_close,
589 .ioctl = snd_pcm_lib_ioctl,
590 .hw_params = snd_ad1889_hw_params,
591 .hw_free = snd_ad1889_hw_free,
592 .prepare = snd_ad1889_capture_prepare,
593 .trigger = snd_ad1889_capture_trigger,
594 .pointer = snd_ad1889_capture_pointer,
595};
596
597static irqreturn_t
598snd_ad1889_interrupt(int irq,
599 void *dev_id,
600 struct pt_regs *regs)
601{
602 unsigned long st;
603 struct snd_ad1889 *chip = dev_id;
604
605 st = ad1889_readl(chip, AD_DMA_DISR);
606
607 /* clear ISR */
608 ad1889_writel(chip, AD_DMA_DISR, st);
609
610 st &= AD_INTR_MASK;
611
612 if (unlikely(!st))
613 return IRQ_NONE;
614
615 if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI))
616 ad1889_debug("Unexpected master or target abort interrupt!\n");
617
618 if ((st & AD_DMA_DISR_WAVI) && chip->psubs)
619 snd_pcm_period_elapsed(chip->psubs);
620 if ((st & AD_DMA_DISR_ADCI) && chip->csubs)
621 snd_pcm_period_elapsed(chip->csubs);
622
623 return IRQ_HANDLED;
624}
625
626static void
627snd_ad1889_pcm_free(snd_pcm_t *pcm)
628{
629 struct snd_ad1889 *chip = pcm->private_data;
630 chip->pcm = NULL;
631 snd_pcm_lib_preallocate_free_for_all(pcm);
632}
633
634static int __devinit
635snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, snd_pcm_t **rpcm)
636{
637 int err;
638 snd_pcm_t *pcm;
639
640 if (rpcm)
641 *rpcm = NULL;
642
643 err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm);
644 if (err < 0)
645 return err;
646
647 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK,
648 &snd_ad1889_playback_ops);
649 snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
650 &snd_ad1889_capture_ops);
651
652 pcm->private_data = chip;
653 pcm->private_free = snd_ad1889_pcm_free;
654 pcm->info_flags = 0;
655 strcpy(pcm->name, chip->card->shortname);
656
657 chip->pcm = pcm;
658 chip->psubs = NULL;
659 chip->csubs = NULL;
660
661 err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
662 snd_dma_pci_data(chip->pci),
663 BUFFER_BYTES_MAX / 2,
664 BUFFER_BYTES_MAX);
665
666 if (err < 0) {
667 snd_printk(KERN_ERR PFX "buffer allocation error: %d\n", err);
668 return err;
669 }
670
671 if (rpcm)
672 *rpcm = pcm;
673
674 return 0;
675}
676
677static void
678snd_ad1889_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
679{
680 struct snd_ad1889 *chip = entry->private_data;
681 u16 reg;
682 int tmp;
683
684 reg = ad1889_readw(chip, AD_DS_WSMC);
685 snd_iprintf(buffer, "Wave output: %s\n",
686 (reg & AD_DS_WSMC_WAEN) ? "enabled" : "disabled");
687 snd_iprintf(buffer, "Wave Channels: %s\n",
688 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
689 snd_iprintf(buffer, "Wave Quality: %d-bit linear\n",
690 (reg & AD_DS_WSMC_WA16) ? 16 : 8);
691
692 /* WARQ is at offset 12 */
693 tmp = (reg & AD_DS_WSMC_WARQ) ?
694 (((reg & AD_DS_WSMC_WARQ >> 12) & 0x01) ? 12 : 18) : 4;
695 tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1;
696
697 snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp,
698 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
699
700
701 snd_iprintf(buffer, "Synthesis output: %s\n",
702 reg & AD_DS_WSMC_SYEN ? "enabled" : "disabled");
703
704 /* SYRQ is at offset 4 */
705 tmp = (reg & AD_DS_WSMC_SYRQ) ?
706 (((reg & AD_DS_WSMC_SYRQ >> 4) & 0x01) ? 12 : 18) : 4;
707 tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1;
708
709 snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp,
710 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
711
712 reg = ad1889_readw(chip, AD_DS_RAMC);
713 snd_iprintf(buffer, "ADC input: %s\n",
714 (reg & AD_DS_RAMC_ADEN) ? "enabled" : "disabled");
715 snd_iprintf(buffer, "ADC Channels: %s\n",
716 (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono");
717 snd_iprintf(buffer, "ADC Quality: %d-bit linear\n",
718 (reg & AD_DS_RAMC_AD16) ? 16 : 8);
719
720 /* ACRQ is at offset 4 */
721 tmp = (reg & AD_DS_RAMC_ACRQ) ?
722 (((reg & AD_DS_RAMC_ACRQ >> 4) & 0x01) ? 12 : 18) : 4;
723 tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1;
724
725 snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp,
726 (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono");
727
728 snd_iprintf(buffer, "Resampler input: %s\n",
729 reg & AD_DS_RAMC_REEN ? "enabled" : "disabled");
730
731 /* RERQ is at offset 12 */
732 tmp = (reg & AD_DS_RAMC_RERQ) ?
733 (((reg & AD_DS_RAMC_RERQ >> 12) & 0x01) ? 12 : 18) : 4;
734 tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1;
735
736 snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp,
737 (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
738
739
740 /* doc says LSB represents -1.5dB, but the max value (-94.5dB)
741 suggests that LSB is -3dB, which is more coherent with the logarithmic
742 nature of the dB scale */
743 reg = ad1889_readw(chip, AD_DS_WADA);
744 snd_iprintf(buffer, "Left: %s, -%d dB\n",
745 (reg & AD_DS_WADA_LWAM) ? "mute" : "unmute",
746 ((reg & AD_DS_WADA_LWAA) >> 8) * 3);
747 reg = ad1889_readw(chip, AD_DS_WADA);
748 snd_iprintf(buffer, "Right: %s, -%d dB\n",
749 (reg & AD_DS_WADA_RWAM) ? "mute" : "unmute",
750 ((reg & AD_DS_WADA_RWAA) >> 8) * 3);
751
752 reg = ad1889_readw(chip, AD_DS_WAS);
753 snd_iprintf(buffer, "Wave samplerate: %u Hz\n", reg);
754 reg = ad1889_readw(chip, AD_DS_RES);
755 snd_iprintf(buffer, "Resampler samplerate: %u Hz\n", reg);
756}
757
758static void __devinit
759snd_ad1889_proc_init(struct snd_ad1889 *chip)
760{
761 snd_info_entry_t *entry;
762
763 if (!snd_card_proc_new(chip->card, chip->card->driver, &entry))
764 snd_info_set_text_ops(entry, chip, 1024, snd_ad1889_proc_read);
765}
766
767static struct ac97_quirk ac97_quirks[] = {
768 {
769 .subvendor = 0x11d4, /* AD */
770 .subdevice = 0x1889, /* AD1889 */
771 .codec_id = AC97_ID_AD1819,
772 .name = "AD1889",
773 .type = AC97_TUNE_HP_ONLY
774 },
775 { } /* terminator */
776};
777
778static void __devinit
779snd_ad1889_ac97_xinit(struct snd_ad1889 *chip)
780{
781 u16 reg;
782
783 reg = ad1889_readw(chip, AD_AC97_ACIC);
784 reg |= AD_AC97_ACIC_ACRD; /* Reset Disable */
785 ad1889_writew(chip, AD_AC97_ACIC, reg);
786 ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */
787 udelay(10);
788 /* Interface Enable */
789 reg |= AD_AC97_ACIC_ACIE;
790 ad1889_writew(chip, AD_AC97_ACIC, reg);
791
792 snd_ad1889_ac97_ready(chip);
793
794 /* Audio Stream Output | Variable Sample Rate Mode */
795 reg = ad1889_readw(chip, AD_AC97_ACIC);
796 reg |= AD_AC97_ACIC_ASOE | AD_AC97_ACIC_VSRM;
797 ad1889_writew(chip, AD_AC97_ACIC, reg);
798 ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */
799
800}
801
802static void
803snd_ad1889_ac97_bus_free(ac97_bus_t *bus)
804{
805 struct snd_ad1889 *chip = bus->private_data;
806 chip->ac97_bus = NULL;
807}
808
809static void
810snd_ad1889_ac97_free(ac97_t *ac97)
811{
812 struct snd_ad1889 *chip = ac97->private_data;
813 chip->ac97 = NULL;
814}
815
816static int __devinit
817snd_ad1889_ac97_init(struct snd_ad1889 *chip, const char *quirk_override)
818{
819 int err;
820 ac97_template_t ac97;
821 static ac97_bus_ops_t ops = {
822 .write = snd_ad1889_ac97_write,
823 .read = snd_ad1889_ac97_read,
824 };
825
826 /* doing that here, it works. */
827 snd_ad1889_ac97_xinit(chip);
828
829 err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
830 if (err < 0)
831 return err;
832
833 chip->ac97_bus->private_free = snd_ad1889_ac97_bus_free;
834
835 memset(&ac97, 0, sizeof(ac97));
836 ac97.private_data = chip;
837 ac97.private_free = snd_ad1889_ac97_free;
838 ac97.pci = chip->pci;
839
840 err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
841 if (err < 0)
842 return err;
843
844 snd_ac97_tune_hardware(chip->ac97, ac97_quirks, quirk_override);
845
846 return 0;
847}
848
849static int
850snd_ad1889_free(struct snd_ad1889 *chip)
851{
852 if (chip->irq < 0)
853 goto skip_hw;
854
855 spin_lock_irq(&chip->lock);
856
857 ad1889_mute(chip);
858
859 /* Turn off interrupt on count and zero DMA registers */
860 ad1889_channel_reset(chip, AD_CHAN_WAV | AD_CHAN_ADC);
861
862 /* clear DISR. If we don't, we'd better jump off the Eiffel Tower */
863 ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PTAI | AD_DMA_DISR_PMAI);
864 ad1889_readl(chip, AD_DMA_DISR); /* flush, dammit! */
865
866 spin_unlock_irq(&chip->lock);
867
868 synchronize_irq(chip->irq);
869
870 if (chip->irq >= 0)
871 free_irq(chip->irq, (void*)chip);
872
873skip_hw:
874 if (chip->iobase)
875 iounmap(chip->iobase);
876
877 pci_release_regions(chip->pci);
878 pci_disable_device(chip->pci);
879
880 kfree(chip);
881 return 0;
882}
883
884static inline int
885snd_ad1889_dev_free(snd_device_t *device)
886{
887 struct snd_ad1889 *chip = device->device_data;
888 return snd_ad1889_free(chip);
889}
890
891static int __devinit
892snd_ad1889_init(struct snd_ad1889 *chip)
893{
894 ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */
895 ad1889_readw(chip, AD_DS_CCS); /* flush posted write */
896
897 mdelay(10);
898
899 /* enable Master and Target abort interrupts */
900 ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE);
901
902 return 0;
903}
904
905static int __devinit
906snd_ad1889_create(snd_card_t *card,
907 struct pci_dev *pci,
908 struct snd_ad1889 **rchip)
909{
910 int err;
911
912 struct snd_ad1889 *chip;
913 static snd_device_ops_t ops = {
914 .dev_free = snd_ad1889_dev_free,
915 };
916
917 *rchip = NULL;
918
919 if ((err = pci_enable_device(pci)) < 0)
920 return err;
921
922 /* check PCI availability (32bit DMA) */
923 if (pci_set_dma_mask(pci, 0xffffffff) < 0 ||
924 pci_set_consistent_dma_mask(pci, 0xffffffff) < 0) {
925 printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n");
926 pci_disable_device(pci);
927 return -ENXIO;
928 }
929
930 /* allocate chip specific data with zero-filled memory */
931 if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
932 pci_disable_device(pci);
933 return -ENOMEM;
934 }
935
936 chip->card = card;
937 card->private_data = chip;
938 chip->pci = pci;
939 chip->irq = -1;
940
941 /* (1) PCI resource allocation */
942 if ((err = pci_request_regions(pci, card->driver)) < 0)
943 goto free_and_ret;
944
945 chip->bar = pci_resource_start(pci, 0);
946 chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0));
947 if (chip->iobase == NULL) {
948 printk(KERN_ERR PFX "unable to reserve region.\n");
949 err = -EBUSY;
950 goto free_and_ret;
951 }
952
953 pci_set_master(pci);
954
955 spin_lock_init(&chip->lock); /* only now can we call ad1889_free */
956
957 if (request_irq(pci->irq, snd_ad1889_interrupt,
958 SA_INTERRUPT|SA_SHIRQ, card->driver, (void*)chip)) {
959 printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq);
960 snd_ad1889_free(chip);
961 return -EBUSY;
962 }
963
964 chip->irq = pci->irq;
965 synchronize_irq(chip->irq);
966
967 /* (2) initialization of the chip hardware */
968 if ((err = snd_ad1889_init(chip)) < 0) {
969 snd_ad1889_free(chip);
970 return err;
971 }
972
973 if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
974 snd_ad1889_free(chip);
975 return err;
976 }
977
978 snd_card_set_dev(card, &pci->dev);
979
980 *rchip = chip;
981
982 return 0;
983
984free_and_ret:
985 if (chip)
986 kfree(chip);
987 pci_disable_device(pci);
988
989 return err;
990}
991
992static int __devinit
993snd_ad1889_probe(struct pci_dev *pci,
994 const struct pci_device_id *pci_id)
995{
996 int err;
997 static int devno;
998 snd_card_t *card;
999 struct snd_ad1889 *chip;
1000
1001 /* (1) */
1002 if (devno >= SNDRV_CARDS)
1003 return -ENODEV;
1004 if (!enable[devno]) {
1005 devno++;
1006 return -ENOENT;
1007 }
1008
1009 /* (2) */
1010 card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0);
1011 /* XXX REVISIT: we can probably allocate chip in this call */
1012 if (card == NULL)
1013 return -ENOMEM;
1014
1015 strcpy(card->driver, "AD1889");
1016 strcpy(card->shortname, "Analog Devices AD1889");
1017
1018 /* (3) */
1019 err = snd_ad1889_create(card, pci, &chip);
1020 if (err < 0)
1021 goto free_and_ret;
1022
1023 /* (4) */
1024 sprintf(card->longname, "%s at 0x%lx irq %i",
1025 card->shortname, chip->bar, chip->irq);
1026
1027 /* (5) */
1028 /* register AC97 mixer */
1029 err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]);
1030 if (err < 0)
1031 goto free_and_ret;
1032
1033 err = snd_ad1889_pcm_init(chip, 0, NULL);
1034 if (err < 0)
1035 goto free_and_ret;
1036
1037 /* register proc interface */
1038 snd_ad1889_proc_init(chip);
1039
1040 /* (6) */
1041 err = snd_card_register(card);
1042 if (err < 0)
1043 goto free_and_ret;
1044
1045 /* (7) */
1046 pci_set_drvdata(pci, card);
1047
1048 devno++;
1049 return 0;
1050
1051free_and_ret:
1052 snd_card_free(card);
1053 return err;
1054}
1055
1056static void __devexit
1057snd_ad1889_remove(struct pci_dev *pci)
1058{
1059 snd_card_free(pci_get_drvdata(pci));
1060 pci_set_drvdata(pci, NULL);
1061}
1062
1063static struct pci_device_id snd_ad1889_ids[] = {
1064 { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) },
1065 { 0, },
1066};
1067MODULE_DEVICE_TABLE(pci, snd_ad1889_ids);
1068
1069static struct pci_driver ad1889_pci = {
1070 .name = "AD1889 Audio",
1071 .owner = THIS_MODULE,
1072 .id_table = snd_ad1889_ids,
1073 .probe = snd_ad1889_probe,
1074 .remove = __devexit_p(snd_ad1889_remove),
1075};
1076
1077static int __init
1078alsa_ad1889_init(void)
1079{
1080 return pci_register_driver(&ad1889_pci);
1081}
1082
1083static void __exit
1084alsa_ad1889_fini(void)
1085{
1086 pci_unregister_driver(&ad1889_pci);
1087}
1088
1089module_init(alsa_ad1889_init);
1090module_exit(alsa_ad1889_fini);
diff --git a/sound/pci/ad1889.h b/sound/pci/ad1889.h
new file mode 100644
index 000000000000..5e6dad5341a1
--- /dev/null
+++ b/sound/pci/ad1889.h
@@ -0,0 +1,189 @@
1/* Analog Devices 1889 audio driver
2 * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org>
3 */
4
5#ifndef __AD1889_H__
6#define __AD1889_H__
7
8#define AD_DS_WSMC 0x00 /* wave/synthesis channel mixer control */
9#define AD_DS_WSMC_SYEN 0x0004 /* synthesis channel enable */
10#define AD_DS_WSMC_SYRQ 0x0030 /* synth. fifo request point */
11#define AD_DS_WSMC_WA16 0x0100 /* wave channel 16bit select */
12#define AD_DS_WSMC_WAST 0x0200 /* wave channel stereo select */
13#define AD_DS_WSMC_WAEN 0x0400 /* wave channel enable */
14#define AD_DS_WSMC_WARQ 0x3000 /* wave fifo request point */
15
16#define AD_DS_RAMC 0x02 /* resampler/ADC channel mixer control */
17#define AD_DS_RAMC_AD16 0x0001 /* ADC channel 16bit select */
18#define AD_DS_RAMC_ADST 0x0002 /* ADC channel stereo select */
19#define AD_DS_RAMC_ADEN 0x0004 /* ADC channel enable */
20#define AD_DS_RAMC_ACRQ 0x0030 /* ADC fifo request point */
21#define AD_DS_RAMC_REEN 0x0400 /* resampler channel enable */
22#define AD_DS_RAMC_RERQ 0x3000 /* res. fifo request point */
23
24#define AD_DS_WADA 0x04 /* wave channel mix attenuation */
25#define AD_DS_WADA_RWAM 0x0080 /* right wave mute */
26#define AD_DS_WADA_RWAA 0x001f /* right wave attenuation */
27#define AD_DS_WADA_LWAM 0x8000 /* left wave mute */
28#define AD_DS_WADA_LWAA 0x3e00 /* left wave attenuation */
29
30#define AD_DS_SYDA 0x06 /* synthesis channel mix attenuation */
31#define AD_DS_SYDA_RSYM 0x0080 /* right synthesis mute */
32#define AD_DS_SYDA_RSYA 0x001f /* right synthesis attenuation */
33#define AD_DS_SYDA_LSYM 0x8000 /* left synthesis mute */
34#define AD_DS_SYDA_LSYA 0x3e00 /* left synthesis attenuation */
35
36#define AD_DS_WAS 0x08 /* wave channel sample rate */
37#define AD_DS_WAS_WAS 0xffff /* sample rate mask */
38
39#define AD_DS_RES 0x0a /* resampler channel sample rate */
40#define AD_DS_RES_RES 0xffff /* sample rate mask */
41
42#define AD_DS_CCS 0x0c /* chip control/status */
43#define AD_DS_CCS_ADO 0x0001 /* ADC channel overflow */
44#define AD_DS_CCS_REO 0x0002 /* resampler channel overflow */
45#define AD_DS_CCS_SYU 0x0004 /* synthesis channel underflow */
46#define AD_DS_CCS_WAU 0x0008 /* wave channel underflow */
47/* bits 4 -> 7, 9, 11 -> 14 reserved */
48#define AD_DS_CCS_XTD 0x0100 /* xtd delay control (4096 clock cycles) */
49#define AD_DS_CCS_PDALL 0x0400 /* power */
50#define AD_DS_CCS_CLKEN 0x8000 /* clock */
51
52#define AD_DMA_RESBA 0x40 /* RES base address */
53#define AD_DMA_RESCA 0x44 /* RES current address */
54#define AD_DMA_RESBC 0x48 /* RES base count */
55#define AD_DMA_RESCC 0x4c /* RES current count */
56
57#define AD_DMA_ADCBA 0x50 /* ADC base address */
58#define AD_DMA_ADCCA 0x54 /* ADC current address */
59#define AD_DMA_ADCBC 0x58 /* ADC base count */
60#define AD_DMA_ADCCC 0x5c /* ADC current count */
61
62#define AD_DMA_SYNBA 0x60 /* synth base address */
63#define AD_DMA_SYNCA 0x64 /* synth current address */
64#define AD_DMA_SYNBC 0x68 /* synth base count */
65#define AD_DMA_SYNCC 0x6c /* synth current count */
66
67#define AD_DMA_WAVBA 0x70 /* wave base address */
68#define AD_DMA_WAVCA 0x74 /* wave current address */
69#define AD_DMA_WAVBC 0x78 /* wave base count */
70#define AD_DMA_WAVCC 0x7c /* wave current count */
71
72#define AD_DMA_RESIC 0x80 /* RES dma interrupt current byte count */
73#define AD_DMA_RESIB 0x84 /* RES dma interrupt base byte count */
74
75#define AD_DMA_ADCIC 0x88 /* ADC dma interrupt current byte count */
76#define AD_DMA_ADCIB 0x8c /* ADC dma interrupt base byte count */
77
78#define AD_DMA_SYNIC 0x90 /* synth dma interrupt current byte count */
79#define AD_DMA_SYNIB 0x94 /* synth dma interrupt base byte count */
80
81#define AD_DMA_WAVIC 0x98 /* wave dma interrupt current byte count */
82#define AD_DMA_WAVIB 0x9c /* wave dma interrupt base byte count */
83
84#define AD_DMA_ICC 0xffffff /* current byte count mask */
85#define AD_DMA_IBC 0xffffff /* base byte count mask */
86/* bits 24 -> 31 reserved */
87
88/* 4 bytes pad */
89#define AD_DMA_ADC 0xa8 /* ADC dma control and status */
90#define AD_DMA_SYNTH 0xb0 /* Synth dma control and status */
91#define AD_DMA_WAV 0xb8 /* wave dma control and status */
92#define AD_DMA_RES 0xa0 /* Resample dma control and status */
93
94#define AD_DMA_SGDE 0x0001 /* SGD mode enable */
95#define AD_DMA_LOOP 0x0002 /* loop enable */
96#define AD_DMA_IM 0x000c /* interrupt mode mask */
97#define AD_DMA_IM_DIS (~AD_DMA_IM) /* disable */
98#define AD_DMA_IM_CNT 0x0004 /* interrupt on count */
99#define AD_DMA_IM_SGD 0x0008 /* interrupt on SGD flag */
100#define AD_DMA_IM_EOL 0x000c /* interrupt on End of Linked List */
101#define AD_DMA_SGDS 0x0030 /* SGD status */
102#define AD_DMA_SFLG 0x0040 /* SGD flag */
103#define AD_DMA_EOL 0x0080 /* SGD end of list */
104/* bits 8 -> 15 reserved */
105
106#define AD_DMA_DISR 0xc0 /* dma interrupt status */
107#define AD_DMA_DISR_RESI 0x000001 /* resampler channel interrupt */
108#define AD_DMA_DISR_ADCI 0x000002 /* ADC channel interrupt */
109#define AD_DMA_DISR_SYNI 0x000004 /* synthesis channel interrupt */
110#define AD_DMA_DISR_WAVI 0x000008 /* wave channel interrupt */
111/* bits 4, 5 reserved */
112#define AD_DMA_DISR_SEPS 0x000040 /* serial eeprom status */
113/* bits 7 -> 13 reserved */
114#define AD_DMA_DISR_PMAI 0x004000 /* pci master abort interrupt */
115#define AD_DMA_DISR_PTAI 0x008000 /* pci target abort interrupt */
116#define AD_DMA_DISR_PTAE 0x010000 /* pci target abort interrupt enable */
117#define AD_DMA_DISR_PMAE 0x020000 /* pci master abort interrupt enable */
118/* bits 19 -> 31 reserved */
119
120/* interrupt mask */
121#define AD_INTR_MASK (AD_DMA_DISR_RESI|AD_DMA_DISR_ADCI| \
122 AD_DMA_DISR_WAVI|AD_DMA_DISR_SYNI| \
123 AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI)
124
125#define AD_DMA_CHSS 0xc4 /* dma channel stop status */
126#define AD_DMA_CHSS_RESS 0x000001 /* resampler channel stopped */
127#define AD_DMA_CHSS_ADCS 0x000002 /* ADC channel stopped */
128#define AD_DMA_CHSS_SYNS 0x000004 /* synthesis channel stopped */
129#define AD_DMA_CHSS_WAVS 0x000008 /* wave channel stopped */
130
131#define AD_GPIO_IPC 0xc8 /* gpio port control */
132#define AD_GPIO_OP 0xca /* gpio output port status */
133#define AD_GPIO_IP 0xcc /* gpio input port status */
134
135#define AD_AC97_BASE 0x100 /* ac97 base register */
136
137#define AD_AC97_RESET 0x100 /* reset */
138
139#define AD_AC97_PWR_CTL 0x126 /* == AC97_POWERDOWN */
140#define AD_AC97_PWR_ADC 0x0001 /* ADC ready status */
141#define AD_AC97_PWR_DAC 0x0002 /* DAC ready status */
142#define AD_AC97_PWR_PR0 0x0100 /* PR0 (ADC) powerdown */
143#define AD_AC97_PWR_PR1 0x0200 /* PR1 (DAC) powerdown */
144
145#define AD_MISC_CTL 0x176 /* misc control */
146#define AD_MISC_CTL_DACZ 0x8000 /* set for zero fill, unset for repeat */
147#define AD_MISC_CTL_ARSR 0x0001 /* set for SR1, unset for SR0 */
148#define AD_MISC_CTL_ALSR 0x0100
149#define AD_MISC_CTL_DLSR 0x0400
150#define AD_MISC_CTL_DRSR 0x0004
151
152#define AD_AC97_SR0 0x178 /* sample rate 0, 0xbb80 == 48K */
153#define AD_AC97_SR0_48K 0xbb80 /* 48KHz */
154#define AD_AC97_SR1 0x17a /* sample rate 1 */
155
156#define AD_AC97_ACIC 0x180 /* ac97 codec interface control */
157#define AD_AC97_ACIC_ACIE 0x0001 /* analog codec interface enable */
158#define AD_AC97_ACIC_ACRD 0x0002 /* analog codec reset disable */
159#define AD_AC97_ACIC_ASOE 0x0004 /* audio stream output enable */
160#define AD_AC97_ACIC_VSRM 0x0008 /* variable sample rate mode */
161#define AD_AC97_ACIC_FSDH 0x0100 /* force SDATA_OUT high */
162#define AD_AC97_ACIC_FSYH 0x0200 /* force sync high */
163#define AD_AC97_ACIC_ACRDY 0x8000 /* analog codec ready status */
164/* bits 10 -> 14 reserved */
165
166
167#define AD_DS_MEMSIZE 512
168#define AD_OPL_MEMSIZE 16
169#define AD_MIDI_MEMSIZE 16
170
171#define AD_WAV_STATE 0
172#define AD_ADC_STATE 1
173#define AD_MAX_STATES 2
174
175#define AD_CHAN_WAV 0x0001
176#define AD_CHAN_ADC 0x0002
177#define AD_CHAN_RES 0x0004
178#define AD_CHAN_SYN 0x0008
179
180
181/* The chip would support 4 GB buffers and 16 MB periods,
182 * but let's not overdo it ... */
183#define BUFFER_BYTES_MAX (256 * 1024)
184#define PERIOD_BYTES_MIN 32
185#define PERIOD_BYTES_MAX (BUFFER_BYTES_MAX / 2)
186#define PERIODS_MIN 2
187#define PERIODS_MAX (BUFFER_BYTES_MAX / PERIOD_BYTES_MIN)
188
189#endif /* __AD1889_H__ */
diff --git a/sound/pci/ali5451/ali5451.c b/sound/pci/ali5451/ali5451.c
index 4943299cf137..d683f7736a63 100644
--- a/sound/pci/ali5451/ali5451.c
+++ b/sound/pci/ali5451/ali5451.c
@@ -78,15 +78,7 @@ MODULE_PARM_DESC(spdif, "Support SPDIF I/O");
78 * Constants definition 78 * Constants definition
79 */ 79 */
80 80
81#ifndef PCI_VENDOR_ID_ALI 81#define DEVICE_ID_ALI5451 ((PCI_VENDOR_ID_AL<<16)|PCI_DEVICE_ID_AL_M5451)
82#define PCI_VENDOR_ID_ALI 0x10b9
83#endif
84
85#ifndef PCI_DEVICE_ID_ALI_5451
86#define PCI_DEVICE_ID_ALI_5451 0x5451
87#endif
88
89#define DEVICE_ID_ALI5451 ((PCI_VENDOR_ID_ALI<<16)|PCI_DEVICE_ID_ALI_5451)
90 82
91 83
92#define ALI_CHANNELS 32 84#define ALI_CHANNELS 32
@@ -326,13 +318,12 @@ static void ali_read_regs(ali_t *codec, int channel)
326static void ali_read_cfg(unsigned int vendor, unsigned deviceid) 318static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
327{ 319{
328 unsigned int dwVal; 320 unsigned int dwVal;
329 struct pci_dev *pci_dev = NULL; 321 struct pci_dev *pci_dev;
330 int i,j; 322 int i,j;
331 323
332 324 pci_dev = pci_get_device(vendor, deviceid, NULL);
333 pci_dev = pci_find_device(vendor, deviceid, pci_dev); 325 if (pci_dev == NULL)
334 if (pci_dev == NULL) 326 return ;
335 return ;
336 327
337 printk("\nM%x PCI CFG\n", deviceid); 328 printk("\nM%x PCI CFG\n", deviceid);
338 printk(" "); 329 printk(" ");
@@ -349,6 +340,7 @@ static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
349 } 340 }
350 printk("\n"); 341 printk("\n");
351 } 342 }
343 pci_dev_put(pci_dev);
352 } 344 }
353static void ali_read_ac97regs(ali_t *codec, int secondary) 345static void ali_read_ac97regs(ali_t *codec, int secondary)
354{ 346{
@@ -2116,6 +2108,8 @@ static int snd_ali_free(ali_t * codec)
2116#ifdef CONFIG_PM 2108#ifdef CONFIG_PM
2117 kfree(codec->image); 2109 kfree(codec->image);
2118#endif 2110#endif
2111 pci_dev_put(codec->pci_m1533);
2112 pci_dev_put(codec->pci_m7101);
2119 kfree(codec); 2113 kfree(codec);
2120 return 0; 2114 return 0;
2121} 2115}
@@ -2305,7 +2299,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
2305 codec->chregs.data.ainten = 0x00; 2299 codec->chregs.data.ainten = 0x00;
2306 2300
2307 /* M1533: southbridge */ 2301 /* M1533: southbridge */
2308 pci_dev = pci_find_device(0x10b9, 0x1533, NULL); 2302 pci_dev = pci_get_device(0x10b9, 0x1533, NULL);
2309 codec->pci_m1533 = pci_dev; 2303 codec->pci_m1533 = pci_dev;
2310 if (! codec->pci_m1533) { 2304 if (! codec->pci_m1533) {
2311 snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n"); 2305 snd_printk(KERN_ERR "ali5451: cannot find ALi 1533 chip.\n");
@@ -2313,7 +2307,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
2313 return -ENODEV; 2307 return -ENODEV;
2314 } 2308 }
2315 /* M7101: power management */ 2309 /* M7101: power management */
2316 pci_dev = pci_find_device(0x10b9, 0x7101, NULL); 2310 pci_dev = pci_get_device(0x10b9, 0x7101, NULL);
2317 codec->pci_m7101 = pci_dev; 2311 codec->pci_m7101 = pci_dev;
2318 if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) { 2312 if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) {
2319 snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n"); 2313 snd_printk(KERN_ERR "ali5451: cannot find ALi 7101 chip.\n");
@@ -2417,6 +2411,7 @@ static void __devexit snd_ali_remove(struct pci_dev *pci)
2417 2411
2418static struct pci_driver driver = { 2412static struct pci_driver driver = {
2419 .name = "ALI 5451", 2413 .name = "ALI 5451",
2414 .owner = THIS_MODULE,
2420 .id_table = snd_ali_ids, 2415 .id_table = snd_ali_ids,
2421 .probe = snd_ali_probe, 2416 .probe = snd_ali_probe,
2422 .remove = __devexit_p(snd_ali_remove), 2417 .remove = __devexit_p(snd_ali_remove),
diff --git a/sound/pci/als4000.c b/sound/pci/als4000.c
index ca28b229c704..196ec1c61bb4 100644
--- a/sound/pci/als4000.c
+++ b/sound/pci/als4000.c
@@ -770,6 +770,7 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci)
770 770
771static struct pci_driver driver = { 771static struct pci_driver driver = {
772 .name = "ALS4000", 772 .name = "ALS4000",
773 .owner = THIS_MODULE,
773 .id_table = snd_als4000_ids, 774 .id_table = snd_als4000_ids,
774 .probe = snd_card_als4000_probe, 775 .probe = snd_card_als4000_probe,
775 .remove = __devexit_p(snd_card_als4000_remove), 776 .remove = __devexit_p(snd_card_als4000_remove),
diff --git a/sound/pci/atiixp.c b/sound/pci/atiixp.c
index 188df085b7ee..241eacf1e652 100644
--- a/sound/pci/atiixp.c
+++ b/sound/pci/atiixp.c
@@ -1453,6 +1453,7 @@ static int snd_atiixp_resume(snd_card_t *card)
1453 atiixp_dma_t *dma = &chip->dmas[i]; 1453 atiixp_dma_t *dma = &chip->dmas[i];
1454 if (dma->substream && dma->suspended) { 1454 if (dma->substream && dma->suspended) {
1455 dma->ops->enable_dma(chip, 1); 1455 dma->ops->enable_dma(chip, 1);
1456 dma->substream->ops->prepare(dma->substream);
1456 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN, 1457 writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
1457 chip->remap_addr + dma->ops->llp_offset); 1458 chip->remap_addr + dma->ops->llp_offset);
1458 writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur); 1459 writel(dma->saved_curptr, chip->remap_addr + dma->ops->dt_cur);
@@ -1530,7 +1531,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1530 if ((err = pci_enable_device(pci)) < 0) 1531 if ((err = pci_enable_device(pci)) < 0)
1531 return err; 1532 return err;
1532 1533
1533 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1534 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1534 if (chip == NULL) { 1535 if (chip == NULL) {
1535 pci_disable_device(pci); 1536 pci_disable_device(pci);
1536 return -ENOMEM; 1537 return -ENOMEM;
@@ -1644,6 +1645,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci)
1644 1645
1645static struct pci_driver driver = { 1646static struct pci_driver driver = {
1646 .name = "ATI IXP AC97 controller", 1647 .name = "ATI IXP AC97 controller",
1648 .owner = THIS_MODULE,
1647 .id_table = snd_atiixp_ids, 1649 .id_table = snd_atiixp_ids,
1648 .probe = snd_atiixp_probe, 1650 .probe = snd_atiixp_probe,
1649 .remove = __devexit_p(snd_atiixp_remove), 1651 .remove = __devexit_p(snd_atiixp_remove),
diff --git a/sound/pci/atiixp_modem.c b/sound/pci/atiixp_modem.c
index 8d2002951bd7..8a59598167f9 100644
--- a/sound/pci/atiixp_modem.c
+++ b/sound/pci/atiixp_modem.c
@@ -1208,7 +1208,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
1208 if ((err = pci_enable_device(pci)) < 0) 1208 if ((err = pci_enable_device(pci)) < 0)
1209 return err; 1209 return err;
1210 1210
1211 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1211 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1212 if (chip == NULL) { 1212 if (chip == NULL) {
1213 pci_disable_device(pci); 1213 pci_disable_device(pci);
1214 return -ENOMEM; 1214 return -ENOMEM;
@@ -1318,6 +1318,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci)
1318 1318
1319static struct pci_driver driver = { 1319static struct pci_driver driver = {
1320 .name = "ATI IXP MC97 controller", 1320 .name = "ATI IXP MC97 controller",
1321 .owner = THIS_MODULE,
1321 .id_table = snd_atiixp_ids, 1322 .id_table = snd_atiixp_ids,
1322 .probe = snd_atiixp_probe, 1323 .probe = snd_atiixp_probe,
1323 .remove = __devexit_p(snd_atiixp_remove), 1324 .remove = __devexit_p(snd_atiixp_remove),
diff --git a/sound/pci/au88x0/au88x0.c b/sound/pci/au88x0/au88x0.c
index f6236c63aaaa..04b695d6fd48 100644
--- a/sound/pci/au88x0/au88x0.c
+++ b/sound/pci/au88x0/au88x0.c
@@ -79,19 +79,21 @@ static void vortex_fix_agp_bridge(struct pci_dev *via)
79 79
80static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix) 80static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
81{ 81{
82 struct pci_dev *via; 82 struct pci_dev *via = NULL;
83 83
84 /* autodetect if workarounds are required */ 84 /* autodetect if workarounds are required */
85 if (fix == 255) { 85 if (fix == 255) {
86 /* VIA KT133 */ 86 /* VIA KT133 */
87 via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL); 87 via = pci_get_device(PCI_VENDOR_ID_VIA,
88 PCI_DEVICE_ID_VIA_8365_1, NULL);
88 /* VIA Apollo */ 89 /* VIA Apollo */
89 if (via == NULL) { 90 if (via == NULL) {
90 via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL); 91 via = pci_get_device(PCI_VENDOR_ID_VIA,
91 } 92 PCI_DEVICE_ID_VIA_82C598_1, NULL);
92 /* AMD Irongate */ 93 /* AMD Irongate */
93 if (via == NULL) { 94 if (via == NULL)
94 via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL); 95 via = pci_get_device(PCI_VENDOR_ID_AMD,
96 PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
95 } 97 }
96 if (via) { 98 if (via) {
97 printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n"); 99 printk(KERN_INFO CARD_NAME ": Activating latency workaround...\n");
@@ -101,13 +103,17 @@ static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
101 } else { 103 } else {
102 if (fix & 0x1) 104 if (fix & 0x1)
103 vortex_fix_latency(vortex); 105 vortex_fix_latency(vortex);
104 if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL))) 106 if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
107 PCI_DEVICE_ID_VIA_8365_1, NULL)))
105 vortex_fix_agp_bridge(via); 108 vortex_fix_agp_bridge(via);
106 if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL))) 109 if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
110 PCI_DEVICE_ID_VIA_82C598_1, NULL)))
107 vortex_fix_agp_bridge(via); 111 vortex_fix_agp_bridge(via);
108 if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL))) 112 if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD,
113 PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
109 vortex_fix_agp_bridge(via); 114 vortex_fix_agp_bridge(via);
110 } 115 }
116 pci_dev_put(via);
111} 117}
112 118
113// component-destructor 119// component-destructor
@@ -150,7 +156,7 @@ snd_vortex_create(snd_card_t * card, struct pci_dev *pci, vortex_t ** rchip)
150 } 156 }
151 pci_set_dma_mask(pci, VORTEX_DMA_MASK); 157 pci_set_dma_mask(pci, VORTEX_DMA_MASK);
152 158
153 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 159 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
154 if (chip == NULL) 160 if (chip == NULL)
155 return -ENOMEM; 161 return -ENOMEM;
156 162
@@ -367,6 +373,7 @@ static void __devexit snd_vortex_remove(struct pci_dev *pci)
367// pci_driver definition 373// pci_driver definition
368static struct pci_driver driver = { 374static struct pci_driver driver = {
369 .name = CARD_NAME_SHORT, 375 .name = CARD_NAME_SHORT,
376 .owner = THIS_MODULE,
370 .id_table = snd_vortex_ids, 377 .id_table = snd_vortex_ids,
371 .probe = snd_vortex_probe, 378 .probe = snd_vortex_probe,
372 .remove = __devexit_p(snd_vortex_remove), 379 .remove = __devexit_p(snd_vortex_remove),
diff --git a/sound/pci/azt3328.c b/sound/pci/azt3328.c
index 72bba7b2d983..d5261bdec583 100644
--- a/sound/pci/azt3328.c
+++ b/sound/pci/azt3328.c
@@ -1345,7 +1345,7 @@ static int __devinit snd_azf3328_create(snd_card_t * card,
1345 if ((err = pci_enable_device(pci)) < 0) 1345 if ((err = pci_enable_device(pci)) < 0)
1346 return err; 1346 return err;
1347 1347
1348 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1348 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1349 if (chip == NULL) { 1349 if (chip == NULL) {
1350 pci_disable_device(pci); 1350 pci_disable_device(pci);
1351 return -ENOMEM; 1351 return -ENOMEM;
@@ -1511,6 +1511,7 @@ static void __devexit snd_azf3328_remove(struct pci_dev *pci)
1511 1511
1512static struct pci_driver driver = { 1512static struct pci_driver driver = {
1513 .name = "AZF3328", 1513 .name = "AZF3328",
1514 .owner = THIS_MODULE,
1514 .id_table = snd_azf3328_ids, 1515 .id_table = snd_azf3328_ids,
1515 .probe = snd_azf3328_probe, 1516 .probe = snd_azf3328_probe,
1516 .remove = __devexit_p(snd_azf3328_remove), 1517 .remove = __devexit_p(snd_azf3328_remove),
diff --git a/sound/pci/bt87x.c b/sound/pci/bt87x.c
index c5557eaf3e2e..2236c958aec0 100644
--- a/sound/pci/bt87x.c
+++ b/sound/pci/bt87x.c
@@ -59,16 +59,6 @@ module_param(load_all, bool, 0444);
59MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards"); 59MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards");
60 60
61 61
62#ifndef PCI_VENDOR_ID_BROOKTREE
63#define PCI_VENDOR_ID_BROOKTREE 0x109e
64#endif
65#ifndef PCI_DEVICE_ID_BROOKTREE_878
66#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
67#endif
68#ifndef PCI_DEVICE_ID_BROOKTREE_879
69#define PCI_DEVICE_ID_BROOKTREE_879 0x0879
70#endif
71
72/* register offsets */ 62/* register offsets */
73#define REG_INT_STAT 0x100 /* interrupt status */ 63#define REG_INT_STAT 0x100 /* interrupt status */
74#define REG_INT_MASK 0x104 /* interrupt mask */ 64#define REG_INT_MASK 0x104 /* interrupt mask */
@@ -720,7 +710,7 @@ static int __devinit snd_bt87x_create(snd_card_t *card,
720 if (err < 0) 710 if (err < 0)
721 return err; 711 return err;
722 712
723 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 713 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
724 if (!chip) { 714 if (!chip) {
725 pci_disable_device(pci); 715 pci_disable_device(pci);
726 return -ENOMEM; 716 return -ENOMEM;
@@ -911,6 +901,7 @@ static struct pci_device_id snd_bt87x_default_ids[] = {
911 901
912static struct pci_driver driver = { 902static struct pci_driver driver = {
913 .name = "Bt87x", 903 .name = "Bt87x",
904 .owner = THIS_MODULE,
914 .id_table = snd_bt87x_ids, 905 .id_table = snd_bt87x_ids,
915 .probe = snd_bt87x_probe, 906 .probe = snd_bt87x_probe,
916 .remove = __devexit_p(snd_bt87x_remove), 907 .remove = __devexit_p(snd_bt87x_remove),
diff --git a/sound/pci/ca0106/ca0106_main.c b/sound/pci/ca0106/ca0106_main.c
index 7e27bfc37439..ba07960921d8 100644
--- a/sound/pci/ca0106/ca0106_main.c
+++ b/sound/pci/ca0106/ca0106_main.c
@@ -352,7 +352,7 @@ static int snd_ca0106_pcm_open_playback_channel(snd_pcm_substream_t *substream,
352 snd_pcm_runtime_t *runtime = substream->runtime; 352 snd_pcm_runtime_t *runtime = substream->runtime;
353 int err; 353 int err;
354 354
355 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 355 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
356 356
357 if (epcm == NULL) 357 if (epcm == NULL)
358 return -ENOMEM; 358 return -ENOMEM;
@@ -419,7 +419,7 @@ static int snd_ca0106_pcm_open_capture_channel(snd_pcm_substream_t *substream, i
419 snd_pcm_runtime_t *runtime = substream->runtime; 419 snd_pcm_runtime_t *runtime = substream->runtime;
420 int err; 420 int err;
421 421
422 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 422 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
423 if (epcm == NULL) { 423 if (epcm == NULL) {
424 snd_printk("open_capture_channel: failed epcm alloc\n"); 424 snd_printk("open_capture_channel: failed epcm alloc\n");
425 return -ENOMEM; 425 return -ENOMEM;
@@ -1144,7 +1144,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
1144 return -ENXIO; 1144 return -ENXIO;
1145 } 1145 }
1146 1146
1147 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1147 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1148 if (chip == NULL) { 1148 if (chip == NULL) {
1149 pci_disable_device(pci); 1149 pci_disable_device(pci);
1150 return -ENOMEM; 1150 return -ENOMEM;
@@ -1390,6 +1390,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids);
1390// pci_driver definition 1390// pci_driver definition
1391static struct pci_driver driver = { 1391static struct pci_driver driver = {
1392 .name = "CA0106", 1392 .name = "CA0106",
1393 .owner = THIS_MODULE,
1393 .id_table = snd_ca0106_ids, 1394 .id_table = snd_ca0106_ids,
1394 .probe = snd_ca0106_probe, 1395 .probe = snd_ca0106_probe,
1395 .remove = __devexit_p(snd_ca0106_remove), 1396 .remove = __devexit_p(snd_ca0106_remove),
diff --git a/sound/pci/ca0106/ca0106_mixer.c b/sound/pci/ca0106/ca0106_mixer.c
index b6b8882ce704..c10e4a54301b 100644
--- a/sound/pci/ca0106/ca0106_mixer.c
+++ b/sound/pci/ca0106/ca0106_mixer.c
@@ -482,7 +482,7 @@ static int snd_ca0106_volume_put_feedback(snd_kcontrol_t * kcontrol,
482static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front = 482static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front =
483{ 483{
484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 484 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
485 .name = "Analog Front Volume", 485 .name = "Analog Front Playback Volume",
486 .info = snd_ca0106_volume_info, 486 .info = snd_ca0106_volume_info,
487 .get = snd_ca0106_volume_get_analog_front, 487 .get = snd_ca0106_volume_get_analog_front,
488 .put = snd_ca0106_volume_put_analog_front 488 .put = snd_ca0106_volume_put_analog_front
@@ -490,7 +490,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front =
490static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe = 490static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe =
491{ 491{
492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 492 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
493 .name = "Analog Center/LFE Volume", 493 .name = "Analog Center/LFE Playback Volume",
494 .info = snd_ca0106_volume_info, 494 .info = snd_ca0106_volume_info,
495 .get = snd_ca0106_volume_get_analog_center_lfe, 495 .get = snd_ca0106_volume_get_analog_center_lfe,
496 .put = snd_ca0106_volume_put_analog_center_lfe 496 .put = snd_ca0106_volume_put_analog_center_lfe
@@ -498,7 +498,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe =
498static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown = 498static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown =
499{ 499{
500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 500 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
501 .name = "Analog Side Volume", 501 .name = "Analog Side Playback Volume",
502 .info = snd_ca0106_volume_info, 502 .info = snd_ca0106_volume_info,
503 .get = snd_ca0106_volume_get_analog_unknown, 503 .get = snd_ca0106_volume_get_analog_unknown,
504 .put = snd_ca0106_volume_put_analog_unknown 504 .put = snd_ca0106_volume_put_analog_unknown
@@ -506,7 +506,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown =
506static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear = 506static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear =
507{ 507{
508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 508 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
509 .name = "Analog Rear Volume", 509 .name = "Analog Rear Playback Volume",
510 .info = snd_ca0106_volume_info, 510 .info = snd_ca0106_volume_info,
511 .get = snd_ca0106_volume_get_analog_rear, 511 .get = snd_ca0106_volume_get_analog_rear,
512 .put = snd_ca0106_volume_put_analog_rear 512 .put = snd_ca0106_volume_put_analog_rear
@@ -514,7 +514,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear =
514static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front = 514static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
515{ 515{
516 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 516 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
517 .name = "SPDIF Front Volume", 517 .name = "SPDIF Front Playback Volume",
518 .info = snd_ca0106_volume_info, 518 .info = snd_ca0106_volume_info,
519 .get = snd_ca0106_volume_get_spdif_front, 519 .get = snd_ca0106_volume_get_spdif_front,
520 .put = snd_ca0106_volume_put_spdif_front 520 .put = snd_ca0106_volume_put_spdif_front
@@ -522,7 +522,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
522static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe = 522static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe =
523{ 523{
524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 524 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
525 .name = "SPDIF Center/LFE Volume", 525 .name = "SPDIF Center/LFE Playback Volume",
526 .info = snd_ca0106_volume_info, 526 .info = snd_ca0106_volume_info,
527 .get = snd_ca0106_volume_get_spdif_center_lfe, 527 .get = snd_ca0106_volume_get_spdif_center_lfe,
528 .put = snd_ca0106_volume_put_spdif_center_lfe 528 .put = snd_ca0106_volume_put_spdif_center_lfe
@@ -530,7 +530,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe =
530static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown = 530static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown =
531{ 531{
532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 532 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
533 .name = "SPDIF Unknown Volume", 533 .name = "SPDIF Unknown Playback Volume",
534 .info = snd_ca0106_volume_info, 534 .info = snd_ca0106_volume_info,
535 .get = snd_ca0106_volume_get_spdif_unknown, 535 .get = snd_ca0106_volume_get_spdif_unknown,
536 .put = snd_ca0106_volume_put_spdif_unknown 536 .put = snd_ca0106_volume_put_spdif_unknown
@@ -538,7 +538,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown =
538static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear = 538static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear =
539{ 539{
540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 540 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
541 .name = "SPDIF Rear Volume", 541 .name = "SPDIF Rear Playback Volume",
542 .info = snd_ca0106_volume_info, 542 .info = snd_ca0106_volume_info,
543 .get = snd_ca0106_volume_get_spdif_rear, 543 .get = snd_ca0106_volume_get_spdif_rear,
544 .put = snd_ca0106_volume_put_spdif_rear 544 .put = snd_ca0106_volume_put_spdif_rear
@@ -547,7 +547,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear =
547static snd_kcontrol_new_t snd_ca0106_volume_control_feedback = 547static snd_kcontrol_new_t snd_ca0106_volume_control_feedback =
548{ 548{
549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER, 549 .iface = SNDRV_CTL_ELEM_IFACE_MIXER,
550 .name = "CAPTURE feedback into PLAYBACK", 550 .name = "CAPTURE feedback Playback Volume",
551 .info = snd_ca0106_volume_info, 551 .info = snd_ca0106_volume_info,
552 .get = snd_ca0106_volume_get_feedback, 552 .get = snd_ca0106_volume_get_feedback,
553 .put = snd_ca0106_volume_put_feedback 553 .put = snd_ca0106_volume_put_feedback
diff --git a/sound/pci/cmipci.c b/sound/pci/cmipci.c
index b098b51099c2..1eb3315d136d 100644
--- a/sound/pci/cmipci.c
+++ b/sound/pci/cmipci.c
@@ -79,13 +79,6 @@ module_param_array(joystick_port, int, NULL, 0444);
79MODULE_PARM_DESC(joystick_port, "Joystick port address."); 79MODULE_PARM_DESC(joystick_port, "Joystick port address.");
80#endif 80#endif
81 81
82#ifndef PCI_DEVICE_ID_CMEDIA_CM8738
83#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
84#endif
85#ifndef PCI_DEVICE_ID_CMEDIA_CM8738B
86#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
87#endif
88
89/* 82/*
90 * CM8x38 registers definition 83 * CM8x38 registers definition
91 */ 84 */
@@ -348,25 +341,6 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
348 341
349 342
350/* 343/*
351 * pci ids
352 */
353#ifndef PCI_VENDOR_ID_CMEDIA
354#define PCI_VENDOR_ID_CMEDIA 0x13F6
355#endif
356#ifndef PCI_DEVICE_ID_CMEDIA_CM8338A
357#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
358#endif
359#ifndef PCI_DEVICE_ID_CMEDIA_CM8338B
360#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
361#endif
362#ifndef PCI_DEVICE_ID_CMEDIA_CM8738
363#define PCI_DEVICE_ID_CMEDIA_CM8738 0x0111
364#endif
365#ifndef PCI_DEVICE_ID_CMEDIA_CM8738B
366#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
367#endif
368
369/*
370 * channels for playback / capture 344 * channels for playback / capture
371 */ 345 */
372#define CM_CH_PLAY 0 346#define CM_CH_PLAY 0
@@ -2801,7 +2775,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
2801 if ((err = pci_enable_device(pci)) < 0) 2775 if ((err = pci_enable_device(pci)) < 0)
2802 return err; 2776 return err;
2803 2777
2804 cm = kcalloc(1, sizeof(*cm), GFP_KERNEL); 2778 cm = kzalloc(sizeof(*cm), GFP_KERNEL);
2805 if (cm == NULL) { 2779 if (cm == NULL) {
2806 pci_disable_device(pci); 2780 pci_disable_device(pci);
2807 return -ENOMEM; 2781 return -ENOMEM;
@@ -3063,6 +3037,7 @@ static void __devexit snd_cmipci_remove(struct pci_dev *pci)
3063 3037
3064static struct pci_driver driver = { 3038static struct pci_driver driver = {
3065 .name = "C-Media PCI", 3039 .name = "C-Media PCI",
3040 .owner = THIS_MODULE,
3066 .id_table = snd_cmipci_ids, 3041 .id_table = snd_cmipci_ids,
3067 .probe = snd_cmipci_probe, 3042 .probe = snd_cmipci_probe,
3068 .remove = __devexit_p(snd_cmipci_remove), 3043 .remove = __devexit_p(snd_cmipci_remove),
diff --git a/sound/pci/cs4281.c b/sound/pci/cs4281.c
index c7a370d4f923..dc87e0144b5a 100644
--- a/sound/pci/cs4281.c
+++ b/sound/pci/cs4281.c
@@ -57,17 +57,6 @@ module_param_array(dual_codec, bool, NULL, 0444);
57MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled)."); 57MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled).");
58 58
59/* 59/*
60 *
61 */
62
63#ifndef PCI_VENDOR_ID_CIRRUS
64#define PCI_VENDOR_ID_CIRRUS 0x1013
65#endif
66#ifndef PCI_DEVICE_ID_CIRRUS_4281
67#define PCI_DEVICE_ID_CIRRUS_4281 0x6005
68#endif
69
70/*
71 * Direct registers 60 * Direct registers
72 */ 61 */
73 62
@@ -1394,7 +1383,7 @@ static int __devinit snd_cs4281_create(snd_card_t * card,
1394 *rchip = NULL; 1383 *rchip = NULL;
1395 if ((err = pci_enable_device(pci)) < 0) 1384 if ((err = pci_enable_device(pci)) < 0)
1396 return err; 1385 return err;
1397 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1386 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1398 if (chip == NULL) { 1387 if (chip == NULL) {
1399 pci_disable_device(pci); 1388 pci_disable_device(pci);
1400 return -ENOMEM; 1389 return -ENOMEM;
@@ -2119,6 +2108,7 @@ static int cs4281_resume(snd_card_t *card)
2119 2108
2120static struct pci_driver driver = { 2109static struct pci_driver driver = {
2121 .name = "CS4281", 2110 .name = "CS4281",
2111 .owner = THIS_MODULE,
2122 .id_table = snd_cs4281_ids, 2112 .id_table = snd_cs4281_ids,
2123 .probe = snd_cs4281_probe, 2113 .probe = snd_cs4281_probe,
2124 .remove = __devexit_p(snd_cs4281_remove), 2114 .remove = __devexit_p(snd_cs4281_remove),
diff --git a/sound/pci/cs46xx/cs46xx.c b/sound/pci/cs46xx/cs46xx.c
index b9fff4ee6f9d..32b4f8465cef 100644
--- a/sound/pci/cs46xx/cs46xx.c
+++ b/sound/pci/cs46xx/cs46xx.c
@@ -163,6 +163,7 @@ static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci)
163 163
164static struct pci_driver driver = { 164static struct pci_driver driver = {
165 .name = "Sound Fusion CS46xx", 165 .name = "Sound Fusion CS46xx",
166 .owner = THIS_MODULE,
166 .id_table = snd_cs46xx_ids, 167 .id_table = snd_cs46xx_ids,
167 .probe = snd_card_cs46xx_probe, 168 .probe = snd_card_cs46xx_probe,
168 .remove = __devexit_p(snd_card_cs46xx_remove), 169 .remove = __devexit_p(snd_card_cs46xx_remove),
diff --git a/sound/pci/cs46xx/cs46xx_lib.c b/sound/pci/cs46xx/cs46xx_lib.c
index 4b052158ee33..6e3855b8b33d 100644
--- a/sound/pci/cs46xx/cs46xx_lib.c
+++ b/sound/pci/cs46xx/cs46xx_lib.c
@@ -1304,7 +1304,7 @@ static int _cs46xx_playback_open_channel (snd_pcm_substream_t * substream,int pc
1304 cs46xx_pcm_t * cpcm; 1304 cs46xx_pcm_t * cpcm;
1305 snd_pcm_runtime_t *runtime = substream->runtime; 1305 snd_pcm_runtime_t *runtime = substream->runtime;
1306 1306
1307 cpcm = kcalloc(1, sizeof(*cpcm), GFP_KERNEL); 1307 cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);
1308 if (cpcm == NULL) 1308 if (cpcm == NULL)
1309 return -ENOMEM; 1309 return -ENOMEM;
1310 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 1310 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
@@ -3525,17 +3525,6 @@ static void amp_voyetra_4294(cs46xx_t *chip, int change)
3525 3525
3526 3526
3527/* 3527/*
3528 * piix4 pci ids
3529 */
3530#ifndef PCI_VENDOR_ID_INTEL
3531#define PCI_VENDOR_ID_INTEL 0x8086
3532#endif /* PCI_VENDOR_ID_INTEL */
3533
3534#ifndef PCI_DEVICE_ID_INTEL_82371AB_3
3535#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
3536#endif /* PCI_DEVICE_ID_INTEL_82371AB_3 */
3537
3538/*
3539 * Handle the CLKRUN on a thinkpad. We must disable CLKRUN support 3528 * Handle the CLKRUN on a thinkpad. We must disable CLKRUN support
3540 * whenever we need to beat on the chip. 3529 * whenever we need to beat on the chip.
3541 * 3530 *
@@ -3548,7 +3537,7 @@ static void clkrun_hack(cs46xx_t *chip, int change)
3548{ 3537{
3549 u16 control, nval; 3538 u16 control, nval;
3550 3539
3551 if (chip->acpi_dev == NULL) 3540 if (!chip->acpi_port)
3552 return; 3541 return;
3553 3542
3554 chip->amplifier += change; 3543 chip->amplifier += change;
@@ -3571,15 +3560,20 @@ static void clkrun_hack(cs46xx_t *chip, int change)
3571 */ 3560 */
3572static void clkrun_init(cs46xx_t *chip) 3561static void clkrun_init(cs46xx_t *chip)
3573{ 3562{
3563 struct pci_dev *pdev;
3574 u8 pp; 3564 u8 pp;
3575 3565
3576 chip->acpi_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL); 3566 chip->acpi_port = 0;
3577 if (chip->acpi_dev == NULL) 3567
3568 pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
3569 PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
3570 if (pdev == NULL)
3578 return; /* Not a thinkpad thats for sure */ 3571 return; /* Not a thinkpad thats for sure */
3579 3572
3580 /* Find the control port */ 3573 /* Find the control port */
3581 pci_read_config_byte(chip->acpi_dev, 0x41, &pp); 3574 pci_read_config_byte(pdev, 0x41, &pp);
3582 chip->acpi_port = pp << 8; 3575 chip->acpi_port = pp << 8;
3576 pci_dev_put(pdev);
3583} 3577}
3584 3578
3585 3579
@@ -3780,7 +3774,7 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
3780 if ((err = pci_enable_device(pci)) < 0) 3774 if ((err = pci_enable_device(pci)) < 0)
3781 return err; 3775 return err;
3782 3776
3783 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 3777 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
3784 if (chip == NULL) { 3778 if (chip == NULL) {
3785 pci_disable_device(pci); 3779 pci_disable_device(pci);
3786 return -ENOMEM; 3780 return -ENOMEM;
diff --git a/sound/pci/emu10k1/emu10k1.c b/sound/pci/emu10k1/emu10k1.c
index fc377c4b666c..b0e00f0a7c2f 100644
--- a/sound/pci/emu10k1/emu10k1.c
+++ b/sound/pci/emu10k1/emu10k1.c
@@ -223,6 +223,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci)
223 223
224static struct pci_driver driver = { 224static struct pci_driver driver = {
225 .name = "EMU10K1_Audigy", 225 .name = "EMU10K1_Audigy",
226 .owner = THIS_MODULE,
226 .id_table = snd_emu10k1_ids, 227 .id_table = snd_emu10k1_ids,
227 .probe = snd_card_emu10k1_probe, 228 .probe = snd_card_emu10k1_probe,
228 .remove = __devexit_p(snd_card_emu10k1_remove), 229 .remove = __devexit_p(snd_card_emu10k1_remove),
diff --git a/sound/pci/emu10k1/emu10k1_main.c b/sound/pci/emu10k1/emu10k1_main.c
index e69d5b739e80..e87e8427f25f 100644
--- a/sound/pci/emu10k1/emu10k1_main.c
+++ b/sound/pci/emu10k1/emu10k1_main.c
@@ -754,12 +754,11 @@ static emu_chip_details_t emu_chip_details[] = {
754 .emu10k1_chip = 1, 754 .emu10k1_chip = 1,
755 .ac97_chip = 1, 755 .ac97_chip = 1,
756 .sblive51 = 1} , 756 .sblive51 = 1} ,
757 /* Tested by alsa bugtrack user "hus" 12th Sept 2005 */ 757 /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102, 758 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
759 .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", 759 .driver = "EMU10K1", .name = "SBLive! Platinum 5.1 [SB0060]",
760 .id = "Live", 760 .id = "Live",
761 .emu10k1_chip = 1, 761 .emu10k1_chip = 1,
762 .ac97_chip = 1,
763 .sblive51 = 1} , 762 .sblive51 = 1} ,
764 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102, 763 {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
765 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", 764 .driver = "EMU10K1", .name = "SBLive! Value [CT4850]",
@@ -865,7 +864,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
865 if ((err = pci_enable_device(pci)) < 0) 864 if ((err = pci_enable_device(pci)) < 0)
866 return err; 865 return err;
867 866
868 emu = kcalloc(1, sizeof(*emu), GFP_KERNEL); 867 emu = kzalloc(sizeof(*emu), GFP_KERNEL);
869 if (emu == NULL) { 868 if (emu == NULL) {
870 pci_disable_device(pci); 869 pci_disable_device(pci);
871 return -ENOMEM; 870 return -ENOMEM;
diff --git a/sound/pci/emu10k1/emu10k1x.c b/sound/pci/emu10k1/emu10k1x.c
index 52c7826df440..ad15755a63c3 100644
--- a/sound/pci/emu10k1/emu10k1x.c
+++ b/sound/pci/emu10k1/emu10k1x.c
@@ -395,7 +395,7 @@ static int snd_emu10k1x_playback_open(snd_pcm_substream_t *substream)
395 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) 395 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
396 return err; 396 return err;
397 397
398 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 398 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
399 if (epcm == NULL) 399 if (epcm == NULL)
400 return -ENOMEM; 400 return -ENOMEM;
401 epcm->emu = chip; 401 epcm->emu = chip;
@@ -571,7 +571,7 @@ static int snd_emu10k1x_pcm_open_capture(snd_pcm_substream_t *substream)
571 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0) 571 if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
572 return err; 572 return err;
573 573
574 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 574 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
575 if (epcm == NULL) 575 if (epcm == NULL)
576 return -ENOMEM; 576 return -ENOMEM;
577 577
@@ -920,7 +920,7 @@ static int __devinit snd_emu10k1x_create(snd_card_t *card,
920 return -ENXIO; 920 return -ENXIO;
921 } 921 }
922 922
923 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 923 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
924 if (chip == NULL) { 924 if (chip == NULL) {
925 pci_disable_device(pci); 925 pci_disable_device(pci);
926 return -ENOMEM; 926 return -ENOMEM;
@@ -1615,6 +1615,7 @@ MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids);
1615// pci_driver definition 1615// pci_driver definition
1616static struct pci_driver driver = { 1616static struct pci_driver driver = {
1617 .name = "EMU10K1X", 1617 .name = "EMU10K1X",
1618 .owner = THIS_MODULE,
1618 .id_table = snd_emu10k1x_ids, 1619 .id_table = snd_emu10k1x_ids,
1619 .probe = snd_emu10k1x_probe, 1620 .probe = snd_emu10k1x_probe,
1620 .remove = __devexit_p(snd_emu10k1x_remove), 1621 .remove = __devexit_p(snd_emu10k1x_remove),
diff --git a/sound/pci/emu10k1/emufx.c b/sound/pci/emu10k1/emufx.c
index 637c555cfdb1..646b5d972e6f 100644
--- a/sound/pci/emu10k1/emufx.c
+++ b/sound/pci/emu10k1/emufx.c
@@ -470,7 +470,7 @@ static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr
470{ 470{
471 u_int32_t *code; 471 u_int32_t *code;
472 snd_assert(*ptr < 512, return); 472 snd_assert(*ptr < 512, return);
473 code = (u_int32_t *)icode->code + (*ptr) * 2; 473 code = (u_int32_t __force *)icode->code + (*ptr) * 2;
474 set_bit(*ptr, icode->code_valid); 474 set_bit(*ptr, icode->code_valid);
475 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff); 475 code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff);
476 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff); 476 code[1] = ((op & 0x0f) << 20) | ((r & 0x3ff) << 10) | (a & 0x3ff);
@@ -485,7 +485,7 @@ static void snd_emu10k1_audigy_write_op(emu10k1_fx8010_code_t *icode, unsigned i
485{ 485{
486 u_int32_t *code; 486 u_int32_t *code;
487 snd_assert(*ptr < 1024, return); 487 snd_assert(*ptr < 1024, return);
488 code = (u_int32_t *)icode->code + (*ptr) * 2; 488 code = (u_int32_t __force *)icode->code + (*ptr) * 2;
489 set_bit(*ptr, icode->code_valid); 489 set_bit(*ptr, icode->code_valid);
490 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff); 490 code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff);
491 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff); 491 code[1] = ((op & 0x0f) << 24) | ((r & 0x7ff) << 12) | (a & 0x7ff);
@@ -1036,13 +1036,13 @@ static int __devinit _snd_emu10k1_audigy_init_efx(emu10k1_t *emu)
1036 spin_lock_init(&emu->fx8010.irq_lock); 1036 spin_lock_init(&emu->fx8010.irq_lock);
1037 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); 1037 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
1038 1038
1039 if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL || 1039 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL ||
1040 (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL || 1040 (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||
1041 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) { 1041 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) {
1042 err = -ENOMEM; 1042 err = -ENOMEM;
1043 goto __err; 1043 goto __err;
1044 } 1044 }
1045 gpr_map = (u32 *)icode->gpr_map; 1045 gpr_map = (u32 __force *)icode->gpr_map;
1046 1046
1047 icode->tram_data_map = icode->gpr_map + 512; 1047 icode->tram_data_map = icode->gpr_map + 512;
1048 icode->tram_addr_map = icode->tram_data_map + 256; 1048 icode->tram_addr_map = icode->tram_data_map + 256;
@@ -1431,7 +1431,7 @@ A_OP(icode, &ptr, iMAC0, A_GPR(var), A_GPR(var), A_GPR(vol), A_EXTIN(input))
1431 __err: 1431 __err:
1432 kfree(controls); 1432 kfree(controls);
1433 if (icode != NULL) { 1433 if (icode != NULL) {
1434 kfree((void *)icode->gpr_map); 1434 kfree((void __force *)icode->gpr_map);
1435 kfree(icode); 1435 kfree(icode);
1436 } 1436 }
1437 return err; 1437 return err;
@@ -1503,15 +1503,15 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
1503 spin_lock_init(&emu->fx8010.irq_lock); 1503 spin_lock_init(&emu->fx8010.irq_lock);
1504 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl); 1504 INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
1505 1505
1506 if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL) 1506 if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL)
1507 return -ENOMEM; 1507 return -ENOMEM;
1508 if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL || 1508 if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||
1509 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL || 1509 (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL ||
1510 (ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL)) == NULL) { 1510 (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) {
1511 err = -ENOMEM; 1511 err = -ENOMEM;
1512 goto __err; 1512 goto __err;
1513 } 1513 }
1514 gpr_map = (u32 *)icode->gpr_map; 1514 gpr_map = (u32 __force *)icode->gpr_map;
1515 1515
1516 icode->tram_data_map = icode->gpr_map + 256; 1516 icode->tram_data_map = icode->gpr_map + 256;
1517 icode->tram_addr_map = icode->tram_data_map + 160; 1517 icode->tram_addr_map = icode->tram_data_map + 160;
@@ -2032,7 +2032,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
2032 kfree(ipcm); 2032 kfree(ipcm);
2033 kfree(controls); 2033 kfree(controls);
2034 if (icode != NULL) { 2034 if (icode != NULL) {
2035 kfree((void *)icode->gpr_map); 2035 kfree((void __force *)icode->gpr_map);
2036 kfree(icode); 2036 kfree(icode);
2037 } 2037 }
2038 return err; 2038 return err;
@@ -2217,7 +2217,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
2217 kfree(ipcm); 2217 kfree(ipcm);
2218 return res; 2218 return res;
2219 case SNDRV_EMU10K1_IOCTL_PCM_PEEK: 2219 case SNDRV_EMU10K1_IOCTL_PCM_PEEK:
2220 ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL); 2220 ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL);
2221 if (ipcm == NULL) 2221 if (ipcm == NULL)
2222 return -ENOMEM; 2222 return -ENOMEM;
2223 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) { 2223 if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
diff --git a/sound/pci/emu10k1/emupcm.c b/sound/pci/emu10k1/emupcm.c
index 9c35f6dde1b5..66ba27afe962 100644
--- a/sound/pci/emu10k1/emupcm.c
+++ b/sound/pci/emu10k1/emupcm.c
@@ -1016,7 +1016,7 @@ static int snd_emu10k1_efx_playback_open(snd_pcm_substream_t * substream)
1016 snd_pcm_runtime_t *runtime = substream->runtime; 1016 snd_pcm_runtime_t *runtime = substream->runtime;
1017 int i; 1017 int i;
1018 1018
1019 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1019 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1020 if (epcm == NULL) 1020 if (epcm == NULL)
1021 return -ENOMEM; 1021 return -ENOMEM;
1022 epcm->emu = emu; 1022 epcm->emu = emu;
@@ -1049,7 +1049,7 @@ static int snd_emu10k1_playback_open(snd_pcm_substream_t * substream)
1049 snd_pcm_runtime_t *runtime = substream->runtime; 1049 snd_pcm_runtime_t *runtime = substream->runtime;
1050 int i, err; 1050 int i, err;
1051 1051
1052 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1052 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1053 if (epcm == NULL) 1053 if (epcm == NULL)
1054 return -ENOMEM; 1054 return -ENOMEM;
1055 epcm->emu = emu; 1055 epcm->emu = emu;
@@ -1094,7 +1094,7 @@ static int snd_emu10k1_capture_open(snd_pcm_substream_t * substream)
1094 snd_pcm_runtime_t *runtime = substream->runtime; 1094 snd_pcm_runtime_t *runtime = substream->runtime;
1095 emu10k1_pcm_t *epcm; 1095 emu10k1_pcm_t *epcm;
1096 1096
1097 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1097 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1098 if (epcm == NULL) 1098 if (epcm == NULL)
1099 return -ENOMEM; 1099 return -ENOMEM;
1100 epcm->emu = emu; 1100 epcm->emu = emu;
@@ -1130,7 +1130,7 @@ static int snd_emu10k1_capture_mic_open(snd_pcm_substream_t * substream)
1130 emu10k1_pcm_t *epcm; 1130 emu10k1_pcm_t *epcm;
1131 snd_pcm_runtime_t *runtime = substream->runtime; 1131 snd_pcm_runtime_t *runtime = substream->runtime;
1132 1132
1133 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1133 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1134 if (epcm == NULL) 1134 if (epcm == NULL)
1135 return -ENOMEM; 1135 return -ENOMEM;
1136 epcm->emu = emu; 1136 epcm->emu = emu;
@@ -1170,7 +1170,7 @@ static int snd_emu10k1_capture_efx_open(snd_pcm_substream_t * substream)
1170 int nefx = emu->audigy ? 64 : 32; 1170 int nefx = emu->audigy ? 64 : 32;
1171 int idx; 1171 int idx;
1172 1172
1173 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 1173 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
1174 if (epcm == NULL) 1174 if (epcm == NULL)
1175 return -ENOMEM; 1175 return -ENOMEM;
1176 epcm->emu = emu; 1176 epcm->emu = emu;
diff --git a/sound/pci/emu10k1/p16v.c b/sound/pci/emu10k1/p16v.c
index a1691330d3b6..d59c7f345ad6 100644
--- a/sound/pci/emu10k1/p16v.c
+++ b/sound/pci/emu10k1/p16v.c
@@ -178,7 +178,7 @@ static int snd_p16v_pcm_open_playback_channel(snd_pcm_substream_t *substream, in
178 snd_pcm_runtime_t *runtime = substream->runtime; 178 snd_pcm_runtime_t *runtime = substream->runtime;
179 int err; 179 int err;
180 180
181 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 181 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
182 //snd_printk("epcm kcalloc: %p\n", epcm); 182 //snd_printk("epcm kcalloc: %p\n", epcm);
183 183
184 if (epcm == NULL) 184 if (epcm == NULL)
@@ -214,7 +214,7 @@ static int snd_p16v_pcm_open_capture_channel(snd_pcm_substream_t *substream, int
214 snd_pcm_runtime_t *runtime = substream->runtime; 214 snd_pcm_runtime_t *runtime = substream->runtime;
215 int err; 215 int err;
216 216
217 epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL); 217 epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
218 //snd_printk("epcm kcalloc: %p\n", epcm); 218 //snd_printk("epcm kcalloc: %p\n", epcm);
219 219
220 if (epcm == NULL) 220 if (epcm == NULL)
diff --git a/sound/pci/ens1370.c b/sound/pci/ens1370.c
index f06b95f41a1d..bef9a59f46d7 100644
--- a/sound/pci/ens1370.c
+++ b/sound/pci/ens1370.c
@@ -100,13 +100,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
100#endif 100#endif
101#endif /* SUPPORT_JOYSTICK */ 101#endif /* SUPPORT_JOYSTICK */
102 102
103#ifndef PCI_DEVICE_ID_ENSONIQ_CT5880
104#define PCI_DEVICE_ID_ENSONIQ_CT5880 0x5880
105#endif
106#ifndef PCI_DEVICE_ID_ENSONIQ_ES1371
107#define PCI_DEVICE_ID_ENSONIQ_ES1371 0x1371
108#endif
109
110/* ES1371 chip ID */ 103/* ES1371 chip ID */
111/* This is a little confusing because all ES1371 compatible chips have the 104/* This is a little confusing because all ES1371 compatible chips have the
112 same DEVICE_ID, the only thing differentiating them is the REV_ID field. 105 same DEVICE_ID, the only thing differentiating them is the REV_ID field.
@@ -1950,7 +1943,7 @@ static int __devinit snd_ensoniq_create(snd_card_t * card,
1950 *rensoniq = NULL; 1943 *rensoniq = NULL;
1951 if ((err = pci_enable_device(pci)) < 0) 1944 if ((err = pci_enable_device(pci)) < 0)
1952 return err; 1945 return err;
1953 ensoniq = kcalloc(1, sizeof(*ensoniq), GFP_KERNEL); 1946 ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);
1954 if (ensoniq == NULL) { 1947 if (ensoniq == NULL) {
1955 pci_disable_device(pci); 1948 pci_disable_device(pci);
1956 return -ENOMEM; 1949 return -ENOMEM;
@@ -2394,6 +2387,7 @@ static void __devexit snd_audiopci_remove(struct pci_dev *pci)
2394 2387
2395static struct pci_driver driver = { 2388static struct pci_driver driver = {
2396 .name = DRIVER_NAME, 2389 .name = DRIVER_NAME,
2390 .owner = THIS_MODULE,
2397 .id_table = snd_audiopci_ids, 2391 .id_table = snd_audiopci_ids,
2398 .probe = snd_audiopci_probe, 2392 .probe = snd_audiopci_probe,
2399 .remove = __devexit_p(snd_audiopci_remove), 2393 .remove = __devexit_p(snd_audiopci_remove),
diff --git a/sound/pci/es1938.c b/sound/pci/es1938.c
index b492777bc30f..17fa80c23870 100644
--- a/sound/pci/es1938.c
+++ b/sound/pci/es1938.c
@@ -76,13 +76,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
76#define SUPPORT_JOYSTICK 1 76#define SUPPORT_JOYSTICK 1
77#endif 77#endif
78 78
79#ifndef PCI_VENDOR_ID_ESS
80#define PCI_VENDOR_ID_ESS 0x125d
81#endif
82#ifndef PCI_DEVICE_ID_ESS_ES1938
83#define PCI_DEVICE_ID_ESS_ES1938 0x1969
84#endif
85
86static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 79static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
87static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 80static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
88static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 81static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
@@ -1501,7 +1494,7 @@ static int __devinit snd_es1938_create(snd_card_t * card,
1501 return -ENXIO; 1494 return -ENXIO;
1502 } 1495 }
1503 1496
1504 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1497 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1505 if (chip == NULL) { 1498 if (chip == NULL) {
1506 pci_disable_device(pci); 1499 pci_disable_device(pci);
1507 return -ENOMEM; 1500 return -ENOMEM;
@@ -1753,6 +1746,7 @@ static void __devexit snd_es1938_remove(struct pci_dev *pci)
1753 1746
1754static struct pci_driver driver = { 1747static struct pci_driver driver = {
1755 .name = "ESS ES1938 (Solo-1)", 1748 .name = "ESS ES1938 (Solo-1)",
1749 .owner = THIS_MODULE,
1756 .id_table = snd_es1938_ids, 1750 .id_table = snd_es1938_ids,
1757 .probe = snd_es1938_probe, 1751 .probe = snd_es1938_probe,
1758 .remove = __devexit_p(snd_es1938_remove), 1752 .remove = __devexit_p(snd_es1938_remove),
diff --git a/sound/pci/es1968.c b/sound/pci/es1968.c
index 9d7a28783930..ecdcada90ca2 100644
--- a/sound/pci/es1968.c
+++ b/sound/pci/es1968.c
@@ -160,25 +160,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
160#endif 160#endif
161 161
162 162
163/* PCI Dev ID's */
164
165#ifndef PCI_VENDOR_ID_ESS
166#define PCI_VENDOR_ID_ESS 0x125D
167#endif
168
169#define PCI_VENDOR_ID_ESS_OLD 0x1285 /* Platform Tech, the people the ESS
170 was bought form */
171
172#ifndef PCI_DEVICE_ID_ESS_M2E
173#define PCI_DEVICE_ID_ESS_M2E 0x1978
174#endif
175#ifndef PCI_DEVICE_ID_ESS_M2
176#define PCI_DEVICE_ID_ESS_M2 0x1968
177#endif
178#ifndef PCI_DEVICE_ID_ESS_M1
179#define PCI_DEVICE_ID_ESS_M1 0x0100
180#endif
181
182#define NR_APUS 64 163#define NR_APUS 64
183#define NR_APU_REGS 16 164#define NR_APU_REGS 16
184 165
@@ -1596,7 +1577,7 @@ static int snd_es1968_playback_open(snd_pcm_substream_t *substream)
1596 if (apu1 < 0) 1577 if (apu1 < 0)
1597 return apu1; 1578 return apu1;
1598 1579
1599 es = kcalloc(1, sizeof(*es), GFP_KERNEL); 1580 es = kzalloc(sizeof(*es), GFP_KERNEL);
1600 if (!es) { 1581 if (!es) {
1601 snd_es1968_free_apu_pair(chip, apu1); 1582 snd_es1968_free_apu_pair(chip, apu1);
1602 return -ENOMEM; 1583 return -ENOMEM;
@@ -1641,7 +1622,7 @@ static int snd_es1968_capture_open(snd_pcm_substream_t *substream)
1641 return apu2; 1622 return apu2;
1642 } 1623 }
1643 1624
1644 es = kcalloc(1, sizeof(*es), GFP_KERNEL); 1625 es = kzalloc(sizeof(*es), GFP_KERNEL);
1645 if (!es) { 1626 if (!es) {
1646 snd_es1968_free_apu_pair(chip, apu1); 1627 snd_es1968_free_apu_pair(chip, apu1);
1647 snd_es1968_free_apu_pair(chip, apu2); 1628 snd_es1968_free_apu_pair(chip, apu2);
@@ -2588,7 +2569,7 @@ static int __devinit snd_es1968_create(snd_card_t * card,
2588 return -ENXIO; 2569 return -ENXIO;
2589 } 2570 }
2590 2571
2591 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2572 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2592 if (! chip) { 2573 if (! chip) {
2593 pci_disable_device(pci); 2574 pci_disable_device(pci);
2594 return -ENOMEM; 2575 return -ENOMEM;
@@ -2782,6 +2763,7 @@ static void __devexit snd_es1968_remove(struct pci_dev *pci)
2782 2763
2783static struct pci_driver driver = { 2764static struct pci_driver driver = {
2784 .name = "ES1968 (ESS Maestro)", 2765 .name = "ES1968 (ESS Maestro)",
2766 .owner = THIS_MODULE,
2785 .id_table = snd_es1968_ids, 2767 .id_table = snd_es1968_ids,
2786 .probe = snd_es1968_probe, 2768 .probe = snd_es1968_probe,
2787 .remove = __devexit_p(snd_es1968_remove), 2769 .remove = __devexit_p(snd_es1968_remove),
diff --git a/sound/pci/fm801.c b/sound/pci/fm801.c
index 36b2f62e8573..e5cfa2a0c246 100644
--- a/sound/pci/fm801.c
+++ b/sound/pci/fm801.c
@@ -1263,7 +1263,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
1263 *rchip = NULL; 1263 *rchip = NULL;
1264 if ((err = pci_enable_device(pci)) < 0) 1264 if ((err = pci_enable_device(pci)) < 0)
1265 return err; 1265 return err;
1266 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1266 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1267 if (chip == NULL) { 1267 if (chip == NULL) {
1268 pci_disable_device(pci); 1268 pci_disable_device(pci);
1269 return -ENOMEM; 1269 return -ENOMEM;
@@ -1462,6 +1462,7 @@ static void __devexit snd_card_fm801_remove(struct pci_dev *pci)
1462 1462
1463static struct pci_driver driver = { 1463static struct pci_driver driver = {
1464 .name = "FM801", 1464 .name = "FM801",
1465 .owner = THIS_MODULE,
1465 .id_table = snd_fm801_ids, 1466 .id_table = snd_fm801_ids,
1466 .probe = snd_card_fm801_probe, 1467 .probe = snd_card_fm801_probe,
1467 .remove = __devexit_p(snd_card_fm801_remove), 1468 .remove = __devexit_p(snd_card_fm801_remove),
diff --git a/sound/pci/hda/hda_codec.c b/sound/pci/hda/hda_codec.c
index 20f7762f7144..3815403ed095 100644
--- a/sound/pci/hda/hda_codec.c
+++ b/sound/pci/hda/hda_codec.c
@@ -288,7 +288,7 @@ static int init_unsol_queue(struct hda_bus *bus)
288{ 288{
289 struct hda_bus_unsolicited *unsol; 289 struct hda_bus_unsolicited *unsol;
290 290
291 unsol = kcalloc(1, sizeof(*unsol), GFP_KERNEL); 291 unsol = kzalloc(sizeof(*unsol), GFP_KERNEL);
292 if (! unsol) { 292 if (! unsol) {
293 snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n"); 293 snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n");
294 return -ENOMEM; 294 return -ENOMEM;
@@ -358,7 +358,7 @@ int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp,
358 if (busp) 358 if (busp)
359 *busp = NULL; 359 *busp = NULL;
360 360
361 bus = kcalloc(1, sizeof(*bus), GFP_KERNEL); 361 bus = kzalloc(sizeof(*bus), GFP_KERNEL);
362 if (bus == NULL) { 362 if (bus == NULL) {
363 snd_printk(KERN_ERR "can't allocate struct hda_bus\n"); 363 snd_printk(KERN_ERR "can't allocate struct hda_bus\n");
364 return -ENOMEM; 364 return -ENOMEM;
@@ -493,7 +493,7 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
493 return -EBUSY; 493 return -EBUSY;
494 } 494 }
495 495
496 codec = kcalloc(1, sizeof(*codec), GFP_KERNEL); 496 codec = kzalloc(sizeof(*codec), GFP_KERNEL);
497 if (codec == NULL) { 497 if (codec == NULL) {
498 snd_printk(KERN_ERR "can't allocate struct hda_codec\n"); 498 snd_printk(KERN_ERR "can't allocate struct hda_codec\n");
499 return -ENOMEM; 499 return -ENOMEM;
diff --git a/sound/pci/hda/hda_codec.h b/sound/pci/hda/hda_codec.h
index 63a29a8a2860..bb53bcf76742 100644
--- a/sound/pci/hda/hda_codec.h
+++ b/sound/pci/hda/hda_codec.h
@@ -505,6 +505,7 @@ struct hda_pcm_stream {
505struct hda_pcm { 505struct hda_pcm {
506 char *name; 506 char *name;
507 struct hda_pcm_stream stream[2]; 507 struct hda_pcm_stream stream[2];
508 unsigned int is_modem; /* modem codec? */
508}; 509};
509 510
510/* codec information */ 511/* codec information */
diff --git a/sound/pci/hda/hda_generic.c b/sound/pci/hda/hda_generic.c
index 1229227af5b5..5b829a1a4c60 100644
--- a/sound/pci/hda/hda_generic.c
+++ b/sound/pci/hda/hda_generic.c
@@ -98,7 +98,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
98 struct hda_gnode *node; 98 struct hda_gnode *node;
99 int nconns; 99 int nconns;
100 100
101 node = kcalloc(1, sizeof(*node), GFP_KERNEL); 101 node = kzalloc(sizeof(*node), GFP_KERNEL);
102 if (node == NULL) 102 if (node == NULL)
103 return -ENOMEM; 103 return -ENOMEM;
104 node->nid = nid; 104 node->nid = nid;
@@ -886,7 +886,7 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
886 return -ENODEV; 886 return -ENODEV;
887 } 887 }
888 888
889 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 889 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
890 if (spec == NULL) { 890 if (spec == NULL) {
891 printk(KERN_ERR "hda_generic: can't allocate spec\n"); 891 printk(KERN_ERR "hda_generic: can't allocate spec\n");
892 return -ENOMEM; 892 return -ENOMEM;
diff --git a/sound/pci/hda/hda_intel.c b/sound/pci/hda/hda_intel.c
index 15107df1f490..9590ece2099d 100644
--- a/sound/pci/hda/hda_intel.c
+++ b/sound/pci/hda/hda_intel.c
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(enable, "Enable Intel HD audio interface.");
62module_param_array(model, charp, NULL, 0444); 62module_param_array(model, charp, NULL, 0444);
63MODULE_PARM_DESC(model, "Use the given board model."); 63MODULE_PARM_DESC(model, "Use the given board model.");
64module_param_array(position_fix, int, NULL, 0444); 64module_param_array(position_fix, int, NULL, 0444);
65MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF)."); 65MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size).");
66 66
67MODULE_LICENSE("GPL"); 67MODULE_LICENSE("GPL");
68MODULE_SUPPORTED_DEVICE("{{Intel, ICH6}," 68MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
@@ -164,7 +164,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
164/* max buffer size - no h/w limit, you can increase as you like */ 164/* max buffer size - no h/w limit, you can increase as you like */
165#define AZX_MAX_BUF_SIZE (1024*1024*1024) 165#define AZX_MAX_BUF_SIZE (1024*1024*1024)
166/* max number of PCM devics per card */ 166/* max number of PCM devics per card */
167#define AZX_MAX_PCMS 8 167#define AZX_MAX_AUDIO_PCMS 6
168#define AZX_MAX_MODEM_PCMS 2
169#define AZX_MAX_PCMS (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS)
168 170
169/* RIRB int mask: overrun[2], response[0] */ 171/* RIRB int mask: overrun[2], response[0] */
170#define RIRB_INT_RESPONSE 0x01 172#define RIRB_INT_RESPONSE 0x01
@@ -211,9 +213,10 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
211 213
212/* position fix mode */ 214/* position fix mode */
213enum { 215enum {
214 POS_FIX_FIFO, 216 POS_FIX_AUTO,
215 POS_FIX_NONE, 217 POS_FIX_NONE,
216 POS_FIX_POSBUF 218 POS_FIX_POSBUF,
219 POS_FIX_FIFO,
217}; 220};
218 221
219/* Defines for ATI HD Audio support in SB450 south bridge */ 222/* Defines for ATI HD Audio support in SB450 south bridge */
@@ -243,6 +246,7 @@ struct snd_azx_dev {
243 unsigned int fragsize; /* size of each period in bytes */ 246 unsigned int fragsize; /* size of each period in bytes */
244 unsigned int frags; /* number for period in the play buffer */ 247 unsigned int frags; /* number for period in the play buffer */
245 unsigned int fifo_size; /* FIFO size */ 248 unsigned int fifo_size; /* FIFO size */
249 unsigned int last_pos; /* last updated period position */
246 250
247 void __iomem *sd_addr; /* stream descriptor pointer */ 251 void __iomem *sd_addr; /* stream descriptor pointer */
248 252
@@ -256,6 +260,7 @@ struct snd_azx_dev {
256 260
257 unsigned int opened: 1; 261 unsigned int opened: 1;
258 unsigned int running: 1; 262 unsigned int running: 1;
263 unsigned int period_updating: 1;
259}; 264};
260 265
261/* CORB/RIRB */ 266/* CORB/RIRB */
@@ -724,11 +729,9 @@ static void azx_init_chip(azx_t *chip)
724 /* initialize the codec command I/O */ 729 /* initialize the codec command I/O */
725 azx_init_cmd_io(chip); 730 azx_init_cmd_io(chip);
726 731
727 if (chip->position_fix == POS_FIX_POSBUF) { 732 /* program the position buffer */
728 /* program the position buffer */ 733 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr);
729 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr); 734 azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
730 azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
731 }
732 735
733 /* For ATI SB450 azalia HD audio, we need to enable snoop */ 736 /* For ATI SB450 azalia HD audio, we need to enable snoop */
734 if (chip->driver_type == AZX_DRIVER_ATI) { 737 if (chip->driver_type == AZX_DRIVER_ATI) {
@@ -763,9 +766,11 @@ static irqreturn_t azx_interrupt(int irq, void* dev_id, struct pt_regs *regs)
763 if (status & azx_dev->sd_int_sta_mask) { 766 if (status & azx_dev->sd_int_sta_mask) {
764 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK); 767 azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
765 if (azx_dev->substream && azx_dev->running) { 768 if (azx_dev->substream && azx_dev->running) {
769 azx_dev->period_updating = 1;
766 spin_unlock(&chip->reg_lock); 770 spin_unlock(&chip->reg_lock);
767 snd_pcm_period_elapsed(azx_dev->substream); 771 snd_pcm_period_elapsed(azx_dev->substream);
768 spin_lock(&chip->reg_lock); 772 spin_lock(&chip->reg_lock);
773 azx_dev->period_updating = 0;
769 } 774 }
770 } 775 }
771 } 776 }
@@ -866,11 +871,9 @@ static int azx_setup_controller(azx_t *chip, azx_dev_t *azx_dev)
866 /* upper BDL address */ 871 /* upper BDL address */
867 azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr)); 872 azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr));
868 873
869 if (chip->position_fix == POS_FIX_POSBUF) { 874 /* enable the position buffer */
870 /* enable the position buffer */ 875 if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE))
871 if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE)) 876 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
872 azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
873 }
874 877
875 /* set the interrupt enable bits in the descriptor control register */ 878 /* set the interrupt enable bits in the descriptor control register */
876 azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK); 879 azx_sd_writel(azx_dev, SD_CTL, azx_sd_readl(azx_dev, SD_CTL) | SD_INT_MASK);
@@ -1078,6 +1081,7 @@ static int azx_pcm_prepare(snd_pcm_substream_t *substream)
1078 azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1; 1081 azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1;
1079 else 1082 else
1080 azx_dev->fifo_size = 0; 1083 azx_dev->fifo_size = 0;
1084 azx_dev->last_pos = 0;
1081 1085
1082 return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag, 1086 return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag,
1083 azx_dev->format_val, substream); 1087 azx_dev->format_val, substream);
@@ -1133,6 +1137,26 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
1133 pos = azx_sd_readl(azx_dev, SD_LPIB); 1137 pos = azx_sd_readl(azx_dev, SD_LPIB);
1134 if (chip->position_fix == POS_FIX_FIFO) 1138 if (chip->position_fix == POS_FIX_FIFO)
1135 pos += azx_dev->fifo_size; 1139 pos += azx_dev->fifo_size;
1140 else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) {
1141 /* check the validity of DMA position */
1142 unsigned int diff = 0;
1143 azx_dev->last_pos += azx_dev->fragsize;
1144 if (azx_dev->last_pos > pos)
1145 diff = azx_dev->last_pos - pos;
1146 if (azx_dev->last_pos >= azx_dev->bufsize) {
1147 if (pos < azx_dev->fragsize)
1148 diff = 0;
1149 azx_dev->last_pos = 0;
1150 }
1151 if (diff > 0 && diff <= azx_dev->fifo_size)
1152 pos += azx_dev->fifo_size;
1153 else {
1154 snd_printdd(KERN_INFO "hda_intel: DMA position fix %d, switching to posbuf\n", diff);
1155 chip->position_fix = POS_FIX_POSBUF;
1156 pos = *azx_dev->posbuf;
1157 }
1158 azx_dev->period_updating = 0;
1159 }
1136 } 1160 }
1137 if (pos >= azx_dev->bufsize) 1161 if (pos >= azx_dev->bufsize)
1138 pos = 0; 1162 pos = 0;
@@ -1203,12 +1227,33 @@ static int __devinit azx_pcm_create(azx_t *chip)
1203 if ((err = snd_hda_build_pcms(chip->bus)) < 0) 1227 if ((err = snd_hda_build_pcms(chip->bus)) < 0)
1204 return err; 1228 return err;
1205 1229
1230 /* create audio PCMs */
1206 pcm_dev = 0; 1231 pcm_dev = 0;
1207 list_for_each(p, &chip->bus->codec_list) { 1232 list_for_each(p, &chip->bus->codec_list) {
1208 codec = list_entry(p, struct hda_codec, list); 1233 codec = list_entry(p, struct hda_codec, list);
1209 for (c = 0; c < codec->num_pcms; c++) { 1234 for (c = 0; c < codec->num_pcms; c++) {
1235 if (codec->pcm_info[c].is_modem)
1236 continue; /* create later */
1237 if (pcm_dev >= AZX_MAX_AUDIO_PCMS) {
1238 snd_printk(KERN_ERR SFX "Too many audio PCMs\n");
1239 return -EINVAL;
1240 }
1241 err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
1242 if (err < 0)
1243 return err;
1244 pcm_dev++;
1245 }
1246 }
1247
1248 /* create modem PCMs */
1249 pcm_dev = AZX_MAX_AUDIO_PCMS;
1250 list_for_each(p, &chip->bus->codec_list) {
1251 codec = list_entry(p, struct hda_codec, list);
1252 for (c = 0; c < codec->num_pcms; c++) {
1253 if (! codec->pcm_info[c].is_modem)
1254 continue; /* already created */
1210 if (pcm_dev >= AZX_MAX_PCMS) { 1255 if (pcm_dev >= AZX_MAX_PCMS) {
1211 snd_printk(KERN_ERR SFX "Too many PCMs\n"); 1256 snd_printk(KERN_ERR SFX "Too many modem PCMs\n");
1212 return -EINVAL; 1257 return -EINVAL;
1213 } 1258 }
1214 err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev); 1259 err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
@@ -1244,8 +1289,7 @@ static int __devinit azx_init_stream(azx_t *chip)
1244 azx_dev_t *azx_dev = &chip->azx_dev[i]; 1289 azx_dev_t *azx_dev = &chip->azx_dev[i];
1245 azx_dev->bdl = (u32 *)(chip->bdl.area + off); 1290 azx_dev->bdl = (u32 *)(chip->bdl.area + off);
1246 azx_dev->bdl_addr = chip->bdl.addr + off; 1291 azx_dev->bdl_addr = chip->bdl.addr + off;
1247 if (chip->position_fix == POS_FIX_POSBUF) 1292 azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
1248 azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
1249 /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */ 1293 /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
1250 azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80); 1294 azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80);
1251 /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */ 1295 /* int mask: SDI0=0x01, SDI1=0x02, ... SDO3=0x80 */
@@ -1358,7 +1402,7 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1358 if ((err = pci_enable_device(pci)) < 0) 1402 if ((err = pci_enable_device(pci)) < 0)
1359 return err; 1403 return err;
1360 1404
1361 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1405 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1362 1406
1363 if (NULL == chip) { 1407 if (NULL == chip) {
1364 snd_printk(KERN_ERR SFX "cannot allocate chip\n"); 1408 snd_printk(KERN_ERR SFX "cannot allocate chip\n");
@@ -1437,13 +1481,11 @@ static int __devinit azx_create(snd_card_t *card, struct pci_dev *pci,
1437 snd_printk(KERN_ERR SFX "cannot allocate BDL\n"); 1481 snd_printk(KERN_ERR SFX "cannot allocate BDL\n");
1438 goto errout; 1482 goto errout;
1439 } 1483 }
1440 if (chip->position_fix == POS_FIX_POSBUF) { 1484 /* allocate memory for the position buffer */
1441 /* allocate memory for the position buffer */ 1485 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
1442 if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci), 1486 chip->num_streams * 8, &chip->posbuf)) < 0) {
1443 chip->num_streams * 8, &chip->posbuf)) < 0) { 1487 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
1444 snd_printk(KERN_ERR SFX "cannot allocate posbuf\n"); 1488 goto errout;
1445 goto errout;
1446 }
1447 } 1489 }
1448 /* allocate CORB/RIRB */ 1490 /* allocate CORB/RIRB */
1449 if ((err = azx_alloc_cmd_io(chip)) < 0) 1491 if ((err = azx_alloc_cmd_io(chip)) < 0)
@@ -1561,6 +1603,7 @@ MODULE_DEVICE_TABLE(pci, azx_ids);
1561/* pci_driver definition */ 1603/* pci_driver definition */
1562static struct pci_driver driver = { 1604static struct pci_driver driver = {
1563 .name = "HDA Intel", 1605 .name = "HDA Intel",
1606 .owner = THIS_MODULE,
1564 .id_table = azx_ids, 1607 .id_table = azx_ids,
1565 .probe = azx_probe, 1608 .probe = azx_probe,
1566 .remove = __devexit_p(azx_remove), 1609 .remove = __devexit_p(azx_remove),
diff --git a/sound/pci/hda/hda_proc.c b/sound/pci/hda/hda_proc.c
index de1217bd8e68..08f6a6efc5e6 100644
--- a/sound/pci/hda/hda_proc.c
+++ b/sound/pci/hda/hda_proc.c
@@ -207,6 +207,8 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
207 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id); 207 snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id);
208 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id); 208 snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id);
209 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id); 209 snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
210 if (! codec->afg)
211 return;
210 snd_iprintf(buffer, "Default PCM: "); 212 snd_iprintf(buffer, "Default PCM: ");
211 print_pcm_caps(buffer, codec, codec->afg); 213 print_pcm_caps(buffer, codec, codec->afg);
212 snd_iprintf(buffer, "Default Amp-In caps: "); 214 snd_iprintf(buffer, "Default Amp-In caps: ");
diff --git a/sound/pci/hda/patch_analog.c b/sound/pci/hda/patch_analog.c
index bceb83a42a38..da6874d3988c 100644
--- a/sound/pci/hda/patch_analog.c
+++ b/sound/pci/hda/patch_analog.c
@@ -465,7 +465,7 @@ static int patch_ad1986a(struct hda_codec *codec)
465{ 465{
466 struct ad198x_spec *spec; 466 struct ad198x_spec *spec;
467 467
468 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 468 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
469 if (spec == NULL) 469 if (spec == NULL)
470 return -ENOMEM; 470 return -ENOMEM;
471 471
@@ -623,7 +623,7 @@ static int patch_ad1983(struct hda_codec *codec)
623{ 623{
624 struct ad198x_spec *spec; 624 struct ad198x_spec *spec;
625 625
626 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 626 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
627 if (spec == NULL) 627 if (spec == NULL)
628 return -ENOMEM; 628 return -ENOMEM;
629 629
@@ -764,7 +764,7 @@ static int patch_ad1981(struct hda_codec *codec)
764{ 764{
765 struct ad198x_spec *spec; 765 struct ad198x_spec *spec;
766 766
767 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 767 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
768 if (spec == NULL) 768 if (spec == NULL)
769 return -ENOMEM; 769 return -ENOMEM;
770 770
diff --git a/sound/pci/hda/patch_cmedia.c b/sound/pci/hda/patch_cmedia.c
index 07fb4f5a54b3..523c362ec44d 100644
--- a/sound/pci/hda/patch_cmedia.c
+++ b/sound/pci/hda/patch_cmedia.c
@@ -667,7 +667,7 @@ static int patch_cmi9880(struct hda_codec *codec)
667{ 667{
668 struct cmi_spec *spec; 668 struct cmi_spec *spec;
669 669
670 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 670 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
671 if (spec == NULL) 671 if (spec == NULL)
672 return -ENOMEM; 672 return -ENOMEM;
673 673
diff --git a/sound/pci/hda/patch_realtek.c b/sound/pci/hda/patch_realtek.c
index eeb900ab79af..849b5b50c921 100644
--- a/sound/pci/hda/patch_realtek.c
+++ b/sound/pci/hda/patch_realtek.c
@@ -1526,6 +1526,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1526 /* Back 3 jack, front 2 jack (Internal add Aux-In) */ 1526 /* Back 3 jack, front 2 jack (Internal add Aux-In) */
1527 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST }, 1527 { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST },
1528 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, 1528 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST },
1529 { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST },
1529 1530
1530 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */ 1531 /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
1531 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG }, 1532 { .modelname = "3stack-digout", .config = ALC880_3ST_DIG },
@@ -1581,6 +1582,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
1581 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG }, 1582 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG },
1582 { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG }, 1583 { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG },
1583 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG }, 1584 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG },
1585 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG },
1584 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS }, 1586 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS },
1585 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG }, 1587 { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG },
1586 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS }, 1588 { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS },
@@ -2093,7 +2095,7 @@ static int patch_alc880(struct hda_codec *codec)
2093 int board_config; 2095 int board_config;
2094 int i, err; 2096 int i, err;
2095 2097
2096 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2098 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2097 if (spec == NULL) 2099 if (spec == NULL)
2098 return -ENOMEM; 2100 return -ENOMEM;
2099 2101
@@ -2365,7 +2367,7 @@ static int patch_alc260(struct hda_codec *codec)
2365 struct alc_spec *spec; 2367 struct alc_spec *spec;
2366 int board_config; 2368 int board_config;
2367 2369
2368 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2370 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2369 if (spec == NULL) 2371 if (spec == NULL)
2370 return -ENOMEM; 2372 return -ENOMEM;
2371 2373
@@ -2615,7 +2617,7 @@ static int patch_alc882(struct hda_codec *codec)
2615{ 2617{
2616 struct alc_spec *spec; 2618 struct alc_spec *spec;
2617 2619
2618 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 2620 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
2619 if (spec == NULL) 2621 if (spec == NULL)
2620 return -ENOMEM; 2622 return -ENOMEM;
2621 2623
diff --git a/sound/pci/hda/patch_si3054.c b/sound/pci/hda/patch_si3054.c
index b0270d1b64ce..d014b7bb70df 100644
--- a/sound/pci/hda/patch_si3054.c
+++ b/sound/pci/hda/patch_si3054.c
@@ -214,6 +214,7 @@ static int si3054_build_pcms(struct hda_codec *codec)
214 info->name = "Si3054 Modem"; 214 info->name = "Si3054 Modem";
215 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm; 215 info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
216 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm; 216 info->stream[SNDRV_PCM_STREAM_CAPTURE] = si3054_pcm;
217 info->is_modem = 1;
217 return 0; 218 return 0;
218} 219}
219 220
@@ -282,7 +283,7 @@ static struct hda_codec_ops si3054_patch_ops = {
282 283
283static int patch_si3054(struct hda_codec *codec) 284static int patch_si3054(struct hda_codec *codec)
284{ 285{
285 struct si3054_spec *spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 286 struct si3054_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
286 if (spec == NULL) 287 if (spec == NULL)
287 return -ENOMEM; 288 return -ENOMEM;
288 codec->spec = spec; 289 codec->spec = spec;
diff --git a/sound/pci/hda/patch_sigmatel.c b/sound/pci/hda/patch_sigmatel.c
index 9d503da7320d..33a8adaea768 100644
--- a/sound/pci/hda/patch_sigmatel.c
+++ b/sound/pci/hda/patch_sigmatel.c
@@ -919,7 +919,7 @@ static int patch_stac9200(struct hda_codec *codec)
919 struct sigmatel_spec *spec; 919 struct sigmatel_spec *spec;
920 int err; 920 int err;
921 921
922 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 922 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
923 if (spec == NULL) 923 if (spec == NULL)
924 return -ENOMEM; 924 return -ENOMEM;
925 925
@@ -957,7 +957,7 @@ static int patch_stac922x(struct hda_codec *codec)
957 struct sigmatel_spec *spec; 957 struct sigmatel_spec *spec;
958 int err; 958 int err;
959 959
960 spec = kcalloc(1, sizeof(*spec), GFP_KERNEL); 960 spec = kzalloc(sizeof(*spec), GFP_KERNEL);
961 if (spec == NULL) 961 if (spec == NULL)
962 return -ENOMEM; 962 return -ENOMEM;
963 963
diff --git a/sound/pci/ice1712/aureon.c b/sound/pci/ice1712/aureon.c
index 4405d96cbedf..2e0a31613ee6 100644
--- a/sound/pci/ice1712/aureon.c
+++ b/sound/pci/ice1712/aureon.c
@@ -1796,7 +1796,7 @@ static int __devinit aureon_init(ice1712_t *ice)
1796 } 1796 }
1797 1797
1798 /* to remeber the register values of CS8415 */ 1798 /* to remeber the register values of CS8415 */
1799 ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 1799 ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
1800 if (! ice->akm) 1800 if (! ice->akm)
1801 return -ENOMEM; 1801 return -ENOMEM;
1802 ice->akm_codecs = 1; 1802 ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/ice1712.c b/sound/pci/ice1712/ice1712.c
index b97f50d10ba3..a6d98013c331 100644
--- a/sound/pci/ice1712/ice1712.c
+++ b/sound/pci/ice1712/ice1712.c
@@ -100,12 +100,6 @@ MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec r
100module_param_array(model, charp, NULL, 0444); 100module_param_array(model, charp, NULL, 0444);
101MODULE_PARM_DESC(model, "Use the given board model."); 101MODULE_PARM_DESC(model, "Use the given board model.");
102 102
103#ifndef PCI_VENDOR_ID_ICE
104#define PCI_VENDOR_ID_ICE 0x1412
105#endif
106#ifndef PCI_DEVICE_ID_ICE_1712
107#define PCI_DEVICE_ID_ICE_1712 0x1712
108#endif
109 103
110static struct pci_device_id snd_ice1712_ids[] = { 104static struct pci_device_id snd_ice1712_ids[] = {
111 { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */ 105 { PCI_VENDOR_ID_ICE, PCI_DEVICE_ID_ICE_1712, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0 }, /* ICE1712 */
@@ -2535,7 +2529,7 @@ static int __devinit snd_ice1712_create(snd_card_t * card,
2535 return -ENXIO; 2529 return -ENXIO;
2536 } 2530 }
2537 2531
2538 ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); 2532 ice = kzalloc(sizeof(*ice), GFP_KERNEL);
2539 if (ice == NULL) { 2533 if (ice == NULL) {
2540 pci_disable_device(pci); 2534 pci_disable_device(pci);
2541 return -ENOMEM; 2535 return -ENOMEM;
@@ -2741,6 +2735,7 @@ static void __devexit snd_ice1712_remove(struct pci_dev *pci)
2741 2735
2742static struct pci_driver driver = { 2736static struct pci_driver driver = {
2743 .name = "ICE1712", 2737 .name = "ICE1712",
2738 .owner = THIS_MODULE,
2744 .id_table = snd_ice1712_ids, 2739 .id_table = snd_ice1712_ids,
2745 .probe = snd_ice1712_probe, 2740 .probe = snd_ice1712_probe,
2746 .remove = __devexit_p(snd_ice1712_remove), 2741 .remove = __devexit_p(snd_ice1712_remove),
diff --git a/sound/pci/ice1712/ice1724.c b/sound/pci/ice1712/ice1724.c
index c7af5e5fee13..c3ce8f93740b 100644
--- a/sound/pci/ice1712/ice1724.c
+++ b/sound/pci/ice1712/ice1724.c
@@ -83,12 +83,6 @@ MODULE_PARM_DESC(enable, "Enable ICE1724 soundcard.");
83module_param_array(model, charp, NULL, 0444); 83module_param_array(model, charp, NULL, 0444);
84MODULE_PARM_DESC(model, "Use the given board model."); 84MODULE_PARM_DESC(model, "Use the given board model.");
85 85
86#ifndef PCI_VENDOR_ID_ICE
87#define PCI_VENDOR_ID_ICE 0x1412
88#endif
89#ifndef PCI_DEVICE_ID_VT1724
90#define PCI_DEVICE_ID_VT1724 0x1724
91#endif
92 86
93/* Both VT1720 and VT1724 have the same PCI IDs */ 87/* Both VT1720 and VT1724 have the same PCI IDs */
94static struct pci_device_id snd_vt1724_ids[] = { 88static struct pci_device_id snd_vt1724_ids[] = {
@@ -2130,7 +2124,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card,
2130 if ((err = pci_enable_device(pci)) < 0) 2124 if ((err = pci_enable_device(pci)) < 0)
2131 return err; 2125 return err;
2132 2126
2133 ice = kcalloc(1, sizeof(*ice), GFP_KERNEL); 2127 ice = kzalloc(sizeof(*ice), GFP_KERNEL);
2134 if (ice == NULL) { 2128 if (ice == NULL) {
2135 pci_disable_device(pci); 2129 pci_disable_device(pci);
2136 return -ENOMEM; 2130 return -ENOMEM;
@@ -2321,6 +2315,7 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci)
2321 2315
2322static struct pci_driver driver = { 2316static struct pci_driver driver = {
2323 .name = "ICE1724", 2317 .name = "ICE1724",
2318 .owner = THIS_MODULE,
2324 .id_table = snd_vt1724_ids, 2319 .id_table = snd_vt1724_ids,
2325 .probe = snd_vt1724_probe, 2320 .probe = snd_vt1724_probe,
2326 .remove = __devexit_p(snd_vt1724_remove), 2321 .remove = __devexit_p(snd_vt1724_remove),
diff --git a/sound/pci/ice1712/juli.c b/sound/pci/ice1712/juli.c
index 3fb297b969cd..2437876a44e4 100644
--- a/sound/pci/ice1712/juli.c
+++ b/sound/pci/ice1712/juli.c
@@ -182,7 +182,7 @@ static int __devinit juli_init(ice1712_t *ice)
182 ice->num_total_dacs = 2; 182 ice->num_total_dacs = 2;
183 ice->num_total_adcs = 2; 183 ice->num_total_adcs = 2;
184 184
185 ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 185 ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
186 if (! ak) 186 if (! ak)
187 return -ENOMEM; 187 return -ENOMEM;
188 ice->akm_codecs = 1; 188 ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/phase.c b/sound/pci/ice1712/phase.c
index 5bf734b04fa0..dcf1e8ca3f66 100644
--- a/sound/pci/ice1712/phase.c
+++ b/sound/pci/ice1712/phase.c
@@ -122,7 +122,7 @@ static int __devinit phase22_init(ice1712_t *ice)
122 } 122 }
123 123
124 // Initialize analog chips 124 // Initialize analog chips
125 ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 125 ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
126 if (! ak) 126 if (! ak)
127 return -ENOMEM; 127 return -ENOMEM;
128 ice->akm_codecs = 1; 128 ice->akm_codecs = 1;
@@ -386,7 +386,7 @@ static int __devinit phase28_init(ice1712_t *ice)
386 ice->num_total_adcs = 2; 386 ice->num_total_adcs = 2;
387 387
388 // Initialize analog chips 388 // Initialize analog chips
389 ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 389 ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
390 if (!ak) 390 if (!ak)
391 return -ENOMEM; 391 return -ENOMEM;
392 ice->akm_codecs = 1; 392 ice->akm_codecs = 1;
diff --git a/sound/pci/ice1712/pontis.c b/sound/pci/ice1712/pontis.c
index 25f827d8fbd9..a5f852b1f575 100644
--- a/sound/pci/ice1712/pontis.c
+++ b/sound/pci/ice1712/pontis.c
@@ -781,7 +781,7 @@ static int __devinit pontis_init(ice1712_t *ice)
781 ice->num_total_adcs = 2; 781 ice->num_total_adcs = 2;
782 782
783 /* to remeber the register values */ 783 /* to remeber the register values */
784 ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL); 784 ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
785 if (! ice->akm) 785 if (! ice->akm)
786 return -ENOMEM; 786 return -ENOMEM;
787 ice->akm_codecs = 1; 787 ice->akm_codecs = 1;
diff --git a/sound/pci/intel8x0.c b/sound/pci/intel8x0.c
index 7b548416dcef..1a96198a17ae 100644
--- a/sound/pci/intel8x0.c
+++ b/sound/pci/intel8x0.c
@@ -69,6 +69,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
69static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 69static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
70static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0}; 70static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
71static char *ac97_quirk[SNDRV_CARDS]; 71static char *ac97_quirk[SNDRV_CARDS];
72static int buggy_semaphore[SNDRV_CARDS];
72static int buggy_irq[SNDRV_CARDS]; 73static int buggy_irq[SNDRV_CARDS];
73static int xbox[SNDRV_CARDS]; 74static int xbox[SNDRV_CARDS];
74 75
@@ -86,6 +87,8 @@ module_param_array(ac97_clock, int, NULL, 0444);
86MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect)."); 87MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
87module_param_array(ac97_quirk, charp, NULL, 0444); 88module_param_array(ac97_quirk, charp, NULL, 0444);
88MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware."); 89MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
90module_param_array(buggy_semaphore, bool, NULL, 0444);
91MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores.");
89module_param_array(buggy_irq, bool, NULL, 0444); 92module_param_array(buggy_irq, bool, NULL, 0444);
90MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards."); 93MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards.");
91module_param_array(xbox, bool, NULL, 0444); 94module_param_array(xbox, bool, NULL, 0444);
@@ -94,62 +97,6 @@ MODULE_PARM_DESC(xbox, "Set to 1 for Xbox, if you have problems with the AC'97 c
94/* 97/*
95 * Direct registers 98 * Direct registers
96 */ 99 */
97
98#ifndef PCI_DEVICE_ID_INTEL_82801
99#define PCI_DEVICE_ID_INTEL_82801 0x2415
100#endif
101#ifndef PCI_DEVICE_ID_INTEL_82901
102#define PCI_DEVICE_ID_INTEL_82901 0x2425
103#endif
104#ifndef PCI_DEVICE_ID_INTEL_82801BA
105#define PCI_DEVICE_ID_INTEL_82801BA 0x2445
106#endif
107#ifndef PCI_DEVICE_ID_INTEL_440MX
108#define PCI_DEVICE_ID_INTEL_440MX 0x7195
109#endif
110#ifndef PCI_DEVICE_ID_INTEL_ICH3
111#define PCI_DEVICE_ID_INTEL_ICH3 0x2485
112#endif
113#ifndef PCI_DEVICE_ID_INTEL_ICH4
114#define PCI_DEVICE_ID_INTEL_ICH4 0x24c5
115#endif
116#ifndef PCI_DEVICE_ID_INTEL_ICH5
117#define PCI_DEVICE_ID_INTEL_ICH5 0x24d5
118#endif
119#ifndef PCI_DEVICE_ID_INTEL_ESB_5
120#define PCI_DEVICE_ID_INTEL_ESB_5 0x25a6
121#endif
122#ifndef PCI_DEVICE_ID_INTEL_ICH6_18
123#define PCI_DEVICE_ID_INTEL_ICH6_18 0x266e
124#endif
125#ifndef PCI_DEVICE_ID_INTEL_ICH7_20
126#define PCI_DEVICE_ID_INTEL_ICH7_20 0x27de
127#endif
128#ifndef PCI_DEVICE_ID_INTEL_ESB2_14
129#define PCI_DEVICE_ID_INTEL_ESB2_14 0x2698
130#endif
131#ifndef PCI_DEVICE_ID_SI_7012
132#define PCI_DEVICE_ID_SI_7012 0x7012
133#endif
134#ifndef PCI_DEVICE_ID_NVIDIA_MCP_AUDIO
135#define PCI_DEVICE_ID_NVIDIA_MCP_AUDIO 0x01b1
136#endif
137#ifndef PCI_DEVICE_ID_NVIDIA_CK804_AUDIO
138#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
139#endif
140#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO
141#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO 0x006a
142#endif
143#ifndef PCI_DEVICE_ID_NVIDIA_CK8_AUDIO
144#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
145#endif
146#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO
147#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO 0x00da
148#endif
149#ifndef PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO
150#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO 0x00ea
151#endif
152
153enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; 100enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
154 101
155#define ICHREG(x) ICH_REG_##x 102#define ICHREG(x) ICH_REG_##x
@@ -423,6 +370,7 @@ struct _snd_intel8x0 {
423 unsigned fix_nocache: 1; /* workaround for 440MX */ 370 unsigned fix_nocache: 1; /* workaround for 440MX */
424 unsigned buggy_irq: 1; /* workaround for buggy mobos */ 371 unsigned buggy_irq: 1; /* workaround for buggy mobos */
425 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */ 372 unsigned xbox: 1; /* workaround for Xbox AC'97 detection */
373 unsigned buggy_semaphore: 1; /* workaround for buggy codec semaphore */
426 374
427 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */ 375 int spdif_idx; /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */
428 unsigned int sdm_saved; /* SDM reg value */ 376 unsigned int sdm_saved; /* SDM reg value */
@@ -577,6 +525,9 @@ static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec)
577 if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0) 525 if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0)
578 return -EIO; 526 return -EIO;
579 527
528 if (chip->buggy_semaphore)
529 return 0; /* just ignore ... */
530
580 /* Anyone holding a semaphore for 1 msec should be shot... */ 531 /* Anyone holding a semaphore for 1 msec should be shot... */
581 time = 100; 532 time = 100;
582 do { 533 do {
@@ -1759,6 +1710,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
1759 .type = AC97_TUNE_ALC_JACK 1710 .type = AC97_TUNE_ALC_JACK
1760 }, 1711 },
1761 { 1712 {
1713 .subvendor = 0x1014,
1714 .subdevice = 0x0267,
1715 .name = "IBM NetVista A30p", /* AD1981B */
1716 .type = AC97_TUNE_HP_ONLY
1717 },
1718 {
1762 .subvendor = 0x1028, 1719 .subvendor = 0x1028,
1763 .subdevice = 0x00d8, 1720 .subdevice = 0x00d8,
1764 .name = "Dell Precision 530", /* AD1885 */ 1721 .name = "Dell Precision 530", /* AD1885 */
@@ -2599,6 +2556,7 @@ struct ich_reg_info {
2599static int __devinit snd_intel8x0_create(snd_card_t * card, 2556static int __devinit snd_intel8x0_create(snd_card_t * card,
2600 struct pci_dev *pci, 2557 struct pci_dev *pci,
2601 unsigned long device_type, 2558 unsigned long device_type,
2559 int buggy_sem,
2602 intel8x0_t ** r_intel8x0) 2560 intel8x0_t ** r_intel8x0)
2603{ 2561{
2604 intel8x0_t *chip; 2562 intel8x0_t *chip;
@@ -2646,7 +2604,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
2646 if ((err = pci_enable_device(pci)) < 0) 2604 if ((err = pci_enable_device(pci)) < 0)
2647 return err; 2605 return err;
2648 2606
2649 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2607 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2650 if (chip == NULL) { 2608 if (chip == NULL) {
2651 pci_disable_device(pci); 2609 pci_disable_device(pci);
2652 return -ENOMEM; 2610 return -ENOMEM;
@@ -2656,6 +2614,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
2656 chip->card = card; 2614 chip->card = card;
2657 chip->pci = pci; 2615 chip->pci = pci;
2658 chip->irq = -1; 2616 chip->irq = -1;
2617 chip->buggy_semaphore = buggy_sem;
2659 2618
2660 if (pci->vendor == PCI_VENDOR_ID_INTEL && 2619 if (pci->vendor == PCI_VENDOR_ID_INTEL &&
2661 pci->device == PCI_DEVICE_ID_INTEL_440MX) 2620 pci->device == PCI_DEVICE_ID_INTEL_440MX)
@@ -2795,19 +2754,19 @@ static struct shortname_table {
2795 unsigned int id; 2754 unsigned int id;
2796 const char *s; 2755 const char *s;
2797} shortnames[] __devinitdata = { 2756} shortnames[] __devinitdata = {
2798 { PCI_DEVICE_ID_INTEL_82801, "Intel 82801AA-ICH" }, 2757 { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" },
2799 { PCI_DEVICE_ID_INTEL_82901, "Intel 82901AB-ICH0" }, 2758 { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" },
2800 { PCI_DEVICE_ID_INTEL_82801BA, "Intel 82801BA-ICH2" }, 2759 { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" },
2801 { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" }, 2760 { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" },
2802 { PCI_DEVICE_ID_INTEL_ICH3, "Intel 82801CA-ICH3" }, 2761 { PCI_DEVICE_ID_INTEL_82801CA_5, "Intel 82801CA-ICH3" },
2803 { PCI_DEVICE_ID_INTEL_ICH4, "Intel 82801DB-ICH4" }, 2762 { PCI_DEVICE_ID_INTEL_82801DB_5, "Intel 82801DB-ICH4" },
2804 { PCI_DEVICE_ID_INTEL_ICH5, "Intel ICH5" }, 2763 { PCI_DEVICE_ID_INTEL_82801EB_5, "Intel ICH5" },
2805 { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" }, 2764 { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" },
2806 { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" }, 2765 { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" },
2807 { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" }, 2766 { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" },
2808 { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" }, 2767 { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" },
2809 { PCI_DEVICE_ID_SI_7012, "SiS SI7012" }, 2768 { PCI_DEVICE_ID_SI_7012, "SiS SI7012" },
2810 { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia nForce" }, 2769 { PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO, "NVidia nForce" },
2811 { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" }, 2770 { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" },
2812 { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" }, 2771 { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" },
2813 { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" }, 2772 { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" },
@@ -2860,7 +2819,8 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
2860 } 2819 }
2861 } 2820 }
2862 2821
2863 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) { 2822 if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
2823 buggy_semaphore[dev], &chip)) < 0) {
2864 snd_card_free(card); 2824 snd_card_free(card);
2865 return err; 2825 return err;
2866 } 2826 }
@@ -2904,6 +2864,7 @@ static void __devexit snd_intel8x0_remove(struct pci_dev *pci)
2904 2864
2905static struct pci_driver driver = { 2865static struct pci_driver driver = {
2906 .name = "Intel ICH", 2866 .name = "Intel ICH",
2867 .owner = THIS_MODULE,
2907 .id_table = snd_intel8x0_ids, 2868 .id_table = snd_intel8x0_ids,
2908 .probe = snd_intel8x0_probe, 2869 .probe = snd_intel8x0_probe,
2909 .remove = __devexit_p(snd_intel8x0_remove), 2870 .remove = __devexit_p(snd_intel8x0_remove),
diff --git a/sound/pci/intel8x0m.c b/sound/pci/intel8x0m.c
index bb758c77d211..9e2060d56c24 100644
--- a/sound/pci/intel8x0m.c
+++ b/sound/pci/intel8x0m.c
@@ -73,51 +73,6 @@ MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
73/* 73/*
74 * Direct registers 74 * Direct registers
75 */ 75 */
76
77#ifndef PCI_DEVICE_ID_INTEL_82801_6
78#define PCI_DEVICE_ID_INTEL_82801_6 0x2416
79#endif
80#ifndef PCI_DEVICE_ID_INTEL_82901_6
81#define PCI_DEVICE_ID_INTEL_82901_6 0x2426
82#endif
83#ifndef PCI_DEVICE_ID_INTEL_82801BA_6
84#define PCI_DEVICE_ID_INTEL_82801BA_6 0x2446
85#endif
86#ifndef PCI_DEVICE_ID_INTEL_440MX_6
87#define PCI_DEVICE_ID_INTEL_440MX_6 0x7196
88#endif
89#ifndef PCI_DEVICE_ID_INTEL_ICH3_6
90#define PCI_DEVICE_ID_INTEL_ICH3_6 0x2486
91#endif
92#ifndef PCI_DEVICE_ID_INTEL_ICH4_6
93#define PCI_DEVICE_ID_INTEL_ICH4_6 0x24c6
94#endif
95#ifndef PCI_DEVICE_ID_INTEL_ICH5_6
96#define PCI_DEVICE_ID_INTEL_ICH5_6 0x24d6
97#endif
98#ifndef PCI_DEVICE_ID_INTEL_ICH6_6
99#define PCI_DEVICE_ID_INTEL_ICH6_6 0x266d
100#endif
101#ifndef PCI_DEVICE_ID_INTEL_ICH7_6
102#define PCI_DEVICE_ID_INTEL_ICH7_6 0x27dd
103#endif
104#ifndef PCI_DEVICE_ID_SI_7013
105#define PCI_DEVICE_ID_SI_7013 0x7013
106#endif
107#ifndef PCI_DEVICE_ID_NVIDIA_MCP_MODEM
108#define PCI_DEVICE_ID_NVIDIA_MCP_MODEM 0x01c1
109#endif
110#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_MODEM
111#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM 0x0069
112#endif
113#ifndef PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM
114#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
115#endif
116#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_MODEM
117#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM 0x00d9
118#endif
119
120
121enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE }; 76enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
122 77
123#define ICHREG(x) ICH_REG_##x 78#define ICHREG(x) ICH_REG_##x
@@ -1158,7 +1113,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
1158 if ((err = pci_enable_device(pci)) < 0) 1113 if ((err = pci_enable_device(pci)) < 0)
1159 return err; 1114 return err;
1160 1115
1161 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1116 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1162 if (chip == NULL) { 1117 if (chip == NULL) {
1163 pci_disable_device(pci); 1118 pci_disable_device(pci);
1164 return -ENOMEM; 1119 return -ENOMEM;
@@ -1283,18 +1238,18 @@ static struct shortname_table {
1283 unsigned int id; 1238 unsigned int id;
1284 const char *s; 1239 const char *s;
1285} shortnames[] __devinitdata = { 1240} shortnames[] __devinitdata = {
1286 { PCI_DEVICE_ID_INTEL_82801_6, "Intel 82801AA-ICH" }, 1241 { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" },
1287 { PCI_DEVICE_ID_INTEL_82901_6, "Intel 82901AB-ICH0" }, 1242 { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" },
1288 { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" }, 1243 { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" },
1289 { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" }, 1244 { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" },
1290 { PCI_DEVICE_ID_INTEL_ICH3_6, "Intel 82801CA-ICH3" }, 1245 { PCI_DEVICE_ID_INTEL_82801CA_6, "Intel 82801CA-ICH3" },
1291 { PCI_DEVICE_ID_INTEL_ICH4_6, "Intel 82801DB-ICH4" }, 1246 { PCI_DEVICE_ID_INTEL_82801DB_6, "Intel 82801DB-ICH4" },
1292 { PCI_DEVICE_ID_INTEL_ICH5_6, "Intel ICH5" }, 1247 { PCI_DEVICE_ID_INTEL_82801EB_6, "Intel ICH5" },
1293 { PCI_DEVICE_ID_INTEL_ICH6_6, "Intel ICH6" }, 1248 { PCI_DEVICE_ID_INTEL_ICH6_17, "Intel ICH6" },
1294 { PCI_DEVICE_ID_INTEL_ICH7_6, "Intel ICH7" }, 1249 { PCI_DEVICE_ID_INTEL_ICH7_19, "Intel ICH7" },
1295 { 0x7446, "AMD AMD768" }, 1250 { 0x7446, "AMD AMD768" },
1296 { PCI_DEVICE_ID_SI_7013, "SiS SI7013" }, 1251 { PCI_DEVICE_ID_SI_7013, "SiS SI7013" },
1297 { PCI_DEVICE_ID_NVIDIA_MCP_MODEM, "NVidia nForce" }, 1252 { PCI_DEVICE_ID_NVIDIA_MCP1_MODEM, "NVidia nForce" },
1298 { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" }, 1253 { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" },
1299 { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" }, 1254 { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" },
1300 { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" }, 1255 { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" },
@@ -1371,6 +1326,7 @@ static void __devexit snd_intel8x0m_remove(struct pci_dev *pci)
1371 1326
1372static struct pci_driver driver = { 1327static struct pci_driver driver = {
1373 .name = "Intel ICH Modem", 1328 .name = "Intel ICH Modem",
1329 .owner = THIS_MODULE,
1374 .id_table = snd_intel8x0m_ids, 1330 .id_table = snd_intel8x0m_ids,
1375 .probe = snd_intel8x0m_probe, 1331 .probe = snd_intel8x0m_probe,
1376 .remove = __devexit_p(snd_intel8x0m_remove), 1332 .remove = __devexit_p(snd_intel8x0m_remove),
diff --git a/sound/pci/korg1212/korg1212.c b/sound/pci/korg1212/korg1212.c
index d2aa9c82d41e..09f9cbe116a3 100644
--- a/sound/pci/korg1212/korg1212.c
+++ b/sound/pci/korg1212/korg1212.c
@@ -2220,7 +2220,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
2220 if ((err = pci_enable_device(pci)) < 0) 2220 if ((err = pci_enable_device(pci)) < 0)
2221 return err; 2221 return err;
2222 2222
2223 korg1212 = kcalloc(1, sizeof(*korg1212), GFP_KERNEL); 2223 korg1212 = kzalloc(sizeof(*korg1212), GFP_KERNEL);
2224 if (korg1212 == NULL) { 2224 if (korg1212 == NULL) {
2225 pci_disable_device(pci); 2225 pci_disable_device(pci);
2226 return -ENOMEM; 2226 return -ENOMEM;
@@ -2534,6 +2534,7 @@ static void __devexit snd_korg1212_remove(struct pci_dev *pci)
2534 2534
2535static struct pci_driver driver = { 2535static struct pci_driver driver = {
2536 .name = "korg1212", 2536 .name = "korg1212",
2537 .owner = THIS_MODULE,
2537 .id_table = snd_korg1212_ids, 2538 .id_table = snd_korg1212_ids,
2538 .probe = snd_korg1212_probe, 2539 .probe = snd_korg1212_probe,
2539 .remove = __devexit_p(snd_korg1212_remove), 2540 .remove = __devexit_p(snd_korg1212_remove),
diff --git a/sound/pci/maestro3.c b/sound/pci/maestro3.c
index 39b5e7db1543..2693b6f731f3 100644
--- a/sound/pci/maestro3.c
+++ b/sound/pci/maestro3.c
@@ -872,35 +872,6 @@ struct snd_m3 {
872/* 872/*
873 * pci ids 873 * pci ids
874 */ 874 */
875
876#ifndef PCI_VENDOR_ID_ESS
877#define PCI_VENDOR_ID_ESS 0x125D
878#endif
879#ifndef PCI_DEVICE_ID_ESS_ALLEGRO_1
880#define PCI_DEVICE_ID_ESS_ALLEGRO_1 0x1988
881#endif
882#ifndef PCI_DEVICE_ID_ESS_ALLEGRO
883#define PCI_DEVICE_ID_ESS_ALLEGRO 0x1989
884#endif
885#ifndef PCI_DEVICE_ID_ESS_CANYON3D_2LE
886#define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990
887#endif
888#ifndef PCI_DEVICE_ID_ESS_CANYON3D_2
889#define PCI_DEVICE_ID_ESS_CANYON3D_2 0x1992
890#endif
891#ifndef PCI_DEVICE_ID_ESS_MAESTRO3
892#define PCI_DEVICE_ID_ESS_MAESTRO3 0x1998
893#endif
894#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_1
895#define PCI_DEVICE_ID_ESS_MAESTRO3_1 0x1999
896#endif
897#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_HW
898#define PCI_DEVICE_ID_ESS_MAESTRO3_HW 0x199a
899#endif
900#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_2
901#define PCI_DEVICE_ID_ESS_MAESTRO3_2 0x199b
902#endif
903
904static struct pci_device_id snd_m3_ids[] = { 875static struct pci_device_id snd_m3_ids[] = {
905 {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID, 876 {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID,
906 PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0}, 877 PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
@@ -2689,7 +2660,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
2689 return -ENXIO; 2660 return -ENXIO;
2690 } 2661 }
2691 2662
2692 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2663 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2693 if (chip == NULL) { 2664 if (chip == NULL) {
2694 pci_disable_device(pci); 2665 pci_disable_device(pci);
2695 return -ENOMEM; 2666 return -ENOMEM;
@@ -2890,6 +2861,7 @@ static void __devexit snd_m3_remove(struct pci_dev *pci)
2890 2861
2891static struct pci_driver driver = { 2862static struct pci_driver driver = {
2892 .name = "Maestro3", 2863 .name = "Maestro3",
2864 .owner = THIS_MODULE,
2893 .id_table = snd_m3_ids, 2865 .id_table = snd_m3_ids,
2894 .probe = snd_m3_probe, 2866 .probe = snd_m3_probe,
2895 .remove = __devexit_p(snd_m3_remove), 2867 .remove = __devexit_p(snd_m3_remove),
diff --git a/sound/pci/mixart/mixart.c b/sound/pci/mixart/mixart.c
index 6c868d913634..1a62c7f6c52b 100644
--- a/sound/pci/mixart/mixart.c
+++ b/sound/pci/mixart/mixart.c
@@ -1004,7 +1004,7 @@ static int __devinit snd_mixart_create(mixart_mgr_t *mgr, snd_card_t *card, int
1004 .dev_free = snd_mixart_chip_dev_free, 1004 .dev_free = snd_mixart_chip_dev_free,
1005 }; 1005 };
1006 1006
1007 mgr->chip[idx] = chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1007 mgr->chip[idx] = chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1008 if (! chip) { 1008 if (! chip) {
1009 snd_printk(KERN_ERR "cannot allocate chip\n"); 1009 snd_printk(KERN_ERR "cannot allocate chip\n");
1010 return -ENOMEM; 1010 return -ENOMEM;
@@ -1292,7 +1292,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
1292 1292
1293 /* 1293 /*
1294 */ 1294 */
1295 mgr = kcalloc(1, sizeof(*mgr), GFP_KERNEL); 1295 mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
1296 if (! mgr) { 1296 if (! mgr) {
1297 pci_disable_device(pci); 1297 pci_disable_device(pci);
1298 return -ENOMEM; 1298 return -ENOMEM;
@@ -1424,6 +1424,7 @@ static void __devexit snd_mixart_remove(struct pci_dev *pci)
1424 1424
1425static struct pci_driver driver = { 1425static struct pci_driver driver = {
1426 .name = "Digigram miXart", 1426 .name = "Digigram miXart",
1427 .owner = THIS_MODULE,
1427 .id_table = snd_mixart_ids, 1428 .id_table = snd_mixart_ids,
1428 .probe = snd_mixart_probe, 1429 .probe = snd_mixart_probe,
1429 .remove = __devexit_p(snd_mixart_remove), 1430 .remove = __devexit_p(snd_mixart_remove),
diff --git a/sound/pci/nm256/nm256.c b/sound/pci/nm256/nm256.c
index 2bbeb10ff7c4..5c55a3b1d121 100644
--- a/sound/pci/nm256/nm256.c
+++ b/sound/pci/nm256/nm256.c
@@ -259,21 +259,6 @@ struct snd_nm256 {
259/* 259/*
260 * PCI ids 260 * PCI ids
261 */ 261 */
262
263#ifndef PCI_VENDOR_ID_NEOMAGIC
264#define PCI_VENDOR_ID_NEOMEGIC 0x10c8
265#endif
266#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO
267#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
268#endif
269#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO
270#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
271#endif
272#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO
273#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
274#endif
275
276
277static struct pci_device_id snd_nm256_ids[] = { 262static struct pci_device_id snd_nm256_ids[] = {
278 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 263 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
279 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0}, 264 {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
@@ -840,7 +825,7 @@ static void snd_nm256_setup_stream(nm256_t *chip, nm256_stream_t *s,
840 runtime->hw = *hw_ptr; 825 runtime->hw = *hw_ptr;
841 runtime->hw.buffer_bytes_max = s->bufsize; 826 runtime->hw.buffer_bytes_max = s->bufsize;
842 runtime->hw.period_bytes_max = s->bufsize / 2; 827 runtime->hw.period_bytes_max = s->bufsize / 2;
843 runtime->dma_area = (void*) s->bufptr; 828 runtime->dma_area = (void __force *) s->bufptr;
844 runtime->dma_addr = s->bufptr_addr; 829 runtime->dma_addr = s->bufptr_addr;
845 runtime->dma_bytes = s->bufsize; 830 runtime->dma_bytes = s->bufsize;
846 runtime->private_data = s; 831 runtime->private_data = s;
@@ -1404,7 +1389,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
1404 if ((err = pci_enable_device(pci)) < 0) 1389 if ((err = pci_enable_device(pci)) < 0)
1405 return err; 1390 return err;
1406 1391
1407 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1392 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1408 if (chip == NULL) { 1393 if (chip == NULL) {
1409 pci_disable_device(pci); 1394 pci_disable_device(pci);
1410 return -ENOMEM; 1395 return -ENOMEM;
@@ -1683,6 +1668,7 @@ static void __devexit snd_nm256_remove(struct pci_dev *pci)
1683 1668
1684static struct pci_driver driver = { 1669static struct pci_driver driver = {
1685 .name = "NeoMagic 256", 1670 .name = "NeoMagic 256",
1671 .owner = THIS_MODULE,
1686 .id_table = snd_nm256_ids, 1672 .id_table = snd_nm256_ids,
1687 .probe = snd_nm256_probe, 1673 .probe = snd_nm256_probe,
1688 .remove = __devexit_p(snd_nm256_remove), 1674 .remove = __devexit_p(snd_nm256_remove),
diff --git a/sound/pci/rme32.c b/sound/pci/rme32.c
index 456be39e8e4a..3daeecb9eb0e 100644
--- a/sound/pci/rme32.c
+++ b/sound/pci/rme32.c
@@ -192,20 +192,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi32}," "{RME,Digi32/8}," "{RME,Digi32 PRO}}");
192#define RME32_PRO_REVISION_WITH_8414 150 192#define RME32_PRO_REVISION_WITH_8414 150
193 193
194 194
195/* PCI vendor/device ID's */
196#ifndef PCI_VENDOR_ID_XILINX_RME
197# define PCI_VENDOR_ID_XILINX_RME 0xea60
198#endif
199#ifndef PCI_DEVICE_ID_DIGI32
200# define PCI_DEVICE_ID_DIGI32 0x9896
201#endif
202#ifndef PCI_DEVICE_ID_DIGI32_PRO
203# define PCI_DEVICE_ID_DIGI32_PRO 0x9897
204#endif
205#ifndef PCI_DEVICE_ID_DIGI32_8
206# define PCI_DEVICE_ID_DIGI32_8 0x9898
207#endif
208
209typedef struct snd_rme32 { 195typedef struct snd_rme32 {
210 spinlock_t lock; 196 spinlock_t lock;
211 int irq; 197 int irq;
@@ -692,7 +678,8 @@ snd_rme32_playback_hw_params(snd_pcm_substream_t * substream,
692 if (err < 0) 678 if (err < 0)
693 return err; 679 return err;
694 } else { 680 } else {
695 runtime->dma_area = (void *)(rme32->iobase + RME32_IO_DATA_BUFFER); 681 runtime->dma_area = (void __force *)(rme32->iobase +
682 RME32_IO_DATA_BUFFER);
696 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; 683 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
697 runtime->dma_bytes = RME32_BUFFER_SIZE; 684 runtime->dma_bytes = RME32_BUFFER_SIZE;
698 } 685 }
@@ -746,7 +733,8 @@ snd_rme32_capture_hw_params(snd_pcm_substream_t * substream,
746 if (err < 0) 733 if (err < 0)
747 return err; 734 return err;
748 } else { 735 } else {
749 runtime->dma_area = (void *)rme32->iobase + RME32_IO_DATA_BUFFER; 736 runtime->dma_area = (void __force *)rme32->iobase +
737 RME32_IO_DATA_BUFFER;
750 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER; 738 runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
751 runtime->dma_bytes = RME32_BUFFER_SIZE; 739 runtime->dma_bytes = RME32_BUFFER_SIZE;
752 } 740 }
@@ -2024,6 +2012,7 @@ static void __devexit snd_rme32_remove(struct pci_dev *pci)
2024 2012
2025static struct pci_driver driver = { 2013static struct pci_driver driver = {
2026 .name = "RME Digi32", 2014 .name = "RME Digi32",
2015 .owner = THIS_MODULE,
2027 .id_table = snd_rme32_ids, 2016 .id_table = snd_rme32_ids,
2028 .probe = snd_rme32_probe, 2017 .probe = snd_rme32_probe,
2029 .remove = __devexit_p(snd_rme32_remove), 2018 .remove = __devexit_p(snd_rme32_remove),
diff --git a/sound/pci/rme96.c b/sound/pci/rme96.c
index 9645e9004a48..9983b66dc564 100644
--- a/sound/pci/rme96.c
+++ b/sound/pci/rme96.c
@@ -200,25 +200,6 @@ MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard.");
200#define RME96_AD1852_VOL_BITS 14 200#define RME96_AD1852_VOL_BITS 14
201#define RME96_AD1855_VOL_BITS 10 201#define RME96_AD1855_VOL_BITS 10
202 202
203/*
204 * PCI vendor/device ids, could in the future be defined in <linux/pci.h>,
205 * therefore #ifndef is used.
206 */
207#ifndef PCI_VENDOR_ID_XILINX
208#define PCI_VENDOR_ID_XILINX 0x10ee
209#endif
210#ifndef PCI_DEVICE_ID_DIGI96
211#define PCI_DEVICE_ID_DIGI96 0x3fc0
212#endif
213#ifndef PCI_DEVICE_ID_DIGI96_8
214#define PCI_DEVICE_ID_DIGI96_8 0x3fc1
215#endif
216#ifndef PCI_DEVICE_ID_DIGI96_8_PRO
217#define PCI_DEVICE_ID_DIGI96_8_PRO 0x3fc2
218#endif
219#ifndef PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST
220#define PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST 0x3fc3
221#endif
222 203
223typedef struct snd_rme96 { 204typedef struct snd_rme96 {
224 spinlock_t lock; 205 spinlock_t lock;
@@ -985,7 +966,8 @@ snd_rme96_playback_hw_params(snd_pcm_substream_t *substream,
985 snd_pcm_runtime_t *runtime = substream->runtime; 966 snd_pcm_runtime_t *runtime = substream->runtime;
986 int err, rate, dummy; 967 int err, rate, dummy;
987 968
988 runtime->dma_area = (void *)(rme96->iobase + RME96_IO_PLAY_BUFFER); 969 runtime->dma_area = (void __force *)(rme96->iobase +
970 RME96_IO_PLAY_BUFFER);
989 runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER; 971 runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER;
990 runtime->dma_bytes = RME96_BUFFER_SIZE; 972 runtime->dma_bytes = RME96_BUFFER_SIZE;
991 973
@@ -1037,7 +1019,8 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream,
1037 snd_pcm_runtime_t *runtime = substream->runtime; 1019 snd_pcm_runtime_t *runtime = substream->runtime;
1038 int err, isadat, rate; 1020 int err, isadat, rate;
1039 1021
1040 runtime->dma_area = (void *)(rme96->iobase + RME96_IO_REC_BUFFER); 1022 runtime->dma_area = (void __force *)(rme96->iobase +
1023 RME96_IO_REC_BUFFER);
1041 runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER; 1024 runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER;
1042 runtime->dma_bytes = RME96_BUFFER_SIZE; 1025 runtime->dma_bytes = RME96_BUFFER_SIZE;
1043 1026
@@ -2430,6 +2413,7 @@ static void __devexit snd_rme96_remove(struct pci_dev *pci)
2430 2413
2431static struct pci_driver driver = { 2414static struct pci_driver driver = {
2432 .name = "RME Digi96", 2415 .name = "RME Digi96",
2416 .owner = THIS_MODULE,
2433 .id_table = snd_rme96_ids, 2417 .id_table = snd_rme96_ids,
2434 .probe = snd_rme96_probe, 2418 .probe = snd_rme96_probe,
2435 .remove = __devexit_p(snd_rme96_remove), 2419 .remove = __devexit_p(snd_rme96_remove),
diff --git a/sound/pci/rme9652/hdsp.c b/sound/pci/rme9652/hdsp.c
index 6694866089b5..52525eb198c7 100644
--- a/sound/pci/rme9652/hdsp.c
+++ b/sound/pci/rme9652/hdsp.c
@@ -370,13 +370,6 @@ MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP},"
370#define UNITY_GAIN 32768 370#define UNITY_GAIN 32768
371#define MINUS_INFINITY_GAIN 0 371#define MINUS_INFINITY_GAIN 0
372 372
373#ifndef PCI_VENDOR_ID_XILINX
374#define PCI_VENDOR_ID_XILINX 0x10ee
375#endif
376#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP
377#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
378#endif
379
380/* the size of a substream (1 mono data stream) */ 373/* the size of a substream (1 mono data stream) */
381 374
382#define HDSP_CHANNEL_BUFFER_SAMPLES (16*1024) 375#define HDSP_CHANNEL_BUFFER_SAMPLES (16*1024)
@@ -4899,6 +4892,7 @@ static int snd_hdsp_create_alsa_devices(snd_card_t *card, hdsp_t *hdsp)
4899 } 4892 }
4900 4893
4901 if (!(hdsp->state & HDSP_InitializationComplete)) { 4894 if (!(hdsp->state & HDSP_InitializationComplete)) {
4895 strcpy(card->shortname, "Hammerfall DSP");
4902 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 4896 sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name,
4903 hdsp->port, hdsp->irq); 4897 hdsp->port, hdsp->irq);
4904 4898
@@ -5222,6 +5216,7 @@ static void __devexit snd_hdsp_remove(struct pci_dev *pci)
5222 5216
5223static struct pci_driver driver = { 5217static struct pci_driver driver = {
5224 .name = "RME Hammerfall DSP", 5218 .name = "RME Hammerfall DSP",
5219 .owner = THIS_MODULE,
5225 .id_table = snd_hdsp_ids, 5220 .id_table = snd_hdsp_ids,
5226 .probe = snd_hdsp_probe, 5221 .probe = snd_hdsp_probe,
5227 .remove = __devexit_p(snd_hdsp_remove), 5222 .remove = __devexit_p(snd_hdsp_remove),
diff --git a/sound/pci/rme9652/hdspm.c b/sound/pci/rme9652/hdspm.c
index 5d786d113b25..fc3f3283ff37 100644
--- a/sound/pci/rme9652/hdspm.c
+++ b/sound/pci/rme9652/hdspm.c
@@ -301,18 +301,6 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
301#define UNITY_GAIN 32768 /* = 65536/2 */ 301#define UNITY_GAIN 32768 /* = 65536/2 */
302#define MINUS_INFINITY_GAIN 0 302#define MINUS_INFINITY_GAIN 0
303 303
304/* PCI info */
305#ifndef PCI_VENDOR_ID_XILINX
306#define PCI_VENDOR_ID_XILINX 0x10ee
307#endif
308#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP
309#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
310#endif
311#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI
312#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
313#endif
314
315
316/* Number of channels for different Speed Modes */ 304/* Number of channels for different Speed Modes */
317#define MADI_SS_CHANNELS 64 305#define MADI_SS_CHANNELS 64
318#define MADI_DS_CHANNELS 32 306#define MADI_DS_CHANNELS 32
@@ -3652,6 +3640,7 @@ static void __devexit snd_hdspm_remove(struct pci_dev *pci)
3652 3640
3653static struct pci_driver driver = { 3641static struct pci_driver driver = {
3654 .name = "RME Hammerfall DSP MADI", 3642 .name = "RME Hammerfall DSP MADI",
3643 .owner = THIS_MODULE,
3655 .id_table = snd_hdspm_ids, 3644 .id_table = snd_hdspm_ids,
3656 .probe = snd_hdspm_probe, 3645 .probe = snd_hdspm_probe,
3657 .remove = __devexit_p(snd_hdspm_remove), 3646 .remove = __devexit_p(snd_hdspm_remove),
diff --git a/sound/pci/rme9652/rme9652.c b/sound/pci/rme9652/rme9652.c
index 8ee4d6fd6ea7..b600f45e1834 100644
--- a/sound/pci/rme9652/rme9652.c
+++ b/sound/pci/rme9652/rme9652.c
@@ -120,13 +120,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Hammerfall},"
120 120
121#define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos)) 121#define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos))
122 122
123#ifndef PCI_VENDOR_ID_XILINX
124#define PCI_VENDOR_ID_XILINX 0x10ee
125#endif
126#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL
127#define PCI_DEVICE_ID_XILINX_HAMMERFALL 0x3fc4
128#endif
129
130/* amount of io space we remap for register access. i'm not sure we 123/* amount of io space we remap for register access. i'm not sure we
131 even need this much, but 1K is nice round number :) 124 even need this much, but 1K is nice round number :)
132*/ 125*/
@@ -2661,6 +2654,7 @@ static void __devexit snd_rme9652_remove(struct pci_dev *pci)
2661 2654
2662static struct pci_driver driver = { 2655static struct pci_driver driver = {
2663 .name = "RME Digi9652 (Hammerfall)", 2656 .name = "RME Digi9652 (Hammerfall)",
2657 .owner = THIS_MODULE,
2664 .id_table = snd_rme9652_ids, 2658 .id_table = snd_rme9652_ids,
2665 .probe = snd_rme9652_probe, 2659 .probe = snd_rme9652_probe,
2666 .remove = __devexit_p(snd_rme9652_remove), 2660 .remove = __devexit_p(snd_rme9652_remove),
diff --git a/sound/pci/sonicvibes.c b/sound/pci/sonicvibes.c
index 60ecb2bdb65e..1f6c2bfd43fd 100644
--- a/sound/pci/sonicvibes.c
+++ b/sound/pci/sonicvibes.c
@@ -50,13 +50,6 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
50#define SUPPORT_JOYSTICK 1 50#define SUPPORT_JOYSTICK 1
51#endif 51#endif
52 52
53#ifndef PCI_VENDOR_ID_S3
54#define PCI_VENDOR_ID_S3 0x5333
55#endif
56#ifndef PCI_DEVICE_ID_S3_SONICVIBES
57#define PCI_DEVICE_ID_S3_SONICVIBES 0xca00
58#endif
59
60static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */ 53static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX; /* Index 0-MAX */
61static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */ 54static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR; /* ID for this card */
62static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */ 55static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP; /* Enable this card */
@@ -1257,7 +1250,7 @@ static int __devinit snd_sonicvibes_create(snd_card_t * card,
1257 return -ENXIO; 1250 return -ENXIO;
1258 } 1251 }
1259 1252
1260 sonic = kcalloc(1, sizeof(*sonic), GFP_KERNEL); 1253 sonic = kzalloc(sizeof(*sonic), GFP_KERNEL);
1261 if (sonic == NULL) { 1254 if (sonic == NULL) {
1262 pci_disable_device(pci); 1255 pci_disable_device(pci);
1263 return -ENOMEM; 1256 return -ENOMEM;
@@ -1515,6 +1508,7 @@ static void __devexit snd_sonic_remove(struct pci_dev *pci)
1515 1508
1516static struct pci_driver driver = { 1509static struct pci_driver driver = {
1517 .name = "S3 SonicVibes", 1510 .name = "S3 SonicVibes",
1511 .owner = THIS_MODULE,
1518 .id_table = snd_sonic_ids, 1512 .id_table = snd_sonic_ids,
1519 .probe = snd_sonic_probe, 1513 .probe = snd_sonic_probe,
1520 .remove = __devexit_p(snd_sonic_remove), 1514 .remove = __devexit_p(snd_sonic_remove),
diff --git a/sound/pci/trident/trident.c b/sound/pci/trident/trident.c
index 940d531575c0..a8ca8e17853f 100644
--- a/sound/pci/trident/trident.c
+++ b/sound/pci/trident/trident.c
@@ -177,6 +177,7 @@ static void __devexit snd_trident_remove(struct pci_dev *pci)
177 177
178static struct pci_driver driver = { 178static struct pci_driver driver = {
179 .name = "Trident4DWaveAudio", 179 .name = "Trident4DWaveAudio",
180 .owner = THIS_MODULE,
180 .id_table = snd_trident_ids, 181 .id_table = snd_trident_ids,
181 .probe = snd_trident_probe, 182 .probe = snd_trident_probe,
182 .remove = __devexit_p(snd_trident_remove), 183 .remove = __devexit_p(snd_trident_remove),
diff --git a/sound/pci/trident/trident_main.c b/sound/pci/trident/trident_main.c
index f30d9d947862..777da9a7298b 100644
--- a/sound/pci/trident/trident_main.c
+++ b/sound/pci/trident/trident_main.c
@@ -2960,7 +2960,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
2960 .read = snd_trident_codec_read, 2960 .read = snd_trident_codec_read,
2961 }; 2961 };
2962 2962
2963 uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL); 2963 uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
2964 if (!uctl) 2964 if (!uctl)
2965 return -ENOMEM; 2965 return -ENOMEM;
2966 2966
@@ -3546,7 +3546,7 @@ int __devinit snd_trident_create(snd_card_t * card,
3546 return -ENXIO; 3546 return -ENXIO;
3547 } 3547 }
3548 3548
3549 trident = kcalloc(1, sizeof(*trident), GFP_KERNEL); 3549 trident = kzalloc(sizeof(*trident), GFP_KERNEL);
3550 if (trident == NULL) { 3550 if (trident == NULL) {
3551 pci_disable_device(pci); 3551 pci_disable_device(pci);
3552 return -ENOMEM; 3552 return -ENOMEM;
diff --git a/sound/pci/via82xx.c b/sound/pci/via82xx.c
index 56c6e52d7264..6db7de6b9719 100644
--- a/sound/pci/via82xx.c
+++ b/sound/pci/via82xx.c
@@ -104,14 +104,6 @@ module_param_array(dxs_support, int, NULL, 0444);
104MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)"); 104MODULE_PARM_DESC(dxs_support, "Support for DXS channels (0 = auto, 1 = enable, 2 = disable, 3 = 48k only, 4 = no VRA, 5 = enable any sample rate)");
105 105
106 106
107/* pci ids */
108#ifndef PCI_DEVICE_ID_VIA_82C686_5
109#define PCI_DEVICE_ID_VIA_82C686_5 0x3058
110#endif
111#ifndef PCI_DEVICE_ID_VIA_8233_5
112#define PCI_DEVICE_ID_VIA_8233_5 0x3059
113#endif
114
115/* revision numbers for via686 */ 107/* revision numbers for via686 */
116#define VIA_REV_686_A 0x10 108#define VIA_REV_686_A 0x10
117#define VIA_REV_686_B 0x11 109#define VIA_REV_686_B 0x11
@@ -1935,11 +1927,12 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
1935 * DXS channels don't work properly with VRA if MC97 is disabled. 1927 * DXS channels don't work properly with VRA if MC97 is disabled.
1936 */ 1928 */
1937 struct pci_dev *pci; 1929 struct pci_dev *pci;
1938 pci = pci_find_device(0x1106, 0x3068, NULL); /* MC97 */ 1930 pci = pci_get_device(0x1106, 0x3068, NULL); /* MC97 */
1939 if (pci) { 1931 if (pci) {
1940 unsigned char data; 1932 unsigned char data;
1941 pci_read_config_byte(pci, 0x44, &data); 1933 pci_read_config_byte(pci, 0x44, &data);
1942 pci_write_config_byte(pci, 0x44, data | 0x40); 1934 pci_write_config_byte(pci, 0x44, data | 0x40);
1935 pci_dev_put(pci);
1943 } 1936 }
1944 } 1937 }
1945 1938
@@ -2065,7 +2058,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
2065 if ((err = pci_enable_device(pci)) < 0) 2058 if ((err = pci_enable_device(pci)) < 0)
2066 return err; 2059 return err;
2067 2060
2068 if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) { 2061 if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
2069 pci_disable_device(pci); 2062 pci_disable_device(pci);
2070 return -ENOMEM; 2063 return -ENOMEM;
2071 } 2064 }
@@ -2350,6 +2343,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci)
2350 2343
2351static struct pci_driver driver = { 2344static struct pci_driver driver = {
2352 .name = "VIA 82xx Audio", 2345 .name = "VIA 82xx Audio",
2346 .owner = THIS_MODULE,
2353 .id_table = snd_via82xx_ids, 2347 .id_table = snd_via82xx_ids,
2354 .probe = snd_via82xx_probe, 2348 .probe = snd_via82xx_probe,
2355 .remove = __devexit_p(snd_via82xx_remove), 2349 .remove = __devexit_p(snd_via82xx_remove),
diff --git a/sound/pci/via82xx_modem.c b/sound/pci/via82xx_modem.c
index 5872d438a04a..7eac6f6ac737 100644
--- a/sound/pci/via82xx_modem.c
+++ b/sound/pci/via82xx_modem.c
@@ -1083,7 +1083,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
1083 if ((err = pci_enable_device(pci)) < 0) 1083 if ((err = pci_enable_device(pci)) < 0)
1084 return err; 1084 return err;
1085 1085
1086 if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) { 1086 if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
1087 pci_disable_device(pci); 1087 pci_disable_device(pci);
1088 return -ENOMEM; 1088 return -ENOMEM;
1089 } 1089 }
@@ -1207,6 +1207,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci)
1207 1207
1208static struct pci_driver driver = { 1208static struct pci_driver driver = {
1209 .name = "VIA 82xx Modem", 1209 .name = "VIA 82xx Modem",
1210 .owner = THIS_MODULE,
1210 .id_table = snd_via82xx_modem_ids, 1211 .id_table = snd_via82xx_modem_ids,
1211 .probe = snd_via82xx_probe, 1212 .probe = snd_via82xx_probe,
1212 .remove = __devexit_p(snd_via82xx_remove), 1213 .remove = __devexit_p(snd_via82xx_remove),
diff --git a/sound/pci/vx222/vx222.c b/sound/pci/vx222/vx222.c
index dca6bd2c7580..2a7ad9dec021 100644
--- a/sound/pci/vx222/vx222.c
+++ b/sound/pci/vx222/vx222.c
@@ -252,6 +252,7 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci)
252 252
253static struct pci_driver driver = { 253static struct pci_driver driver = {
254 .name = "Digigram VX222", 254 .name = "Digigram VX222",
255 .owner = THIS_MODULE,
255 .id_table = snd_vx222_ids, 256 .id_table = snd_vx222_ids,
256 .probe = snd_vx222_probe, 257 .probe = snd_vx222_probe,
257 .remove = __devexit_p(snd_vx222_remove), 258 .remove = __devexit_p(snd_vx222_remove),
diff --git a/sound/pci/ymfpci/ymfpci.c b/sound/pci/ymfpci/ymfpci.c
index 5b5b624b47d0..2e69abe51aa9 100644
--- a/sound/pci/ymfpci/ymfpci.c
+++ b/sound/pci/ymfpci/ymfpci.c
@@ -352,6 +352,7 @@ static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci)
352 352
353static struct pci_driver driver = { 353static struct pci_driver driver = {
354 .name = "Yamaha DS-XG PCI", 354 .name = "Yamaha DS-XG PCI",
355 .owner = THIS_MODULE,
355 .id_table = snd_ymfpci_ids, 356 .id_table = snd_ymfpci_ids,
356 .probe = snd_card_ymfpci_probe, 357 .probe = snd_card_ymfpci_probe,
357 .remove = __devexit_p(snd_card_ymfpci_remove), 358 .remove = __devexit_p(snd_card_ymfpci_remove),
diff --git a/sound/pci/ymfpci/ymfpci_main.c b/sound/pci/ymfpci/ymfpci_main.c
index 054836412dc4..27fa523639ae 100644
--- a/sound/pci/ymfpci/ymfpci_main.c
+++ b/sound/pci/ymfpci/ymfpci_main.c
@@ -839,7 +839,7 @@ static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream)
839 snd_pcm_runtime_t *runtime = substream->runtime; 839 snd_pcm_runtime_t *runtime = substream->runtime;
840 ymfpci_pcm_t *ypcm; 840 ymfpci_pcm_t *ypcm;
841 841
842 ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL); 842 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
843 if (ypcm == NULL) 843 if (ypcm == NULL)
844 return -ENOMEM; 844 return -ENOMEM;
845 ypcm->chip = chip; 845 ypcm->chip = chip;
@@ -957,7 +957,7 @@ static int snd_ymfpci_capture_open(snd_pcm_substream_t * substream,
957 snd_pcm_runtime_t *runtime = substream->runtime; 957 snd_pcm_runtime_t *runtime = substream->runtime;
958 ymfpci_pcm_t *ypcm; 958 ymfpci_pcm_t *ypcm;
959 959
960 ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL); 960 ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
961 if (ypcm == NULL) 961 if (ypcm == NULL)
962 return -ENOMEM; 962 return -ENOMEM;
963 ypcm->chip = chip; 963 ypcm->chip = chip;
@@ -2270,7 +2270,7 @@ int __devinit snd_ymfpci_create(snd_card_t * card,
2270 if ((err = pci_enable_device(pci)) < 0) 2270 if ((err = pci_enable_device(pci)) < 0)
2271 return err; 2271 return err;
2272 2272
2273 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2273 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2274 if (chip == NULL) { 2274 if (chip == NULL) {
2275 pci_disable_device(pci); 2275 pci_disable_device(pci);
2276 return -ENOMEM; 2276 return -ENOMEM;
diff --git a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
index a2132e3763dd..0208c54896b3 100644
--- a/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
+++ b/sound/pcmcia/pdaudiocf/pdaudiocf_core.c
@@ -151,7 +151,7 @@ pdacf_t *snd_pdacf_create(snd_card_t *card)
151{ 151{
152 pdacf_t *chip; 152 pdacf_t *chip;
153 153
154 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 154 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
155 if (chip == NULL) 155 if (chip == NULL)
156 return NULL; 156 return NULL;
157 chip->card = card; 157 chip->card = card;
diff --git a/sound/ppc/Kconfig b/sound/ppc/Kconfig
index 75213bf4d567..206b9333f91f 100644
--- a/sound/ppc/Kconfig
+++ b/sound/ppc/Kconfig
@@ -13,11 +13,24 @@ config SND_POWERMAC
13 tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)" 13 tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)"
14 depends on SND && I2C && INPUT && PPC_PMAC 14 depends on SND && I2C && INPUT && PPC_PMAC
15 select SND_PCM 15 select SND_PCM
16 select SND_GENERIC_DRIVER
16 help 17 help
17 Say Y here to include support for the integrated sound device. 18 Say Y here to include support for the integrated sound device.
18 19
19 To compile this driver as a module, choose M here: the module 20 To compile this driver as a module, choose M here: the module
20 will be called snd-powermac. 21 will be called snd-powermac.
21 22
22endmenu 23config SND_POWERMAC_AUTO_DRC
24 bool "Toggle DRC automatically at headphone/line plug-in"
25 depends on SND_POWERMAC
26 default y
27 help
28 Say Y here to enable the automatic toggle of DRC (dynamic
29 range compression) on Tumbler/Snapper.
30 If this feature is enabled, DRC is turned off when the
31 headphone/line jack is plugged, and turned on when unplugged.
23 32
33 Note that you can turn on/off DRC manually even without this
34 option.
35
36endmenu
diff --git a/sound/ppc/pmac.c b/sound/ppc/pmac.c
index c89e82eb06a6..e35b48d29c45 100644
--- a/sound/ppc/pmac.c
+++ b/sound/ppc/pmac.c
@@ -988,6 +988,7 @@ static int __init snd_pmac_detect(pmac_t *chip)
988 case 0x33: 988 case 0x33:
989 case 0x29: 989 case 0x29:
990 case 0x24: 990 case 0x24:
991 case 0x5c:
991 chip->num_freqs = ARRAY_SIZE(tumbler_freqs); 992 chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
992 chip->model = PMAC_SNAPPER; 993 chip->model = PMAC_SNAPPER;
993 chip->can_byte_swap = 0; /* FIXME: check this */ 994 chip->can_byte_swap = 0; /* FIXME: check this */
@@ -1159,7 +1160,7 @@ int __init snd_pmac_new(snd_card_t *card, pmac_t **chip_return)
1159 snd_runtime_check(chip_return, return -EINVAL); 1160 snd_runtime_check(chip_return, return -EINVAL);
1160 *chip_return = NULL; 1161 *chip_return = NULL;
1161 1162
1162 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1163 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1163 if (chip == NULL) 1164 if (chip == NULL)
1164 return -ENOMEM; 1165 return -ENOMEM;
1165 chip->card = card; 1166 chip->card = card;
diff --git a/sound/ppc/powermac.c b/sound/ppc/powermac.c
index 231f6432ea6d..a6d8cbf4064f 100644
--- a/sound/ppc/powermac.c
+++ b/sound/ppc/powermac.c
@@ -131,6 +131,9 @@ static int __init snd_pmac_probe(void)
131 if (enable_beep) 131 if (enable_beep)
132 snd_pmac_attach_beep(chip); 132 snd_pmac_attach_beep(chip);
133 133
134 if ((err = snd_card_set_generic_dev(card)) < 0)
135 goto __error;
136
134 if ((err = snd_card_register(card)) < 0) 137 if ((err = snd_card_register(card)) < 0)
135 goto __error; 138 goto __error;
136 139
diff --git a/sound/ppc/tumbler.c b/sound/ppc/tumbler.c
index b94437c024b1..65384afcfc3f 100644
--- a/sound/ppc/tumbler.c
+++ b/sound/ppc/tumbler.c
@@ -948,7 +948,6 @@ static void device_change_handler(void *self)
948 msleep(10); 948 msleep(10);
949 check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify, 949 check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify,
950 chip->speaker_sw_ctl); 950 chip->speaker_sw_ctl);
951 mix->drc_enable = 0;
952 } else { 951 } else {
953 /* unmute speaker, mute others */ 952 /* unmute speaker, mute others */
954 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify, 953 check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify,
@@ -960,20 +959,21 @@ static void device_change_handler(void *self)
960 if (mix->line_mute.addr != 0) 959 if (mix->line_mute.addr != 0)
961 check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify, 960 check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify,
962 chip->lineout_sw_ctl); 961 chip->lineout_sw_ctl);
963 mix->drc_enable = 1;
964 } 962 }
965 if (mix->auto_mute_notify) { 963 if (mix->auto_mute_notify)
966 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, 964 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
967 &chip->hp_detect_ctl->id); 965 &chip->hp_detect_ctl->id);
966
967#ifdef CONFIG_SND_POWERMAC_AUTO_DRC
968 mix->drc_enable = ! (headphone || lineout);
969 if (mix->auto_mute_notify)
968 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE, 970 snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
969 &chip->drc_sw_ctl->id); 971 &chip->drc_sw_ctl->id);
970 }
971
972 /* first set the DRC so the speaker do not explode -ReneR */
973 if (chip->model == PMAC_TUMBLER) 972 if (chip->model == PMAC_TUMBLER)
974 tumbler_set_drc(mix); 973 tumbler_set_drc(mix);
975 else 974 else
976 snapper_set_drc(mix); 975 snapper_set_drc(mix);
976#endif
977 977
978 /* reset the master volume so the correct amplification is applied */ 978 /* reset the master volume so the correct amplification is applied */
979 tumbler_set_master_volume(mix); 979 tumbler_set_master_volume(mix);
@@ -1370,6 +1370,17 @@ int __init snd_pmac_tumbler_init(pmac_t *chip)
1370 if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0) 1370 if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
1371 return err; 1371 return err;
1372 1372
1373 /* set initial DRC range to 60% */
1374 if (chip->model == PMAC_TUMBLER)
1375 mix->drc_range = (TAS3001_DRC_MAX * 6) / 10;
1376 else
1377 mix->drc_range = (TAS3004_DRC_MAX * 6) / 10;
1378 mix->drc_enable = 1; /* will be changed later if AUTO_DRC is set */
1379 if (chip->model == PMAC_TUMBLER)
1380 tumbler_set_drc(mix);
1381 else
1382 snapper_set_drc(mix);
1383
1373#ifdef CONFIG_PM 1384#ifdef CONFIG_PM
1374 chip->suspend = tumbler_suspend; 1385 chip->suspend = tumbler_suspend;
1375 chip->resume = tumbler_resume; 1386 chip->resume = tumbler_resume;
diff --git a/sound/sparc/Kconfig b/sound/sparc/Kconfig
index 25a8a558ef92..09ab138646a6 100644
--- a/sound/sparc/Kconfig
+++ b/sound/sparc/Kconfig
@@ -7,6 +7,7 @@ config SND_SUN_AMD7930
7 tristate "Sun AMD7930" 7 tristate "Sun AMD7930"
8 depends on SBUS && SND 8 depends on SBUS && SND
9 select SND_PCM 9 select SND_PCM
10 select SND_GENERIC_DRIVER
10 help 11 help
11 Say Y here to include support for AMD7930 sound device on Sun. 12 Say Y here to include support for AMD7930 sound device on Sun.
12 13
@@ -17,6 +18,7 @@ config SND_SUN_CS4231
17 tristate "Sun CS4231" 18 tristate "Sun CS4231"
18 depends on SND 19 depends on SND
19 select SND_PCM 20 select SND_PCM
21 select SND_GENERIC_DRIVER
20 help 22 help
21 Say Y here to include support for CS4231 sound device on Sun. 23 Say Y here to include support for CS4231 sound device on Sun.
22 24
@@ -27,6 +29,7 @@ config SND_SUN_DBRI
27 tristate "Sun DBRI" 29 tristate "Sun DBRI"
28 depends on SND && SBUS 30 depends on SND && SBUS
29 select SND_PCM 31 select SND_PCM
32 select SND_GENERIC_DRIVER
30 help 33 help
31 Say Y here to include support for DBRI sound device on Sun. 34 Say Y here to include support for DBRI sound device on Sun.
32 35
diff --git a/sound/sparc/amd7930.c b/sound/sparc/amd7930.c
index bd8a850e93ea..46d504ba7e03 100644
--- a/sound/sparc/amd7930.c
+++ b/sound/sparc/amd7930.c
@@ -967,7 +967,7 @@ static int __init snd_amd7930_create(snd_card_t *card,
967 int err; 967 int err;
968 968
969 *ramd = NULL; 969 *ramd = NULL;
970 amd = kcalloc(1, sizeof(*amd), GFP_KERNEL); 970 amd = kzalloc(sizeof(*amd), GFP_KERNEL);
971 if (amd == NULL) 971 if (amd == NULL)
972 return -ENOMEM; 972 return -ENOMEM;
973 973
@@ -1088,6 +1088,9 @@ static int __init amd7930_attach(int prom_node, struct sbus_dev *sdev)
1088 if ((err = snd_amd7930_mixer(amd)) < 0) 1088 if ((err = snd_amd7930_mixer(amd)) < 0)
1089 goto out_err; 1089 goto out_err;
1090 1090
1091 if ((err = snd_card_set_generic_dev(card)) < 0)
1092 goto out_err;
1093
1091 if ((err = snd_card_register(card)) < 0) 1094 if ((err = snd_card_register(card)) < 0)
1092 goto out_err; 1095 goto out_err;
1093 1096
diff --git a/sound/sparc/cs4231.c b/sound/sparc/cs4231.c
index 36f9fe4d7bea..2fb27c4e951f 100644
--- a/sound/sparc/cs4231.c
+++ b/sound/sparc/cs4231.c
@@ -1915,6 +1915,9 @@ static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip)
1915 if ((err = snd_cs4231_timer(chip)) < 0) 1915 if ((err = snd_cs4231_timer(chip)) < 0)
1916 goto out_err; 1916 goto out_err;
1917 1917
1918 if ((err = snd_card_set_generic_dev(card)) < 0)
1919 goto out_err;
1920
1918 if ((err = snd_card_register(card)) < 0) 1921 if ((err = snd_card_register(card)) < 0)
1919 goto out_err; 1922 goto out_err;
1920 1923
@@ -1966,7 +1969,7 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
1966 int err; 1969 int err;
1967 1970
1968 *rchip = NULL; 1971 *rchip = NULL;
1969 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 1972 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
1970 if (chip == NULL) 1973 if (chip == NULL)
1971 return -ENOMEM; 1974 return -ENOMEM;
1972 1975
@@ -2080,7 +2083,7 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
2080 int err; 2083 int err;
2081 2084
2082 *rchip = NULL; 2085 *rchip = NULL;
2083 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 2086 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
2084 if (chip == NULL) 2087 if (chip == NULL)
2085 return -ENOMEM; 2088 return -ENOMEM;
2086 2089
diff --git a/sound/sparc/dbri.c b/sound/sparc/dbri.c
index 941c7b1e7ebb..b5c4c15ae7f0 100644
--- a/sound/sparc/dbri.c
+++ b/sound/sparc/dbri.c
@@ -1,6 +1,6 @@
1/* 1/*
2 * Driver for DBRI sound chip found on Sparcs. 2 * Driver for DBRI sound chip found on Sparcs.
3 * Copyright (C) 2004 Martin Habets (mhabets@users.sourceforge.net) 3 * Copyright (C) 2004, 2005 Martin Habets (mhabets@users.sourceforge.net)
4 * 4 *
5 * Based entirely upon drivers/sbus/audio/dbri.c which is: 5 * Based entirely upon drivers/sbus/audio/dbri.c which is:
6 * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de) 6 * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
@@ -43,6 +43,12 @@
43 * audio devices. But the SUN HW group decided against it, at least on my 43 * audio devices. But the SUN HW group decided against it, at least on my
44 * LX the speakerbox connector has at least 1 pin missing and 1 wrongly 44 * LX the speakerbox connector has at least 1 pin missing and 1 wrongly
45 * connected. 45 * connected.
46 *
47 * I've tried to stick to the following function naming conventions:
48 * snd_* ALSA stuff
49 * cs4215_* CS4215 codec specfic stuff
50 * dbri_* DBRI high-level stuff
51 * other DBRI low-level stuff
46 */ 52 */
47 53
48#include <sound/driver.h> 54#include <sound/driver.h>
@@ -87,7 +93,7 @@ MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard.");
87#define D_DESC (1<<5) 93#define D_DESC (1<<5)
88 94
89static int dbri_debug = 0; 95static int dbri_debug = 0;
90module_param(dbri_debug, int, 0444); 96module_param(dbri_debug, int, 0644);
91MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard."); 97MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
92 98
93#ifdef DBRI_DEBUG 99#ifdef DBRI_DEBUG
@@ -320,7 +326,8 @@ typedef struct snd_dbri {
320 void __iomem *regs; /* dbri HW regs */ 326 void __iomem *regs; /* dbri HW regs */
321 int dbri_version; /* 'e' and up is OK */ 327 int dbri_version; /* 'e' and up is OK */
322 int dbri_irqp; /* intr queue pointer */ 328 int dbri_irqp; /* intr queue pointer */
323 int wait_seen; 329 int wait_send; /* sequence of command buffers send */
330 int wait_ackd; /* sequence of command buffers acknowledged */
324 331
325 struct dbri_pipe pipes[DBRI_NO_PIPES]; /* DBRI's 32 data pipes */ 332 struct dbri_pipe pipes[DBRI_NO_PIPES]; /* DBRI's 32 data pipes */
326 struct dbri_desc descs[DBRI_NO_DESCS]; 333 struct dbri_desc descs[DBRI_NO_DESCS];
@@ -625,16 +632,13 @@ static __u32 reverse_bytes(__u32 b, int len)
625 632
626Commands are sent to the DBRI by building a list of them in memory, 633Commands are sent to the DBRI by building a list of them in memory,
627then writing the address of the first list item to DBRI register 8. 634then writing the address of the first list item to DBRI register 8.
628The list is terminated with a WAIT command, which can generate a 635The list is terminated with a WAIT command, which generates a
629CPU interrupt if required. 636CPU interrupt to signal completion.
630 637
631Since the DBRI can run in parallel with the CPU, several means of 638Since the DBRI can run in parallel with the CPU, several means of
632synchronization present themselves. The original scheme (Rudolf's) 639synchronization present themselves. The method implemented here is close
633was to set a flag when we "cmdlock"ed the DBRI, clear the flag when 640to the original scheme (Rudolf's), and uses 2 counters (wait_send and
634an interrupt signaled completion, and wait on a wait_queue if a routine 641wait_ackd) to synchronize the command buffer between the CPU and the DBRI.
635attempted to cmdlock while the flag was set. The problems arose when
636we tried to cmdlock from inside an interrupt handler, which might
637cause scheduling in an interrupt (if we waited), etc, etc
638 642
639A more sophisticated scheme might involve a circular command buffer 643A more sophisticated scheme might involve a circular command buffer
640or an array of command buffers. A routine could fill one with 644or an array of command buffers. A routine could fill one with
@@ -642,70 +646,75 @@ commands and link it onto a list. When a interrupt signaled
642completion of the current command buffer, look on the list for 646completion of the current command buffer, look on the list for
643the next one. 647the next one.
644 648
645I've decided to implement something much simpler - after each command,
646the CPU waits for the DBRI to finish the command by polling the P bit
647in DBRI register 0. I've tried to implement this in such a way
648that might make implementing a more sophisticated scheme easier.
649
650Every time a routine wants to write commands to the DBRI, it must 649Every time a routine wants to write commands to the DBRI, it must
651first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd 650first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd
652in return. After the commands have been writen, dbri_cmdsend() is 651in return. dbri_cmdlock() will block if the previous commands have not
653called with the final pointer value. 652been completed yet. After this the commands can be written to the buffer,
653and dbri_cmdsend() is called with the final pointer value to send them
654to the DBRI.
654 655
655*/ 656*/
656 657
658static void dbri_process_interrupt_buffer(snd_dbri_t * dbri);
659
657enum dbri_lock_t { NoGetLock, GetLock }; 660enum dbri_lock_t { NoGetLock, GetLock };
661#define MAXLOOPS 10
658 662
659static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get) 663static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get)
660{ 664{
665 int maxloops = MAXLOOPS;
666
661#ifndef SMP 667#ifndef SMP
662 if ((get == GetLock) && spin_is_locked(&dbri->lock)) { 668 if ((get == GetLock) && spin_is_locked(&dbri->lock)) {
663 printk(KERN_ERR "DBRI: cmdlock called while in spinlock."); 669 printk(KERN_ERR "DBRI: cmdlock called while in spinlock.");
664 } 670 }
665#endif 671#endif
666 672
673 /* Delay if previous commands are still being processed */
674 while ((--maxloops) > 0 && (dbri->wait_send != dbri->wait_ackd)) {
675 msleep_interruptible(1);
676 /* If dbri_cmdlock() got called from inside the
677 * interrupt handler, this will do the processing.
678 */
679 dbri_process_interrupt_buffer(dbri);
680 }
681 if (maxloops == 0) {
682 printk(KERN_ERR "DBRI: Chip never completed command buffer %d\n",
683 dbri->wait_send);
684 } else {
685 dprintk(D_CMD, "Chip completed command buffer (%d)\n",
686 MAXLOOPS - maxloops - 1);
687 }
688
667 /*if (get == GetLock) spin_lock(&dbri->lock); */ 689 /*if (get == GetLock) spin_lock(&dbri->lock); */
668 return &dbri->dma->cmd[0]; 690 return &dbri->dma->cmd[0];
669} 691}
670 692
671static void dbri_process_interrupt_buffer(snd_dbri_t *);
672
673static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd) 693static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd)
674{ 694{
675 int MAXLOOPS = 1000000;
676 int maxloops = MAXLOOPS;
677 volatile s32 *ptr; 695 volatile s32 *ptr;
696 u32 reg;
678 697
679 for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) { 698 for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) {
680 dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr); 699 dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
681 } 700 }
682 701
683 if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) { 702 if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) {
684 printk("DBRI: Command buffer overflow! (bug in driver)\n"); 703 printk(KERN_ERR "DBRI: Command buffer overflow! (bug in driver)\n");
685 /* Ignore the last part. */ 704 /* Ignore the last part. */
686 cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3]; 705 cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3];
687 } 706 }
688 707
708 dbri->wait_send++;
709 dbri->wait_send &= 0xffff; /* restrict it to a 16 bit counter. */
689 *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0); 710 *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0);
690 *(cmd++) = DBRI_CMD(D_WAIT, 1, 0); 711 *(cmd++) = DBRI_CMD(D_WAIT, 1, dbri->wait_send);
691 dbri->wait_seen = 0; 712
713 /* Set command pointer and signal it is valid. */
692 sbus_writel(dbri->dma_dvma, dbri->regs + REG8); 714 sbus_writel(dbri->dma_dvma, dbri->regs + REG8);
693 while ((--maxloops) > 0 && (sbus_readl(dbri->regs + REG0) & D_P)) 715 reg = sbus_readl(dbri->regs + REG0);
694 barrier(); 716 reg |= D_P;
695 if (maxloops == 0) { 717 sbus_writel(reg, dbri->regs + REG0);
696 printk(KERN_ERR "DBRI: Chip never completed command buffer\n");
697 dprintk(D_CMD, "DBRI: Chip never completed command buffer\n");
698 } else {
699 while ((--maxloops) > 0 && (!dbri->wait_seen))
700 dbri_process_interrupt_buffer(dbri);
701 if (maxloops == 0) {
702 printk(KERN_ERR "DBRI: Chip never acked WAIT\n");
703 dprintk(D_CMD, "DBRI: Chip never acked WAIT\n");
704 } else {
705 dprintk(D_CMD, "Chip completed command "
706 "buffer (%d)\n", MAXLOOPS - maxloops);
707 }
708 }
709 718
710 /*spin_unlock(&dbri->lock); */ 719 /*spin_unlock(&dbri->lock); */
711} 720}
@@ -757,10 +766,11 @@ static void dbri_initialize(snd_dbri_t * dbri)
757 for (n = 0; n < DBRI_NO_PIPES; n++) 766 for (n = 0; n < DBRI_NO_PIPES; n++)
758 dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1; 767 dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1;
759 768
760 /* We should query the openprom to see what burst sizes this 769 /* A brute approach - DBRI falls back to working burst size by itself
761 * SBus supports. For now, just disable all SBus bursts */ 770 * On SS20 D_S does not work, so do not try so high. */
762 tmp = sbus_readl(dbri->regs + REG0); 771 tmp = sbus_readl(dbri->regs + REG0);
763 tmp &= ~(D_G | D_S | D_E); 772 tmp |= D_G | D_E;
773 tmp &= ~D_S;
764 sbus_writel(tmp, dbri->regs + REG0); 774 sbus_writel(tmp, dbri->regs + REG0);
765 775
766 /* 776 /*
@@ -805,13 +815,13 @@ static void reset_pipe(snd_dbri_t * dbri, int pipe)
805 volatile int *cmd; 815 volatile int *cmd;
806 816
807 if (pipe < 0 || pipe > 31) { 817 if (pipe < 0 || pipe > 31) {
808 printk("DBRI: reset_pipe called with illegal pipe number\n"); 818 printk(KERN_ERR "DBRI: reset_pipe called with illegal pipe number\n");
809 return; 819 return;
810 } 820 }
811 821
812 sdp = dbri->pipes[pipe].sdp; 822 sdp = dbri->pipes[pipe].sdp;
813 if (sdp == 0) { 823 if (sdp == 0) {
814 printk("DBRI: reset_pipe called on uninitialized pipe\n"); 824 printk(KERN_ERR "DBRI: reset_pipe called on uninitialized pipe\n");
815 return; 825 return;
816 } 826 }
817 827
@@ -834,12 +844,12 @@ static void reset_pipe(snd_dbri_t * dbri, int pipe)
834static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp) 844static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp)
835{ 845{
836 if (pipe < 0 || pipe > 31) { 846 if (pipe < 0 || pipe > 31) {
837 printk("DBRI: setup_pipe called with illegal pipe number\n"); 847 printk(KERN_ERR "DBRI: setup_pipe called with illegal pipe number\n");
838 return; 848 return;
839 } 849 }
840 850
841 if ((sdp & 0xf800) != sdp) { 851 if ((sdp & 0xf800) != sdp) {
842 printk("DBRI: setup_pipe called with strange SDP value\n"); 852 printk(KERN_ERR "DBRI: setup_pipe called with strange SDP value\n");
843 /* sdp &= 0xf800; */ 853 /* sdp &= 0xf800; */
844 } 854 }
845 855
@@ -872,13 +882,13 @@ static void link_time_slot(snd_dbri_t * dbri, int pipe,
872 int nextpipe; 882 int nextpipe;
873 883
874 if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) { 884 if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) {
875 printk 885 printk(KERN_ERR
876 ("DBRI: link_time_slot called with illegal pipe number\n"); 886 "DBRI: link_time_slot called with illegal pipe number\n");
877 return; 887 return;
878 } 888 }
879 889
880 if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) { 890 if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) {
881 printk("DBRI: link_time_slot called on uninitialized pipe\n"); 891 printk(KERN_ERR "DBRI: link_time_slot called on uninitialized pipe\n");
882 return; 892 return;
883 } 893 }
884 894
@@ -960,8 +970,8 @@ static void unlink_time_slot(snd_dbri_t * dbri, int pipe,
960 int val; 970 int val;
961 971
962 if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) { 972 if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) {
963 printk 973 printk(KERN_ERR
964 ("DBRI: unlink_time_slot called with illegal pipe number\n"); 974 "DBRI: unlink_time_slot called with illegal pipe number\n");
965 return; 975 return;
966 } 976 }
967 977
@@ -1001,22 +1011,22 @@ static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data)
1001 volatile s32 *cmd; 1011 volatile s32 *cmd;
1002 1012
1003 if (pipe < 16 || pipe > 31) { 1013 if (pipe < 16 || pipe > 31) {
1004 printk("DBRI: xmit_fixed: Illegal pipe number\n"); 1014 printk(KERN_ERR "DBRI: xmit_fixed: Illegal pipe number\n");
1005 return; 1015 return;
1006 } 1016 }
1007 1017
1008 if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) { 1018 if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) {
1009 printk("DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe); 1019 printk(KERN_ERR "DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe);
1010 return; 1020 return;
1011 } 1021 }
1012 1022
1013 if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { 1023 if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
1014 printk("DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe); 1024 printk(KERN_ERR "DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe);
1015 return; 1025 return;
1016 } 1026 }
1017 1027
1018 if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) { 1028 if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) {
1019 printk("DBRI: xmit_fixed: Called on receive pipe %d\n", pipe); 1029 printk(KERN_ERR "DBRI: xmit_fixed: Called on receive pipe %d\n", pipe);
1020 return; 1030 return;
1021 } 1031 }
1022 1032
@@ -1036,17 +1046,17 @@ static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data)
1036static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr) 1046static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr)
1037{ 1047{
1038 if (pipe < 16 || pipe > 31) { 1048 if (pipe < 16 || pipe > 31) {
1039 printk("DBRI: recv_fixed called with illegal pipe number\n"); 1049 printk(KERN_ERR "DBRI: recv_fixed called with illegal pipe number\n");
1040 return; 1050 return;
1041 } 1051 }
1042 1052
1043 if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) { 1053 if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
1044 printk("DBRI: recv_fixed called on non-fixed pipe %d\n", pipe); 1054 printk(KERN_ERR "DBRI: recv_fixed called on non-fixed pipe %d\n", pipe);
1045 return; 1055 return;
1046 } 1056 }
1047 1057
1048 if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) { 1058 if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) {
1049 printk("DBRI: recv_fixed called on transmit pipe %d\n", pipe); 1059 printk(KERN_ERR "DBRI: recv_fixed called on transmit pipe %d\n", pipe);
1050 return; 1060 return;
1051 } 1061 }
1052 1062
@@ -1075,12 +1085,12 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
1075 int last_desc = -1; 1085 int last_desc = -1;
1076 1086
1077 if (info->pipe < 0 || info->pipe > 15) { 1087 if (info->pipe < 0 || info->pipe > 15) {
1078 printk("DBRI: setup_descs: Illegal pipe number\n"); 1088 printk(KERN_ERR "DBRI: setup_descs: Illegal pipe number\n");
1079 return -2; 1089 return -2;
1080 } 1090 }
1081 1091
1082 if (dbri->pipes[info->pipe].sdp == 0) { 1092 if (dbri->pipes[info->pipe].sdp == 0) {
1083 printk("DBRI: setup_descs: Uninitialized pipe %d\n", 1093 printk(KERN_ERR "DBRI: setup_descs: Uninitialized pipe %d\n",
1084 info->pipe); 1094 info->pipe);
1085 return -2; 1095 return -2;
1086 } 1096 }
@@ -1090,20 +1100,20 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
1090 1100
1091 if (streamno == DBRI_PLAY) { 1101 if (streamno == DBRI_PLAY) {
1092 if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) { 1102 if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) {
1093 printk("DBRI: setup_descs: Called on receive pipe %d\n", 1103 printk(KERN_ERR "DBRI: setup_descs: Called on receive pipe %d\n",
1094 info->pipe); 1104 info->pipe);
1095 return -2; 1105 return -2;
1096 } 1106 }
1097 } else { 1107 } else {
1098 if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) { 1108 if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) {
1099 printk 1109 printk(KERN_ERR
1100 ("DBRI: setup_descs: Called on transmit pipe %d\n", 1110 "DBRI: setup_descs: Called on transmit pipe %d\n",
1101 info->pipe); 1111 info->pipe);
1102 return -2; 1112 return -2;
1103 } 1113 }
1104 /* Should be able to queue multiple buffers to receive on a pipe */ 1114 /* Should be able to queue multiple buffers to receive on a pipe */
1105 if (pipe_active(dbri, info->pipe)) { 1115 if (pipe_active(dbri, info->pipe)) {
1106 printk("DBRI: recv_on_pipe: Called on active pipe %d\n", 1116 printk(KERN_ERR "DBRI: recv_on_pipe: Called on active pipe %d\n",
1107 info->pipe); 1117 info->pipe);
1108 return -2; 1118 return -2;
1109 } 1119 }
@@ -1120,7 +1130,7 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
1120 break; 1130 break;
1121 } 1131 }
1122 if (desc == DBRI_NO_DESCS) { 1132 if (desc == DBRI_NO_DESCS) {
1123 printk("DBRI: setup_descs: No descriptors\n"); 1133 printk(KERN_ERR "DBRI: setup_descs: No descriptors\n");
1124 return -1; 1134 return -1;
1125 } 1135 }
1126 1136
@@ -1165,7 +1175,7 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
1165 } 1175 }
1166 1176
1167 if (first_desc == -1 || last_desc == -1) { 1177 if (first_desc == -1 || last_desc == -1) {
1168 printk("DBRI: setup_descs: Not enough descriptors available\n"); 1178 printk(KERN_ERR "DBRI: setup_descs: Not enough descriptors available\n");
1169 return -1; 1179 return -1;
1170 } 1180 }
1171 1181
@@ -1270,7 +1280,7 @@ static void reset_chi(snd_dbri_t * dbri, enum master_or_slave master_or_slave,
1270 int divisor = 12288 / clockrate; 1280 int divisor = 12288 / clockrate;
1271 1281
1272 if (divisor > 255 || divisor * clockrate != 12288) 1282 if (divisor > 255 || divisor * clockrate != 12288)
1273 printk("DBRI: illegal bits_per_frame in setup_chi\n"); 1283 printk(KERN_ERR "DBRI: illegal bits_per_frame in setup_chi\n");
1274 1284
1275 *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD 1285 *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD
1276 | D_CHI_BPF(bits_per_frame)); 1286 | D_CHI_BPF(bits_per_frame));
@@ -1474,7 +1484,6 @@ static int cs4215_setctrl(snd_dbri_t * dbri)
1474 /* Temporarily mute outputs, and wait 1/8000 sec (125 us) 1484 /* Temporarily mute outputs, and wait 1/8000 sec (125 us)
1475 * to make sure this takes. This avoids clicking noises. 1485 * to make sure this takes. This avoids clicking noises.
1476 */ 1486 */
1477
1478 cs4215_setdata(dbri, 1); 1487 cs4215_setdata(dbri, 1);
1479 udelay(125); 1488 udelay(125);
1480 1489
@@ -1530,8 +1539,8 @@ static int cs4215_setctrl(snd_dbri_t * dbri)
1530 tmp |= D_C; /* Enable CHI */ 1539 tmp |= D_C; /* Enable CHI */
1531 sbus_writel(tmp, dbri->regs + REG0); 1540 sbus_writel(tmp, dbri->regs + REG0);
1532 1541
1533 for (i = 64; ((dbri->mm.status & 0xe4) != 0x20); --i) { 1542 for (i = 10; ((dbri->mm.status & 0xe4) != 0x20); --i) {
1534 udelay(125); 1543 msleep_interruptible(1);
1535 } 1544 }
1536 if (i == 0) { 1545 if (i == 0) {
1537 dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n", 1546 dprintk(D_MM, "CS4215 didn't respond to CLB (0x%02x)\n",
@@ -1678,8 +1687,8 @@ buffer and calls dbri_process_one_interrupt() for each interrupt word.
1678Complicated interrupts are handled by dedicated functions (which 1687Complicated interrupts are handled by dedicated functions (which
1679appear first in this file). Any pending interrupts can be serviced by 1688appear first in this file). Any pending interrupts can be serviced by
1680calling dbri_process_interrupt_buffer(), which works even if the CPU's 1689calling dbri_process_interrupt_buffer(), which works even if the CPU's
1681interrupts are disabled. This function is used by dbri_cmdsend() 1690interrupts are disabled. This function is used by dbri_cmdlock()
1682to make sure we're synced up with the chip after each command sequence, 1691to make sure we're synced up with the chip before each command sequence,
1683even if we're running cli'ed. 1692even if we're running cli'ed.
1684 1693
1685*/ 1694*/
@@ -1765,11 +1774,13 @@ DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0);
1765 * Called by main interrupt handler when DBRI signals transmission complete 1774 * Called by main interrupt handler when DBRI signals transmission complete
1766 * on a pipe (interrupt triggered by the B bit in a transmit descriptor). 1775 * on a pipe (interrupt triggered by the B bit in a transmit descriptor).
1767 * 1776 *
1768 * Walks through the pipe's list of transmit buffer descriptors, releasing 1777 * Walks through the pipe's list of transmit buffer descriptors and marks
1769 * each one's DMA buffer (if present), flagging the descriptor available, 1778 * them as available. Stops when the first descriptor is found without
1770 * and signaling its callback routine (if present), before proceeding
1771 * to the next one. Stops when the first descriptor is found without
1772 * TBC (Transmit Buffer Complete) set, or we've run through them all. 1779 * TBC (Transmit Buffer Complete) set, or we've run through them all.
1780 *
1781 * The DMA buffers are not released, but re-used. Since the transmit buffer
1782 * descriptors are not clobbered, they can be re-submitted as is. This is
1783 * done by the xmit_descs() tasklet above since that could take longer.
1773 */ 1784 */
1774 1785
1775static void transmission_complete_intr(snd_dbri_t * dbri, int pipe) 1786static void transmission_complete_intr(snd_dbri_t * dbri, int pipe)
@@ -1885,7 +1896,11 @@ static void dbri_process_one_interrupt(snd_dbri_t * dbri, int x)
1885 } 1896 }
1886 1897
1887 if (channel == D_INTR_CMD && command == D_WAIT) { 1898 if (channel == D_INTR_CMD && command == D_WAIT) {
1888 dbri->wait_seen++; 1899 dbri->wait_ackd = val;
1900 if (dbri->wait_send != val) {
1901 printk(KERN_ERR "Processing wait command %d when %d was send.\n",
1902 val, dbri->wait_send);
1903 }
1889 return; 1904 return;
1890 } 1905 }
1891 1906
@@ -1994,8 +2009,7 @@ static irqreturn_t snd_dbri_interrupt(int irq, void *dev_id,
1994 * The only one I've seen is MRR, which will be triggered 2009 * The only one I've seen is MRR, which will be triggered
1995 * if you let a transmit pipe underrun, then try to CDP it. 2010 * if you let a transmit pipe underrun, then try to CDP it.
1996 * 2011 *
1997 * If these things persist, we should probably reset 2012 * If these things persist, we reset the chip.
1998 * and re-init the chip.
1999 */ 2013 */
2000 if ((++errcnt) % 10 == 0) { 2014 if ((++errcnt) % 10 == 0) {
2001 dprintk(D_INT, "Interrupt errors exceeded.\n"); 2015 dprintk(D_INT, "Interrupt errors exceeded.\n");
@@ -2094,7 +2108,7 @@ static int snd_dbri_hw_params(snd_pcm_substream_t * substream,
2094 2108
2095 if ((ret = snd_pcm_lib_malloc_pages(substream, 2109 if ((ret = snd_pcm_lib_malloc_pages(substream,
2096 params_buffer_bytes(hw_params))) < 0) { 2110 params_buffer_bytes(hw_params))) < 0) {
2097 snd_printk(KERN_ERR "malloc_pages failed with %d\n", ret); 2111 printk(KERN_ERR "malloc_pages failed with %d\n", ret);
2098 return ret; 2112 return ret;
2099 } 2113 }
2100 2114
@@ -2455,8 +2469,7 @@ static int __init snd_dbri_mixer(snd_dbri_t * dbri)
2455 2469
2456 for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) { 2470 for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) {
2457 if ((err = snd_ctl_add(card, 2471 if ((err = snd_ctl_add(card,
2458 snd_ctl_new1(&dbri_controls[idx], 2472 snd_ctl_new1(&dbri_controls[idx], dbri))) < 0)
2459 dbri))) < 0)
2460 return err; 2473 return err;
2461 } 2474 }
2462 2475
@@ -2490,8 +2503,6 @@ static void dbri_debug_read(snd_info_entry_t * entry,
2490 int pipe; 2503 int pipe;
2491 snd_iprintf(buffer, "debug=%d\n", dbri_debug); 2504 snd_iprintf(buffer, "debug=%d\n", dbri_debug);
2492 2505
2493 snd_iprintf(buffer, "CHI pipe in=%d, out=%d\n",
2494 dbri->chi_in_pipe, dbri->chi_out_pipe);
2495 for (pipe = 0; pipe < 32; pipe++) { 2506 for (pipe = 0; pipe < 32; pipe++) {
2496 if (pipe_active(dbri, pipe)) { 2507 if (pipe_active(dbri, pipe)) {
2497 struct dbri_pipe *pptr = &dbri->pipes[pipe]; 2508 struct dbri_pipe *pptr = &dbri->pipes[pipe];
@@ -2506,18 +2517,6 @@ static void dbri_debug_read(snd_info_entry_t * entry,
2506 } 2517 }
2507 } 2518 }
2508} 2519}
2509
2510static void dbri_debug_write(snd_info_entry_t * entry,
2511 snd_info_buffer_t * buffer)
2512{
2513 char line[80];
2514 int i;
2515
2516 if (snd_info_get_line(buffer, line, 80) == 0) {
2517 sscanf(line, "%d\n", &i);
2518 dbri_debug = i & 0x3f;
2519 }
2520}
2521#endif 2520#endif
2522 2521
2523void snd_dbri_proc(snd_dbri_t * dbri) 2522void snd_dbri_proc(snd_dbri_t * dbri)
@@ -2531,9 +2530,7 @@ void snd_dbri_proc(snd_dbri_t * dbri)
2531#ifdef DBRI_DEBUG 2530#ifdef DBRI_DEBUG
2532 err = snd_card_proc_new(dbri->card, "debug", &entry); 2531 err = snd_card_proc_new(dbri->card, "debug", &entry);
2533 snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read); 2532 snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read);
2534 entry->mode = S_IFREG | S_IRUGO | S_IWUSR; /* Writable for root */ 2533 entry->mode = S_IFREG | S_IRUGO; /* Readable only. */
2535 entry->c.text.write_size = 256;
2536 entry->c.text.write = dbri_debug_write;
2537#endif 2534#endif
2538} 2535}
2539 2536
@@ -2637,7 +2634,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
2637 return -ENOENT; 2634 return -ENOENT;
2638 } 2635 }
2639 2636
2640 prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq)); 2637 err = prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq));
2638 if (err < 0) {
2639 printk(KERN_ERR "DBRI-%d: Firmware node lacks IRQ property.\n", dev);
2640 return -ENODEV;
2641 }
2641 2642
2642 card = snd_card_new(index[dev], id[dev], THIS_MODULE, 2643 card = snd_card_new(index[dev], id[dev], THIS_MODULE,
2643 sizeof(snd_dbri_t)); 2644 sizeof(snd_dbri_t));
@@ -2657,26 +2658,20 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
2657 } 2658 }
2658 2659
2659 dbri = (snd_dbri_t *) card->private_data; 2660 dbri = (snd_dbri_t *) card->private_data;
2660 if ((err = snd_dbri_pcm(dbri)) < 0) { 2661 if ((err = snd_dbri_pcm(dbri)) < 0)
2661 snd_dbri_free(dbri); 2662 goto _err;
2662 snd_card_free(card);
2663 return err;
2664 }
2665 2663
2666 if ((err = snd_dbri_mixer(dbri)) < 0) { 2664 if ((err = snd_dbri_mixer(dbri)) < 0)
2667 snd_dbri_free(dbri); 2665 goto _err;
2668 snd_card_free(card);
2669 return err;
2670 }
2671 2666
2672 /* /proc file handling */ 2667 /* /proc file handling */
2673 snd_dbri_proc(dbri); 2668 snd_dbri_proc(dbri);
2674 2669
2675 if ((err = snd_card_register(card)) < 0) { 2670 if ((err = snd_card_set_generic_dev(card)) < 0)
2676 snd_dbri_free(dbri); 2671 goto _err;
2677 snd_card_free(card); 2672
2678 return err; 2673 if ((err = snd_card_register(card)) < 0)
2679 } 2674 goto _err;
2680 2675
2681 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n", 2676 printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
2682 dev, dbri->regs, 2677 dev, dbri->regs,
@@ -2684,6 +2679,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
2684 dev++; 2679 dev++;
2685 2680
2686 return 0; 2681 return 0;
2682
2683 _err:
2684 snd_dbri_free(dbri);
2685 snd_card_free(card);
2686 return err;
2687} 2687}
2688 2688
2689/* Probe for the dbri chip and then attach the driver. */ 2689/* Probe for the dbri chip and then attach the driver. */
diff --git a/sound/synth/emux/emux.c b/sound/synth/emux/emux.c
index 60d0b2c66698..9e2b4c0c8a8a 100644
--- a/sound/synth/emux/emux.c
+++ b/sound/synth/emux/emux.c
@@ -40,7 +40,7 @@ int snd_emux_new(snd_emux_t **remu)
40 snd_emux_t *emu; 40 snd_emux_t *emu;
41 41
42 *remu = NULL; 42 *remu = NULL;
43 emu = kcalloc(1, sizeof(*emu), GFP_KERNEL); 43 emu = kzalloc(sizeof(*emu), GFP_KERNEL);
44 if (emu == NULL) 44 if (emu == NULL)
45 return -ENOMEM; 45 return -ENOMEM;
46 46
diff --git a/sound/synth/emux/emux_seq.c b/sound/synth/emux/emux_seq.c
index e41b28d9bf52..8ccd33f4aa57 100644
--- a/sound/synth/emux/emux_seq.c
+++ b/sound/synth/emux/emux_seq.c
@@ -146,7 +146,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
146 int i, type, cap; 146 int i, type, cap;
147 147
148 /* Allocate structures for this channel */ 148 /* Allocate structures for this channel */
149 if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) { 149 if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) {
150 snd_printk("no memory\n"); 150 snd_printk("no memory\n");
151 return NULL; 151 return NULL;
152 } 152 }
diff --git a/sound/synth/emux/soundfont.c b/sound/synth/emux/soundfont.c
index 901a7db05bde..d0925ea50838 100644
--- a/sound/synth/emux/soundfont.c
+++ b/sound/synth/emux/soundfont.c
@@ -266,7 +266,7 @@ newsf(snd_sf_list_t *sflist, int type, char *name)
266 } 266 }
267 267
268 /* not found -- create a new one */ 268 /* not found -- create a new one */
269 sf = kcalloc(1, sizeof(*sf), GFP_KERNEL); 269 sf = kzalloc(sizeof(*sf), GFP_KERNEL);
270 if (sf == NULL) 270 if (sf == NULL)
271 return NULL; 271 return NULL;
272 sf->id = sflist->fonts_size; 272 sf->id = sflist->fonts_size;
@@ -346,7 +346,7 @@ sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
346{ 346{
347 snd_sf_zone_t *zp; 347 snd_sf_zone_t *zp;
348 348
349 if ((zp = kcalloc(1, sizeof(*zp), GFP_KERNEL)) == NULL) 349 if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL)
350 return NULL; 350 return NULL;
351 zp->next = sf->zones; 351 zp->next = sf->zones;
352 sf->zones = zp; 352 sf->zones = zp;
@@ -377,7 +377,7 @@ sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
377{ 377{
378 snd_sf_sample_t *sp; 378 snd_sf_sample_t *sp;
379 379
380 if ((sp = kcalloc(1, sizeof(*sp), GFP_KERNEL)) == NULL) 380 if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL)
381 return NULL; 381 return NULL;
382 382
383 sp->next = sf->samples; 383 sp->next = sf->samples;
@@ -1362,7 +1362,7 @@ snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr)
1362{ 1362{
1363 snd_sf_list_t *sflist; 1363 snd_sf_list_t *sflist;
1364 1364
1365 if ((sflist = kcalloc(1, sizeof(*sflist), GFP_KERNEL)) == NULL) 1365 if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
1366 return NULL; 1366 return NULL;
1367 1367
1368 init_MUTEX(&sflist->presets_mutex); 1368 init_MUTEX(&sflist->presets_mutex);
diff --git a/sound/synth/util_mem.c b/sound/synth/util_mem.c
index 8b131a11e549..5f75bf31bc36 100644
--- a/sound/synth/util_mem.c
+++ b/sound/synth/util_mem.c
@@ -38,7 +38,7 @@ snd_util_memhdr_new(int memsize)
38{ 38{
39 snd_util_memhdr_t *hdr; 39 snd_util_memhdr_t *hdr;
40 40
41 hdr = kcalloc(1, sizeof(*hdr), GFP_KERNEL); 41 hdr = kzalloc(sizeof(*hdr), GFP_KERNEL);
42 if (hdr == NULL) 42 if (hdr == NULL)
43 return NULL; 43 return NULL;
44 hdr->size = memsize; 44 hdr->size = memsize;
diff --git a/sound/usb/usbaudio.c b/sound/usb/usbaudio.c
index bfbec5876659..d5ae2055b896 100644
--- a/sound/usb/usbaudio.c
+++ b/sound/usb/usbaudio.c
@@ -1439,9 +1439,11 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream)
1439 1439
1440static snd_pcm_hardware_t snd_usb_playback = 1440static snd_pcm_hardware_t snd_usb_playback =
1441{ 1441{
1442 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1442 .info = SNDRV_PCM_INFO_MMAP |
1443 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1443 SNDRV_PCM_INFO_MMAP_VALID |
1444 SNDRV_PCM_INFO_MMAP_VALID), 1444 SNDRV_PCM_INFO_BATCH |
1445 SNDRV_PCM_INFO_INTERLEAVED |
1446 SNDRV_PCM_INFO_BLOCK_TRANSFER,
1445 .buffer_bytes_max = (256*1024), 1447 .buffer_bytes_max = (256*1024),
1446 .period_bytes_min = 64, 1448 .period_bytes_min = 64,
1447 .period_bytes_max = (128*1024), 1449 .period_bytes_max = (128*1024),
@@ -1451,9 +1453,11 @@ static snd_pcm_hardware_t snd_usb_playback =
1451 1453
1452static snd_pcm_hardware_t snd_usb_capture = 1454static snd_pcm_hardware_t snd_usb_capture =
1453{ 1455{
1454 .info = (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED | 1456 .info = SNDRV_PCM_INFO_MMAP |
1455 SNDRV_PCM_INFO_BLOCK_TRANSFER | 1457 SNDRV_PCM_INFO_MMAP_VALID |
1456 SNDRV_PCM_INFO_MMAP_VALID), 1458 SNDRV_PCM_INFO_BATCH |
1459 SNDRV_PCM_INFO_INTERLEAVED |
1460 SNDRV_PCM_INFO_BLOCK_TRANSFER,
1457 .buffer_bytes_max = (256*1024), 1461 .buffer_bytes_max = (256*1024),
1458 .period_bytes_min = 64, 1462 .period_bytes_min = 64,
1459 .period_bytes_max = (128*1024), 1463 .period_bytes_max = (128*1024),
@@ -3132,7 +3136,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
3132 return -ENOMEM; 3136 return -ENOMEM;
3133 } 3137 }
3134 3138
3135 chip = kcalloc(1, sizeof(*chip), GFP_KERNEL); 3139 chip = kzalloc(sizeof(*chip), GFP_KERNEL);
3136 if (! chip) { 3140 if (! chip) {
3137 snd_card_free(card); 3141 snd_card_free(card);
3138 return -ENOMEM; 3142 return -ENOMEM;
diff --git a/sound/usb/usbmidi.c b/sound/usb/usbmidi.c
index 93dedde3c428..e0d0365453b3 100644
--- a/sound/usb/usbmidi.c
+++ b/sound/usb/usbmidi.c
@@ -841,7 +841,7 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi,
841 int length; 841 int length;
842 842
843 rep->in = NULL; 843 rep->in = NULL;
844 ep = kcalloc(1, sizeof(*ep), GFP_KERNEL); 844 ep = kzalloc(sizeof(*ep), GFP_KERNEL);
845 if (!ep) 845 if (!ep)
846 return -ENOMEM; 846 return -ENOMEM;
847 ep->umidi = umidi; 847 ep->umidi = umidi;
@@ -913,7 +913,7 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi,
913 void* buffer; 913 void* buffer;
914 914
915 rep->out = NULL; 915 rep->out = NULL;
916 ep = kcalloc(1, sizeof(*ep), GFP_KERNEL); 916 ep = kzalloc(sizeof(*ep), GFP_KERNEL);
917 if (!ep) 917 if (!ep)
918 return -ENOMEM; 918 return -ENOMEM;
919 ep->umidi = umidi; 919 ep->umidi = umidi;
@@ -1537,7 +1537,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
1537 int out_ports, in_ports; 1537 int out_ports, in_ports;
1538 int i, err; 1538 int i, err;
1539 1539
1540 umidi = kcalloc(1, sizeof(*umidi), GFP_KERNEL); 1540 umidi = kzalloc(sizeof(*umidi), GFP_KERNEL);
1541 if (!umidi) 1541 if (!umidi)
1542 return -ENOMEM; 1542 return -ENOMEM;
1543 umidi->chip = chip; 1543 umidi->chip = chip;
diff --git a/sound/usb/usbmixer.c b/sound/usb/usbmixer.c
index fa7056f5caaf..c3c08c9cb46e 100644
--- a/sound/usb/usbmixer.c
+++ b/sound/usb/usbmixer.c
@@ -824,7 +824,7 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc,
824 if (check_ignored_ctl(state, unitid, control)) 824 if (check_ignored_ctl(state, unitid, control))
825 return; 825 return;
826 826
827 cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 827 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
828 if (! cval) { 828 if (! cval) {
829 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 829 snd_printk(KERN_ERR "cannot malloc kcontrol\n");
830 return; 830 return;
@@ -997,7 +997,7 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc,
997 if (check_ignored_ctl(state, unitid, 0)) 997 if (check_ignored_ctl(state, unitid, 0))
998 return; 998 return;
999 999
1000 cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 1000 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
1001 if (! cval) 1001 if (! cval)
1002 return; 1002 return;
1003 1003
@@ -1244,7 +1244,7 @@ static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char
1244 continue; 1244 continue;
1245 if (check_ignored_ctl(state, unitid, valinfo->control)) 1245 if (check_ignored_ctl(state, unitid, valinfo->control))
1246 continue; 1246 continue;
1247 cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 1247 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
1248 if (! cval) { 1248 if (! cval) {
1249 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1249 snd_printk(KERN_ERR "cannot malloc kcontrol\n");
1250 return -ENOMEM; 1250 return -ENOMEM;
@@ -1430,7 +1430,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
1430 if (check_ignored_ctl(state, unitid, 0)) 1430 if (check_ignored_ctl(state, unitid, 0))
1431 return 0; 1431 return 0;
1432 1432
1433 cval = kcalloc(1, sizeof(*cval), GFP_KERNEL); 1433 cval = kzalloc(sizeof(*cval), GFP_KERNEL);
1434 if (! cval) { 1434 if (! cval) {
1435 snd_printk(KERN_ERR "cannot malloc kcontrol\n"); 1435 snd_printk(KERN_ERR "cannot malloc kcontrol\n");
1436 return -ENOMEM; 1436 return -ENOMEM;
@@ -1945,7 +1945,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
1945 1945
1946 strcpy(chip->card->mixername, "USB Mixer"); 1946 strcpy(chip->card->mixername, "USB Mixer");
1947 1947
1948 mixer = kcalloc(1, sizeof(*mixer), GFP_KERNEL); 1948 mixer = kzalloc(sizeof(*mixer), GFP_KERNEL);
1949 if (!mixer) 1949 if (!mixer)
1950 return -ENOMEM; 1950 return -ENOMEM;
1951 mixer->chip = chip; 1951 mixer->chip = chip;
diff --git a/sound/usb/usx2y/usbusx2yaudio.c b/sound/usb/usx2y/usbusx2yaudio.c
index 62dfd28b3b07..0f09e0de52dd 100644
--- a/sound/usb/usx2y/usbusx2yaudio.c
+++ b/sound/usb/usx2y/usbusx2yaudio.c
@@ -957,7 +957,7 @@ static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int c
957 957
958 for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE; 958 for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
959 i <= SNDRV_PCM_STREAM_CAPTURE; ++i) { 959 i <= SNDRV_PCM_STREAM_CAPTURE; ++i) {
960 usX2Y_substream[i] = kcalloc(1, sizeof(snd_usX2Y_substream_t), GFP_KERNEL); 960 usX2Y_substream[i] = kzalloc(sizeof(snd_usX2Y_substream_t), GFP_KERNEL);
961 if (NULL == usX2Y_substream[i]) { 961 if (NULL == usX2Y_substream[i]) {
962 snd_printk(KERN_ERR "cannot malloc\n"); 962 snd_printk(KERN_ERR "cannot malloc\n");
963 return -ENOMEM; 963 return -ENOMEM;