]> git.kernelconcepts.de Git - karo-tx-linux.git/commitdiff
Merge master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa-current
authorLinus Torvalds <torvalds@g5.osdl.org>
Tue, 13 Sep 2005 16:46:22 +0000 (09:46 -0700)
committerLinus Torvalds <torvalds@g5.osdl.org>
Tue, 13 Sep 2005 16:46:22 +0000 (09:46 -0700)
189 files changed:
Documentation/sound/alsa/ALSA-Configuration.txt
Documentation/sound/alsa/DocBook/writing-an-alsa-driver.tmpl
include/linux/pci_ids.h
include/sound/core.h
include/sound/cs46xx.h
include/sound/emu10k1.h
include/sound/pcm.h
include/sound/pcm_oss.h
include/sound/trident.h
include/sound/version.h
include/sound/ymfpci.h
sound/arm/Kconfig
sound/arm/aaci.c
sound/arm/sa11xx-uda1341.c
sound/core/Kconfig
sound/core/control.c
sound/core/control_compat.c
sound/core/device.c
sound/core/hwdep.c
sound/core/info.c
sound/core/init.c
sound/core/memalloc.c
sound/core/memory.c
sound/core/oss/mixer_oss.c
sound/core/oss/pcm_oss.c
sound/core/oss/pcm_plugin.c
sound/core/pcm.c
sound/core/pcm_lib.c
sound/core/pcm_memory.c
sound/core/pcm_native.c
sound/core/rawmidi.c
sound/core/seq/instr/ainstr_gf1.c
sound/core/seq/instr/ainstr_iw.c
sound/core/seq/oss/seq_oss_init.c
sound/core/seq/oss/seq_oss_midi.c
sound/core/seq/oss/seq_oss_readq.c
sound/core/seq/oss/seq_oss_synth.c
sound/core/seq/oss/seq_oss_timer.c
sound/core/seq/oss/seq_oss_writeq.c
sound/core/seq/seq.c
sound/core/seq/seq_clientmgr.c
sound/core/seq/seq_device.c
sound/core/seq/seq_dummy.c
sound/core/seq/seq_fifo.c
sound/core/seq/seq_instr.c
sound/core/seq/seq_memory.c
sound/core/seq/seq_midi.c
sound/core/seq/seq_midi_event.c
sound/core/seq/seq_ports.c
sound/core/seq/seq_prioq.c
sound/core/seq/seq_queue.c
sound/core/seq/seq_system.c
sound/core/seq/seq_timer.c
sound/core/seq/seq_virmidi.c
sound/core/sound.c
sound/core/timer.c
sound/drivers/Kconfig
sound/drivers/dummy.c
sound/drivers/mpu401/mpu401.c
sound/drivers/mpu401/mpu401_uart.c
sound/drivers/mtpav.c
sound/drivers/opl3/opl3_lib.c
sound/drivers/opl3/opl3_oss.c
sound/drivers/opl4/opl4_lib.c
sound/drivers/serial-u16550.c
sound/drivers/virmidi.c
sound/drivers/vx/vx_core.c
sound/drivers/vx/vx_pcm.c
sound/i2c/cs8427.c
sound/i2c/i2c.c
sound/i2c/l3/uda1341.c
sound/i2c/other/ak4114.c
sound/i2c/other/ak4117.c
sound/i2c/tea6330t.c
sound/isa/Kconfig
sound/isa/ad1816a/ad1816a_lib.c
sound/isa/ad1848/ad1848.c
sound/isa/ad1848/ad1848_lib.c
sound/isa/cmi8330.c
sound/isa/cs423x/cs4231.c
sound/isa/cs423x/cs4231_lib.c
sound/isa/cs423x/cs4236.c
sound/isa/es1688/es1688.c
sound/isa/es1688/es1688_lib.c
sound/isa/es18xx.c
sound/isa/gus/gus_main.c
sound/isa/gus/gus_mem_proc.c
sound/isa/gus/gus_pcm.c
sound/isa/gus/gusclassic.c
sound/isa/gus/gusextreme.c
sound/isa/gus/gusmax.c
sound/isa/gus/interwave.c
sound/isa/opl3sa2.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/emu8000.c
sound/isa/sb/emu8000_pcm.c
sound/isa/sb/sb16.c
sound/isa/sb/sb16_csp.c
sound/isa/sb/sb8.c
sound/isa/sb/sb_common.c
sound/isa/sgalaxy.c
sound/isa/sscape.c
sound/isa/wavefront/wavefront.c
sound/mips/Kconfig
sound/mips/au1x00.c
sound/parisc/harmony.c
sound/pci/Kconfig
sound/pci/Makefile
sound/pci/ac97/ac97_codec.c
sound/pci/ac97/ac97_id.h
sound/pci/ac97/ac97_patch.c
sound/pci/ac97/ak4531_codec.c
sound/pci/ad1889.c [new file with mode: 0644]
sound/pci/ad1889.h [new file with mode: 0644]
sound/pci/ali5451/ali5451.c
sound/pci/als4000.c
sound/pci/atiixp.c
sound/pci/atiixp_modem.c
sound/pci/au88x0/au88x0.c
sound/pci/azt3328.c
sound/pci/bt87x.c
sound/pci/ca0106/ca0106_main.c
sound/pci/ca0106/ca0106_mixer.c
sound/pci/cmipci.c
sound/pci/cs4281.c
sound/pci/cs46xx/cs46xx.c
sound/pci/cs46xx/cs46xx_lib.c
sound/pci/emu10k1/emu10k1.c
sound/pci/emu10k1/emu10k1_main.c
sound/pci/emu10k1/emu10k1x.c
sound/pci/emu10k1/emufx.c
sound/pci/emu10k1/emupcm.c
sound/pci/emu10k1/p16v.c
sound/pci/ens1370.c
sound/pci/es1938.c
sound/pci/es1968.c
sound/pci/fm801.c
sound/pci/hda/hda_codec.c
sound/pci/hda/hda_codec.h
sound/pci/hda/hda_generic.c
sound/pci/hda/hda_intel.c
sound/pci/hda/hda_proc.c
sound/pci/hda/patch_analog.c
sound/pci/hda/patch_cmedia.c
sound/pci/hda/patch_realtek.c
sound/pci/hda/patch_si3054.c
sound/pci/hda/patch_sigmatel.c
sound/pci/ice1712/aureon.c
sound/pci/ice1712/ice1712.c
sound/pci/ice1712/ice1724.c
sound/pci/ice1712/juli.c
sound/pci/ice1712/phase.c
sound/pci/ice1712/pontis.c
sound/pci/intel8x0.c
sound/pci/intel8x0m.c
sound/pci/korg1212/korg1212.c
sound/pci/maestro3.c
sound/pci/mixart/mixart.c
sound/pci/nm256/nm256.c
sound/pci/rme32.c
sound/pci/rme96.c
sound/pci/rme9652/hdsp.c
sound/pci/rme9652/hdspm.c
sound/pci/rme9652/rme9652.c
sound/pci/sonicvibes.c
sound/pci/trident/trident.c
sound/pci/trident/trident_main.c
sound/pci/via82xx.c
sound/pci/via82xx_modem.c
sound/pci/vx222/vx222.c
sound/pci/ymfpci/ymfpci.c
sound/pci/ymfpci/ymfpci_main.c
sound/pcmcia/pdaudiocf/pdaudiocf_core.c
sound/ppc/Kconfig
sound/ppc/pmac.c
sound/ppc/powermac.c
sound/ppc/tumbler.c
sound/sparc/Kconfig
sound/sparc/amd7930.c
sound/sparc/cs4231.c
sound/sparc/dbri.c
sound/synth/emux/emux.c
sound/synth/emux/emux_seq.c
sound/synth/emux/soundfont.c
sound/synth/util_mem.c
sound/usb/usbaudio.c
sound/usb/usbmidi.c
sound/usb/usbmixer.c
sound/usb/usx2y/usbusx2yaudio.c

index ebfcdf28485f28aa47ee6af8fd5f4f639aadda59..13cba955cb5af313a2c2cc0866666766ef56a40a 100644 (file)
@@ -75,7 +75,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     adsp_map   - PCM device number maps assigned to the 2st OSS device.
                - Default: 1
     nonblock_open
-               - Don't block opening busy PCM devices.
+               - Don't block opening busy PCM devices.  Default: 1
 
     For example, when dsp_map=2, /dev/dsp will be mapped to PCM #2 of
     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.
     Module supports up to 8 cards. This module does not support autoprobe
     thus main port must be specified!!! Other ports are optional.
     
+  Module snd-ad1889
+  -----------------
+
+    Module for Analog Devices AD1889 chips.
+
+    ac97_quirk  - AC'97 workaround for strange hardware
+                  See the description of intel8x0 module for details.
+
+    This module supports up to 8 cards.
+
   Module snd-ali5451
   ------------------
 
@@ -189,15 +199,20 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
   Module snd-atiixp
   -----------------
 
-    Module for ATI IXP 150/200/250 AC97 controllers.
+    Module for ATI IXP 150/200/250/400 AC97 controllers.
 
-    ac97_clock         - AC'97 clock (defalut = 48000)
+    ac97_clock         - AC'97 clock (default = 48000)
     ac97_quirk         - AC'97 workaround for strange hardware
-                         See the description of intel8x0 module for details.
+                         See "AC97 Quirk Option" section below.
     spdif_aclink       - S/PDIF transfer over AC-link (default = 1)
 
     This module supports up to 8 cards and autoprobe.
 
+    ATI IXP has two different methods to control SPDIF output.  One is
+    over AC-link and another is over the "direct" SPDIF output.  The
+    implementation depends on the motherboard, and you'll need to
+    choose the correct one via spdif_aclink module option.
+
   Module snd-atiixp-modem
   -----------------------
 
@@ -230,7 +245,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     The hardware EQ hardware and SPDIF is only present in the Vortex2 and 
     Advantage.
 
-    Note: Some ALSA mixer applicactions don't handle the SPDIF samplerate 
+    Note: Some ALSA mixer applications don't handle the SPDIF sample rate 
            control correctly. If you have problems regarding this, try
            another ALSA compliant mixer (alsamixer works).
 
@@ -302,7 +317,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
 
     mpu_port   - 0x300,0x310,0x320,0x330, 0 = disable (default)
     fm_port     - 0x388 (default), 0 = disable (default)
-    soft_ac3    - Sofware-conversion of raw SPDIF packets (model 033 only)
+    soft_ac3    - Software-conversion of raw SPDIF packets (model 033 only)
                   (default = 1)
     joystick_port - Joystick port address (0 = disable, 1 = auto-detect)
 
@@ -384,7 +399,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     Module for PCI sound cards based on CS4610/CS4612/CS4614/CS4615/CS4622/
                                       CS4624/CS4630/CS4280 PCI chips.
 
-    external_amp     - Force to enable external amplifer.
+    external_amp     - Force to enable external amplifier.
     thinkpad         - Force to enable Thinkpad's CLKRUN control.
     mmap_valid       - Support OSS mmap mode (default = 0).
 
@@ -620,7 +635,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
               VIA VT8251/VT8237A
 
     model      - force the model name
-    position_fix - Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF)
+    position_fix - Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size)
 
     Module supports up to 8 cards.
 
@@ -656,6 +671,11 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
          allout        5-jack in back, 2-jack in front, SPDIF out
          auto          auto-config reading BIOS (default)
 
+    If the default configuration doesn't work and one of the above
+    matches with your device, report it together with the PCI
+    subsystem ID (output of "lspci -nv") to ALSA BTS or alsa-devel
+    ML (see the section "Links and Addresses").
+
     Note 2: If you get click noises on output, try the module option
            position_fix=1 or 2.  position_fix=1 will use the SD_LPIB
            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.
 
     ac97_clock   - AC'97 codec clock base (0 = auto-detect)
     ac97_quirk    - AC'97 workaround for strange hardware
-                    The following strings are accepted:
-                      default = don't override the default setting
-                      disable = disable the quirk
-                      hp_only = use headphone control as master
-                      swap_hp = swap headphone and master controls
-                      swap_surround = swap master and surround controls
-                      ad_sharing = for AD1985, turn on OMS bit and use headphone
-                      alc_jack = for ALC65x, turn on the jack sense mode
-                      inv_eapd = inverted EAPD implementation
-                      mute_led = bind EAPD bit for turning on/off mute LED
-                    For backward compatibility, the corresponding integer
-                    value -1, 0, ... are accepted, too.
+                   See "AC97 Quirk Option" section below.
     buggy_irq     - Enable workaround for buggy interrupts on some
-                    motherboards (default off)
+                    motherboards (default yes on nForce chips,
+                   otherwise off)
+    buggy_semaphore - Enable workaround for hardwares with buggy
+                   semaphores (e.g. on some ASUS laptops)
+                   (default off)
 
     Module supports autoprobe and multiple bus-master chips (max 8).
 
@@ -808,13 +821,6 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     motherboard has these devices, use the ns558 or snd-mpu401
     modules, respectively.
 
-    The ac97_quirk option is used to enable/override the workaround
-    for specific devices.  Some hardware have swapped output pins
-    between Master and Headphone, or Surround.  The driver provides
-    the auto-detection of known problematic devices, but some might
-    be unknown or wrongly detected.  In such a case, pass the proper
-    value with this option.
-
     The power-management is supported.
     
   Module snd-intel8x0m
@@ -966,7 +972,7 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     with machines with other (most likely CS423x or OPL3SAx) chips,
     even though the device is detected in lspci.  In such a case, try
     other drivers, e.g. snd-cs4232 or snd-opl3sa2.  Some has ISA-PnP
-    but some doesn't have ISA PnP.  You'll need to speicfy isapnp=0
+    but some doesn't have ISA PnP.  You'll need to specify isapnp=0
     and proper hardware parameters in the case without ISA PnP.
 
     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.
                  channels
                  [VIA8233/C, 8235, 8237 only]
     ac97_quirk  - AC'97 workaround for strange hardware
-                  See the description of intel8x0 module for details.
+                 See "AC97 Quirk Option" section below.
 
     Module supports autoprobe and multiple bus-master chips (max 8).
 
@@ -1327,16 +1333,17 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
          "lspci -nv").
          If dxs_support=5 does not work, try dxs_support=4; if it
          doesn't work too, try dxs_support=1.  (dxs_support=1 is
-         usually for old motherboards.  The correct implementated
+         usually for old motherboards.  The correct implemented
          board should work with 4 or 5.)  If it still doesn't
          work and the default setting is ok, dxs_support=3 is the
          right choice.  If the default setting doesn't work at all,
          try dxs_support=2 to disable the DXS channels.
          In any cases, please let us know the result and the
-         subsystem vendor/device ids.
+         subsystem vendor/device ids.  See "Links and Addresses"
+         below.
 
     Note: for the MPU401 on VIA823x, use snd-mpu401 driver
-         additonally.  The mpu_port option is for VIA686 chips only.
+         additionally.  The mpu_port option is for VIA686 chips only.
 
   Module snd-via82xx-modem
   ------------------------
@@ -1398,8 +1405,10 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     Module supports up to 8 cards.  The module is compiled only when
     PCMCIA is supported on kernel.
 
-    To activate the driver via the card manager, you'll need to set
-    up /etc/pcmcia/vxpocket.conf.  See the sound/pcmcia/vx/vxpocket.c.
+    With the older 2.6.x kernel, to activate the driver via the card
+    manager, you'll need to set up /etc/pcmcia/vxpocket.conf.  See the
+    sound/pcmcia/vx/vxpocket.c.  2.6.13 or later kernel requires no
+    longer require a config file.
 
     When the driver is compiled as a module and the hotplug firmware
     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.
 
     Note: the driver is build only when CONFIG_ISA is set.
     
+    Note2: snd-vxp440 driver is merged to snd-vxpocket driver since
+           ALSA 1.0.10.
+
   Module snd-ymfpci
   -----------------
 
@@ -1436,6 +1448,37 @@ Prior to version 0.9.0rc4 options had a 'snd_' prefix. This was removed.
     Note: the driver is build only when CONFIG_ISA is set.
 
 
+AC97 Quirk Option
+=================
+
+The ac97_quirk option is used to enable/override the workaround for
+specific devices on drivers for on-board AC'97 controllers like
+snd-intel8x0.  Some hardware have swapped output pins between Master
+and Headphone, or Surround (thanks to confusion of AC'97
+specifications from version to version :-)
+
+The driver provides the auto-detection of known problematic devices,
+but some might be unknown or wrongly detected.  In such a case, pass
+the proper value with this option.
+
+The following strings are accepted:
+    - default  Don't override the default setting
+    - disable  Disable the quirk
+    - hp_only  Bind Master and Headphone controls as a single control
+    - swap_hp  Swap headphone and master controls
+    - swap_surround  Swap master and surround controls
+    - ad_sharing  For AD1985, turn on OMS bit and use headphone
+    - alc_jack For ALC65x, turn on the jack sense mode
+    - inv_eapd Inverted EAPD implementation
+    - mute_led Bind EAPD bit for turning on/off mute LED
+
+For backward compatibility, the corresponding integer value -1, 0,
+... are  accepted, too.
+
+For example, if "Master" volume control has no effect on your device
+but only "Headphone" does, pass ac97_quirk=hp_only module option.
+
+
 Configuring Non-ISAPNP Cards
 ============================
 
@@ -1553,6 +1596,8 @@ Proc interfaces (/proc/asound)
          - whole-frag  write only whole fragments (optimization affecting
                        playback only)
          - no-silence  do not fill silence ahead to avoid clicks
+         - buggy-ptr   Returns the whitespace blocks in GETOPTR ioctl
+                       instead of filled blocks
 
   Example: echo "x11amp 128 16384" > /proc/asound/card0/pcm0p/oss
            echo "squake 0 0 disable" > /proc/asound/card0/pcm0c/oss
@@ -1589,9 +1634,14 @@ commands to the snd-page-alloc driver:
     use.
 
 
-Links
-=====
+Links and Addresses
+===================
 
   ALSA project homepage
        http://www.alsa-project.org
 
+  ALSA Bug Tracking System
+       https://bugtrack.alsa-project.org/bugs/
+
+  ALSA Developers ML
+       mailto:alsa-devel@lists.sourceforge.net
index 0475478c2484c90c3b14b6c74a4a8efe8fa4941b..24e85520890b902a799def758cef191f78a30490 100644 (file)
           ....
 
           /* allocate a chip-specific data with zero filled */
-          chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+          chip = kzalloc(sizeof(*chip), GFP_KERNEL);
           if (chip == NULL)
                   return -ENOMEM;
 
           After allocating a card instance via
           <function>snd_card_new()</function> (with
           <constant>NULL</constant> on the 4th arg), call
-          <function>kcalloc()</function>. 
+          <function>kzalloc()</function>. 
 
           <informalexample>
             <programlisting>
   mychip_t *chip;
   card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL);
   .....
-  chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+  chip = kzalloc(sizeof(*chip), GFP_KERNEL);
 ]]>
             </programlisting>
           </informalexample>
                   return -ENXIO;
           }
 
-          chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+          chip = kzalloc(sizeof(*chip), GFP_KERNEL);
           if (chip == NULL) {
                   pci_disable_device(pci);
                   return -ENOMEM;
       need to initialize this number as -1 before actual allocation,
       since irq 0 is valid. The port address and its resource pointer
       can be initialized as null by
-      <function>kcalloc()</function> automatically, so you
+      <function>kzalloc()</function> automatically, so you
       don't have to take care of resetting them. 
       </para>
 
index 7fcb44bc9af97e0a04e1779f6c115598e716a2ac..f6c1a142286ada86dedd2acf509dfc429b594186 100644 (file)
 #define PCI_DEVICE_ID_CIRRUS_7542      0x1200
 #define PCI_DEVICE_ID_CIRRUS_7543      0x1202
 #define PCI_DEVICE_ID_CIRRUS_7541      0x1204
+#define PCI_DEVICE_ID_CIRRUS_4610      0x6001
+#define PCI_DEVICE_ID_CIRRUS_4612      0x6003
+#define PCI_DEVICE_ID_CIRRUS_4615      0x6004
+#define PCI_DEVICE_ID_CIRRUS_4281      0x6005
 
 #define PCI_VENDOR_ID_IBM              0x1014
 #define PCI_DEVICE_ID_IBM_FIRE_CORAL   0x000a
 #define PCI_DEVICE_ID_SI_6326          0x6326
 #define PCI_DEVICE_ID_SI_7001          0x7001
 #define PCI_DEVICE_ID_SI_7012          0x7012
+#define PCI_DEVICE_ID_SI_7013          0x7013
 #define PCI_DEVICE_ID_SI_7016          0x7016
+#define PCI_DEVICE_ID_SI_7018          0x7018
 
 #define PCI_VENDOR_ID_HP               0x103c
 #define PCI_DEVICE_ID_HP_VISUALIZE_EG  0x1005
 #define PCI_DEVICE_ID_BROOKTREE_849A   0x0351
 #define PCI_DEVICE_ID_BROOKTREE_878_1  0x036e
 #define PCI_DEVICE_ID_BROOKTREE_878    0x0878
+#define PCI_DEVICE_ID_BROOKTREE_879    0x0879
 #define PCI_DEVICE_ID_BROOKTREE_8474   0x8474
 
 #define PCI_VENDOR_ID_SIERRA           0x10a8
 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_NM2160 0x0004
 #define PCI_DEVICE_ID_NEOMAGIC_MAGICMEDIA_256AV       0x0005
 #define PCI_DEVICE_ID_NEOMAGIC_MAGICGRAPH_128ZVPLUS   0x0083
+#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
+#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
+#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
 
 #define PCI_VENDOR_ID_ASP              0x10cd
 #define PCI_DEVICE_ID_ASP_ABP940       0x1200
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_SMBUS     0x0064
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2_IDE       0x0065
 #define PCI_DEVICE_ID_NVIDIA_NVENET_2          0x0066
+#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM                0x0069
 #define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO                0x006a
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SMBUS    0x0084
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_IDE      0x0085
 #define PCI_DEVICE_ID_NVIDIA_NVENET_4          0x0086
+#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM       0x0089
+#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO         0x008a
 #define PCI_DEVICE_ID_NVIDIA_NVENET_5          0x008c
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2S_SATA     0x008e
 #define PCI_DEVICE_ID_NVIDIA_ITNT2             0x00A0
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_SMBUS     0x00d4
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3_IDE       0x00d5
 #define PCI_DEVICE_ID_NVIDIA_NVENET_3          0x00d6
+#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM                0x00d9
 #define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO                0x00da
 #define PCI_DEVICE_ID_NVIDIA_NVENET_7          0x00df
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S          0x00e1
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SMBUS    0x00e4
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_IDE      0x00e5
 #define PCI_DEVICE_ID_NVIDIA_NVENET_6          0x00e6
+#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO                0x00ea
 #define PCI_DEVICE_ID_NVIDIA_NFORCE3S_SATA2    0x00ee
 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_SDR       0x0100
 #define PCI_DEVICE_ID_NVIDIA_GEFORCE_DDR       0x0101
 #define PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO                0x01b1
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_SMBUS      0x01b4
 #define PCI_DEVICE_ID_NVIDIA_NFORCE_IDE                0x01bc
+#define PCI_DEVICE_ID_NVIDIA_MCP1_MODEM                0x01c1
 #define PCI_DEVICE_ID_NVIDIA_NVENET_1          0x01c3
 #define PCI_DEVICE_ID_NVIDIA_NFORCE2           0x01e0
 #define PCI_DEVICE_ID_NVIDIA_GEFORCE3          0x0200
 #define PCI_DEVICE_ID_REALTEK_8169     0x8169
 
 #define PCI_VENDOR_ID_XILINX           0x10ee
+#define PCI_DEVICE_ID_RME_DIGI96       0x3fc0
+#define PCI_DEVICE_ID_RME_DIGI96_8     0x3fc1
+#define PCI_DEVICE_ID_RME_DIGI96_8_PRO 0x3fc2
+#define PCI_DEVICE_IDRME__DIGI96_8_PAD_OR_PST 0x3fc3
+#define PCI_DEVICE_ID_XILINX_HAMMERFALL        0x3fc4
+#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
+#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
 #define PCI_DEVICE_ID_TURBOPAM         0x4020
 
 #define PCI_VENDOR_ID_TRUEVISION       0x10fa
 #define PCI_DEVICE_ID_ESS_ESS1968      0x1968
 #define PCI_DEVICE_ID_ESS_AUDIOPCI     0x1969
 #define PCI_DEVICE_ID_ESS_ESS1978      0x1978
+#define PCI_DEVICE_ID_ESS_ALLEGRO_1    0x1988
+#define PCI_DEVICE_ID_ESS_ALLEGRO      0x1989
+#define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990
+#define PCI_DEVICE_ID_ESS_CANYON3D_2   0x1992
+#define PCI_DEVICE_ID_ESS_MAESTRO3     0x1998
+#define PCI_DEVICE_ID_ESS_MAESTRO3_1   0x1999
+#define PCI_DEVICE_ID_ESS_MAESTRO3_HW  0x199a
+#define PCI_DEVICE_ID_ESS_MAESTRO3_2   0x199b
 
 #define PCI_VENDOR_ID_SATSAGEM         0x1267
 #define PCI_DEVICE_ID_SATSAGEM_NICCY   0x1016
 #define PCI_DEVICE_ID_LMC_SSI          0x0005
 #define PCI_DEVICE_ID_LMC_T1           0x0006
 
+#define PCI_VENDOR_ID_MARIAN           0x1382
+#define PCI_DEVICE_ID_MARIAN_PRODIF_PLUS 0x2048
+
 #define PCI_VENDOR_ID_NETGEAR          0x1385
 #define PCI_DEVICE_ID_NETGEAR_GA620    0x620a
 #define PCI_DEVICE_ID_NETGEAR_GA622    0x622a
 #define PCI_VENDOR_ID_TIMEDIA          0x1409
 #define PCI_DEVICE_ID_TIMEDIA_1889     0x7168
 
+#define PCI_VENDOR_ID_ICE              0x1412
+#define PCI_DEVICE_ID_ICE_1712         0x1712
+#define PCI_DEVICE_ID_VT1724           0x1724
+
 #define PCI_VENDOR_ID_OXSEMI           0x1415
 #define PCI_DEVICE_ID_OXSEMI_12PCI840  0x8403
 #define PCI_DEVICE_ID_OXSEMI_16PCI954  0x9501
 #define PCI_DEVICE_ID_INTEL_82443BX_1  0x7191
 #define PCI_DEVICE_ID_INTEL_82443BX_2  0x7192
 #define PCI_DEVICE_ID_INTEL_440MX      0x7195
+#define PCI_DEVICE_ID_INTEL_440MX_6    0x7196
 #define PCI_DEVICE_ID_INTEL_82443MX_0  0x7198
 #define PCI_DEVICE_ID_INTEL_82443MX_1  0x7199
 #define PCI_DEVICE_ID_INTEL_82443MX_2  0x719a
 #define PCI_VENDOR_ID_TTTECH           0x0357
 #define PCI_DEVICE_ID_TTTECH_MC322     0x000A
 
+#define PCI_VENDOR_ID_XILINX_RME       0xea60
+#define PCI_DEVICE_ID_RME_DIGI32       0x9896
+#define PCI_DEVICE_ID_RME_DIGI32_PRO   0x9897
+#define PCI_DEVICE_ID_RME_DIGI32_8     0x9898
+
 #define PCI_VENDOR_ID_ARK              0xedd8
 #define PCI_DEVICE_ID_ARK_STING                0xa091
 #define PCI_DEVICE_ID_ARK_STINGARK     0xa099
index 3dc41fd5c54d46730d39c01967c93d05e5b48b32..26160adcdffccb3e70e8f5d189863bc310f62985 100644 (file)
@@ -168,6 +168,9 @@ struct _snd_card {
        wait_queue_head_t shutdown_sleep;
        struct work_struct free_workq;  /* for free in workqueue */
        struct device *dev;
+#ifdef CONFIG_SND_GENERIC_DRIVER
+       struct snd_generic_device *generic_dev;
+#endif
 
 #ifdef CONFIG_PM
        int (*pm_suspend)(snd_card_t *card, pm_message_t state);
@@ -176,9 +179,6 @@ struct _snd_card {
        unsigned int power_state;       /* power state */
        struct semaphore power_lock;    /* power lock */
        wait_queue_head_t power_sleep;
-#ifdef CONFIG_SND_GENERIC_PM
-       struct snd_generic_device *pm_dev;      /* for ISA */
-#endif
 #endif
 
 #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);
 #ifndef snd_card_set_dev
 #define snd_card_set_dev(card,devptr) ((card)->dev = (devptr))
 #endif
+/* register a generic device (for ISA, etc) */
+int snd_card_set_generic_dev(snd_card_t *card);
 
 /* device.c */
 
index 9b94510eda60224f67d513e27ca1f1b4bd0596d6..b0c0e192eb56711f9ab623805f2dc02eed8106a0 100644 (file)
 #include "ac97_codec.h"
 #include "cs46xx_dsp_spos.h"
 
-#ifndef PCI_VENDOR_ID_CIRRUS
-#define PCI_VENDOR_ID_CIRRUS            0x1013
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4610
-#define PCI_DEVICE_ID_CIRRUS_4610       0x6001
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4612
-#define PCI_DEVICE_ID_CIRRUS_4612       0x6003
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4615
-#define PCI_DEVICE_ID_CIRRUS_4615       0x6004
-#endif
-
 /*
  *  Direct registers
  */
@@ -1715,7 +1702,6 @@ struct _snd_cs46xx {
        void (*active_ctrl)(cs46xx_t *, int);
        void (*mixer_init)(cs46xx_t *);
 
-       struct pci_dev *acpi_dev;
        int acpi_port;
        snd_kcontrol_t *eapd_switch; /* for amplifier hack */
        int accept_valid;       /* accept mmap valid (for OSS) */
index 4e3993dfcefef1a9301e0eee798c6554b42cc4cb..67bf3f18e96a81702821ad1c739f7422cc35892e 100644 (file)
 #include <linux/interrupt.h>
 #include <asm/io.h>
 
-#ifndef PCI_VENDOR_ID_CREATIVE
-#define PCI_VENDOR_ID_CREATIVE         0x1102
-#endif
-#ifndef PCI_DEVICE_ID_CREATIVE_EMU10K1
-#define PCI_DEVICE_ID_CREATIVE_EMU10K1 0x0002
-#endif
-
 /* ------------------- DEFINES -------------------- */
 
 #define EMUPAGESIZE     4096
index d6361dab0370856e3fb3638b442798c435a5c5af..2b23a596707114faf2315b9fef045890cab95550 100644 (file)
@@ -903,13 +903,16 @@ int snd_pcm_format_unsigned(snd_pcm_format_t format);
 int snd_pcm_format_linear(snd_pcm_format_t format);
 int snd_pcm_format_little_endian(snd_pcm_format_t format);
 int snd_pcm_format_big_endian(snd_pcm_format_t format);
-/*
+#if 0 /* just for DocBook */
+/**
  * snd_pcm_format_cpu_endian - Check the PCM format is CPU-endian
  * @format: the format to check
  *
  * Returns 1 if the given PCM format is CPU-endian, 0 if
  * opposite, or a negative error code if endian not specified.
  */
+int snd_pcm_format_cpu_endian(snd_pcm_format_t format);
+#endif /* DocBook */
 #ifdef SNDRV_LITTLE_ENDIAN
 #define snd_pcm_format_cpu_endian(format) snd_pcm_format_little_endian(format)
 #else
index 518728536bc6e644c8935288a929ae89f0ae2052..0b67c9d105af0e9d5cb1eea6ee31f7e00104bfd4 100644 (file)
@@ -32,7 +32,8 @@ struct _snd_pcm_oss_setup {
                     block:1,
                     nonblock:1,
                     partialfrag:1,
-                    nosilence:1;
+                    nosilence:1,
+                    buggyptr:1;
        unsigned int periods;
        unsigned int period_size;
        snd_pcm_oss_setup_t *next;
index f5254ec36e6af5335b7d96728a8a754f596ac29a..a408d39250503eeed51c9d5eb918ed87b9df351c 100644 (file)
 //#include "ainstr_gf1.h"
 #include "ainstr_simple.h"
 
-#ifndef PCI_VENDOR_ID_TRIDENT
-#define PCI_VENDOR_ID_TRIDENT          0x1023
-#endif
-#ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_DX 
-#define PCI_DEVICE_ID_TRIDENT_4DWAVE_DX        0x2000
-#endif
-#ifndef PCI_DEVICE_ID_TRIDENT_4DWAVE_NX 
-#define PCI_DEVICE_ID_TRIDENT_4DWAVE_NX        0x2001
-#endif
-
-#ifndef PCI_VENDOR_ID_SI
-#define PCI_VENDOR_ID_SI               0x1039
-#endif
-#ifndef PCI_DEVICE_ID_SI_7018
-#define PCI_DEVICE_ID_SI_7018          0x7018
-#endif
-
 #define TRIDENT_DEVICE_ID_DX           ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_DX)
 #define TRIDENT_DEVICE_ID_NX           ((PCI_VENDOR_ID_TRIDENT<<16)|PCI_DEVICE_ID_TRIDENT_4DWAVE_NX)
 #define TRIDENT_DEVICE_ID_SI7018       ((PCI_VENDOR_ID_SI<<16)|PCI_DEVICE_ID_SI_7018)
index 8d19bfabb7e0812caf0963dfb763e92329fb1d82..ee32af20dba9de068ac7ee2f680776664ac9dbc0 100644 (file)
@@ -1,3 +1,3 @@
 /* include/version.h.  Generated by configure.  */
 #define CONFIG_SND_VERSION "1.0.10rc1"
-#define CONFIG_SND_DATE " (Tue Aug 30 05:31:08 2005 UTC)"
+#define CONFIG_SND_DATE " (Mon Sep 12 08:13:09 2005 UTC)"
index 9a3c1e6c820a2d28ddec0cffdaa83cfe7ba81d1f..c3bccbfd8d4c344ac7336a4084deeb3226ebea54 100644 (file)
 #include "timer.h"
 #include <linux/gameport.h>
 
-#ifndef PCI_VENDOR_ID_YAMAHA
-#define PCI_VENDOR_ID_YAMAHA            0x1073
-#endif
-#ifndef PCI_DEVICE_ID_YAMAHA_724
-#define PCI_DEVICE_ID_YAMAHA_724       0x0004
-#endif
-#ifndef PCI_DEVICE_ID_YAMAHA_724F
-#define PCI_DEVICE_ID_YAMAHA_724F      0x000d
-#endif
-#ifndef PCI_DEVICE_ID_YAMAHA_740
-#define PCI_DEVICE_ID_YAMAHA_740       0x000a
-#endif
-#ifndef PCI_DEVICE_ID_YAMAHA_740C
-#define PCI_DEVICE_ID_YAMAHA_740C      0x000c
-#endif
-#ifndef PCI_DEVICE_ID_YAMAHA_744
-#define PCI_DEVICE_ID_YAMAHA_744       0x0010
-#endif
-#ifndef PCI_DEVICE_ID_YAMAHA_754
-#define PCI_DEVICE_ID_YAMAHA_754       0x0012
-#endif
-
 /*
  *  Direct registers
  */
index 2e4a5e0d16db3726755dea8c8930f35138927395..0864a7ce414d7bddb48a7497314e90a5d956d159 100644 (file)
@@ -7,6 +7,7 @@ config SND_SA11XX_UDA1341
        tristate "SA11xx UDA1341TS driver (iPaq H3600)"
        depends on ARCH_SA1100 && SND && L3
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here if you have a Compaq iPaq H3x00 handheld computer
          and want to use its Philips UDA 1341 audio chip.
index 98877030d579fa6f641dee8dca596241940f32e6..34195b7486082f6550997947459a38b554800ea9 100644 (file)
@@ -900,6 +900,8 @@ static int __devinit aaci_probe(struct amba_device *dev, void *id)
        if (ret)
                goto out;
 
+       snd_card_set_dev(aaci->card, &dev->dev);
+
        ret = snd_card_register(aaci->card);
        if (ret == 0) {
                dev_info(&dev->dev, "%s, fifo %d\n", aaci->card->longname,
index 174bc032d1ad5e988875fe95e9f1a71ad96f97ee..6ee912259cc53b14aa900863d4ef5d89b74f5bbf 100644 (file)
@@ -21,7 +21,7 @@
  *                              merged HAL layer (patches from Brian)
  */
 
-/* $Id: sa11xx-uda1341.c,v 1.21 2005/01/28 19:34:04 tiwai Exp $ */
+/* $Id: sa11xx-uda1341.c,v 1.23 2005/09/09 13:22:34 tiwai Exp $ */
 
 /***************************************************************************************************
 *
@@ -918,7 +918,7 @@ static int __init sa11xx_uda1341_init(void)
        if (card == NULL)
                return -ENOMEM;
 
-       sa11xx_uda1341 = kcalloc(1, sizeof(*sa11xx_uda1341), GFP_KERNEL);
+       sa11xx_uda1341 = kzalloc(sizeof(*sa11xx_uda1341), GFP_KERNEL);
        if (sa11xx_uda1341 == NULL)
                return -ENOMEM; 
        spin_lock_init(&chip->s[0].dma_lock);
@@ -946,6 +946,9 @@ static int __init sa11xx_uda1341_init(void)
        strcpy(card->shortname, "H3600 UDA1341TS");
        sprintf(card->longname, "Compaq iPAQ H3600 with Philips UDA1341TS");
         
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto nodev;
+
        if ((err = snd_card_register(card)) == 0) {
                printk( KERN_INFO "iPAQ audio support initialized\n" );
                return 0;
index d1e800b9866df5a2d6303dfa6b9b3430bc7be23f..48cf45cfd0b7943f23f1890fa3c898dc1b5a98eb 100644 (file)
@@ -99,6 +99,18 @@ config SND_RTCTIMER
          To compile this driver as a module, choose M here: the module
          will be called snd-rtctimer.
 
+config SND_SEQ_RTCTIMER_DEFAULT
+       bool "Use RTC as default sequencer timer"
+       depends on SND_RTCTIMER && SND_SEQUENCER
+       default y
+       help
+         Say Y here to use the RTC timer as the default sequencer
+         timer.  This is strongly recommended because it ensures
+         precise MIDI timing even when the system timer runs at less
+         than 1000 Hz.
+
+         If in doubt, say Y.
+
 config SND_VERBOSE_PRINTK
        bool "Verbose printk"
        depends on SND
@@ -128,6 +140,6 @@ config SND_DEBUG_DETECT
          Say Y here to enable extra-verbose log messages printed when
          detecting devices.
 
-config SND_GENERIC_PM
+config SND_GENERIC_DRIVER
        bool
        depends on SND
index 227f3cf02771605d11e8ddd32c565bc902d75d7d..736edf358e050cee4f93e698811e974fe2f380c0 100644 (file)
@@ -69,7 +69,7 @@ static int snd_ctl_open(struct inode *inode, struct file *file)
                err = -EFAULT;
                goto __error2;
        }
-       ctl = kcalloc(1, sizeof(*ctl), GFP_KERNEL);
+       ctl = kzalloc(sizeof(*ctl), GFP_KERNEL);
        if (ctl == NULL) {
                err = -ENOMEM;
                goto __error;
@@ -162,7 +162,7 @@ void snd_ctl_notify(snd_card_t *card, unsigned int mask, snd_ctl_elem_id_t *id)
                                goto _found;
                        }
                }
-               ev = kcalloc(1, sizeof(*ev), GFP_ATOMIC);
+               ev = kzalloc(sizeof(*ev), GFP_ATOMIC);
                if (ev) {
                        ev->id = *id;
                        ev->mask = mask;
@@ -195,7 +195,7 @@ snd_kcontrol_t *snd_ctl_new(snd_kcontrol_t * control, unsigned int access)
        
        snd_runtime_check(control != NULL, return NULL);
        snd_runtime_check(control->count > 0, return NULL);
-       kctl = kcalloc(1, sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL);
+       kctl = kzalloc(sizeof(*kctl) + sizeof(snd_kcontrol_volatile_t) * control->count, GFP_KERNEL);
        if (kctl == NULL)
                return NULL;
        *kctl = *control;
@@ -521,7 +521,7 @@ static int snd_ctl_card_info(snd_card_t * card, snd_ctl_file_t * ctl,
 {
        snd_ctl_card_info_t *info;
 
-       info = kcalloc(1, sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (! info)
                return -ENOMEM;
        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
                return -EINVAL;
        }
        private_size *= info->count;
-       ue = kcalloc(1, sizeof(struct user_element) + private_size, GFP_KERNEL);
+       ue = kzalloc(sizeof(struct user_element) + private_size, GFP_KERNEL);
        if (ue == NULL)
                return -ENOMEM;
        ue->info = *info;
@@ -1185,7 +1185,7 @@ static int _snd_ctl_register_ioctl(snd_kctl_ioctl_func_t fcn, struct list_head *
 {
        snd_kctl_ioctl_t *pn;
 
-       pn = kcalloc(1, sizeof(snd_kctl_ioctl_t), GFP_KERNEL);
+       pn = kzalloc(sizeof(snd_kctl_ioctl_t), GFP_KERNEL);
        if (pn == NULL)
                return -ENOMEM;
        pn->fioctl = fcn;
index 7fdabea4bfc8bf081e0e8ac8b46315c40762a11c..207c7de5129cba64c7ad340d7152352bb2a81973 100644 (file)
@@ -92,7 +92,7 @@ static int snd_ctl_elem_info_compat(snd_ctl_file_t *ctl, struct sndrv_ctl_elem_i
        struct sndrv_ctl_elem_info *data;
        int err;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (! data)
                return -ENOMEM;
 
@@ -271,7 +271,7 @@ static int snd_ctl_elem_read_user_compat(snd_card_t *card,
        struct sndrv_ctl_elem_value *data;
        int err, type, count;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
@@ -291,7 +291,7 @@ static int snd_ctl_elem_write_user_compat(snd_ctl_file_t *file,
        struct sndrv_ctl_elem_value *data;
        int err, type, count;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL)
                return -ENOMEM;
 
@@ -313,7 +313,7 @@ static int snd_ctl_elem_add_compat(snd_ctl_file_t *file,
        struct sndrv_ctl_elem_info *data;
        int err;
 
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (! data)
                return -ENOMEM;
 
index ca00ad7740c983de5d10f8fbe06ba96be09dd6b4..1f509f56e60c82108007dc6baa01b72fb1f91027 100644 (file)
@@ -49,7 +49,7 @@ int snd_device_new(snd_card_t *card, snd_device_type_t type,
        snd_assert(card != NULL, return -ENXIO);
        snd_assert(device_data != NULL, return -ENXIO);
        snd_assert(ops != NULL, return -ENXIO);
-       dev = kcalloc(1, sizeof(*dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL)
                return -ENOMEM;
        dev->card = card;
index 997dd41c584e67b9a71347a9935454e2ae07c575..9383f1294fb5ec528bd2160df78fd1b579ec5279 100644 (file)
@@ -359,7 +359,7 @@ int snd_hwdep_new(snd_card_t * card, char *id, int device, snd_hwdep_t ** rhwdep
        snd_assert(rhwdep != NULL, return -EINVAL);
        *rhwdep = NULL;
        snd_assert(card != NULL, return -ENXIO);
-       hwdep = kcalloc(1, sizeof(*hwdep), GFP_KERNEL);
+       hwdep = kzalloc(sizeof(*hwdep), GFP_KERNEL);
        if (hwdep == NULL)
                return -ENOMEM;
        hwdep->card = card;
index 7f8bdf7b00588d55af030fa463bafb50b6744105..37024d68a26ea25a5358aff96c5c34857fc549d2 100644 (file)
@@ -295,7 +295,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
                        goto __error;
                }
        }
-       data = kcalloc(1, sizeof(*data), GFP_KERNEL);
+       data = kzalloc(sizeof(*data), GFP_KERNEL);
        if (data == NULL) {
                err = -ENOMEM;
                goto __error;
@@ -304,7 +304,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
        switch (entry->content) {
        case SNDRV_INFO_CONTENT_TEXT:
                if (mode == O_RDONLY || mode == O_RDWR) {
-                       buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL);
+                       buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
                        if (buffer == NULL) {
                                kfree(data);
                                err = -ENOMEM;
@@ -323,7 +323,7 @@ static int snd_info_entry_open(struct inode *inode, struct file *file)
                        data->rbuffer = buffer;
                }
                if (mode == O_WRONLY || mode == O_RDWR) {
-                       buffer = kcalloc(1, sizeof(*buffer), GFP_KERNEL);
+                       buffer = kzalloc(sizeof(*buffer), GFP_KERNEL);
                        if (buffer == NULL) {
                                if (mode == O_RDWR) {
                                        vfree(data->rbuffer->buffer);
@@ -752,7 +752,7 @@ char *snd_info_get_str(char *dest, char *src, int len)
 static snd_info_entry_t *snd_info_create_entry(const char *name)
 {
        snd_info_entry_t *entry;
-       entry = kcalloc(1, sizeof(*entry), GFP_KERNEL);
+       entry = kzalloc(sizeof(*entry), GFP_KERNEL);
        if (entry == NULL)
                return NULL;
        entry->name = kstrdup(name, GFP_KERNEL);
index d72f58f450ce442dac0386be21a94c567ac2e293..a5702014a704e0ffcbf153156532fd69a151601b 100644 (file)
@@ -72,7 +72,7 @@ snd_card_t *snd_card_new(int idx, const char *xid,
 
        if (extra_size < 0)
                extra_size = 0;
-       card = kcalloc(1, sizeof(*card) + extra_size, GFP_KERNEL);
+       card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
        if (card == NULL)
                return NULL;
        if (xid) {
@@ -226,8 +226,10 @@ int snd_card_disconnect(snd_card_t * card)
        return 0;       
 }
 
-#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM)
-static void snd_generic_device_unregister(struct snd_generic_device *dev);
+#ifdef CONFIG_SND_GENERIC_DRIVER
+static void snd_generic_device_unregister(snd_card_t *card);
+#else
+#define snd_generic_device_unregister(x) /*NOP*/
 #endif
 
 /**
@@ -253,14 +255,7 @@ int snd_card_free(snd_card_t * card)
 
 #ifdef CONFIG_PM
        wake_up(&card->power_sleep);
-#ifdef CONFIG_SND_GENERIC_PM
-       if (card->pm_dev) {
-               snd_generic_device_unregister(card->pm_dev);
-               card->pm_dev = NULL;
-       }
-#endif
 #endif
-
        /* wait, until all devices are ready for the free operation */
        wait_event(card->shutdown_sleep, card->files == NULL);
 
@@ -288,6 +283,7 @@ int snd_card_free(snd_card_t * card)
                snd_printk(KERN_WARNING "unable to free card info\n");
                /* Not fatal error */
        }
+       snd_generic_device_unregister(card);
        while (card->s_f_ops) {
                s_f_ops = card->s_f_ops;
                card->s_f_ops = s_f_ops->next;
@@ -665,6 +661,96 @@ int snd_card_file_remove(snd_card_t *card, struct file *file)
        return 0;
 }
 
+#ifdef CONFIG_SND_GENERIC_DRIVER
+/*
+ * generic device without a proper bus using platform_device
+ * (e.g. ISA)
+ */
+struct snd_generic_device {
+       struct platform_device pdev;
+       snd_card_t *card;
+};
+
+#define get_snd_generic_card(dev)      container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card
+
+#define SND_GENERIC_NAME       "snd_generic"
+
+#ifdef CONFIG_PM
+static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
+static int snd_generic_resume(struct device *dev, u32 level);
+#endif
+
+/* initialized in sound.c */
+struct device_driver snd_generic_driver = {
+       .name           = SND_GENERIC_NAME,
+       .bus            = &platform_bus_type,
+#ifdef CONFIG_PM
+       .suspend        = snd_generic_suspend,
+       .resume         = snd_generic_resume,
+#endif
+};
+
+void snd_generic_device_release(struct device *dev)
+{
+}
+
+static int snd_generic_device_register(snd_card_t *card)
+{
+       struct snd_generic_device *dev;
+       int err;
+
+       if (card->generic_dev)
+               return 0; /* already registered */
+
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
+       if (! dev) {
+               snd_printk(KERN_ERR "can't allocate generic_device\n");
+               return -ENOMEM;
+       }
+
+       dev->pdev.name = SND_GENERIC_NAME;
+       dev->pdev.id = card->number;
+       dev->pdev.dev.release = snd_generic_device_release;
+       dev->card = card;
+       if ((err = platform_device_register(&dev->pdev)) < 0) {
+               kfree(dev);
+               return err;
+       }
+       card->generic_dev = dev;
+       return 0;
+}
+
+static void snd_generic_device_unregister(snd_card_t *card)
+{
+       struct snd_generic_device *dev = card->generic_dev;
+       if (dev) {
+               platform_device_unregister(&dev->pdev);
+               kfree(dev);
+               card->generic_dev = NULL;
+       }
+}
+
+/**
+ * snd_card_set_generic_dev - assign the generic device to the card
+ * @card: soundcard structure
+ *
+ * Assigns a generic device to the card.  This function is provided as the
+ * last resort, for devices without any proper bus.  Thus this won't override
+ * the device already assigned to the card.
+ * 
+ * Returns zero if successful, or a negative error code.
+ */
+int snd_card_set_generic_dev(snd_card_t *card)
+{
+       int err;
+       if ((err = snd_generic_device_register(card)) < 0)
+               return err;
+       if (! card->dev)
+               snd_card_set_dev(card, &card->generic_dev->pdev.dev);
+       return 0;
+}
+#endif /* CONFIG_SND_GENERIC_DRIVER */
+
 #ifdef CONFIG_PM
 /**
  *  snd_power_wait - wait until the power-state is changed.
@@ -730,75 +816,7 @@ int snd_card_set_pm_callback(snd_card_t *card,
        return 0;
 }
 
-#ifdef CONFIG_SND_GENERIC_PM
-/*
- * use platform_device for generic power-management without a proper bus
- * (e.g. ISA)
- */
-struct snd_generic_device {
-       struct platform_device pdev;
-       snd_card_t *card;
-};
-
-#define get_snd_generic_card(dev)      container_of(to_platform_device(dev), struct snd_generic_device, pdev)->card
-
-#define SND_GENERIC_NAME       "snd_generic_pm"
-
-static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level);
-static int snd_generic_resume(struct device *dev, u32 level);
-
-static struct device_driver snd_generic_driver = {
-       .name           = SND_GENERIC_NAME,
-       .bus            = &platform_bus_type,
-       .suspend        = snd_generic_suspend,
-       .resume         = snd_generic_resume,
-};
-
-static int generic_driver_registered;
-
-static void generic_driver_unregister(void)
-{
-       if (generic_driver_registered) {
-               generic_driver_registered--;
-               if (! generic_driver_registered)
-                       driver_unregister(&snd_generic_driver);
-       }
-}
-
-static struct snd_generic_device *snd_generic_device_register(snd_card_t *card)
-{
-       struct snd_generic_device *dev;
-
-       if (! generic_driver_registered) {
-               if (driver_register(&snd_generic_driver) < 0)
-                       return NULL;
-       }
-       generic_driver_registered++;
-
-       dev = kcalloc(1, sizeof(*dev), GFP_KERNEL);
-       if (! dev) {
-               generic_driver_unregister();
-               return NULL;
-       }
-
-       dev->pdev.name = SND_GENERIC_NAME;
-       dev->pdev.id = card->number;
-       dev->card = card;
-       if (platform_device_register(&dev->pdev) < 0) {
-               kfree(dev);
-               generic_driver_unregister();
-               return NULL;
-       }
-       return dev;
-}
-
-static void snd_generic_device_unregister(struct snd_generic_device *dev)
-{
-       platform_device_unregister(&dev->pdev);
-       kfree(dev);
-       generic_driver_unregister();
-}
-
+#ifdef CONFIG_SND_GENERIC_DRIVER
 /* suspend/resume callbacks for snd_generic platform device */
 static int snd_generic_suspend(struct device *dev, pm_message_t state, u32 level)
 {
@@ -846,13 +864,12 @@ int snd_card_set_generic_pm_callback(snd_card_t *card,
                                 int (*resume)(snd_card_t *),
                                 void *private_data)
 {
-       card->pm_dev = snd_generic_device_register(card);
-       if (! card->pm_dev)
-               return -ENOMEM;
-       snd_card_set_pm_callback(card, suspend, resume, private_data);
-       return 0;
+       int err;
+       if ((err = snd_generic_device_register(card)) < 0)
+               return err;
+       return snd_card_set_pm_callback(card, suspend, resume, private_data);
 }
-#endif /* CONFIG_SND_GENERIC_PM */
+#endif /* CONFIG_SND_GENERIC_DRIVER */
 
 #ifdef CONFIG_PCI
 int snd_card_pci_suspend(struct pci_dev *dev, pm_message_t state)
index 39a54a415528080a01620e71d7a40efdcbac1e66..91124ddbdda939322f6bc813fa418578b9ff2280 100644 (file)
@@ -590,7 +590,7 @@ static int snd_mem_proc_write(struct file *file, const char __user *buffer,
 
                alloced = 0;
                pci = NULL;
-               while ((pci = pci_find_device(vendor, device, pci)) != NULL) {
+               while ((pci = pci_get_device(vendor, device, pci)) != NULL) {
                        if (mask > 0 && mask < 0xffffffff) {
                                if (pci_set_dma_mask(pci, mask) < 0 ||
                                    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,
                                if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(pci),
                                                        size, &dmab) < 0) {
                                        printk(KERN_ERR "snd-page-alloc: cannot allocate buffer pages (size = %d)\n", size);
+                                       pci_dev_put(pci);
                                        return (int)count;
                                }
                                snd_dma_reserve_buf(&dmab, snd_dma_pci_buf_id(pci));
index 291b4769bde38f2bf2775958ce94f200e62f9732..8fa888fc53a0a6b8d717142240960696e959db12 100644 (file)
@@ -249,7 +249,7 @@ int __exit snd_memory_info_done(void)
 int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size_t count)
 {
 #if defined(__i386__) || defined(CONFIG_SPARC32)
-       return copy_to_user(dst, (const void*)src, count) ? -EFAULT : 0;
+       return copy_to_user(dst, (const void __force*)src, count) ? -EFAULT : 0;
 #else
        char buf[256];
        while (count) {
@@ -280,7 +280,7 @@ int copy_to_user_fromio(void __user *dst, const volatile void __iomem *src, size
 int copy_from_user_toio(volatile void __iomem *dst, const void __user *src, size_t count)
 {
 #if defined(__i386__) || defined(CONFIG_SPARC32)
-       return copy_from_user((void*)dst, src, count) ? -EFAULT : 0;
+       return copy_from_user((void __force *)dst, src, count) ? -EFAULT : 0;
 #else
        char buf[256];
        while (count) {
index 98fc0766f8853731757105c534556e27712e1e8f..69e1059112d1ace7eadd3fd85a40b48020488394 100644 (file)
@@ -53,7 +53,7 @@ static int snd_mixer_oss_open(struct inode *inode, struct file *file)
        err = snd_card_file_add(card, file);
        if (err < 0)
                return err;
-       fmixer = kcalloc(1, sizeof(*fmixer), GFP_KERNEL);
+       fmixer = kzalloc(sizeof(*fmixer), GFP_KERNEL);
        if (fmixer == NULL) {
                snd_card_file_remove(card, file);
                return -ENOMEM;
@@ -517,8 +517,8 @@ static void snd_mixer_oss_get_volume1_vol(snd_mixer_oss_file_t *fmixer,
                up_read(&card->controls_rwsem);
                return;
        }
-       uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (uinfo == NULL || uctl == NULL)
                goto __unalloc;
        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,
                up_read(&card->controls_rwsem);
                return;
        }
-       uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (uinfo == NULL || uctl == NULL)
                goto __unalloc;
        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,
        down_read(&card->controls_rwsem);
        if ((kctl = snd_ctl_find_numid(card, numid)) == NULL)
                return;
-       uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (uinfo == NULL || uctl == NULL)
                goto __unalloc;
        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,
                up_read(&fmixer->card->controls_rwsem);
                return;
        }
-       uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (uinfo == NULL || uctl == NULL)
                goto __unalloc;
        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
        snd_ctl_elem_value_t *uctl;
        int err, idx;
        
-       uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (uinfo == NULL || uctl == NULL) {
                err = -ENOMEM;
                goto __unlock;
@@ -813,8 +813,8 @@ static int snd_mixer_oss_put_recsrc2(snd_mixer_oss_file_t *fmixer, unsigned int
        int err;
        unsigned int idx;
 
-       uinfo = kcalloc(1, sizeof(*uinfo), GFP_KERNEL);
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uinfo = kzalloc(sizeof(*uinfo), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (uinfo == NULL || uctl == NULL) {
                err = -ENOMEM;
                goto __unlock;
index a13bd7bb4c9f08cf6628ce8856f1c56896ba2e9c..842c28b2ed55cfad9266cd3e0245fe2f4648892d 100644 (file)
@@ -850,7 +850,9 @@ static ssize_t snd_pcm_oss_write1(snd_pcm_substream_t *substream, const char __u
                                        return xfer > 0 ? xfer : -EAGAIN;
                        }
                } else {
-                       tmp = snd_pcm_oss_write2(substream, (const char *)buf, runtime->oss.period_bytes, 0);
+                       tmp = snd_pcm_oss_write2(substream,
+                                                (const char __force *)buf,
+                                                runtime->oss.period_bytes, 0);
                        if (tmp <= 0)
                                return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
                        runtime->oss.bytes += tmp;
@@ -926,7 +928,8 @@ static ssize_t snd_pcm_oss_read1(snd_pcm_substream_t *substream, char __user *bu
                        xfer += tmp;
                        runtime->oss.buffer_used -= tmp;
                } else {
-                       tmp = snd_pcm_oss_read2(substream, (char *)buf, runtime->oss.period_bytes, 0);
+                       tmp = snd_pcm_oss_read2(substream, (char __force *)buf,
+                                               runtime->oss.period_bytes, 0);
                        if (tmp <= 0)
                                return xfer > 0 ? (snd_pcm_sframes_t)xfer : tmp;
                        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
        } else {
                delay = snd_pcm_oss_bytes(substream, delay);
                if (stream == SNDRV_PCM_STREAM_PLAYBACK) {
-                       info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
+                       snd_pcm_oss_setup_t *setup = substream->oss.setup;
+                       if (setup && setup->buggyptr)
+                               info.blocks = (runtime->oss.buffer_bytes - delay - fixup) / runtime->oss.period_bytes;
+                       else
+                               info.blocks = (delay + fixup) / runtime->oss.period_bytes;
                        info.bytes = (runtime->oss.bytes - delay) & INT_MAX;
                } else {
                        delay += fixup;
@@ -1733,7 +1740,7 @@ static int snd_pcm_oss_open_file(struct file *file,
        snd_assert(rpcm_oss_file != NULL, return -EINVAL);
        *rpcm_oss_file = NULL;
 
-       pcm_oss_file = kcalloc(1, sizeof(*pcm_oss_file), GFP_KERNEL);
+       pcm_oss_file = kzalloc(sizeof(*pcm_oss_file), GFP_KERNEL);
        if (pcm_oss_file == NULL)
                return -ENOMEM;
 
@@ -2347,6 +2354,8 @@ static void snd_pcm_oss_proc_write(snd_info_entry_t *entry,
                                template.partialfrag = 1;
                        } else if (!strcmp(str, "no-silence")) {
                                template.nosilence = 1;
+                       } else if (!strcmp(str, "buggy-ptr")) {
+                               template.buggyptr = 1;
                        }
                } while (*str);
                if (setup == NULL) {
index 6430410c6c04703af940b04f377b15fdb304572a..fc23373c000dda4ddf6cd66b5cb8d585b1f59c7d 100644 (file)
@@ -171,7 +171,7 @@ int snd_pcm_plugin_build(snd_pcm_plug_t *plug,
        
        snd_assert(plug != NULL, return -ENXIO);
        snd_assert(src_format != NULL && dst_format != NULL, return -ENXIO);
-       plugin = kcalloc(1, sizeof(*plugin) + extra, GFP_KERNEL);
+       plugin = kzalloc(sizeof(*plugin) + extra, GFP_KERNEL);
        if (plugin == NULL)
                return -ENOMEM;
        plugin->name = name;
index 9f4c9209b2717a0ff23b938402e9fb5132efeaeb..1be470e942efa6e0c6159d99a0bac430caa553f2 100644 (file)
@@ -597,7 +597,7 @@ int snd_pcm_new_stream(snd_pcm_t *pcm, int stream, int substream_count)
        }
        prev = NULL;
        for (idx = 0, prev = NULL; idx < substream_count; idx++) {
-               substream = kcalloc(1, sizeof(*substream), GFP_KERNEL);
+               substream = kzalloc(sizeof(*substream), GFP_KERNEL);
                if (substream == NULL)
                        return -ENOMEM;
                substream->pcm = pcm;
@@ -657,7 +657,7 @@ int snd_pcm_new(snd_card_t * card, char *id, int device,
        snd_assert(rpcm != NULL, return -EINVAL);
        *rpcm = NULL;
        snd_assert(card != NULL, return -ENXIO);
-       pcm = kcalloc(1, sizeof(*pcm), GFP_KERNEL);
+       pcm = kzalloc(sizeof(*pcm), GFP_KERNEL);
        if (pcm == NULL)
                return -ENOMEM;
        pcm->card = card;
@@ -795,7 +795,7 @@ int snd_pcm_open_substream(snd_pcm_t *pcm, int stream,
        if (substream == NULL)
                return -EAGAIN;
 
-       runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL);
+       runtime = kzalloc(sizeof(*runtime), GFP_KERNEL);
        if (runtime == NULL)
                return -ENOMEM;
 
index 0082914a7e3331825b7a302dfe9dfe4035694971..0503980c23d91ca67ac04c93fc9ae86740cc42df 100644 (file)
@@ -524,6 +524,9 @@ void snd_interval_mul(const snd_interval_t *a, const snd_interval_t *b, snd_inte
 
 /**
  * snd_interval_div - refine the interval value with division
+ * @a: dividend
+ * @b: divisor
+ * @c: quotient
  *
  * c = a / b
  *
@@ -555,7 +558,11 @@ void snd_interval_div(const snd_interval_t *a, const snd_interval_t *b, snd_inte
 
 /**
  * snd_interval_muldivk - refine the interval value
- *
+ * @a: dividend 1
+ * @b: dividend 2
+ * @k: divisor (as integer)
+ * @c: result
+  *
  * c = a * b / k
  *
  * 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,
 
 /**
  * snd_interval_mulkdiv - refine the interval value
+ * @a: dividend 1
+ * @k: dividend 2 (as integer)
+ * @b: divisor
+ * @c: result
  *
  * c = a * k / b
  *
@@ -618,6 +629,11 @@ void snd_interval_mulkdiv(const snd_interval_t *a, unsigned int k,
 
 /**
  * snd_interval_ratnum - refine the interval value
+ * @i: interval to refine
+ * @rats_count: number of ratnum_t 
+ * @rats: ratnum_t array
+ * @nump: pointer to store the resultant numerator
+ * @denp: pointer to store the resultant denominator
  *
  * Returns non-zero if the value is changed, zero if not changed.
  */
@@ -715,6 +731,11 @@ int snd_interval_ratnum(snd_interval_t *i,
 
 /**
  * snd_interval_ratden - refine the interval value
+ * @i: interval to refine
+ * @rats_count: number of ratden_t
+ * @rats: ratden_t array
+ * @nump: pointer to store the resultant numerator
+ * @denp: pointer to store the resultant denominator
  *
  * Returns non-zero if the value is changed, zero if not changed.
  */
@@ -936,6 +957,11 @@ int snd_pcm_hw_rule_add(snd_pcm_runtime_t *runtime, unsigned int cond,
 
 /**
  * snd_pcm_hw_constraint_mask
+ * @runtime: PCM runtime instance
+ * @var: hw_params variable to apply the mask
+ * @mask: the bitmap mask
+ *
+ * Apply the constraint of the given bitmap mask to a mask parameter.
  */
 int snd_pcm_hw_constraint_mask(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
                               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
 
 /**
  * snd_pcm_hw_constraint_mask64
+ * @runtime: PCM runtime instance
+ * @var: hw_params variable to apply the mask
+ * @mask: the 64bit bitmap mask
+ *
+ * Apply the constraint of the given bitmap mask to a mask parameter.
  */
 int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
                                 u_int64_t mask)
@@ -967,6 +998,10 @@ int snd_pcm_hw_constraint_mask64(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
 
 /**
  * snd_pcm_hw_constraint_integer
+ * @runtime: PCM runtime instance
+ * @var: hw_params variable to apply the integer constraint
+ *
+ * Apply the constraint of integer to an interval parameter.
  */
 int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var)
 {
@@ -976,6 +1011,12 @@ int snd_pcm_hw_constraint_integer(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t
 
 /**
  * snd_pcm_hw_constraint_minmax
+ * @runtime: PCM runtime instance
+ * @var: hw_params variable to apply the range
+ * @min: the minimal value
+ * @max: the maximal value
+ * 
+ * Apply the min/max range constraint to an interval parameter.
  */
 int snd_pcm_hw_constraint_minmax(snd_pcm_runtime_t *runtime, snd_pcm_hw_param_t var,
                                 unsigned int min, unsigned int max)
@@ -999,6 +1040,12 @@ static int snd_pcm_hw_rule_list(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_constraint_list
+ * @runtime: PCM runtime instance
+ * @cond: condition bits
+ * @var: hw_params variable to apply the list constraint
+ * @l: list
+ * 
+ * Apply the list of constraints to an interval parameter.
  */
 int snd_pcm_hw_constraint_list(snd_pcm_runtime_t *runtime,
                               unsigned int cond,
@@ -1027,6 +1074,10 @@ static int snd_pcm_hw_rule_ratnums(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_constraint_ratnums
+ * @runtime: PCM runtime instance
+ * @cond: condition bits
+ * @var: hw_params variable to apply the ratnums constraint
+ * @r: ratnums_t constriants
  */
 int snd_pcm_hw_constraint_ratnums(snd_pcm_runtime_t *runtime, 
                                  unsigned int cond,
@@ -1054,6 +1105,10 @@ static int snd_pcm_hw_rule_ratdens(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_constraint_ratdens
+ * @runtime: PCM runtime instance
+ * @cond: condition bits
+ * @var: hw_params variable to apply the ratdens constraint
+ * @r: ratdens_t constriants
  */
 int snd_pcm_hw_constraint_ratdens(snd_pcm_runtime_t *runtime, 
                                  unsigned int cond,
@@ -1079,6 +1134,10 @@ static int snd_pcm_hw_rule_msbits(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_constraint_msbits
+ * @runtime: PCM runtime instance
+ * @cond: condition bits
+ * @width: sample bits width
+ * @msbits: msbits width
  */
 int snd_pcm_hw_constraint_msbits(snd_pcm_runtime_t *runtime, 
                                 unsigned int cond,
@@ -1101,6 +1160,10 @@ static int snd_pcm_hw_rule_step(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_constraint_step
+ * @runtime: PCM runtime instance
+ * @cond: condition bits
+ * @var: hw_params variable to apply the step constraint
+ * @step: step size
  */
 int snd_pcm_hw_constraint_step(snd_pcm_runtime_t *runtime,
                               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 *
 
 /**
  * snd_pcm_hw_constraint_pow2
+ * @runtime: PCM runtime instance
+ * @cond: condition bits
+ * @var: hw_params variable to apply the power-of-2 constraint
  */
 int snd_pcm_hw_constraint_pow2(snd_pcm_runtime_t *runtime,
                               unsigned int cond,
@@ -1162,7 +1228,7 @@ static void _snd_pcm_hw_param_any(snd_pcm_hw_params_t *params,
 }
 
 #if 0
-/**
+/*
  * snd_pcm_hw_param_any
  */
 int 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)
 }
 
 #if 0
-/**
+/*
  * snd_pcm_hw_params_any
  *
  * 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)
 
 /**
  * snd_pcm_hw_param_value
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Return the value for field PAR if it's fixed in configuration space 
  *  defined by PARAMS. Return -EINVAL otherwise
@@ -1228,6 +1297,9 @@ static int snd_pcm_hw_param_value(const snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_value_min
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Return the minimum value for field PAR.
  */
@@ -1251,6 +1323,9 @@ unsigned int snd_pcm_hw_param_value_min(const snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_value_max
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Return the maximum value for field PAR.
  */
@@ -1302,7 +1377,7 @@ int _snd_pcm_hw_param_setinteger(snd_pcm_hw_params_t *params,
 }
        
 #if 0
-/**
+/*
  * snd_pcm_hw_param_setinteger
  *
  * 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,
 
 /**
  * snd_pcm_hw_param_first
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Inside configuration space defined by PARAMS remove from PAR all 
  * values > minimum. Reduce configuration space accordingly.
@@ -1388,6 +1467,10 @@ static int _snd_pcm_hw_param_last(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_last
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Inside configuration space defined by PARAMS remove from PAR all 
  * values < maximum. Reduce configuration space accordingly.
@@ -1439,6 +1522,11 @@ int _snd_pcm_hw_param_min(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_min
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @val: minimal value
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Inside configuration space defined by PARAMS remove from PAR all 
  * values < VAL. Reduce configuration space accordingly.
@@ -1494,6 +1582,11 @@ static int _snd_pcm_hw_param_max(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_max
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @val: maximal value
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Inside configuration space defined by PARAMS remove from PAR all 
  *  values >= VAL + 1. Reduce configuration space accordingly.
@@ -1565,6 +1658,11 @@ int _snd_pcm_hw_param_set(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_set
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @val: value to set
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Inside configuration space defined by PARAMS remove from PAR all 
  * values != VAL. Reduce configuration space accordingly.
@@ -1599,6 +1697,10 @@ static int _snd_pcm_hw_param_mask(snd_pcm_hw_params_t *params,
 
 /**
  * snd_pcm_hw_param_mask
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @val: mask to apply
  *
  * Inside configuration space defined by PARAMS remove from PAR all values
  * not contained in MASK. Reduce configuration space accordingly.
@@ -1671,6 +1773,11 @@ static int boundary_nearer(int min, int mindir,
 
 /**
  * snd_pcm_hw_param_near
+ * @pcm: PCM instance
+ * @params: the hw_params instance
+ * @var: parameter to retrieve
+ * @best: value to set
+ * @dir: pointer to the direction (-1,0,1) or NULL
  *
  * Inside configuration space defined by PARAMS set PAR to the available value
  * 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,
 
 /**
  * snd_pcm_hw_param_choose
+ * @pcm: PCM instance
+ * @params: the hw_params instance
  *
  * Choose one configuration from configuration space defined by PARAMS
  * The configuration chosen is that obtained fixing in this order:
index 9a174fb96565368abe767344de9bffca32887e09..b3f5344f60bef92f440eef1a3e88ff167bd488ba 100644 (file)
@@ -244,7 +244,7 @@ int snd_pcm_lib_preallocate_pages(snd_pcm_substream_t *substream,
 
 /**
  * snd_pcm_lib_preallocate_pages_for_all - pre-allocation for continous memory type (all substreams)
- * @substream: the pcm substream instance
+ * @pcm: the pcm instance
  * @type: DMA type (SNDRV_DMA_TYPE_*)
  * @data: DMA type dependant data
  * @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)
        if (substream->dma_buffer.area != NULL && substream->dma_buffer.bytes >= size) {
                dmab = &substream->dma_buffer; /* use the pre-allocated buffer */
        } else {
-               dmab = kcalloc(1, sizeof(*dmab), GFP_KERNEL);
+               dmab = kzalloc(sizeof(*dmab), GFP_KERNEL);
                if (! dmab)
                        return -ENOMEM;
                dmab->dev = substream->dma_buffer.dev;
index 03c17159dd8e0fe48f9625af9dfd979038a5adff..67abebabf83e4afb1d9da5e69215adf7d3eee8ca 100644 (file)
@@ -859,6 +859,7 @@ static struct action_ops snd_pcm_action_start = {
 
 /**
  * snd_pcm_start
+ * @substream: the PCM substream instance
  *
  * Start all linked streams.
  */
@@ -908,6 +909,8 @@ static struct action_ops snd_pcm_action_stop = {
 
 /**
  * snd_pcm_stop
+ * @substream: the PCM substream instance
+ * @state: PCM state after stopping the stream
  *
  * Try to stop all running streams in the substream group.
  * 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)
 
 /**
  * snd_pcm_drain_done
+ * @substream: the PCM substream
  *
  * Stop the DMA only when the given stream is playback.
  * The state is changed to SETUP.
@@ -1040,6 +1044,7 @@ static struct action_ops snd_pcm_action_suspend = {
 
 /**
  * snd_pcm_suspend
+ * @substream: the PCM substream
  *
  * Trigger SUSPEND to all linked streams.
  * After this call, all streams are changed to SUSPENDED state.
@@ -1057,6 +1062,7 @@ int snd_pcm_suspend(snd_pcm_substream_t *substream)
 
 /**
  * snd_pcm_suspend_all
+ * @pcm: the PCM instance
  *
  * Trigger SUSPEND to all substreams in the given pcm.
  * After this call, all streams are changed to SUSPENDED state.
@@ -1272,6 +1278,9 @@ static struct action_ops snd_pcm_action_prepare = {
 
 /**
  * snd_pcm_prepare
+ * @substream: the PCM substream instance
+ *
+ * Prepare the PCM substream to be triggerable.
  */
 int snd_pcm_prepare(snd_pcm_substream_t *substream)
 {
@@ -1992,7 +2001,7 @@ static int snd_pcm_open_file(struct file *file,
        snd_assert(rpcm_file != NULL, return -EINVAL);
        *rpcm_file = NULL;
 
-       pcm_file = kcalloc(1, sizeof(*pcm_file), GFP_KERNEL);
+       pcm_file = kzalloc(sizeof(*pcm_file), GFP_KERNEL);
        if (pcm_file == NULL) {
                return -ENOMEM;
        }
index edba4118271c74695d4f3d1715d47255d5160b2f..7c20eafecb8ac6932cf9e547d6d16e0edeb129da 100644 (file)
@@ -101,7 +101,7 @@ static int snd_rawmidi_runtime_create(snd_rawmidi_substream_t * substream)
 {
        snd_rawmidi_runtime_t *runtime;
 
-       if ((runtime = kcalloc(1, sizeof(*runtime), GFP_KERNEL)) == NULL)
+       if ((runtime = kzalloc(sizeof(*runtime), GFP_KERNEL)) == NULL)
                return -ENOMEM;
        spin_lock_init(&runtime->lock);
        init_waitqueue_head(&runtime->sleep);
@@ -984,7 +984,9 @@ static ssize_t snd_rawmidi_read(struct file *file, char __user *buf, size_t coun
                        spin_lock_irq(&runtime->lock);
                }
                spin_unlock_irq(&runtime->lock);
-               count1 = snd_rawmidi_kernel_read1(substream, (unsigned char *)buf, count, 0);
+               count1 = snd_rawmidi_kernel_read1(substream,
+                                                 (unsigned char __force *)buf,
+                                                 count, 0);
                if (count1 < 0)
                        return result > 0 ? result : count1;
                result += count1;
@@ -1107,7 +1109,7 @@ int snd_rawmidi_transmit_ack(snd_rawmidi_substream_t * substream, int count)
 /**
  * snd_rawmidi_transmit - copy from the buffer to the device
  * @substream: the rawmidi substream
- * @buf: the buffer pointer
+ * @buffer: the buffer pointer
  * @count: the data size to transfer
  * 
  * 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
                        spin_lock_irq(&runtime->lock);
                }
                spin_unlock_irq(&runtime->lock);
-               count1 = snd_rawmidi_kernel_write1(substream, (unsigned char *)buf, count, 0);
+               count1 = snd_rawmidi_kernel_write1(substream,
+                                                  (unsigned char __force *)buf,
+                                                  count, 0);
                if (count1 < 0)
                        return result > 0 ? result : count1;
                result += count1;
@@ -1370,7 +1374,7 @@ static int snd_rawmidi_alloc_substreams(snd_rawmidi_t *rmidi,
 
        INIT_LIST_HEAD(&stream->substreams);
        for (idx = 0; idx < count; idx++) {
-               substream = kcalloc(1, sizeof(*substream), GFP_KERNEL);
+               substream = kzalloc(sizeof(*substream), GFP_KERNEL);
                if (substream == NULL)
                        return -ENOMEM;
                substream->stream = direction;
@@ -1413,7 +1417,7 @@ int snd_rawmidi_new(snd_card_t * card, char *id, int device,
        snd_assert(rrawmidi != NULL, return -EINVAL);
        *rrawmidi = NULL;
        snd_assert(card != NULL, return -ENXIO);
-       rmidi = kcalloc(1, sizeof(*rmidi), GFP_KERNEL);
+       rmidi = kzalloc(sizeof(*rmidi), GFP_KERNEL);
        if (rmidi == NULL)
                return -ENOMEM;
        rmidi->card = card;
index 32e91c6b25febb7cf02b825a1037f7a236fcdf83..207c2c54bf1de91cbc5e69648098289e89f62f47 100644 (file)
@@ -61,7 +61,7 @@ static int snd_seq_gf1_copy_wave_from_stream(snd_gf1_ops_t *ops,
                return -EFAULT;
        *data += sizeof(xp);
        *len -= sizeof(xp);
-       wp = kcalloc(1, sizeof(*wp), gfp_mask);
+       wp = kzalloc(sizeof(*wp), gfp_mask);
        if (wp == NULL)
                return -ENOMEM;
        wp->share_id[0] = le32_to_cpu(xp.share_id[0]);
index 2622b8679ca76be886524be263517560e8f2e43b..b3cee092b1a4491f6ba5cdbb0b4a3844b4cc2804 100644 (file)
@@ -92,7 +92,7 @@ static int snd_seq_iwffff_copy_env_from_stream(__u32 req_stype,
                points_size = (le16_to_cpu(rx.nattack) + le16_to_cpu(rx.nrelease)) * 2 * sizeof(__u16);
                if (points_size > *len)
                        return -EINVAL;
-               rp = kcalloc(1, sizeof(*rp) + points_size, gfp_mask);
+               rp = kzalloc(sizeof(*rp) + points_size, gfp_mask);
                if (rp == NULL)
                        return -ENOMEM;
                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,
                return -EFAULT;
        *data += sizeof(xp);
        *len -= sizeof(xp);
-       wp = kcalloc(1, sizeof(*wp), gfp_mask);
+       wp = kzalloc(sizeof(*wp), gfp_mask);
        if (wp == NULL)
                return -ENOMEM;
        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,
                        snd_seq_iwffff_instr_free(ops, ip, atomic);
                        return -EINVAL;
                }
-               lp = kcalloc(1, sizeof(*lp), gfp_mask);
+               lp = kzalloc(sizeof(*lp), gfp_mask);
                if (lp == NULL) {
                        snd_seq_iwffff_instr_free(ops, ip, atomic);
                        return -ENOMEM;
index bac4b4f1a94ecd0d07c065f16fa220d65e39f7ae..1ab1cf8158c840b9651476d5229316da426bddcc 100644 (file)
@@ -193,7 +193,7 @@ snd_seq_oss_open(struct file *file, int level)
        int i, rc;
        seq_oss_devinfo_t *dp;
 
-       if ((dp = kcalloc(1, sizeof(*dp), GFP_KERNEL)) == NULL) {
+       if ((dp = kzalloc(sizeof(*dp), GFP_KERNEL)) == NULL) {
                snd_printk(KERN_ERR "can't malloc device info\n");
                return -ENOMEM;
        }
index 9aece6c65dbc8449c569c849c6fa0c5fa4e5bdb4..f0e95c8f2eef04fdd0b5dc864fec6814986b3ade 100644 (file)
@@ -76,8 +76,8 @@ snd_seq_oss_midi_lookup_ports(int client)
        snd_seq_client_info_t *clinfo;
        snd_seq_port_info_t *pinfo;
 
-       clinfo = kcalloc(1, sizeof(*clinfo), GFP_KERNEL);
-       pinfo = kcalloc(1, sizeof(*pinfo), GFP_KERNEL);
+       clinfo = kzalloc(sizeof(*clinfo), GFP_KERNEL);
+       pinfo = kzalloc(sizeof(*pinfo), GFP_KERNEL);
        if (! clinfo || ! pinfo) {
                kfree(clinfo);
                kfree(pinfo);
@@ -172,7 +172,7 @@ snd_seq_oss_midi_check_new_port(snd_seq_port_info_t *pinfo)
        /*
         * allocate midi info record
         */
-       if ((mdev = kcalloc(1, sizeof(*mdev), GFP_KERNEL)) == NULL) {
+       if ((mdev = kzalloc(sizeof(*mdev), GFP_KERNEL)) == NULL) {
                snd_printk(KERN_ERR "can't malloc midi info\n");
                return -ENOMEM;
        }
index 0a6f2a64f6923f619f55d78bfe6de76977934076..55571e15cd38b79d85914ce3465041eda189c1f9 100644 (file)
@@ -46,7 +46,7 @@ snd_seq_oss_readq_new(seq_oss_devinfo_t *dp, int maxlen)
 {
        seq_oss_readq_t *q;
 
-       if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL) {
+       if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL) {
                snd_printk(KERN_ERR "can't malloc read queue\n");
                return NULL;
        }
index 1a7736cbf3a4717202159087fb4355071c5c7c4e..8257fce2ca1bf3ed82cd40c42be5e5b4c3edf19e 100644 (file)
@@ -103,7 +103,7 @@ snd_seq_oss_synth_register(snd_seq_device_t *dev)
        snd_seq_oss_reg_t *reg = SNDRV_SEQ_DEVICE_ARGPTR(dev);
        unsigned long flags;
 
-       if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL) {
+       if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL) {
                snd_printk(KERN_ERR "can't malloc synth info\n");
                return -ENOMEM;
        }
@@ -499,7 +499,7 @@ snd_seq_oss_synth_sysex(seq_oss_devinfo_t *dp, int dev, unsigned char *buf, snd_
 
        sysex = dp->synths[dev].sysex;
        if (sysex == NULL) {
-               sysex = kcalloc(1, sizeof(*sysex), GFP_KERNEL);
+               sysex = kzalloc(sizeof(*sysex), GFP_KERNEL);
                if (sysex == NULL)
                        return -ENOMEM;
                dp->synths[dev].sysex = sysex;
index 42ca9493fa600a3ddd30b6ed6abd942d8616d025..64d594b3170f1ffd84f22fcebbeae9a9bb101874 100644 (file)
@@ -46,7 +46,7 @@ snd_seq_oss_timer_new(seq_oss_devinfo_t *dp)
 {
        seq_oss_timer_t *rec;
 
-       rec = kcalloc(1, sizeof(*rec), GFP_KERNEL);
+       rec = kzalloc(sizeof(*rec), GFP_KERNEL);
        if (rec == NULL)
                return NULL;
 
index 87f85f7ee81461f7463c1a4bd4575f89ca027843..b20378024547b9b84495105a50f22281444e7fbc 100644 (file)
@@ -38,7 +38,7 @@ snd_seq_oss_writeq_new(seq_oss_devinfo_t *dp, int maxlen)
        seq_oss_writeq_t *q;
        snd_seq_client_pool_t pool;
 
-       if ((q = kcalloc(1, sizeof(*q), GFP_KERNEL)) == NULL)
+       if ((q = kzalloc(sizeof(*q), GFP_KERNEL)) == NULL)
                return NULL;
        q->dp = dp;
        q->maxlen = maxlen;
index 7449d2a6262902277abecdcf32726850d436a15b..24644150f24b9140210315edf411696307dd152a 100644 (file)
@@ -43,7 +43,13 @@ int seq_client_load[64] = {[0 ... 63] = -1};
 int seq_default_timer_class = SNDRV_TIMER_CLASS_GLOBAL;
 int seq_default_timer_sclass = SNDRV_TIMER_SCLASS_NONE;
 int seq_default_timer_card = -1;
-int seq_default_timer_device = SNDRV_TIMER_GLOBAL_SYSTEM;
+int seq_default_timer_device =
+#ifdef CONFIG_SND_SEQ_RTCTIMER_DEFAULT
+       SNDRV_TIMER_GLOBAL_RTC
+#else
+       SNDRV_TIMER_GLOBAL_SYSTEM
+#endif
+       ;
 int seq_default_timer_subdevice = 0;
 int seq_default_timer_resolution = 0;  /* Hz */
 
index d8f76afd284bc19efec4b1c577280508c99a69db..a886db94b1fa0be678cb0b9e8f4793a0b7841188 100644 (file)
@@ -203,7 +203,7 @@ static client_t *seq_create_client1(int client_index, int poolsize)
        client_t *client;
 
        /* init client data */
-       client = kcalloc(1, sizeof(*client), GFP_KERNEL);
+       client = kzalloc(sizeof(*client), GFP_KERNEL);
        if (client == NULL)
                return NULL;
        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
                        }
                        count -= sizeof(snd_seq_event_t);
                        buf += sizeof(snd_seq_event_t);
-                       err = snd_seq_expand_var_event(&cell->event, count, (char *)buf, 0, sizeof(snd_seq_event_t));
+                       err = snd_seq_expand_var_event(&cell->event, count,
+                                                      (char __force *)buf, 0,
+                                                      sizeof(snd_seq_event_t));
                        if (err < 0)
                                break;
                        result += err;
@@ -1009,7 +1011,8 @@ static ssize_t snd_seq_write(struct file *file, const char __user *buf, size_t c
                        }
                        /* set user space pointer */
                        event.data.ext.len = extlen | SNDRV_SEQ_EXT_USRPTR;
-                       event.data.ext.ptr = (char*)buf + sizeof(snd_seq_event_t);
+                       event.data.ext.ptr = (char __force *)buf
+                                               + sizeof(snd_seq_event_t);
                        len += extlen; /* increment data length */
                } else {
 #ifdef CONFIG_COMPAT
index 4d80f39612e835f57d0f6cd6139d2b7d4a24aa6a..252b5273100376e02f6673d9a9e90871098d6ab4 100644 (file)
@@ -200,7 +200,7 @@ int snd_seq_device_new(snd_card_t *card, int device, char *id, int argsize,
        if (ops == NULL)
                return -ENOMEM;
 
-       dev = kcalloc(1, sizeof(*dev)*2 + argsize, GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev)*2 + argsize, GFP_KERNEL);
        if (dev == NULL) {
                unlock_driver(ops);
                return -ENOMEM;
index ea945a5d2a0b194f4884cdbac0aeae4c00f3ced2..5dd0e6a19e5072af35fefd508ff961e102fc5892 100644 (file)
@@ -153,7 +153,7 @@ create_port(int idx, int type)
        snd_seq_port_callback_t pcb;
        snd_seq_dummy_port_t *rec;
 
-       if ((rec = kcalloc(1, sizeof(*rec), GFP_KERNEL)) == NULL)
+       if ((rec = kzalloc(sizeof(*rec), GFP_KERNEL)) == NULL)
                return NULL;
 
        rec->client = my_client;
index 3b7647ca7ad9e7a35bdccc2dcdc52e2bfe56cd16..4767cfdc361fc00348b6d48ae41d9a0022810c05 100644 (file)
@@ -33,7 +33,7 @@ fifo_t *snd_seq_fifo_new(int poolsize)
 {
        fifo_t *f;
 
-       f = kcalloc(1, sizeof(*f), GFP_KERNEL);
+       f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (f == NULL) {
                snd_printd("malloc failed for snd_seq_fifo_new() \n");
                return NULL;
index 5b40ea2ba8f4f9aaff3f3cbd3aad60fc16510b7a..019d43a462d7ade1e8094189094a9b4c1bb0c8c2 100644 (file)
@@ -53,7 +53,7 @@ static snd_seq_kinstr_t *snd_seq_instr_new(int add_len, int atomic)
 {
        snd_seq_kinstr_t *instr;
        
-       instr = kcalloc(1, sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
+       instr = kzalloc(sizeof(snd_seq_kinstr_t) + add_len, atomic ? GFP_ATOMIC : GFP_KERNEL);
        if (instr == NULL)
                return NULL;
        instr->add_len = add_len;
@@ -77,7 +77,7 @@ snd_seq_kinstr_list_t *snd_seq_instr_list_new(void)
 {
        snd_seq_kinstr_list_t *list;
 
-       list = kcalloc(1, sizeof(snd_seq_kinstr_list_t), GFP_KERNEL);
+       list = kzalloc(sizeof(snd_seq_kinstr_list_t), GFP_KERNEL);
        if (list == NULL)
                return NULL;
        spin_lock_init(&list->lock);
index 03acb2d519ba6bbf975c18ae19d8e13f0e66328b..d4d7d326c4b150af1fc4589d1a4794cf9fdf2d20 100644 (file)
@@ -452,7 +452,7 @@ pool_t *snd_seq_pool_new(int poolsize)
        pool_t *pool;
 
        /* create pool block */
-       pool = kcalloc(1, sizeof(*pool), GFP_KERNEL);
+       pool = kzalloc(sizeof(*pool), GFP_KERNEL);
        if (pool == NULL) {
                snd_printd("seq: malloc failed for pool\n");
                return NULL;
index 4374829ea77043300f088527e74ac815215f9293..b4674ae3bc30d39d808dbfe006036924a44f4f7b 100644 (file)
@@ -322,7 +322,7 @@ snd_seq_midisynth_register_port(snd_seq_device_t *dev)
        client = synths[card->number];
        if (client == NULL) {
                newclient = 1;
-               client = kcalloc(1, sizeof(*client), GFP_KERNEL);
+               client = kzalloc(sizeof(*client), GFP_KERNEL);
                if (client == NULL) {
                        up(&register_mutex);
                        kfree(info);
index 603b63716db67d27375b09a1308ad53f20210f75..2dc1aecfb426ec6c0a4d613f7a8627d91e1fd142 100644 (file)
@@ -118,7 +118,7 @@ int snd_midi_event_new(int bufsize, snd_midi_event_t **rdev)
        snd_midi_event_t *dev;
 
        *rdev = NULL;
-       dev = kcalloc(1, sizeof(*dev), GFP_KERNEL);
+       dev = kzalloc(sizeof(*dev), GFP_KERNEL);
        if (dev == NULL)
                return -ENOMEM;
        if (bufsize > 0) {
index b976951fc100236f34b4a843517956793ca0277d..57ec31df0d15963ccd9727b70299530d542c5fd0 100644 (file)
@@ -141,7 +141,7 @@ client_port_t *snd_seq_create_port(client_t *client, int port)
        }
 
        /* create a new port */
-       new_port = kcalloc(1, sizeof(*new_port), GFP_KERNEL);
+       new_port = kzalloc(sizeof(*new_port), GFP_KERNEL);
        if (! new_port) {
                snd_printd("malloc failed for registering client port\n");
                return NULL;    /* failure, out of memory */
@@ -488,7 +488,7 @@ int snd_seq_port_connect(client_t *connector,
        unsigned long flags;
        int exclusive;
 
-       subs = kcalloc(1, sizeof(*subs), GFP_KERNEL);
+       subs = kzalloc(sizeof(*subs), GFP_KERNEL);
        if (! subs)
                return -ENOMEM;
 
index a519732ed83313bbe443bf17c2dc470fd9fe6925..cd641bca9945b6b35670bd9e2093eb2dc4e88622 100644 (file)
@@ -59,7 +59,7 @@ prioq_t *snd_seq_prioq_new(void)
 {
        prioq_t *f;
 
-       f = kcalloc(1, sizeof(*f), GFP_KERNEL);
+       f = kzalloc(sizeof(*f), GFP_KERNEL);
        if (f == NULL) {
                snd_printd("oops: malloc failed for snd_seq_prioq_new()\n");
                return NULL;
index 98de2e711fde90b174d6cc87ffde3b00861073d1..5f5c3cb37cbf69e4d6e0254d5433c329e4c056f6 100644 (file)
@@ -111,7 +111,7 @@ static queue_t *queue_new(int owner, int locked)
 {
        queue_t *q;
 
-       q = kcalloc(1, sizeof(*q), GFP_KERNEL);
+       q = kzalloc(sizeof(*q), GFP_KERNEL);
        if (q == NULL) {
                snd_printd("malloc failed for snd_seq_queue_new()\n");
                return NULL;
index e8f0a6683d50b5a9305df2642990313c578061e1..0d9eff85ab88c7934ee8842f7aa79b304b34da02 100644 (file)
@@ -126,8 +126,8 @@ int __init snd_seq_system_client_init(void)
        snd_seq_client_info_t *inf;
        snd_seq_port_info_t *port;
 
-       inf = kcalloc(1, sizeof(*inf), GFP_KERNEL);
-       port = kcalloc(1, sizeof(*port), GFP_KERNEL);
+       inf = kzalloc(sizeof(*inf), GFP_KERNEL);
+       port = kzalloc(sizeof(*port), GFP_KERNEL);
        if (! inf || ! port) {
                kfree(inf);
                kfree(port);
index a7f76fc9528092bc38985337409f97dd81451270..b57a3c07ff6f6c0eb1c161f8d7ed2efed1e363a6 100644 (file)
@@ -60,7 +60,7 @@ seq_timer_t *snd_seq_timer_new(void)
 {
        seq_timer_t *tmr;
        
-       tmr = kcalloc(1, sizeof(*tmr), GFP_KERNEL);
+       tmr = kzalloc(sizeof(*tmr), GFP_KERNEL);
        if (tmr == NULL) {
                snd_printd("malloc failed for snd_seq_timer_new() \n");
                return NULL;
index a66484b5cf0e921991895296021ae56aad2c34dc..e4f512aa742662ed95c595bb8634b67dadb74420 100644 (file)
@@ -205,7 +205,7 @@ static int snd_virmidi_input_open(snd_rawmidi_substream_t * substream)
        snd_virmidi_t *vmidi;
        unsigned long flags;
 
-       vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL);
+       vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
        if (vmidi == NULL)
                return -ENOMEM;
        vmidi->substream = substream;
@@ -233,7 +233,7 @@ static int snd_virmidi_output_open(snd_rawmidi_substream_t * substream)
        snd_rawmidi_runtime_t *runtime = substream->runtime;
        snd_virmidi_t *vmidi;
 
-       vmidi = kcalloc(1, sizeof(*vmidi), GFP_KERNEL);
+       vmidi = kzalloc(sizeof(*vmidi), GFP_KERNEL);
        if (vmidi == NULL)
                return -ENOMEM;
        vmidi->substream = substream;
@@ -508,7 +508,7 @@ int snd_virmidi_new(snd_card_t *card, int device, snd_rawmidi_t **rrmidi)
                                   &rmidi)) < 0)
                return err;
        strcpy(rmidi->name, rmidi->id);
-       rdev = kcalloc(1, sizeof(*rdev), GFP_KERNEL);
+       rdev = kzalloc(sizeof(*rdev), GFP_KERNEL);
        if (rdev == NULL) {
                snd_device_free(card, rmidi);
                return -ENOMEM;
index 3271e9245490b81d3b3f6c3d9d3e6b54ec66612d..9e76bddb2c0beb3aab1acfb9e173f3687297e793 100644 (file)
@@ -328,6 +328,10 @@ int __exit snd_minor_info_done(void)
  *  INIT PART
  */
 
+#ifdef CONFIG_SND_GENERIC_DRIVER
+extern struct device_driver snd_generic_driver;
+#endif
+
 static int __init alsa_sound_init(void)
 {
        short controlnum;
@@ -354,6 +358,9 @@ static int __init alsa_sound_init(void)
                return -ENOMEM;
        }
        snd_info_minor_register();
+#ifdef CONFIG_SND_GENERIC_DRIVER
+       driver_register(&snd_generic_driver);
+#endif
        for (controlnum = 0; controlnum < cards_limit; controlnum++)
                devfs_mk_cdev(MKDEV(major, controlnum<<5), S_IFCHR | device_mode, "snd/controlC%d", controlnum);
 #ifndef MODULE
@@ -369,6 +376,9 @@ static void __exit alsa_sound_exit(void)
        for (controlnum = 0; controlnum < cards_limit; controlnum++)
                devfs_remove("snd/controlC%d", controlnum);
 
+#ifdef CONFIG_SND_GENERIC_DRIVER
+       driver_unregister(&snd_generic_driver);
+#endif
        snd_info_minor_unregister();
        snd_info_done();
        snd_memory_done();
@@ -416,10 +426,13 @@ EXPORT_SYMBOL(snd_card_register);
 EXPORT_SYMBOL(snd_component_add);
 EXPORT_SYMBOL(snd_card_file_add);
 EXPORT_SYMBOL(snd_card_file_remove);
+#ifdef CONFIG_SND_GENERIC_DRIVER
+EXPORT_SYMBOL(snd_card_set_generic_dev);
+#endif
 #ifdef CONFIG_PM
 EXPORT_SYMBOL(snd_power_wait);
 EXPORT_SYMBOL(snd_card_set_pm_callback);
-#if defined(CONFIG_PM) && defined(CONFIG_SND_GENERIC_PM)
+#ifdef CONFIG_SND_GENERIC_DRIVER
 EXPORT_SYMBOL(snd_card_set_generic_pm_callback);
 #endif
 #ifdef CONFIG_PCI
index 4104f6e292e959ead04756ccd52d18ee52e49326..22b104624084656b25c8062693e8c7c75a352341 100644 (file)
@@ -98,7 +98,7 @@ static void snd_timer_reschedule(snd_timer_t * timer, unsigned long ticks_left);
 static snd_timer_instance_t *snd_timer_instance_new(char *owner, snd_timer_t *timer)
 {
        snd_timer_instance_t *timeri;
-       timeri = kcalloc(1, sizeof(*timeri), GFP_KERNEL);
+       timeri = kzalloc(sizeof(*timeri), GFP_KERNEL);
        if (timeri == NULL)
                return NULL;
        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 *
        snd_assert(tid != NULL, return -EINVAL);
        snd_assert(rtimer != NULL, return -EINVAL);
        *rtimer = NULL;
-       timer = kcalloc(1, sizeof(*timer), GFP_KERNEL);
+       timer = kzalloc(sizeof(*timer), GFP_KERNEL);
        if (timer == NULL)
                return -ENOMEM;
        timer->tmr_class = tid->dev_class;
@@ -1017,7 +1017,7 @@ static int snd_timer_register_system(void)
                return err;
        strcpy(timer->name, "system timer");
        timer->hw = snd_timer_system;
-       priv = kcalloc(1, sizeof(*priv), GFP_KERNEL);
+       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
        if (priv == NULL) {
                snd_timer_free(timer);
                return -ENOMEM;
@@ -1202,7 +1202,7 @@ static int snd_timer_user_open(struct inode *inode, struct file *file)
 {
        snd_timer_user_t *tu;
        
-       tu = kcalloc(1, sizeof(*tu), GFP_KERNEL);
+       tu = kzalloc(sizeof(*tu), GFP_KERNEL);
        if (tu == NULL)
                return -ENOMEM;
        spin_lock_init(&tu->qlock);
@@ -1513,7 +1513,7 @@ static int snd_timer_user_info(struct file *file, snd_timer_info_t __user *_info
        t = tu->timeri->timer;
        snd_assert(t != NULL, return -ENXIO);
 
-       info = kcalloc(1, sizeof(*info), GFP_KERNEL);
+       info = kzalloc(sizeof(*info), GFP_KERNEL);
        if (! info)
                return -ENOMEM;
        info->card = t->card ? t->card->number : -1;
index 3b2bee19e2c0371c2ce4a151984b693837a1d0a5..efcb4eb2d1a05c955f345c6ea10683ec60876b5f 100644 (file)
@@ -29,6 +29,7 @@ config SND_DUMMY
        tristate "Dummy (/dev/null) soundcard"
        depends on SND
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include the dummy driver.  This driver does
          nothing, but emulates various mixer controls and PCM devices.
@@ -44,6 +45,7 @@ config SND_VIRMIDI
        depends on SND_SEQUENCER
        select SND_TIMER
        select SND_RAWMIDI
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include the virtual MIDI driver.  This driver
          allows to connect applications using raw MIDI devices to
@@ -59,6 +61,7 @@ config SND_MTPAV
        depends on SND
        select SND_TIMER
        select SND_RAWMIDI
+       select SND_GENERIC_DRIVER
        help
          To use a MOTU MidiTimePiece AV multiport MIDI adapter
          connected to the parallel port, say Y here and make sure that
@@ -72,6 +75,7 @@ config SND_SERIAL_U16550
        depends on SND
        select SND_TIMER
        select SND_RAWMIDI
+       select SND_GENERIC_DRIVER
        help
          To include support for MIDI serial port interfaces, say Y here
          and read <file:Documentation/sound/alsa/serial-u16550.txt>.
@@ -88,6 +92,7 @@ config SND_MPU401
        tristate "Generic MPU-401 UART driver"
        depends on SND
        select SND_MPU401_UART
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for MIDI ports compatible with
          the Roland MPU-401 interface in UART mode.
index a61640cf7ae7c3b565d79c328a24aaebd972702a..64ef7f62851dd677be167314f07eca424b1cf23b 100644 (file)
@@ -337,7 +337,7 @@ static int snd_card_dummy_playback_open(snd_pcm_substream_t * substream)
        snd_card_dummy_pcm_t *dpcm;
        int err;
 
-       dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL);
+       dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
        if (dpcm == NULL)
                return -ENOMEM;
        init_timer(&dpcm->timer);
@@ -368,7 +368,7 @@ static int snd_card_dummy_capture_open(snd_pcm_substream_t * substream)
        snd_card_dummy_pcm_t *dpcm;
        int err;
 
-       dpcm = kcalloc(1, sizeof(*dpcm), GFP_KERNEL);
+       dpcm = kzalloc(sizeof(*dpcm), GFP_KERNEL);
        if (dpcm == NULL)
                return -ENOMEM;
        init_timer(&dpcm->timer);
@@ -600,6 +600,10 @@ static int __init snd_card_dummy_probe(int dev)
        strcpy(card->driver, "Dummy");
        strcpy(card->shortname, "Dummy");
        sprintf(card->longname, "Dummy %i", dev + 1);
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto __nodev;
+
        if ((err = snd_card_register(card)) == 0) {
                snd_dummy_cards[dev] = card;
                return 0;
index cb36ecb78697b27288f6cea46a78b15abbf95af6..54e2ff9b5ca13dca3b2cc3914b523adcdfc2cd3b 100644 (file)
@@ -77,20 +77,26 @@ static int snd_mpu401_create(int dev, snd_card_t **rcard)
                strcat(card->longname, "polled");
        }
 
-       if (snd_mpu401_uart_new(card, 0,
-                               MPU401_HW_MPU401,
-                               port[dev], 0,
-                               irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0) {
+       if ((err = snd_mpu401_uart_new(card, 0,
+                                      MPU401_HW_MPU401,
+                                      port[dev], 0,
+                                      irq[dev], irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL)) < 0) {
                printk(KERN_ERR "MPU401 not detected at 0x%lx\n", port[dev]);
-               snd_card_free(card);
-               return -ENODEV;
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+               goto _err;
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        *rcard = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __devinit snd_mpu401_probe(int dev)
index 0f83c5241b6bea081daedff620e5540e17d6d4ac..fe3f921ffbe3707137defded6690020771e641af 100644 (file)
@@ -463,7 +463,7 @@ int snd_mpu401_uart_new(snd_card_t * card, int device,
                *rrawmidi = NULL;
        if ((err = snd_rawmidi_new(card, "MPU-401U", device, 1, 1, &rmidi)) < 0)
                return err;
-       mpu = kcalloc(1, sizeof(*mpu), GFP_KERNEL);
+       mpu = kzalloc(sizeof(*mpu), GFP_KERNEL);
        if (mpu == NULL) {
                snd_device_free(card, rmidi);
                return -ENOMEM;
index 1280a57c49eb89ba3157a4a7a1e15b51394d660f..3a25c89d2983936552b081911866a1106f72dfb7 100644 (file)
@@ -688,7 +688,7 @@ static int snd_mtpav_get_RAWMIDI(mtpav_t * mcard)
 
 static mtpav_t *new_mtpav(void)
 {
-       mtpav_t *ncrd = kcalloc(1, sizeof(*ncrd), GFP_KERNEL);
+       mtpav_t *ncrd = kzalloc(sizeof(*ncrd), GFP_KERNEL);
        if (ncrd != NULL) {
                spin_lock_init(&ncrd->spinlock);
 
@@ -757,6 +757,9 @@ static int __init alsa_card_mtpav_init(void)
        if (err < 0)
                goto __error;
 
+       if ((err = snd_card_set_generic_dev(mtp_card->card)) < 0)
+               goto __error;
+
        err = snd_card_register(mtp_card->card);        // don't snd_card_register until AFTER all cards reources done!
 
        //printk("snd_card_register returned %d\n", err);
index c313e5205cb87365793fea44b2f3fff66f5a69de..1f84d78260dea71d15e27d5859d7b673e1d4e621 100644 (file)
@@ -354,7 +354,7 @@ int snd_opl3_new(snd_card_t *card,
        int err;
 
        *ropl3 = NULL;
-       opl3 = kcalloc(1, sizeof(*opl3), GFP_KERNEL);
+       opl3 = kzalloc(sizeof(*opl3), GFP_KERNEL);
        if (opl3 == NULL)
                return -ENOMEM;
 
index 33da334ae9818149fae31d0273bb13b667a80063..21a2b409d6d312adfc759526285064c605342863 100644 (file)
@@ -241,7 +241,7 @@ static int snd_opl3_load_patch_seq_oss(snd_seq_oss_arg_t *arg, int format,
                }
 
                size = sizeof(*put) + sizeof(fm_xinstrument_t);
-               put = kcalloc(1, size, GFP_KERNEL);
+               put = kzalloc(size, GFP_KERNEL);
                if (put == NULL)
                        return -ENOMEM;
                /* build header */
index 8261464dade8e26aca4da46301bfb4422b4b66a5..380c2c704c54342ea175115b8b6e219f4633c527 100644 (file)
@@ -204,7 +204,7 @@ int snd_opl4_create(snd_card_t *card,
        if (ropl4)
                *ropl4 = NULL;
 
-       opl4 = kcalloc(1, sizeof(*opl4), GFP_KERNEL);
+       opl4 = kzalloc(sizeof(*opl4), GFP_KERNEL);
        if (!opl4)
                return -ENOMEM;
 
index 986df35fb82948fdcaea2a1c043cae2ec3ebe7cd..416172ea1f4753c6acc72b56b4bf3cdd67a36499 100644 (file)
@@ -779,7 +779,7 @@ static int __init snd_uart16550_create(snd_card_t * card,
        int err;
 
 
-       if ((uart = kcalloc(1, sizeof(*uart), GFP_KERNEL)) == NULL)
+       if ((uart = kzalloc(sizeof(*uart), GFP_KERNEL)) == NULL)
                return -ENOMEM;
        uart->adaptor = adaptor;
        uart->card = card;
@@ -928,15 +928,11 @@ static int __init snd_serial_probe(int dev)
                                        base[dev],
                                        adaptor[dev],
                                        droponfull[dev],
-                                       &uart)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                       &uart)) < 0)
+               goto _err;
 
-       if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_uart16550_rmidi(uart, 0, outs[dev], ins[dev], &uart->rmidi)) < 0)
+               goto _err;
 
        sprintf(card->longname, "%s at 0x%lx, irq %d speed %d div %d outs %d ins %d adaptor %s droponfull %d",
                card->shortname,
@@ -949,12 +945,18 @@ static int __init snd_serial_probe(int dev)
                adaptor_names[uart->adaptor],
                uart->drop_on_full);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_serial_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_serial_init(void)
index 5937711e950562c922b5fcb9600c00edc2bfe77b..af12185ab8a2f07bd258952eac0556fbb0aa2aa1 100644 (file)
@@ -116,6 +116,10 @@ static int __init snd_card_virmidi_probe(int dev)
        strcpy(card->driver, "VirMIDI");
        strcpy(card->shortname, "VirMIDI");
        sprintf(card->longname, "Virtual MIDI Card %i", dev + 1);
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto __nodev;
+
        if ((err = snd_card_register(card)) == 0) {
                snd_virmidi_cards[dev] = card;
                return 0;
index c6fa5afa3e9ae3414ce5e08e0e36df38feee458a..4697b1d75cbb13eb10cb9cab40dd663e6fbec05d 100644 (file)
@@ -782,7 +782,7 @@ vx_core_t *snd_vx_create(snd_card_t *card, struct snd_vx_hardware *hw,
 
        snd_assert(card && hw && ops, return NULL);
 
-       chip = kcalloc(1, sizeof(*chip) + extra_size, GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip) + extra_size, GFP_KERNEL);
        if (! chip) {
                snd_printk(KERN_ERR "vx_core: no memory\n");
                return NULL;
index d4becf44e24787ddc9743bb943da30f41c0e02ff..c2312d912fc7d8f1177dac0ad14a572a98385f61 100644 (file)
@@ -473,7 +473,7 @@ static int vx_alloc_pipe(vx_core_t *chip, int capture,
                return err;
 
        /* initialize the pipe record */
-       pipe = kcalloc(1, sizeof(*pipe), GFP_KERNEL);
+       pipe = kzalloc(sizeof(*pipe), GFP_KERNEL);
        if (! pipe) {
                /* release the pipe */
                vx_init_rmh(&rmh, CMD_FREE_PIPE);
index a3fda859dd15c177b70f532d6c81b6073cd0d6ee..a21f7d541f866ff31caea45b529a0a9262961727 100644 (file)
@@ -200,7 +200,7 @@ int snd_cs8427_create(snd_i2c_bus_t *bus,
 
        if ((err = snd_i2c_device_create(bus, "CS8427", CS8427_ADDR | (addr & 7), &device)) < 0)
                return err;
-       chip = device->private_data = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = device->private_data = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                snd_i2c_device_free(device);
                return -ENOMEM;
index e8fa7e1a68e8da63f2e54f70d8cf5ebcf661dbe2..e4e505b9d88bbe75b02cdc74384384b2e0d384b3 100644 (file)
@@ -81,7 +81,7 @@ int snd_i2c_bus_create(snd_card_t *card, const char *name, snd_i2c_bus_t *master
        };
 
        *ri2c = NULL;
-       bus = kcalloc(1, sizeof(*bus), GFP_KERNEL);
+       bus = kzalloc(sizeof(*bus), GFP_KERNEL);
        if (bus == NULL)
                return -ENOMEM;
        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
 
        *rdevice = NULL;
        snd_assert(bus != NULL, return -EINVAL);
-       device = kcalloc(1, sizeof(*device), GFP_KERNEL);
+       device = kzalloc(sizeof(*device), GFP_KERNEL);
        if (device == NULL)
                return -ENOMEM;
        device->addr = addr;
index e13122f3fc50947258372f8b728311dca009a3d6..103a7dcd0dde570cdc0063d0e68e09474400ef4d 100644 (file)
@@ -17,7 +17,7 @@
  * 2002-05-12   Tomas Kasparek  another code cleanup
  */
 
-/* $Id: uda1341.c,v 1.15 2005/01/03 12:05:20 tiwai Exp $ */
+/* $Id: uda1341.c,v 1.16 2005/09/09 13:22:34 tiwai Exp $ */
 
 #include <sound/driver.h>
 #include <linux/module.h>
@@ -670,7 +670,7 @@ int __init snd_chip_uda1341_mixer_new(snd_card_t *card, struct l3_client **clnt)
 
        snd_assert(card != NULL, return -EINVAL);
 
-       uda1341 = kcalloc(1, sizeof(*uda1341), GFP_KERNEL);
+       uda1341 = kzalloc(sizeof(*uda1341), GFP_KERNEL);
        if (uda1341 == NULL)
                return -ENOMEM;
          
@@ -707,7 +707,7 @@ static int uda1341_attach(struct l3_client *clnt)
 {
        struct uda1341 *uda;
 
-       uda = kcalloc(1, sizeof(*uda), 0, GFP_KERNEL);
+       uda = kzalloc(sizeof(*uda), 0, GFP_KERNEL);
        if (!uda)
                return -ENOMEM;
 
index 5adde308a00fa252d180122b24e22fb867af6fb5..af5eadcddd92da2e64051921fbeb00c10f9ea951 100644 (file)
@@ -92,7 +92,7 @@ int snd_ak4114_create(snd_card_t *card,
                .dev_free =     snd_ak4114_dev_free,
        };
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->lock);
index 0419c4336a5572587ca08155a7e7da91e1579b0c..d51b51dd86d6dda11178e571aadb892e327b753b 100644 (file)
@@ -83,7 +83,7 @@ int snd_ak4117_create(snd_card_t *card, ak4117_read_t *read, ak4117_write_t *wri
                .dev_free =     snd_ak4117_dev_free,
        };
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->lock);
index 2da8d7f157f4609eebc0b8b584af20bea91b1403..fd65da654267bda2e31ea60e6cd86dcd15b5a366 100644 (file)
@@ -281,7 +281,7 @@ int snd_tea6330t_update_mixer(snd_card_t * card,
        u8 default_treble, default_bass;
        unsigned char bytes[7];
 
-       tea = kcalloc(1, sizeof(*tea), GFP_KERNEL);
+       tea = kzalloc(sizeof(*tea), GFP_KERNEL);
        if (tea == NULL)
                return -ENOMEM;
        if ((err = snd_i2c_device_create(bus, "TEA6330T", TEA6330T_ADDR, &device)) < 0) {
index 5c3948311528efdca7817e63e8e3fea96c8b8460..5d6c300ac0d5cb0d03d36474e233d5126104d01a 100644 (file)
@@ -6,12 +6,12 @@ menu "ISA devices"
 config SND_AD1848_LIB
         tristate
         select SND_PCM
-       select SND_GENERIC_PM
+       select SND_GENERIC_DRIVER
 
 config SND_CS4231_LIB
         tristate
         select SND_PCM
-       select SND_GENERIC_PM
+       select SND_GENERIC_DRIVER
 
 config SND_AD1816A
        tristate "Analog Devices SoundPort AD1816A"
@@ -97,6 +97,7 @@ config SND_ES1688
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for ESS AudioDrive ES688 or
          ES1688 chips.
@@ -110,7 +111,7 @@ config SND_ES18XX
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
-       select SND_GENERIC_PM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for ESS AudioDrive ES18xx chips.
 
@@ -126,6 +127,7 @@ config SND_GUSCLASSIC
        select SND_RAWMIDI
        select SND_PCM
        select SND_GUS_SYNTH
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Gravis UltraSound Classic
          soundcards.
@@ -140,6 +142,7 @@ config SND_GUSEXTREME
        select SND_MPU401_UART
        select SND_PCM
        select SND_GUS_SYNTH
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Gravis UltraSound Extreme
          soundcards.
@@ -153,6 +156,7 @@ config SND_GUSMAX
        select SND_RAWMIDI
        select SND_CS4231_LIB
        select SND_GUS_SYNTH
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Gravis UltraSound MAX
          soundcards.
@@ -166,7 +170,7 @@ config SND_INTERWAVE
        select SND_RAWMIDI
        select SND_CS4231_LIB
        select SND_GUS_SYNTH
-       select ISAPNP
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for AMD InterWave based
          soundcards (Gravis UltraSound Plug & Play, STB SoundRage32,
@@ -181,7 +185,7 @@ config SND_INTERWAVE_STB
        select SND_RAWMIDI
        select SND_CS4231_LIB
        select SND_GUS_SYNTH
-       select ISAPNP
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for AMD InterWave based
          soundcards with a TEA6330T bass and treble regulator
@@ -224,6 +228,7 @@ config SND_OPTI93X
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for soundcards based on Opti
          82C93x chips.
@@ -237,6 +242,7 @@ config SND_SB8
        select SND_OPL3_LIB
        select SND_RAWMIDI
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Creative Sound Blaster 1.0/
          2.0/Pro (8-bit) or 100% compatible soundcards.
@@ -250,6 +256,7 @@ config SND_SB16
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Sound Blaster 16 soundcards
          (including the Plug and Play version).
@@ -263,6 +270,7 @@ config SND_SBAWE
        select SND_OPL3_LIB
        select SND_MPU401_UART
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for Sound Blaster AWE soundcards
          (including the Plug and Play version).
index ae860360ecf963a3620357e505b2d6025eb57800..27a9dcfbba008cbff69860fe279b80682b12edbe 100644 (file)
@@ -591,7 +591,7 @@ int snd_ad1816a_create(snd_card_t *card,
 
        *rchip = NULL;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        chip->irq = -1;
index 8c399340cd7240b4c75834d9037d87cade038958..3ebcc482b07a101ab6dc0433b25c2af6c27ea86a 100644 (file)
@@ -91,35 +91,36 @@ static int __init snd_card_ad1848_probe(int dev)
                                     irq[dev],
                                     dma1[dev],
                                     thinkpad[dev] ? AD1848_HW_THINKPAD : AD1848_HW_DETECT,
-                                    &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_ad1848_mixer(chip)) < 0)
+               goto _err;
 
-       if ((err = snd_ad1848_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_ad1848_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
        strcpy(card->driver, "AD1848");
        strcpy(card->shortname, pcm->name);
 
        sprintf(card->longname, "%s at 0x%lx, irq %d, dma %d",
                pcm->name, chip->port, irq[dev], dma1[dev]);
 
-       if (thinkpad[dev]) {
+       if (thinkpad[dev])
                strcat(card->longname, " [Thinkpad]");
-       }
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_ad1848_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_ad1848_init(void)
index bc642dc94547b5cea97570988571a9a506070cb2..303861cd03cdfcc4a1396714cf7e1be60d07e672 100644 (file)
@@ -890,7 +890,7 @@ int snd_ad1848_create(snd_card_t * card,
        int err;
 
        *rchip = NULL;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->reg_lock);
index 1fce8b9f37cf88de82991392a12ced9aa363443e..5252206ea38868a93479e6f74b243c9bb5eb487a 100644 (file)
@@ -438,33 +438,37 @@ static int __devinit snd_cmi8330_pcm(snd_card_t *card, struct snd_cmi8330 *chip)
 /*
  */
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
+#define PFX    "cmi8330: "
+
 static int __devinit snd_cmi8330_probe(int dev,
                                       struct pnp_card_link *pcard,
                                       const struct pnp_card_device_id *pid)
 {
        snd_card_t *card;
        struct snd_cmi8330 *acard;
-       unsigned long flags;
        int i, err;
 
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
+       if (! is_isapnp_selected(dev)) {
                if (wssport[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify wssport\n");
+                       snd_printk(KERN_ERR PFX "specify wssport\n");
                        return -EINVAL;
                }
                if (sbport[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify sbport\n");
+                       snd_printk(KERN_ERR PFX "specify sbport\n");
                        return -EINVAL;
                }
-#ifdef CONFIG_PNP
        }
-#endif
+
        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
                            sizeof(struct snd_cmi8330));
        if (card == NULL) {
-               snd_printk("could not get a new card\n");
+               snd_printk(KERN_ERR PFX "could not get a new card\n");
                return -ENOMEM;
        }
        acard = (struct snd_cmi8330 *)card->private_data;
@@ -473,9 +477,8 @@ static int __devinit snd_cmi8330_probe(int dev,
 #ifdef CONFIG_PNP
        if (isapnp[dev]) {
                if ((err = snd_cmi8330_pnp(dev, acard, pcard, pid)) < 0) {
-                       snd_printk("PnP detection failed\n");
-                       snd_card_free(card);
-                       return err;
+                       snd_printk(KERN_ERR PFX "PnP detection failed\n");
+                       goto _err;
                }
                snd_card_set_dev(card, &pcard->card->dev);
        }
@@ -487,14 +490,13 @@ static int __devinit snd_cmi8330_probe(int dev,
                                     wssdma[dev],
                                     AD1848_HW_DETECT,
                                     &acard->wss)) < 0) {
-               snd_printk("(AD1848) device busy??\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "(AD1848) device busy??\n");
+               goto _err;
        }
        if (acard->wss->hardware != AD1848_HW_CMI8330) {
-               snd_printk("(AD1848) not found during probe\n");
-               snd_card_free(card);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "(AD1848) not found during probe\n");
+               err = -ENODEV;
+               goto _err;
        }
 
        if ((err = snd_sbdsp_create(card, sbport[dev],
@@ -503,32 +505,26 @@ static int __devinit snd_cmi8330_probe(int dev,
                                    sbdma8[dev],
                                    sbdma16[dev],
                                    SB_HW_AUTO, &acard->sb)) < 0) {
-               snd_printk("(SB16) device busy??\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "(SB16) device busy??\n");
+               goto _err;
        }
        if (acard->sb->hardware != SB_HW_16) {
-               snd_printk("(SB16) not found during probe\n");
-               snd_card_free(card);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "(SB16) not found during probe\n");
+               goto _err;
        }
 
-       spin_lock_irqsave(&acard->wss->reg_lock, flags);
        snd_ad1848_out(acard->wss, AD1848_MISC_INFO, 0x40); /* switch on MODE2 */
        for (i = CMI8330_RMUX3D; i <= CMI8330_CDINGAIN; i++)
                snd_ad1848_out(acard->wss, i, snd_cmi8330_image[i - CMI8330_RMUX3D]);
-       spin_unlock_irqrestore(&acard->wss->reg_lock, flags);
 
        if ((err = snd_cmi8330_mixer(card, acard)) < 0) {
-               snd_printk("failed to create mixers\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "failed to create mixers\n");
+               goto _err;
        }
 
        if ((err = snd_cmi8330_pcm(card, acard)) < 0) {
-               snd_printk("failed to create pcms\n");
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "failed to create pcms\n");
+               goto _err;
        }
 
        strcpy(card->driver, "CMI8330/C3D");
@@ -539,16 +535,21 @@ static int __devinit snd_cmi8330_probe(int dev,
                wssirq[dev],
                wssdma[dev]);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
 
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_cmi8330_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 #ifdef CONFIG_PNP
@@ -594,10 +595,8 @@ static int __init alsa_card_cmi8330_init(void)
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev])
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (snd_cmi8330_probe(dev, NULL, NULL) >= 0)
                        cards++;
        }
index 7640837659ead2788f0f067b2c5b47b52bedd832..9be5416bcb92023c04970459f99cc2591989b6cd 100644 (file)
@@ -76,15 +76,15 @@ static int __init snd_card_cs4231_probe(int dev)
        int err;
 
        if (port[dev] == SNDRV_AUTO_PORT) {
-               snd_printk("specify port\n");
+               snd_printk(KERN_ERR "specify port\n");
                return -EINVAL;
        }
        if (irq[dev] == SNDRV_AUTO_IRQ) {
-               snd_printk("specify irq\n");
+               snd_printk(KERN_ERR "specify irq\n");
                return -EINVAL;
        }
        if (dma1[dev] == SNDRV_AUTO_DMA) {
-               snd_printk("specify dma1\n");
+               snd_printk(KERN_ERR "specify dma1\n");
                return -EINVAL;
        }
        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
@@ -96,15 +96,11 @@ static int __init snd_card_cs4231_probe(int dev)
                                     dma1[dev],
                                     dma2[dev],
                                     CS4231_HW_DETECT,
-                                    0, &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    0, &chip)) < 0)
+               goto _err;
 
-       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
 
        strcpy(card->driver, "CS4231");
        strcpy(card->shortname, pcm->name);
@@ -113,14 +109,10 @@ static int __init snd_card_cs4231_probe(int dev)
        if (dma2[dev] >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
 
-       if ((err = snd_cs4231_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_cs4231_mixer(chip)) < 0)
+               goto _err;
+       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
+               goto _err;
 
        if (mpu_port[dev] > 0 && mpu_port[dev] != SNDRV_AUTO_PORT) {
                if (mpu_irq[dev] == SNDRV_AUTO_IRQ)
@@ -130,14 +122,20 @@ static int __init snd_card_cs4231_probe(int dev)
                                        mpu_irq[dev],
                                        mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0,
                                        NULL) < 0)
-                       printk(KERN_ERR "cs4231: MPU401 not detected\n");
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+                       printk(KERN_WARNING "cs4231: MPU401 not detected\n");
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
        snd_cs4231_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_cs4231_init(void)
index 3199941edd9bafd67de441b6bbde50f18f343338..32318258cd8ed2384b0248cbf06da7a2521faaa6 100644 (file)
@@ -1480,7 +1480,7 @@ static int snd_cs4231_new(snd_card_t * card,
        cs4231_t *chip;
 
        *rchip = NULL;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        chip->hardware = hardware;
index 39f4eff44f5c8c5ac8fb2dc7595ef2082325fe5e..d28315dc72f7d543a01c24622a666bd6ba6cf381 100644 (file)
@@ -387,6 +387,12 @@ static void snd_card_cs4236_free(snd_card_t *card)
        }
 }
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
                                           const struct pnp_card_device_id *pid)
 {
@@ -397,20 +403,16 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
        opl3_t *opl3;
        int err;
 
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
+       if (! is_isapnp_selected(dev)) {
                if (port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify port\n");
+                       snd_printk(KERN_ERR "specify port\n");
                        return -EINVAL;
                }
                if (cport[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify cport\n");
+                       snd_printk(KERN_ERR "specify cport\n");
                        return -EINVAL;
                }
-#ifdef CONFIG_PNP
        }
-#endif
        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
                            sizeof(struct snd_card_cs4236));
        if (card == NULL)
@@ -421,8 +423,7 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
        if (isapnp[dev]) {
                if ((err = snd_card_cs4236_pnp(dev, acard, pcard, pid))<0) {
                        printk(KERN_ERR "isapnp detection failed and probing for " IDENT " is not supported\n");
-                       snd_card_free(card);
-                       return -ENXIO;
+                       goto _err;
                }
                snd_card_set_dev(card, &pcard->card->dev);
        }
@@ -430,8 +431,8 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
        if (sb_port[dev] > 0 && sb_port[dev] != SNDRV_AUTO_PORT)
                if ((acard->res_sb_port = request_region(sb_port[dev], 16, IDENT " SB")) == NULL) {
                        printk(KERN_ERR IDENT ": unable to register SB port at 0x%lx\n", sb_port[dev]);
-                       snd_card_free(card);
-                       return -ENOMEM;
+                       err = -EBUSY;
+                       goto _err;
                }
 
 #ifdef CS4232
@@ -443,18 +444,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
                                     dma2[dev],
                                     CS4231_HW_DETECT,
                                     0,
-                                    &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_mixer(chip)) < 0)
+               goto _err;
 
 #else /* CS4236 */
        if ((err = snd_cs4236_create(card,
@@ -465,18 +462,14 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
                                     dma2[dev],
                                     CS4231_HW_DETECT,
                                     0,
-                                    &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4236_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4236_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4236_mixer(chip)) < 0)
+               goto _err;
 #endif
        strcpy(card->driver, pcm->name);
        strcpy(card->shortname, pcm->name);
@@ -488,21 +481,17 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
        if (dma2[dev] >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", dma2[dev]);
 
-       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_cs4231_timer(chip, 0, NULL)) < 0)
+               goto _err;
 
        if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
                if (snd_opl3_create(card,
                                    fm_port[dev], fm_port[dev] + 2,
                                    OPL3_HW_OPL3_CS, 0, &opl3) < 0) {
-                       printk(KERN_ERR IDENT ": OPL3 not detected\n");
+                       printk(KERN_WARNING IDENT ": OPL3 not detected\n");
                } else {
-                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                               snd_card_free(card);
-                               return err;
-                       }
+                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                               goto _err;
                }
        }
 
@@ -513,17 +502,23 @@ static int __devinit snd_card_cs423x_probe(int dev, struct pnp_card_link *pcard,
                                        mpu_port[dev], 0,
                                        mpu_irq[dev],
                                        mpu_irq[dev] >= 0 ? SA_INTERRUPT : 0, NULL) < 0)
-                       printk(KERN_ERR IDENT ": MPU401 not detected\n");
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+                       printk(KERN_WARNING IDENT ": MPU401 not detected\n");
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_cs4236_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 #ifdef CONFIG_PNP
@@ -569,10 +564,8 @@ static int __init alsa_card_cs423x_init(void)
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev])
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (snd_card_cs423x_probe(dev, NULL, NULL) >= 0)
                        cards++;
        }
index c5eaec087b466d0b0756e310456945ceffe95faa..26a7d335ed8e0c5fa015dfa6957379d67cc2f768 100644 (file)
@@ -70,6 +70,7 @@ MODULE_PARM_DESC(dma8, "8-bit DMA # for ESx688 driver.");
 
 static snd_card_t *snd_audiodrive_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "es1688: "
 
 static int __init snd_audiodrive_probe(int dev)
 {
@@ -89,47 +90,41 @@ static int __init snd_audiodrive_probe(int dev)
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xmpu_irq = mpu_irq[dev];
        xdma = dma8[dev];
        if (xdma == SNDRV_AUTO_DMA) {
                if ((xdma = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
        if ((err = snd_es1688_create(card, port[dev], mpu_port[dev],
                                     xirq, xmpu_irq, xdma,
-                                    ES1688_HW_AUTO, &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_es1688_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    ES1688_HW_AUTO, &chip)) < 0)
+               goto _err;
+
+       if ((err = snd_es1688_pcm(chip, 0, &pcm)) < 0)
+               goto _err;
+
+       if ((err = snd_es1688_mixer(chip)) < 0)
+               goto _err;
 
        strcpy(card->driver, "ES1688");
        strcpy(card->shortname, pcm->name);
        sprintf(card->longname, "%s at 0x%lx, irq %i, dma %i", pcm->name, chip->port, xirq, xdma);
 
        if ((snd_opl3_create(card, chip->port, chip->port + 2, OPL3_HW_OPL3, 0, &opl3)) < 0) {
-               printk(KERN_ERR "es1688: opl3 not detected at 0x%lx\n", chip->port);
+               printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->port);
        } else {
-               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                       goto _err;
        }
 
        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)
                                               chip->mpu_port, 0,
                                               xmpu_irq,
                                               SA_INTERRUPT,
-                                              NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-       }
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
+                                              NULL)) < 0)
+                       goto _err;
        }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_audiodrive_cards[dev] = card;
        return 0;
 
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_audiodrive_legacy_auto_probe(unsigned long xport)
index 17f68d07d9b244d213d0c38df86094bdd368077c..aac898765c02278e99c7b8ac73efb6afb6de37f6 100644 (file)
@@ -649,7 +649,7 @@ int snd_es1688_create(snd_card_t * card,
        int err;
 
        *rchip = NULL;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        chip->irq = -1;
index 1d832b2adb7ca34ad93863927d3c2ec03413db4a..d0ea19f427034e886fc289f2457f457e6d8f234e 100644 (file)
@@ -1686,7 +1686,7 @@ static int __devinit snd_es18xx_new_device(snd_card_t * card,
        int err;
 
        *rchip = NULL;
-        chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+        chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->reg_lock);
@@ -1988,6 +1988,12 @@ static int __devinit snd_audiodrive_pnp(int dev, struct snd_audiodrive *acard,
 }
 #endif /* CONFIG_PNP */
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
                                          const struct pnp_card_device_id *pid)
 {
@@ -1996,7 +2002,6 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
        int xirq, xdma1, xdma2;
        snd_card_t *card;
        struct snd_audiodrive *acard;
-       snd_rawmidi_t *rmidi = NULL;
        es18xx_t *chip;
        opl3_t *opl3;
        int err;
@@ -2019,25 +2024,25 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
         if (xdma1 == SNDRV_AUTO_DMA) {
                 if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                        snd_card_free(card);
-                        snd_printk("unable to find a free DMA1\n");
-                        return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                 }
         }
        xdma2 = dma2[dev];
         if (xdma2 == SNDRV_AUTO_DMA) {
                 if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                        snd_card_free(card);
-                        snd_printk("unable to find a free DMA2\n");
-                        return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                 }
         }
 
@@ -2046,10 +2051,8 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
                                         mpu_port[dev],
                                         fm_port[dev],
                                         xirq, xdma1, xdma2,
-                                        &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                        &chip)) < 0)
+               goto _err;
 
        sprintf(card->driver, "ES%x", chip->version);
        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,
                        chip->port,
                        xirq, xdma1);
 
-       if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_es18xx_mixer(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_es18xx_pcm(chip, 0, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_es18xx_mixer(chip)) < 0)
+               goto _err;
 
        if (fm_port[dev] > 0 && fm_port[dev] != SNDRV_AUTO_PORT) {
                if (snd_opl3_create(card, chip->fm_port, chip->fm_port + 2, OPL3_HW_OPL3, 0, &opl3) < 0) {
-                       snd_printk(KERN_ERR PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
+                       snd_printk(KERN_WARNING PFX "opl3 not detected at 0x%lx\n", chip->fm_port);
                } else {
-                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                               snd_card_free(card);
-                               return err;
-                       }
+                       if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                               goto _err;
                }
        }
 
@@ -2088,25 +2086,28 @@ static int __devinit snd_audiodrive_probe(int dev, struct pnp_card_link *pcard,
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_ES18XX,
                                               chip->mpu_port, 0,
                                               xirq, 0,
-                                              &rmidi)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-               chip->rmidi = rmidi;
+                                              &chip->rmidi)) < 0)
+                       goto _err;
        }
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
        /* Power Management */
        snd_card_set_isa_pm_callback(card, snd_es18xx_suspend, snd_es18xx_resume, chip);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_audiodrive_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static 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)
        for ( ; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                port[dev] = xport;
                res = snd_audiodrive_probe(dev, NULL, NULL);
                if (res < 0)
@@ -2177,10 +2176,8 @@ static int __init alsa_card_es18xx_init(void)
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (snd_audiodrive_probe(dev, NULL, NULL) >= 0)
                        cards++;
        }
index a636d9ce3502ecf36bdab0291acdaeb0cd4fd514..8f2872f8e8f6daae4907480b5eeb97f2c07d0a1d 100644 (file)
@@ -157,7 +157,7 @@ int snd_gus_create(snd_card_t * card,
        };
 
        *rgus = NULL;
-       gus = kcalloc(1, sizeof(*gus), GFP_KERNEL);
+       gus = kzalloc(sizeof(*gus), GFP_KERNEL);
        if (gus == NULL)
                return -ENOMEM;
        gus->gf1.irq = -1;
index 886763f121323fad88f816f2e73c00b3df4d8095..7f96ac237f3c346ae7ecc5bfcdbbdc09ad190b41 100644 (file)
@@ -98,7 +98,7 @@ int snd_gf1_mem_proc_init(snd_gus_card_t * gus)
 
        for (idx = 0; idx < 4; idx++) {
                if (gus->gf1.mem_alloc.banks_8[idx].size > 0) {
-                       priv = kcalloc(1, sizeof(*priv), GFP_KERNEL);
+                       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
                        if (priv == NULL)
                                return -ENOMEM;
                        priv->gus = gus;
@@ -115,7 +115,7 @@ int snd_gf1_mem_proc_init(snd_gus_card_t * gus)
        }
        for (idx = 0; idx < 4; idx++) {
                if (gus->gf1.rom_present & (1 << idx)) {
-                       priv = kcalloc(1, sizeof(*priv), GFP_KERNEL);
+                       priv = kzalloc(sizeof(*priv), GFP_KERNEL);
                        if (priv == NULL)
                                return -ENOMEM;
                        priv->rom = 1;
index b75066ab46fc33edfa1dd8262f0d1beb822a7bb9..beb01365dc466642f15fcbaa4599976cd74290ec 100644 (file)
@@ -666,7 +666,7 @@ static int snd_gf1_pcm_playback_open(snd_pcm_substream_t *substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err;
 
-       pcmp = kcalloc(1, sizeof(*pcmp), GFP_KERNEL);
+       pcmp = kzalloc(sizeof(*pcmp), GFP_KERNEL);
        if (pcmp == NULL)
                return -ENOMEM;
        pcmp->gus = gus;
index a99fa5040b46c8b5d575b53cb889207fccdb335b..39cef38835ca2b2c2f3a90c827f81bc9f17544fe 100644 (file)
@@ -72,40 +72,24 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Classic driver.");
 
 static snd_card_t *snd_gusclassic_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "gusclassic: "
 
 static int __init snd_gusclassic_detect(snd_gus_card_t * gus)
 {
-       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
+       unsigned char d;
 
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
-
+       }
        return 0;
 }
 
@@ -137,25 +121,25 @@ static int __init snd_gusclassic_probe(int dev)
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
        if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA1\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma2 = dma2[dev];
        if (xdma2 == SNDRV_AUTO_DMA) {
                if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA2\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
@@ -164,47 +148,48 @@ static int __init snd_gusclassic_probe(int dev)
                                  port[dev],
                                  xirq, xdma1, xdma2,
                                  0, channels[dev], pcm_channels[dev],
-                                 0, &gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_gusclassic_detect(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                 0, &gus)) < 0)
+               goto _err;
+
+       if ((err = snd_gusclassic_detect(gus)) < 0)
+               goto _err;
+
        snd_gusclassic_init(dev, gus);
-       if ((err = snd_gus_initialize(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gus_initialize(gus)) < 0)
+               goto _err;
+
        if (gus->max_flag || gus->ess_flag) {
-               snd_printdd("GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port);
-               snd_card_free(card);
-               return -ENODEV;
-       }
-       if ((err = snd_gf1_new_mixer(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
+               snd_printk(KERN_ERR PFX "GUS Classic or ACE soundcard was not detected at 0x%lx\n", gus->gf1.port);
+               err = -ENODEV;
+               goto _err;
        }
+
+       if ((err = snd_gf1_new_mixer(gus)) < 0)
+               goto _err;
+
+       if ((err = snd_gf1_pcm_new(gus, 0, 0, NULL)) < 0)
+               goto _err;
+
        if (!gus->ace_flag) {
-               if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
+                       goto _err;
        }
        sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %d, dma %d", gus->gf1.port, xirq, xdma1);
        if (dma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_gusclassic_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_gusclassic_legacy_auto_probe(unsigned long xport)
index bc6fecb18dcf98ca4c601c4323b98a270fa9d427..d2e7cb1df537f9f9559edfb475c6608e0c9a0dcd 100644 (file)
@@ -87,6 +87,7 @@ MODULE_PARM_DESC(pcm_channels, "Reserved PCM channels for GUS Extreme driver.");
 
 static snd_card_t *snd_gusextreme_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "gusextreme: "
 
 static int __init snd_gusextreme_detect(int dev,
                                        snd_card_t * card,
@@ -94,6 +95,7 @@ static int __init snd_gusextreme_detect(int dev,
                                        es1688_t *es1688)
 {
        unsigned long flags;
+       unsigned char d;
 
        /*
         * This is main stuff - enable access to GF1 chip...
@@ -123,36 +125,17 @@ static int __init snd_gusextreme_detect(int dev,
        udelay(100);
 
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -EIO;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -EIO;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -EIO;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -EIO;
-#endif
-
+       }
        return 0;
 }
 
@@ -205,7 +188,7 @@ static int __init snd_gusextreme_probe(int dev)
        xgf1_irq = gf1_irq[dev];
        if (xgf1_irq == SNDRV_AUTO_IRQ) {
                if ((xgf1_irq = snd_legacy_find_free_irq(possible_gf1_irqs)) < 0) {
-                       snd_printk("unable to find a free IRQ for GF1\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ for GF1\n");
                        err = -EBUSY;
                        goto out;
                }
@@ -213,7 +196,7 @@ static int __init snd_gusextreme_probe(int dev)
        xess_irq = irq[dev];
        if (xess_irq == SNDRV_AUTO_IRQ) {
                if ((xess_irq = snd_legacy_find_free_irq(possible_ess_irqs)) < 0) {
-                       snd_printk("unable to find a free IRQ for ES1688\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ for ES1688\n");
                        err = -EBUSY;
                        goto out;
                }
@@ -226,7 +209,7 @@ static int __init snd_gusextreme_probe(int dev)
        xgf1_dma = dma1[dev];
        if (xgf1_dma == SNDRV_AUTO_DMA) {
                if ((xgf1_dma = snd_legacy_find_free_dma(possible_gf1_dmas)) < 0) {
-                       snd_printk("unable to find a free DMA for GF1\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA for GF1\n");
                        err = -EBUSY;
                        goto out;
                }
@@ -234,7 +217,7 @@ static int __init snd_gusextreme_probe(int dev)
        xess_dma = dma8[dev];
        if (xess_dma == SNDRV_AUTO_DMA) {
                if ((xess_dma = snd_legacy_find_free_dma(possible_ess_dmas)) < 0) {
-                       snd_printk("unable to find a free DMA for ES1688\n");
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA for ES1688\n");
                        err = -EBUSY;
                        goto out;
                }
@@ -264,7 +247,7 @@ static int __init snd_gusextreme_probe(int dev)
                goto out;
 
        if (!gus->ess_flag) {
-               snd_printdd("GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
+               snd_printk(KERN_ERR PFX "GUS Extreme soundcard was not detected at 0x%lx\n", gus->gf1.port);
                err = -ENODEV;
                goto out;
        }
@@ -287,7 +270,7 @@ static int __init snd_gusextreme_probe(int dev)
 
        if (snd_opl3_create(card, es1688->port, es1688->port + 2,
                            OPL3_HW_OPL3, 0, &opl3) < 0) {
-               printk(KERN_ERR "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
+               printk(KERN_ERR PFX "gusextreme: opl3 not detected at 0x%lx\n", es1688->port);
        } else {
                if ((err = snd_opl3_hwdep_new(opl3, 0, 2, NULL)) < 0)
                        goto out;
@@ -303,6 +286,10 @@ static int __init snd_gusextreme_probe(int dev)
 
        sprintf(card->longname, "Gravis UltraSound Extreme at 0x%lx, irq %i&%i, dma %i&%i",
                es1688->port, xgf1_irq, xess_irq, xgf1_dma, xess_dma);
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto out;
+
        if ((err = snd_card_register(card)) < 0)
                goto out;
 
index 400ff34710fb7b28a7de899fed21f1fcab639ff6..0bb44b5193407a772eedf719b5385a452904b997 100644 (file)
@@ -82,39 +82,25 @@ struct snd_gusmax {
 
 static snd_card_t *snd_gusmax_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "gusmax: "
 
 static int __init snd_gusmax_detect(snd_gus_card_t * gus)
 {
-       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
+       unsigned char d;
 
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               unsigned char d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
+
        return 0;
 }
 
@@ -239,25 +225,25 @@ static int __init snd_gusmax_probe(int dev)
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
        if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA1\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma2 = dma2[dev];
        if (xdma2 == SNDRV_AUTO_DMA) {
                if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA2\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
@@ -266,31 +252,28 @@ static int __init snd_gusmax_probe(int dev)
                                  -xirq, xdma1, xdma2,
                                  0, channels[dev],
                                  pcm_channels[dev],
-                                 0, &gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_gusmax_detect(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                 0, &gus)) < 0)
+               goto _err;
+
+       if ((err = snd_gusmax_detect(gus)) < 0)
+               goto _err;
+
        maxcard->gus_status_reg = gus->gf1.reg_irqstat;
        maxcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
        snd_gusmax_init(dev, card, gus);
-       if ((err = snd_gus_initialize(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gus_initialize(gus)) < 0)
+               goto _err;
+
        if (!gus->max_flag) {
-               printk(KERN_ERR "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
-               snd_card_free(card);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "GUS MAX soundcard was not detected at 0x%lx\n", gus->gf1.port);
+               err = -ENODEV;
+               goto _err;
        }
 
        if (request_irq(xirq, snd_gusmax_interrupt, SA_INTERRUPT, "GUS MAX", (void *)maxcard)) {
-               snd_card_free(card);
-               printk(KERN_ERR "gusmax: unable to grab IRQ %d\n", xirq);
-               return -EBUSY;
+               snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
+               err = -EBUSY;
+               goto _err;
        }
        maxcard->irq = xirq;
        
@@ -301,50 +284,46 @@ static int __init snd_gusmax_probe(int dev)
                                     CS4231_HWSHARE_IRQ |
                                     CS4231_HWSHARE_DMA1 |
                                     CS4231_HWSHARE_DMA2,
-                                    &cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &cs4231)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_pcm(cs4231, 0, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_mixer(cs4231)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
+               goto _err;
+
        if (pcm_channels[dev] > 0) {
-               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-       }
-       if ((err = snd_gusmax_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
+               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
+                       goto _err;
        }
+       if ((err = snd_gusmax_mixer(cs4231)) < 0)
+               goto _err;
 
-       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
+               goto _err;
 
        sprintf(card->longname + strlen(card->longname), " at 0x%lx, irq %i, dma %i", gus->gf1.port, xirq, xdma1);
        if (xdma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%i", xdma2);
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
                
        maxcard->gus = gus;
        maxcard->cs4231 = cs4231;
        snd_gusmax_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_gusmax_legacy_auto_probe(unsigned long xport)
index 46e867daba6afd43a3ab128dbe1819c7a2d8399e..358cba9d738fa1976a1b51488f2f40ceac396b59 100644 (file)
@@ -73,6 +73,12 @@ static int midi[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static int pcm_channels[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 2};
 static int effect[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 
+#ifdef SNDRV_STB
+#define PFX "interwave-stb: "
+#else
+#define PFX "interwave: "
+#endif
+
 module_param_array(index, int, NULL, 0444);
 MODULE_PARM_DESC(index, "Index value for InterWave soundcard.");
 module_param_array(id, charp, NULL, 0444);
@@ -249,38 +255,20 @@ static int __devinit snd_interwave_detect(struct snd_interwave *iwcard,
 {
        unsigned long flags;
        unsigned char rev1, rev2;
+       int d;
 
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 0);   /* reset GF1 */
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               int d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
-                       snd_printk("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 0)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 0) {
+               snd_printdd("[0x%lx] check 1 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
+       }
        udelay(160);
        snd_gf1_i_write8(gus, SNDRV_GF1_GB_RESET, 1);   /* release reset */
        udelay(160);
-#ifdef CONFIG_SND_DEBUG_DETECT
-       {
-               int d;
-
-               if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
-                       snd_printk("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
-                       return -ENODEV;
-               }
-       }
-#else
-       if ((snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET) & 0x07) != 1)
+       if (((d = snd_gf1_i_look8(gus, SNDRV_GF1_GB_RESET)) & 0x07) != 1) {
+               snd_printdd("[0x%lx] check 2 failed - 0x%x\n", gus->gf1.port, d);
                return -ENODEV;
-#endif
-
+       }
        spin_lock_irqsave(&gus->reg_lock, flags);
        rev1 = snd_gf1_look8(gus, SNDRV_GF1_GB_VERSION_NUMBER);
        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,
        card->private_free = snd_interwave_free;
 #ifdef CONFIG_PNP
        if (isapnp[dev]) {
-               if (snd_interwave_pnp(dev, iwcard, pcard, pid)) {
-                       snd_card_free(card);
-                       return -ENODEV;
-               }
+               if ((err = snd_interwave_pnp(dev, iwcard, pcard, pid)) < 0)
+                       goto _err;
                snd_card_set_dev(card, &pcard->card->dev);
        }
 #endif
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
        if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA1\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA1\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma2 = dma2[dev];
        if (xdma2 == SNDRV_AUTO_DMA) {
                if ((xdma2 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA2\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA2\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
@@ -722,32 +708,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
                                  port[dev],
                                  -xirq, xdma1, xdma2,
                                  0, 32,
-                                 pcm_channels[dev], effect[dev], &gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                 pcm_channels[dev], effect[dev], &gus)) < 0)
+               goto _err;
+
        if ((err = snd_interwave_detect(iwcard, gus, dev
 #ifdef SNDRV_STB
             , &i2c_bus
 #endif
-           )) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+           )) < 0)
+               goto _err;
+
        iwcard->gus_status_reg = gus->gf1.reg_irqstat;
        iwcard->pcm_status_reg = gus->gf1.port + 0x10c + 2;
 
        snd_interwave_init(dev, gus);
        snd_interwave_detect_memory(gus);
-       if ((err = snd_gus_initialize(gus)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gus_initialize(gus)) < 0)
+               goto _err;
 
        if (request_irq(xirq, snd_interwave_interrupt, SA_INTERRUPT, "InterWave", (void *)iwcard)) {
-               snd_card_free(card);
-               snd_printk("unable to grab IRQ %d\n", xirq);
-               return -EBUSY;
+               snd_printk(KERN_ERR PFX "unable to grab IRQ %d\n", xirq);
+               err = -EBUSY;
+               goto _err;
        }
        iwcard->irq = xirq;
 
@@ -758,34 +740,28 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
                                     CS4231_HWSHARE_IRQ |
                                     CS4231_HWSHARE_DMA1 |
                                     CS4231_HWSHARE_DMA2,
-                                    &cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    &cs4231)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_pcm(cs4231, 0, &pcm)) < 0)
+               goto _err;
+
        sprintf(pcm->name + strlen(pcm->name), " rev %c", gus->revision + 'A');
        strcat(pcm->name, " (codec)");
-       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_cs4231_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_cs4231_timer(cs4231, 2, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_cs4231_mixer(cs4231)) < 0)
+               goto _err;
+
        if (pcm_channels[dev] > 0) {
-               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-       }
-       if ((err = snd_interwave_mixer(cs4231)) < 0) {
-               snd_card_free(card);
-               return err;
+               if ((err = snd_gf1_pcm_new(gus, 1, 1, NULL)) < 0)
+                       goto _err;
        }
+       if ((err = snd_interwave_mixer(cs4231)) < 0)
+               goto _err;
+
 #ifdef SNDRV_STB
        {
                snd_ctl_elem_id_t id1, id2;
@@ -795,28 +771,20 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
                strcpy(id1.name, "Master Playback Switch");
                strcpy(id2.name, id1.name);
                id2.index = 1;
-               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
+                       goto _err;
                strcpy(id1.name, "Master Playback Volume");
                strcpy(id2.name, id1.name);
-               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
-               if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_ctl_rename_id(card, &id1, &id2)) < 0)
+                       goto _err;
+               if ((err = snd_tea6330t_update_mixer(card, i2c_bus, 0, 1)) < 0)
+                       goto _err;
        }
 #endif
 
        gus->uart_enable = midi[dev];
-       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0)
+               goto _err;
 
 #ifndef SNDRV_STB
        str = "AMD InterWave";
@@ -835,10 +803,11 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
        if (xdma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
        
        iwcard->cs4231 = cs4231;
        iwcard->gus = gus;
@@ -847,6 +816,10 @@ static int __devinit snd_interwave_probe(int dev, struct pnp_card_link *pcard,
        else
                snd_interwave_legacy[dev++] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __devinit snd_interwave_probe_legacy_port(unsigned long xport)
index 75bd6eca63e741ed8545f86543a97884a8130eb7..e2d2babcd20b47421ce034afcbda41837cb66a89 100644 (file)
@@ -143,6 +143,8 @@ struct snd_opl3sa2 {
 
 static snd_card_t *snd_opl3sa2_legacy[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "opl3sa2: "
+
 #ifdef CONFIG_PNP
 
 static struct pnp_device_id snd_opl3sa2_pnpbiosids[] = {
@@ -231,7 +233,7 @@ static int __init snd_opl3sa2_detect(opl3sa2_t *chip)
        card = chip->card;
        port = chip->port;
        if ((chip->res_port = request_region(port, 2, "OPL3-SA control")) == NULL) {
-               snd_printk(KERN_ERR "opl3sa2: can't grab port 0x%lx\n", port);
+               snd_printk(KERN_ERR PFX "can't grab port 0x%lx\n", port);
                return -EBUSY;
        }
        // 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)
        return snd_opl3sa2_free(chip);
 }
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __devinit snd_opl3sa2_probe(int dev,
                                       struct pnp_dev *pdev,
                                       struct pnp_card_link *pcard,
@@ -683,34 +691,31 @@ static int __devinit snd_opl3sa2_probe(int dev,
        };
        int err;
 
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
+       if (! is_isapnp_selected(dev)) {
                if (port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify port\n");
+                       snd_printk(KERN_ERR PFX "specify port\n");
                        return -EINVAL;
                }
                if (wss_port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify wss_port\n");
+                       snd_printk(KERN_ERR PFX "specify wss_port\n");
                        return -EINVAL;
                }
                if (fm_port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify fm_port\n");
+                       snd_printk(KERN_ERR PFX "specify fm_port\n");
                        return -EINVAL;
                }
                if (midi_port[dev] == SNDRV_AUTO_PORT) {
-                       snd_printk("specify midi_port\n");
+                       snd_printk(KERN_ERR PFX "specify midi_port\n");
                        return -EINVAL;
                }
-#ifdef CONFIG_PNP
        }
-#endif
+
        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
        if (card == NULL)
                return -ENOMEM;
        strcpy(card->driver, "OPL3SA2");
        strcpy(card->shortname, "Yamaha OPL3-SA2");
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                err = -ENOMEM;
                goto __error;
@@ -742,7 +747,7 @@ static int __devinit snd_opl3sa2_probe(int dev,
        if ((err = snd_opl3sa2_detect(chip)) < 0)
                goto __error;
        if (request_irq(xirq, snd_opl3sa2_interrupt, SA_INTERRUPT, "OPL3-SA2", (void *)chip)) {
-               snd_printk(KERN_ERR "opl3sa2: can't grab IRQ %d\n", xirq);
+               snd_printk(KERN_ERR PFX "can't grab IRQ %d\n", xirq);
                err = -ENODEV;
                goto __error;
        }
@@ -795,6 +800,9 @@ static int __devinit snd_opl3sa2_probe(int dev,
        if (dma2 >= 0)
                sprintf(card->longname + strlen(card->longname), "&%d", xdma2);
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto __error;
+
        if ((err = snd_card_register(card)) < 0)
                goto __error;
 
@@ -852,8 +860,10 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *card,
         int res;
 
         for ( ; dev < SNDRV_CARDS; dev++) {
-                if (!enable[dev] || !isapnp[dev])
-                        continue;
+               if (!enable[dev])
+                       continue;
+               if (is_isapnp_selected(dev))
+                       continue;
                 res = snd_opl3sa2_probe(dev, NULL, card, id);
                 if (res < 0)
                         return res;
index 411a702d85ba5467a9833cec04b4926e0da366e6..73573cb1db6a3555a2b86f20472ea32863eb0330 100644 (file)
@@ -1038,8 +1038,7 @@ static int snd_opti93x_capture_prepare(snd_pcm_substream_t *substream)
 
        chip->c_dma_size = size;
        snd_opti93x_out_mask(chip, OPTi93X_IFACE_CONF,
-               OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO,
-               (unsigned char)~(OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO));
+               OPTi93X_CAPTURE_ENABLE | OPTi93X_CAPTURE_PIO, 0);
 
        snd_dma_program(chip->dma2, runtime->dma_addr, size,
                DMA_MODE_READ | DMA_AUTOINIT);
@@ -1274,7 +1273,7 @@ static int snd_opti93x_create(snd_card_t *card, opti9xx_t *chip,
        opti93x_t *codec;
 
        *rcodec = NULL;
-       codec = kcalloc(1, sizeof(*codec), GFP_KERNEL);
+       codec = kzalloc(sizeof(*codec), GFP_KERNEL);
        if (codec == NULL)
                return -ENOMEM;
        codec->irq = -1;
@@ -1895,8 +1894,8 @@ static void snd_card_opti9xx_free(snd_card_t *card)
        }
 }
 
-static int __devinit snd_card_opti9xx_probe(struct pnp_card_link *pcard,
-                                           const struct pnp_card_device_id *pid)
+static int snd_card_opti9xx_probe(struct pnp_card_link *pcard,
+                                 const struct pnp_card_device_id *pid)
 {
        static long possible_ports[] = {0x530, 0xe80, 0xf40, 0x604, -1};
        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,
                        snd_card_free(card);
                        return error;
                }
+               if ((error = snd_card_set_generic_dev(card)) < 0) {
+                       snd_card_free(card);
+                       return error;
+               }
 #ifdef CONFIG_PNP
        }
 #endif /* CONFIG_PNP */
index 028af4066595f30759eaf4bfb033730a5c572088..5375705c054bbaceece95c7cd7a9797136a688e6 100644 (file)
@@ -1097,7 +1097,7 @@ snd_emu8000_new(snd_card_t *card, int index, long port, int seq_ports, snd_seq_d
        if (seq_ports <= 0)
                return 0;
 
-       hw = kcalloc(1, sizeof(*hw), GFP_KERNEL);
+       hw = kzalloc(sizeof(*hw), GFP_KERNEL);
        if (hw == NULL)
                return -ENOMEM;
        spin_lock_init(&hw->reg_lock);
index db5eb8b55058453a45cb4b1c4d3af32e97c3b47c..0209790dc4b5dafdf4b92fbabec323956652aacf 100644 (file)
@@ -233,7 +233,7 @@ static int emu8k_pcm_open(snd_pcm_substream_t *subs)
        emu8k_pcm_t *rec;
        snd_pcm_runtime_t *runtime = subs->runtime;
 
-       rec = kcalloc(1, sizeof(*rec), GFP_KERNEL);
+       rec = kzalloc(sizeof(*rec), GFP_KERNEL);
        if (! rec)
                return -ENOMEM;
 
index 60e2c53c49fc233b1bc5f9413713c36450bc20dd..7888783d68f598ed2c1ef179834d22cbf5c17ff3 100644 (file)
@@ -351,6 +351,12 @@ static void snd_sb16_free(snd_card_t *card)
        }
 }
 
+#ifdef CONFIG_PNP
+#define is_isapnp_selected(dev)                isapnp[dev]
+#else
+#define is_isapnp_selected(dev)                0
+#endif
+
 static int __init snd_sb16_probe(int dev,
                                 struct pnp_card_link *pcard,
                                 const struct pnp_card_device_id *pid)
@@ -378,10 +384,8 @@ static int __init snd_sb16_probe(int dev,
        card->private_free = snd_sb16_free;
 #ifdef CONFIG_PNP
        if (isapnp[dev]) {
-               if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid))) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_card_sb16_pnp(dev, acard, pcard, pid)))
+                       goto _err;
                snd_card_set_dev(card, &pcard->card->dev);
        }
 #endif
@@ -389,41 +393,37 @@ static int __init snd_sb16_probe(int dev,
        xirq = irq[dev];
        xdma8 = dma8[dev];
        xdma16 = dma16[dev];
-#ifdef CONFIG_PNP
-       if (!isapnp[dev]) {
-#endif
-       if (xirq == SNDRV_AUTO_IRQ) {
-               if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
-                       return -EBUSY;
+       if (! is_isapnp_selected(dev)) {
+               if (xirq == SNDRV_AUTO_IRQ) {
+                       if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
+                               snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                               err = -EBUSY;
+                               goto _err;
+                       }
                }
-       }
-       if (xdma8 == SNDRV_AUTO_DMA) {
-               if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
-                       snd_card_free(card);
-                       snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n");
-                       return -EBUSY;
+               if (xdma8 == SNDRV_AUTO_DMA) {
+                       if ((xdma8 = snd_legacy_find_free_dma(possible_dmas8)) < 0) {
+                               snd_printk(KERN_ERR PFX "unable to find a free 8-bit DMA\n");
+                               err = -EBUSY;
+                               goto _err;
+                       }
                }
-       }
-       if (xdma16 == SNDRV_AUTO_DMA) {
-               if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
-                       snd_card_free(card);
-                       snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n");
-                       return -EBUSY;
+               if (xdma16 == SNDRV_AUTO_DMA) {
+                       if ((xdma16 = snd_legacy_find_free_dma(possible_dmas16)) < 0) {
+                               snd_printk(KERN_ERR PFX "unable to find a free 16-bit DMA\n");
+                               err = -EBUSY;
+                               goto _err;
+                       }
                }
-       }
-       /* non-PnP FM port address is hardwired with base port address */
-       fm_port[dev] = port[dev];
-       /* block the 0x388 port to avoid PnP conflicts */
-       acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
+               /* non-PnP FM port address is hardwired with base port address */
+               fm_port[dev] = port[dev];
+               /* block the 0x388 port to avoid PnP conflicts */
+               acard->fm_res = request_region(0x388, 4, "SoundBlaster FM");
 #ifdef SNDRV_SBAWE_EMU8000
-       /* non-PnP AWE port address is hardwired with base port address */
-       awe_port[dev] = port[dev] + 0x400;
+               /* non-PnP AWE port address is hardwired with base port address */
+               awe_port[dev] = port[dev] + 0x400;
 #endif
-#ifdef CONFIG_PNP
        }
-#endif
 
        if ((err = snd_sbdsp_create(card,
                                    port[dev],
@@ -432,28 +432,20 @@ static int __init snd_sb16_probe(int dev,
                                    xdma8,
                                    xdma16,
                                    SB_HW_AUTO,
-                                   &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                   &chip)) < 0)
+               goto _err;
+
        if (chip->hardware != SB_HW_16) {
-               snd_card_free(card);
-               snd_printdd("SB 16 chip was not detected at 0x%lx\n", port[dev]);
-               return -ENODEV;
+               snd_printk(KERN_ERR PFX "SB 16 chip was not detected at 0x%lx\n", port[dev]);
+               err = -ENODEV;
+               goto _err;
        }
        chip->mpu_port = mpu_port[dev];
-#ifdef CONFIG_PNP
-       if (!isapnp[dev] && (err = snd_sb16dsp_configure(chip)) < 0) {
-#else
-       if ((err = snd_sb16dsp_configure(chip)) < 0) {
-#endif
-               snd_card_free(card);
-               return -ENXIO;
-       }
-       if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return -ENXIO;
-       }
+       if (! is_isapnp_selected(dev) && (err = snd_sb16dsp_configure(chip)) < 0)
+               goto _err;
+
+       if ((err = snd_sb16dsp_pcm(chip, 0, NULL)) < 0)
+               goto _err;
 
        strcpy(card->driver,
 #ifdef SNDRV_SBAWE_EMU8000
@@ -474,10 +466,8 @@ static int __init snd_sb16_probe(int dev,
        if (chip->mpu_port > 0 && chip->mpu_port != SNDRV_AUTO_PORT) {
                if ((err = snd_mpu401_uart_new(card, 0, MPU401_HW_SB,
                                               chip->mpu_port, 0,
-                                              xirq, 0, &chip->rmidi)) < 0) {
-                       snd_card_free(card);
-                       return -ENXIO;
-               }
+                                              xirq, 0, &chip->rmidi)) < 0)
+                       goto _err;
                chip->rmidi_callback = snd_mpu401_uart_interrupt;
        }
 
@@ -499,17 +489,13 @@ static int __init snd_sb16_probe(int dev,
 #else
                        int seqdev = 1;
 #endif
-                       if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0) {
-                               snd_card_free(card);
-                               return -ENXIO;
-                       }
+                       if ((err = snd_opl3_hwdep_new(opl3, 0, seqdev, &synth)) < 0)
+                               goto _err;
                }
        }
 
-       if ((err = snd_sbmixer_new(chip)) < 0) {
-               snd_card_free(card);
-               return -ENXIO;
-       }
+       if ((err = snd_sbmixer_new(chip)) < 0)
+               goto _err;
 
 #ifdef CONFIG_SND_SB16_CSP
        /* CSP chip on SB16ASP/AWE32 */
@@ -525,11 +511,11 @@ static int __init snd_sb16_probe(int dev,
 #endif
 #ifdef SNDRV_SBAWE_EMU8000
        if (awe_port[dev] > 0) {
-               if (snd_emu8000_new(card, 1, awe_port[dev],
-                                   seq_ports[dev], NULL) < 0) {
+               if ((err = snd_emu8000_new(card, 1, awe_port[dev],
+                                          seq_ports[dev], NULL)) < 0) {
                        snd_printk(KERN_ERR PFX "fatal error - EMU-8000 synthesizer not detected at 0x%lx\n", awe_port[dev]);
-                       snd_card_free(card);
-                       return -ENXIO;
+
+                       goto _err;
                }
        }
 #endif
@@ -541,15 +527,21 @@ static int __init snd_sb16_probe(int dev,
                (mic_agc[dev] ? 0x00 : 0x01));
        spin_unlock_irqrestore(&chip->mixer_lock, flags);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        if (pcard)
                pnp_set_card_drvdata(pcard, card);
        else
                snd_sb16_legacy[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static 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)
        for ( ; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] != SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                port[dev] = xport;
                res = snd_sb16_probe(dev, NULL, NULL);
                if (res < 0)
@@ -621,10 +611,8 @@ static int __init alsa_card_sb16_init(void)
        for (dev = 0; dev < SNDRV_CARDS; dev++) {
                if (!enable[dev] || port[dev] == SNDRV_AUTO_PORT)
                        continue;
-#ifdef CONFIG_PNP
-               if (isapnp[dev])
+               if (is_isapnp_selected(dev))
                        continue;
-#endif
                if (!snd_sb16_probe(dev, NULL, NULL)) {
                        cards++;
                        continue;
index d64790bcd831ad8104ec2e50c8e05ca228424fd3..7192d4c758e6026015c42d58aa9c5517c1361f2f 100644 (file)
@@ -122,7 +122,7 @@ int snd_sb_csp_new(sb_t *chip, int device, snd_hwdep_t ** rhwdep)
        if ((err = snd_hwdep_new(chip->card, "SB16-CSP", device, &hw)) < 0)
                return err;
 
-       if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) {
+       if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) {
                snd_device_free(chip->card, hw);
                return -ENOMEM;
        }
index e2cbc4202b3de3f16fee4901192960c86f28d17f..c41ac25e85ca6edcb924bbb8b43f1d4179ccec04 100644 (file)
@@ -107,54 +107,47 @@ static int __init snd_sb8_probe(int dev)
                                    dma8[dev],
                                    -1,
                                    SB_HW_AUTO,
-                                   &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                   &chip)) < 0)
+               goto _err;
+
        if (chip->hardware >= SB_HW_16) {
-               snd_card_free(card);
                if (chip->hardware == SB_HW_ALS100)
-                       snd_printdd("ALS100 chip detected at 0x%lx, try snd-als100 module\n",
+                       snd_printk(KERN_WARNING "ALS100 chip detected at 0x%lx, try snd-als100 module\n",
                                    port[dev]);
                else
-                       snd_printdd("SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
-                                   port[dev]);
-               return -ENODEV;
+                       snd_printk(KERN_WARNING "SB 16 chip detected at 0x%lx, try snd-sb16 module\n",
+                                  port[dev]);
+               err = -ENODEV;
+               goto _err;
        }
 
-       if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
-       if ((err = snd_sbmixer_new(chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_sb8dsp_pcm(chip, 0, NULL)) < 0)
+               goto _err;
+
+       if ((err = snd_sbmixer_new(chip)) < 0)
+               goto _err;
+
        if (chip->hardware == SB_HW_10 || chip->hardware == SB_HW_20) {
                if ((err = snd_opl3_create(card, chip->port + 8, 0,
                                           OPL3_HW_AUTO, 1,
                                           &opl3)) < 0) {
-                       snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx\n", chip->port + 8);
+                       snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx\n", chip->port + 8);
                }
        } else {
                if ((err = snd_opl3_create(card, chip->port, chip->port + 2,
                                           OPL3_HW_AUTO, 1,
                                           &opl3)) < 0) {
-                       snd_printk(KERN_ERR "sb8: no OPL device at 0x%lx-0x%lx\n",
+                       snd_printk(KERN_WARNING "sb8: no OPL device at 0x%lx-0x%lx\n",
                                   chip->port, chip->port + 2);
                }
        }
        if (err >= 0) {
-               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0) {
-                       snd_card_free(card);
-                       return err;
-               }
+               if ((err = snd_opl3_hwdep_new(opl3, 0, 1, NULL)) < 0)
+                       goto _err;
        }
 
-       if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_sb8dsp_midi(chip, 0, NULL)) < 0)
+               goto _err;
 
        strcpy(card->driver, chip->hardware == SB_HW_PRO ? "SB Pro" : "SB8");
        strcpy(card->shortname, chip->name);
@@ -162,12 +155,19 @@ static int __init snd_sb8_probe(int dev)
                chip->name,
                chip->port,
                irq[dev], dma8[dev]);
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_sb8_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init snd_card_sb8_legacy_auto_probe(unsigned long xport)
index 5b6bde213ea0052b9a49a418810b46b9b3c91cdb..f0f205ae425fec52b29d0460243983c4f8f7bf40 100644 (file)
@@ -221,7 +221,7 @@ int snd_sbdsp_create(snd_card_t *card,
 
        snd_assert(r_chip != NULL, return -EINVAL);
        *r_chip = NULL;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        spin_lock_init(&chip->reg_lock);
index 17f585b0ddc19413e10dda63c9017b0d7bb46c54..52f2294da62b48c46784aa7a20b3d0727d44352a 100644 (file)
@@ -67,6 +67,8 @@ MODULE_PARM_DESC(dma1, "DMA1 # for Sound Galaxy driver.");
 
 static snd_card_t *snd_sgalaxy_cards[SNDRV_CARDS] = SNDRV_DEFAULT_PTR;
 
+#define PFX    "sgalaxy: "
+
 /*
 
  */
@@ -135,7 +137,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
        }
 
 #if 0
-       snd_printdd("sgalaxy - setting up IRQ/DMA for WSS\n");
+       snd_printdd(PFX "setting up IRQ/DMA for WSS\n");
 #endif
 
         /* initialize IRQ for WSS codec */
@@ -160,7 +162,7 @@ static int __init snd_sgalaxy_setup_wss(unsigned long port, int irq, int dma)
 static int __init snd_sgalaxy_detect(int dev, int irq, int dma)
 {
 #if 0
-       snd_printdd("sgalaxy - switching to WSS mode\n");
+       snd_printdd(PFX "switching to WSS mode\n");
 #endif
 
        /* switch to WSS mode */
@@ -223,11 +225,11 @@ static int __init snd_sgalaxy_probe(int dev)
        ad1848_t *chip;
 
        if (sbport[dev] == SNDRV_AUTO_PORT) {
-               snd_printk("specify SB port\n");
+               snd_printk(KERN_ERR PFX "specify SB port\n");
                return -EINVAL;
        }
        if (wssport[dev] == SNDRV_AUTO_PORT) {
-               snd_printk("specify WSS port\n");
+               snd_printk(KERN_ERR PFX "specify WSS port\n");
                return -EINVAL;
        }
        card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
@@ -237,46 +239,39 @@ static int __init snd_sgalaxy_probe(int dev)
        xirq = irq[dev];
        if (xirq == SNDRV_AUTO_IRQ) {
                if ((xirq = snd_legacy_find_free_irq(possible_irqs)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free IRQ\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free IRQ\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
        xdma1 = dma1[dev];
         if (xdma1 == SNDRV_AUTO_DMA) {
                if ((xdma1 = snd_legacy_find_free_dma(possible_dmas)) < 0) {
-                       snd_card_free(card);
-                       snd_printk("unable to find a free DMA\n");
-                       return -EBUSY;
+                       snd_printk(KERN_ERR PFX "unable to find a free DMA\n");
+                       err = -EBUSY;
+                       goto _err;
                }
        }
 
-       if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_sgalaxy_detect(dev, xirq, xdma1)) < 0)
+               goto _err;
 
        if ((err = snd_ad1848_create(card, wssport[dev] + 4,
                                     xirq, xdma1,
-                                    AD1848_HW_DETECT, &chip)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+                                    AD1848_HW_DETECT, &chip)) < 0)
+               goto _err;
 
        if ((err = snd_ad1848_pcm(chip, 0, NULL)) < 0) {
-               snd_printdd("sgalaxy - error creating new ad1848 PCM device\n");
-               snd_card_free(card);
-               return err;
+               snd_printdd(PFX "error creating new ad1848 PCM device\n");
+               goto _err;
        }
        if ((err = snd_ad1848_mixer(chip)) < 0) {
-               snd_printdd("sgalaxy - error creating new ad1848 mixer\n");
-               snd_card_free(card);
-               return err;
+               snd_printdd(PFX "error creating new ad1848 mixer\n");
+               goto _err;
        }
-       if (snd_sgalaxy_mixer(chip) < 0) {
-               snd_printdd("sgalaxy - the mixer rewrite failed\n");
-               snd_card_free(card);
-               return err;
+       if ((err = snd_sgalaxy_mixer(chip)) < 0) {
+               snd_printdd(PFX "the mixer rewrite failed\n");
+               goto _err;
        }
 
        strcpy(card->driver, "Sound Galaxy");
@@ -284,12 +279,18 @@ static int __init snd_sgalaxy_probe(int dev)
        sprintf(card->longname, "Sound Galaxy at 0x%lx, irq %d, dma %d",
                wssport[dev], xirq, xdma1);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
+
        snd_sgalaxy_cards[dev] = card;
        return 0;
+
+ _err:
+       snd_card_free(card);
+       return err;
 }
 
 static int __init alsa_card_sgalaxy_init(void)
index 3959ed694eeccad24490825e6c1bd63917c4f92e..9f6b58c79209cbc4f217a0b9dd700bf0270e37b0 100644 (file)
@@ -1262,11 +1262,6 @@ static int __devinit create_sscape(const struct params *params, snd_card_t **rca
         */
        sscape_write(sscape, GA_INTENA_REG, 0x80);
 
-       if ((err = snd_card_register(card)) < 0) {
-               printk(KERN_ERR "sscape: Failed to register sound card\n");
-               goto _release_card;
-       }
-
        /*
         * Initialize mixer
         */
@@ -1396,6 +1391,13 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard,
                        if (ret < 0)
                                return ret;
                        snd_card_set_dev(card, &pcard->card->dev);
+
+                       if ((ret = snd_card_register(card)) < 0) {
+                               printk(KERN_ERR "sscape: Failed to register sound card\n");
+                               snd_card_free(card);
+                               return ret;
+                       }
+
                        pnp_set_card_drvdata(pcard, card);
                        ++sscape_cards;
                        ++idx;
@@ -1460,6 +1462,16 @@ static int __init sscape_manual_probe(struct params *params)
                if (ret < 0)
                        return ret;
 
+               if ((ret = snd_card_set_generic_dev(card)) < 0) {
+                       snd_card_free(card);
+                       return ret;
+               }
+               if ((ret = snd_card_register(card)) < 0) {
+                       printk(KERN_ERR "sscape: Failed to register sound card\n");
+                       snd_card_free(card);
+                       return ret;
+               }
+
                sscape_card[sscape_cards] = card;
                params++;
                sscape_cards++;
index 79b022070ba33b1c34d55ea71401c87a63464f4a..0a572e0a47e62d891f5a5e30d704cfb3f952e217 100644 (file)
@@ -622,6 +622,11 @@ snd_wavefront_probe (int dev, struct pnp_card_link *pcard,
                 ics2115_port[dev],
                 ics2115_irq[dev]);
 
+       if ((err = snd_card_set_generic_dev(card)) < 0) {
+               snd_card_free(card);
+               return err;
+       }
+
        if ((err = snd_card_register(card)) < 0) {
                snd_card_free(card);
                return err;
index 531f8ba96a71ae40d05b810cc6b42e36fe2ec165..2433b7727404a061b80c815957c86048c1fa3f55 100644 (file)
@@ -8,6 +8,7 @@ config SND_AU1X00
        depends on (SOC_AU1000 || SOC_AU1100 || SOC_AU1500) && SND
        select SND_PCM
        select SND_AC97_CODEC
+       select SND_GENERIC_DRIVER
        help
          ALSA Sound driver for the Au1x00's AC97 port.
 
index c20522b0213463409a92f750c50940944081e19a..3f9684f1d1d2a24e1fe7cbcf24f98d3a4ca3a5a7 100644 (file)
@@ -667,6 +667,11 @@ au1000_init(void)
        strcpy(au1000->card->shortname, "Au1000-AC97");
        sprintf(au1000->card->longname, "AMD Au1000--AC97 ALSA Driver");
 
+       if ((err = snd_card_set_generic_dev(au1000->card)) < 0) {
+               snd_card_free(au1000->card);
+               return err;
+       }
+
        if ((err = snd_card_register(au1000->card)) < 0) {
                snd_card_free(au1000->card);
                return err;
index d7a8f9f5896fc2617a6b69240905c5bc81d99580..f560dd8cdb90dd4f9ff20c3a401cb07f21b0ae2b 100644 (file)
@@ -880,6 +880,8 @@ snd_harmony_create(snd_card_t *card,
                 goto free_and_ret;
         }
 
+       snd_card_set_dev(card, &padev->dev);
+
        *rchip = h;
 
        return 0;
index 1e458919cce6dfbc97822c95b383baac9eac041f..a5d593c66f9fca6b05ebade6a33d873dfba89397 100644 (file)
@@ -316,6 +316,18 @@ config SND_YMFPCI
          To compile this driver as a module, choose M here: the module
          will be called snd-ymfpci.
 
+config SND_AD1889
+       tristate "Analog Devices AD1889"
+       depends on SND
+       select SND_AC97_CODEC
+       help
+         Say Y here to include support for the integrated AC97 sound
+         device found in particular on the Hewlett-Packard [BCJ]-xxx0
+         class PA-RISC workstations, using the AD1819 codec.
+
+         To compile this as a module, choose M here: the module
+         will be called snd-ad1889.
+
 config SND_ALS4000
        tristate "Avance Logic ALS4000"
        depends on SND && ISA_DMA_API
index b40575c3349adbc7011121cab44a06c53e16e4ca..42fabfcfc2a9aabdbabaeb11a641aeacfbbed1a8 100644 (file)
@@ -3,6 +3,7 @@
 # Copyright (c) 2001 by Jaroslav Kysela <perex@suse.cz>
 #
 
+snd-ad1889-objs := ad1889.o
 snd-als4000-objs := als4000.o
 snd-atiixp-objs := atiixp.o
 snd-atiixp-modem-objs := atiixp_modem.o
@@ -25,6 +26,7 @@ snd-via82xx-objs := via82xx.o
 snd-via82xx-modem-objs := via82xx_modem.o
 
 # Toplevel Module Dependency
+obj-$(CONFIG_SND_AD1889) += snd-ad1889.o
 obj-$(CONFIG_SND_ALS4000) += snd-als4000.o
 obj-$(CONFIG_SND_ATIIXP) += snd-atiixp.o
 obj-$(CONFIG_SND_ATIIXP_MODEM) += snd-atiixp-modem.o
index 5501f4440c9223439f476788ecfe6211052d948b..e64cb07a39c2e3cdf4dca8a17d0e51a6d980f6e6 100644 (file)
@@ -112,6 +112,7 @@ static const ac97_codec_id_t snd_ac97_codec_ids[] = {
 { 0x414c4723, 0xffffffff, "ALC650F",           NULL,   NULL }, /* already patched */
 { 0x414c4720, 0xfffffff0, "ALC650",            patch_alc650,   NULL },
 { 0x414c4760, 0xfffffff0, "ALC655",            patch_alc655,   NULL },
+{ 0x414c4781, 0xffffffff, "ALC658D",           NULL,   NULL }, /* already patched */
 { 0x414c4780, 0xfffffff0, "ALC658",            patch_alc655,   NULL },
 { 0x414c4790, 0xfffffff0, "ALC850",            patch_alc850,   NULL },
 { 0x414c4730, 0xffffffff, "ALC101",            NULL,           NULL },
@@ -1796,7 +1797,7 @@ int snd_ac97_bus(snd_card_t *card, int num, ac97_bus_ops_t *ops,
 
        snd_assert(card != NULL, return -EINVAL);
        snd_assert(rbus != NULL, return -EINVAL);
-       bus = kcalloc(1, sizeof(*bus), GFP_KERNEL);
+       bus = kzalloc(sizeof(*bus), GFP_KERNEL);
        if (bus == NULL)
                return -ENOMEM;
        bus->card = card;
@@ -1905,7 +1906,7 @@ int snd_ac97_mixer(ac97_bus_t *bus, ac97_template_t *template, ac97_t **rac97)
        }
 
        card = bus->card;
-       ac97 = kcalloc(1, sizeof(*ac97), GFP_KERNEL);
+       ac97 = kzalloc(sizeof(*ac97), GFP_KERNEL);
        if (ac97 == NULL)
                return -ENOMEM;
        ac97->private_data = template->private_data;
index dadf387ad0b8a2b69b6a742e4ed73868dd75222c..6d73514dc49e040dd92310e6057618db8cd5b26b 100644 (file)
@@ -52,6 +52,7 @@
 #define AC97_ID_ALC650F                0x414c4723
 #define AC97_ID_ALC655         0x414c4760
 #define AC97_ID_ALC658         0x414c4780
+#define AC97_ID_ALC658D                0x414c4781
 #define AC97_ID_ALC850         0x414c4790
 #define AC97_ID_YMF753         0x594d4803
 #define AC97_ID_VT1616         0x49434551
index b584172c1104d55c470a9f810ee0eb9e14f79f49..045ddc743edcae9beca7674112e0688bda4ce14f 100644 (file)
@@ -2134,7 +2134,13 @@ int patch_alc655(ac97_t * ac97)
 {
        unsigned int val;
 
-       ac97->spec.dev_flags = (ac97->id == 0x414c4780); /* ALC658 */
+       if (ac97->id == AC97_ID_ALC658) {
+               ac97->spec.dev_flags = 1; /* ALC658 */
+               if ((snd_ac97_read(ac97, AC97_ALC650_REVISION) & 0x3f) == 2) {
+                       ac97->id = AC97_ID_ALC658D;
+                       ac97->spec.dev_flags = 2;
+               }
+       }
 
        ac97->build_ops = &patch_alc655_ops;
 
@@ -2143,10 +2149,15 @@ int patch_alc655(ac97_t * ac97)
 
        /* adjust default values */
        val = snd_ac97_read(ac97, 0x7a); /* misc control */
-       if (ac97->id == 0x414c4780) /* ALC658 */
+       if (ac97->spec.dev_flags) /* ALC658 */
                val &= ~(1 << 1); /* Pin 47 is spdif input pin */
-       else /* ALC655 */
-               val |= (1 << 1); /* Pin 47 is spdif input pin */
+       else { /* ALC655 */
+               if (ac97->subsystem_vendor == 0x1462 &&
+                   ac97->subsystem_device == 0x0131) /* MSI S270 laptop */
+                       val &= ~(1 << 1); /* Pin 47 is EAPD (for internal speaker) */
+               else
+                       val |= (1 << 1); /* Pin 47 is spdif input pin */
+       }
        val &= ~(1 << 12); /* vref enable */
        snd_ac97_write_cache(ac97, 0x7a, val);
        /* set default: spdif-in enabled,
@@ -2159,6 +2170,11 @@ int patch_alc655(ac97_t * ac97)
        /* full DAC volume */
        snd_ac97_write_cache(ac97, AC97_ALC650_SURR_DAC_VOL, 0x0808);
        snd_ac97_write_cache(ac97, AC97_ALC650_LFE_DAC_VOL, 0x0808);
+
+       /* update undocumented bit... */
+       if (ac97->id == AC97_ID_ALC658D)
+               snd_ac97_update_bits(ac97, 0x74, 0x0800, 0x0800);
+
        return 0;
 }
 
index f9ce0fd2f52fbecdbc79ce9eb8487ecc7facd669..4032c57483708731a1490f05f09ccb07cdd717e0 100644 (file)
@@ -357,7 +357,7 @@ int snd_ak4531_mixer(snd_card_t * card, ak4531_t * _ak4531, ak4531_t ** rak4531)
        snd_assert(rak4531 != NULL, return -EINVAL);
        *rak4531 = NULL;
        snd_assert(card != NULL && _ak4531 != NULL, return -EINVAL);
-       ak4531 = kcalloc(1, sizeof(*ak4531), GFP_KERNEL);
+       ak4531 = kzalloc(sizeof(*ak4531), GFP_KERNEL);
        if (ak4531 == NULL)
                return -ENOMEM;
        *ak4531 = *_ak4531;
diff --git a/sound/pci/ad1889.c b/sound/pci/ad1889.c
new file mode 100644 (file)
index 0000000..d7d99a2
--- /dev/null
@@ -0,0 +1,1090 @@
+/* Analog Devices 1889 audio driver
+ *
+ * This is a driver for the AD1889 PCI audio chipset found
+ * on the HP PA-RISC [BCJ]-xxx0 workstations.
+ *
+ * Copyright (C) 2004-2005, Kyle McMartin <kyle@parisc-linux.org>
+ * Copyright (C) 2005, Thibaut Varene <varenet@parisc-linux.org>
+ *   Based on the OSS AD1889 driver by Randolph Chung <tausq@debian.org>
+ *
+ * This program is free software; you can redistribute it and/or modify
+ * it under the terms of the GNU General Public License, version 2, as
+ * published by the Free Software Foundation.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.         See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU General Public License
+ * along with this program; if not, write to the Free Software
+ * Foundation, Inc., 675 Mass Ave, Cambridge, MA 02139, USA.
+ *
+ * TODO:
+ *     Do we need to take care of CCS register?
+ *     Maybe we could use finer grained locking (separate locks for pb/cap)?
+ * Wishlist:
+ *     Control Interface (mixer) support
+ *     Better AC97 support (VSR...)?
+ *     PM support
+ *     MIDI support
+ *     Game Port support
+ *     SG DMA support (this will need *alot* of work)
+ */
+
+#include <linux/init.h>
+#include <linux/pci.h>
+#include <linux/slab.h>
+#include <linux/interrupt.h>
+#include <linux/compiler.h>
+#include <linux/delay.h>
+
+#include <sound/driver.h>
+#include <sound/core.h>
+#include <sound/pcm.h>
+#include <sound/initval.h>
+#include <sound/ac97_codec.h>
+
+#include <asm/io.h>
+
+#include "ad1889.h"
+#include "ac97/ac97_id.h"
+
+#define        AD1889_DRVVER   "$Revision: 1.3 $"
+
+MODULE_AUTHOR("Kyle McMartin <kyle@parisc-linux.org>, Thibaut Varene <t-bone@parisc-linux.org>");
+MODULE_DESCRIPTION("Analog Devices AD1889 ALSA sound driver");
+MODULE_LICENSE("GPL");
+MODULE_SUPPORTED_DEVICE("{{Analog Devices,AD1889}}");
+
+static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;
+module_param_array(index, int, NULL, 0444);
+MODULE_PARM_DESC(index, "Index value for the AD1889 soundcard.");
+
+static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;
+module_param_array(id, charp, NULL, 0444);
+MODULE_PARM_DESC(id, "ID string for the AD1889 soundcard.");
+
+static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;
+module_param_array(enable, bool, NULL, 0444);
+MODULE_PARM_DESC(enable, "Enable AD1889 soundcard.");
+
+static char *ac97_quirk[SNDRV_CARDS];
+module_param_array(ac97_quirk, charp, NULL, 0444);
+MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
+
+#define DEVNAME "ad1889"
+#define PFX    DEVNAME ": "
+
+/* let's use the global sound debug interfaces */
+#define ad1889_debug(fmt, arg...) snd_printd(KERN_DEBUG fmt, ## arg)
+
+/* keep track of some hw registers */
+struct ad1889_register_state {
+       u16 reg;        /* reg setup */
+       u32 addr;       /* dma base address */
+       unsigned long size;     /* DMA buffer size */
+};
+
+struct snd_ad1889 {
+       snd_card_t *card;
+       struct pci_dev *pci;
+
+       int irq;
+       unsigned long bar;
+       void __iomem *iobase;
+
+       ac97_t *ac97;
+       ac97_bus_t *ac97_bus;
+       snd_pcm_t *pcm;
+       snd_info_entry_t *proc;
+
+       snd_pcm_substream_t *psubs;
+       snd_pcm_substream_t *csubs;
+
+       /* playback register state */
+       struct ad1889_register_state wave;
+       struct ad1889_register_state ramc;
+
+       spinlock_t lock;
+};
+
+static inline u16
+ad1889_readw(struct snd_ad1889 *chip, unsigned reg)
+{
+       return readw(chip->iobase + reg);
+}
+
+static inline void
+ad1889_writew(struct snd_ad1889 *chip, unsigned reg, u16 val)
+{
+       writew(val, chip->iobase + reg);
+}
+
+static inline u32
+ad1889_readl(struct snd_ad1889 *chip, unsigned reg)
+{
+       return readl(chip->iobase + reg);
+}
+
+static inline void
+ad1889_writel(struct snd_ad1889 *chip, unsigned reg, u32 val)
+{
+       writel(val, chip->iobase + reg);
+}
+
+static inline void
+ad1889_unmute(struct snd_ad1889 *chip)
+{
+       u16 st;
+       st = ad1889_readw(chip, AD_DS_WADA) & 
+               ~(AD_DS_WADA_RWAM | AD_DS_WADA_LWAM);
+       ad1889_writew(chip, AD_DS_WADA, st);
+       ad1889_readw(chip, AD_DS_WADA);
+}
+
+static inline void
+ad1889_mute(struct snd_ad1889 *chip)
+{
+       u16 st;
+       st = ad1889_readw(chip, AD_DS_WADA) | AD_DS_WADA_RWAM | AD_DS_WADA_LWAM;
+       ad1889_writew(chip, AD_DS_WADA, st);
+       ad1889_readw(chip, AD_DS_WADA);
+}
+
+static inline void
+ad1889_load_adc_buffer_address(struct snd_ad1889 *chip, u32 address)
+{
+       ad1889_writel(chip, AD_DMA_ADCBA, address);
+       ad1889_writel(chip, AD_DMA_ADCCA, address);
+}
+
+static inline void
+ad1889_load_adc_buffer_count(struct snd_ad1889 *chip, u32 count)
+{
+       ad1889_writel(chip, AD_DMA_ADCBC, count);
+       ad1889_writel(chip, AD_DMA_ADCCC, count);
+}
+
+static inline void
+ad1889_load_adc_interrupt_count(struct snd_ad1889 *chip, u32 count)
+{
+       ad1889_writel(chip, AD_DMA_ADCIB, count);
+       ad1889_writel(chip, AD_DMA_ADCIC, count);
+}
+
+static inline void
+ad1889_load_wave_buffer_address(struct snd_ad1889 *chip, u32 address)
+{
+       ad1889_writel(chip, AD_DMA_WAVBA, address);
+       ad1889_writel(chip, AD_DMA_WAVCA, address);
+}
+
+static inline void
+ad1889_load_wave_buffer_count(struct snd_ad1889 *chip, u32 count)
+{
+       ad1889_writel(chip, AD_DMA_WAVBC, count);
+       ad1889_writel(chip, AD_DMA_WAVCC, count);
+}
+
+static inline void
+ad1889_load_wave_interrupt_count(struct snd_ad1889 *chip, u32 count)
+{
+       ad1889_writel(chip, AD_DMA_WAVIB, count);
+       ad1889_writel(chip, AD_DMA_WAVIC, count);
+}
+
+static void
+ad1889_channel_reset(struct snd_ad1889 *chip, unsigned int channel)
+{
+       u16 reg;
+       
+       if (channel & AD_CHAN_WAV) {
+               /* Disable wave channel */
+               reg = ad1889_readw(chip, AD_DS_WSMC) & ~AD_DS_WSMC_WAEN;
+               ad1889_writew(chip, AD_DS_WSMC, reg);
+               chip->wave.reg = reg;
+               
+               /* disable IRQs */
+               reg = ad1889_readw(chip, AD_DMA_WAV);
+               reg &= AD_DMA_IM_DIS;
+               reg &= ~AD_DMA_LOOP;
+               ad1889_writew(chip, AD_DMA_WAV, reg);
+
+               /* clear IRQ and address counters and pointers */
+               ad1889_load_wave_buffer_address(chip, 0x0);
+               ad1889_load_wave_buffer_count(chip, 0x0);
+               ad1889_load_wave_interrupt_count(chip, 0x0);
+
+               /* flush */
+               ad1889_readw(chip, AD_DMA_WAV);
+       }
+       
+       if (channel & AD_CHAN_ADC) {
+               /* Disable ADC channel */
+               reg = ad1889_readw(chip, AD_DS_RAMC) & ~AD_DS_RAMC_ADEN;
+               ad1889_writew(chip, AD_DS_RAMC, reg);
+               chip->ramc.reg = reg;
+
+               reg = ad1889_readw(chip, AD_DMA_ADC);
+               reg &= AD_DMA_IM_DIS;
+               reg &= ~AD_DMA_LOOP;
+               ad1889_writew(chip, AD_DMA_ADC, reg);
+       
+               ad1889_load_adc_buffer_address(chip, 0x0);
+               ad1889_load_adc_buffer_count(chip, 0x0);
+               ad1889_load_adc_interrupt_count(chip, 0x0);
+
+               /* flush */
+               ad1889_readw(chip, AD_DMA_ADC);
+       }
+}
+
+static inline u16
+snd_ad1889_ac97_read(ac97_t *ac97, unsigned short reg)
+{
+       struct snd_ad1889 *chip = ac97->private_data;
+       return ad1889_readw(chip, AD_AC97_BASE + reg);
+}
+
+static inline void
+snd_ad1889_ac97_write(ac97_t *ac97, unsigned short reg, unsigned short val)
+{
+       struct snd_ad1889 *chip = ac97->private_data;
+       ad1889_writew(chip, AD_AC97_BASE + reg, val);
+}
+
+static int
+snd_ad1889_ac97_ready(struct snd_ad1889 *chip)
+{
+       int retry = 400; /* average needs 352 msec */
+       
+       while (!(ad1889_readw(chip, AD_AC97_ACIC) & AD_AC97_ACIC_ACRDY) 
+                       && --retry)
+               mdelay(1);
+       if (!retry) {
+               snd_printk(KERN_ERR PFX "[%s] Link is not ready.\n",
+                      __FUNCTION__);
+               return -EIO;
+       }
+       ad1889_debug("[%s] ready after %d ms\n", __FUNCTION__, 400 - retry);
+
+       return 0;
+}
+
+static int 
+snd_ad1889_hw_params(snd_pcm_substream_t *substream,
+                       snd_pcm_hw_params_t *hw_params)
+{
+       return snd_pcm_lib_malloc_pages(substream, 
+                                       params_buffer_bytes(hw_params));
+}
+
+static int
+snd_ad1889_hw_free(snd_pcm_substream_t *substream)
+{
+       return snd_pcm_lib_free_pages(substream);
+}
+
+static snd_pcm_hardware_t snd_ad1889_playback_hw = {
+       .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+               SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER,
+       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+       .rates = SNDRV_PCM_RATE_CONTINUOUS | SNDRV_PCM_RATE_8000_48000,
+       .rate_min = 8000,       /* docs say 7000, but we're lazy */
+       .rate_max = 48000,
+       .channels_min = 1,
+       .channels_max = 2,
+       .buffer_bytes_max = BUFFER_BYTES_MAX,
+       .period_bytes_min = PERIOD_BYTES_MIN,
+       .period_bytes_max = PERIOD_BYTES_MAX,
+       .periods_min = PERIODS_MIN,
+       .periods_max = PERIODS_MAX,
+       /*.fifo_size = 0,*/
+};
+
+static snd_pcm_hardware_t snd_ad1889_capture_hw = {
+       .info = SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
+               SNDRV_PCM_INFO_MMAP_VALID | SNDRV_PCM_INFO_BLOCK_TRANSFER,
+       .formats = SNDRV_PCM_FMTBIT_S16_LE,
+       .rates = SNDRV_PCM_RATE_48000,
+       .rate_min = 48000,      /* docs say we could to VSR, but we're lazy */
+       .rate_max = 48000,
+       .channels_min = 1,
+       .channels_max = 2,
+       .buffer_bytes_max = BUFFER_BYTES_MAX,
+       .period_bytes_min = PERIOD_BYTES_MIN,
+       .period_bytes_max = PERIOD_BYTES_MAX,
+       .periods_min = PERIODS_MIN,
+       .periods_max = PERIODS_MAX,
+       /*.fifo_size = 0,*/
+};
+
+static int
+snd_ad1889_playback_open(snd_pcm_substream_t *ss)
+{
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       snd_pcm_runtime_t *rt = ss->runtime;
+
+       chip->psubs = ss;
+       rt->hw = snd_ad1889_playback_hw;
+
+       return 0;
+}
+
+static int
+snd_ad1889_capture_open(snd_pcm_substream_t *ss)
+{
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       snd_pcm_runtime_t *rt = ss->runtime;
+
+       chip->csubs = ss;
+       rt->hw = snd_ad1889_capture_hw;
+
+       return 0;
+}
+
+static int
+snd_ad1889_playback_close(snd_pcm_substream_t *ss)
+{
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       chip->psubs = NULL;
+       return 0;
+}
+
+static int
+snd_ad1889_capture_close(snd_pcm_substream_t *ss)
+{
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       chip->csubs = NULL;
+       return 0;
+}
+
+static int
+snd_ad1889_playback_prepare(snd_pcm_substream_t *ss)
+{
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       snd_pcm_runtime_t *rt = ss->runtime;
+       unsigned int size = snd_pcm_lib_buffer_bytes(ss);
+       unsigned int count = snd_pcm_lib_period_bytes(ss);
+       u16 reg;
+
+       ad1889_channel_reset(chip, AD_CHAN_WAV);
+
+       reg = ad1889_readw(chip, AD_DS_WSMC);
+       
+       /* Mask out 16-bit / Stereo */
+       reg &= ~(AD_DS_WSMC_WA16 | AD_DS_WSMC_WAST);
+
+       if (snd_pcm_format_width(rt->format) == 16)
+               reg |= AD_DS_WSMC_WA16;
+
+       if (rt->channels > 1)
+               reg |= AD_DS_WSMC_WAST;
+
+       /* let's make sure we don't clobber ourselves */
+       spin_lock_irq(&chip->lock);
+       
+       chip->wave.size = size;
+       chip->wave.reg = reg;
+       chip->wave.addr = rt->dma_addr;
+
+       ad1889_writew(chip, AD_DS_WSMC, chip->wave.reg);
+       
+       /* Set sample rates on the codec */
+       ad1889_writew(chip, AD_DS_WAS, rt->rate);
+
+       /* Set up DMA */
+       ad1889_load_wave_buffer_address(chip, chip->wave.addr);
+       ad1889_load_wave_buffer_count(chip, size);
+       ad1889_load_wave_interrupt_count(chip, count);
+
+       /* writes flush */
+       ad1889_readw(chip, AD_DS_WSMC);
+       
+       spin_unlock_irq(&chip->lock);
+       
+       ad1889_debug("prepare playback: addr = 0x%x, count = %u, "
+                       "size = %u, reg = 0x%x, rate = %u\n", chip->wave.addr,
+                       count, size, reg, rt->rate);
+       return 0;
+}
+
+static int
+snd_ad1889_capture_prepare(snd_pcm_substream_t *ss)
+{
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       snd_pcm_runtime_t *rt = ss->runtime;
+       unsigned int size = snd_pcm_lib_buffer_bytes(ss);
+       unsigned int count = snd_pcm_lib_period_bytes(ss);
+       u16 reg;
+
+       ad1889_channel_reset(chip, AD_CHAN_ADC);
+       
+       reg = ad1889_readw(chip, AD_DS_RAMC);
+
+       /* Mask out 16-bit / Stereo */
+       reg &= ~(AD_DS_RAMC_AD16 | AD_DS_RAMC_ADST);
+
+       if (snd_pcm_format_width(rt->format) == 16)
+               reg |= AD_DS_RAMC_AD16;
+
+       if (rt->channels > 1)
+               reg |= AD_DS_RAMC_ADST;
+
+       /* let's make sure we don't clobber ourselves */
+       spin_lock_irq(&chip->lock);
+       
+       chip->ramc.size = size;
+       chip->ramc.reg = reg;
+       chip->ramc.addr = rt->dma_addr;
+
+       ad1889_writew(chip, AD_DS_RAMC, chip->ramc.reg);
+
+       /* Set up DMA */
+       ad1889_load_adc_buffer_address(chip, chip->ramc.addr);
+       ad1889_load_adc_buffer_count(chip, size);
+       ad1889_load_adc_interrupt_count(chip, count);
+
+       /* writes flush */
+       ad1889_readw(chip, AD_DS_RAMC);
+       
+       spin_unlock_irq(&chip->lock);
+       
+       ad1889_debug("prepare capture: addr = 0x%x, count = %u, "
+                       "size = %u, reg = 0x%x, rate = %u\n", chip->ramc.addr,
+                       count, size, reg, rt->rate);
+       return 0;
+}
+
+/* this is called in atomic context with IRQ disabled.
+   Must be as fast as possible and not sleep.
+   DMA should be *triggered* by this call.
+   The WSMC "WAEN" bit triggers DMA Wave On/Off */
+static int
+snd_ad1889_playback_trigger(snd_pcm_substream_t *ss, int cmd)
+{
+       u16 wsmc;
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+       
+       wsmc = ad1889_readw(chip, AD_DS_WSMC);
+
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_START:
+               /* enable DMA loop & interrupts */
+               ad1889_writew(chip, AD_DMA_WAV, AD_DMA_LOOP | AD_DMA_IM_CNT);
+               wsmc |= AD_DS_WSMC_WAEN;
+               /* 1 to clear CHSS bit */
+               ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_WAVS);
+               ad1889_unmute(chip);
+               break;
+       case SNDRV_PCM_TRIGGER_STOP:
+               ad1889_mute(chip);
+               wsmc &= ~AD_DS_WSMC_WAEN;
+               break;
+       default:
+               snd_BUG();
+               return -EINVAL;
+       }
+       
+       chip->wave.reg = wsmc;
+       ad1889_writew(chip, AD_DS_WSMC, wsmc);  
+       ad1889_readw(chip, AD_DS_WSMC); /* flush */
+
+       /* reset the chip when STOP - will disable IRQs */
+       if (cmd == SNDRV_PCM_TRIGGER_STOP)
+               ad1889_channel_reset(chip, AD_CHAN_WAV);
+
+       return 0;
+}
+
+/* this is called in atomic context with IRQ disabled.
+   Must be as fast as possible and not sleep.
+   DMA should be *triggered* by this call.
+   The RAMC "ADEN" bit triggers DMA ADC On/Off */
+static int
+snd_ad1889_capture_trigger(snd_pcm_substream_t *ss, int cmd)
+{
+       u16 ramc;
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+
+       ramc = ad1889_readw(chip, AD_DS_RAMC);
+       
+       switch (cmd) {
+       case SNDRV_PCM_TRIGGER_START:
+               /* enable DMA loop & interrupts */
+               ad1889_writew(chip, AD_DMA_ADC, AD_DMA_LOOP | AD_DMA_IM_CNT);
+               ramc |= AD_DS_RAMC_ADEN;
+               /* 1 to clear CHSS bit */
+               ad1889_writel(chip, AD_DMA_CHSS, AD_DMA_CHSS_ADCS);
+               break;
+       case SNDRV_PCM_TRIGGER_STOP:
+               ramc &= ~AD_DS_RAMC_ADEN;
+               break;
+       default:
+               return -EINVAL;
+       }
+       
+       chip->ramc.reg = ramc;
+       ad1889_writew(chip, AD_DS_RAMC, ramc);  
+       ad1889_readw(chip, AD_DS_RAMC); /* flush */
+       
+       /* reset the chip when STOP - will disable IRQs */
+       if (cmd == SNDRV_PCM_TRIGGER_STOP)
+               ad1889_channel_reset(chip, AD_CHAN_ADC);
+               
+       return 0;
+}
+
+/* Called in atomic context with IRQ disabled */
+static snd_pcm_uframes_t
+snd_ad1889_playback_pointer(snd_pcm_substream_t *ss)
+{
+       size_t ptr = 0;
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+
+       if (unlikely(!(chip->wave.reg & AD_DS_WSMC_WAEN)))
+               return 0;
+
+       ptr = ad1889_readl(chip, AD_DMA_WAVCA);
+       ptr -= chip->wave.addr;
+       
+       snd_assert((ptr >= 0) && (ptr < chip->wave.size), return 0);
+       
+       return bytes_to_frames(ss->runtime, ptr);
+}
+
+/* Called in atomic context with IRQ disabled */
+static snd_pcm_uframes_t
+snd_ad1889_capture_pointer(snd_pcm_substream_t *ss)
+{
+       size_t ptr = 0;
+       struct snd_ad1889 *chip = snd_pcm_substream_chip(ss);
+
+       if (unlikely(!(chip->ramc.reg & AD_DS_RAMC_ADEN)))
+               return 0;
+
+       ptr = ad1889_readl(chip, AD_DMA_ADCCA);
+       ptr -= chip->ramc.addr;
+
+       snd_assert((ptr >= 0) && (ptr < chip->ramc.size), return 0);
+       
+       return bytes_to_frames(ss->runtime, ptr);
+}
+
+static snd_pcm_ops_t snd_ad1889_playback_ops = {
+       .open = snd_ad1889_playback_open,
+       .close = snd_ad1889_playback_close,
+       .ioctl = snd_pcm_lib_ioctl,
+       .hw_params = snd_ad1889_hw_params,
+       .hw_free = snd_ad1889_hw_free,
+       .prepare = snd_ad1889_playback_prepare,
+       .trigger = snd_ad1889_playback_trigger,
+       .pointer = snd_ad1889_playback_pointer, 
+};
+
+static snd_pcm_ops_t snd_ad1889_capture_ops = {
+       .open = snd_ad1889_capture_open,
+       .close = snd_ad1889_capture_close,
+       .ioctl = snd_pcm_lib_ioctl,
+       .hw_params = snd_ad1889_hw_params,
+       .hw_free = snd_ad1889_hw_free,
+       .prepare = snd_ad1889_capture_prepare,
+       .trigger = snd_ad1889_capture_trigger,
+       .pointer = snd_ad1889_capture_pointer, 
+};
+
+static irqreturn_t
+snd_ad1889_interrupt(int irq, 
+                    void *dev_id, 
+                    struct pt_regs *regs)
+{
+       unsigned long st;
+       struct snd_ad1889 *chip = dev_id;
+
+       st = ad1889_readl(chip, AD_DMA_DISR);
+
+       /* clear ISR */
+       ad1889_writel(chip, AD_DMA_DISR, st);
+
+       st &= AD_INTR_MASK;
+
+       if (unlikely(!st))
+               return IRQ_NONE;
+
+       if (st & (AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI))
+               ad1889_debug("Unexpected master or target abort interrupt!\n");
+
+       if ((st & AD_DMA_DISR_WAVI) && chip->psubs)
+               snd_pcm_period_elapsed(chip->psubs);
+       if ((st & AD_DMA_DISR_ADCI) && chip->csubs)
+               snd_pcm_period_elapsed(chip->csubs);
+
+       return IRQ_HANDLED;
+}
+
+static void 
+snd_ad1889_pcm_free(snd_pcm_t *pcm)
+{
+       struct snd_ad1889 *chip = pcm->private_data;
+       chip->pcm = NULL;
+       snd_pcm_lib_preallocate_free_for_all(pcm);
+}
+
+static int __devinit
+snd_ad1889_pcm_init(struct snd_ad1889 *chip, int device, snd_pcm_t **rpcm)
+{
+       int err;
+       snd_pcm_t *pcm;
+
+       if (rpcm)
+               *rpcm = NULL;
+
+       err = snd_pcm_new(chip->card, chip->card->driver, device, 1, 1, &pcm);
+       if (err < 0)
+               return err;
+
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_PLAYBACK, 
+                       &snd_ad1889_playback_ops);
+       snd_pcm_set_ops(pcm, SNDRV_PCM_STREAM_CAPTURE,
+                       &snd_ad1889_capture_ops);
+
+       pcm->private_data = chip;
+       pcm->private_free = snd_ad1889_pcm_free;
+       pcm->info_flags = 0;
+       strcpy(pcm->name, chip->card->shortname);
+       
+       chip->pcm = pcm;
+       chip->psubs = NULL;
+       chip->csubs = NULL;
+
+       err = snd_pcm_lib_preallocate_pages_for_all(pcm, SNDRV_DMA_TYPE_DEV,
+                                               snd_dma_pci_data(chip->pci),
+                                               BUFFER_BYTES_MAX / 2,
+                                               BUFFER_BYTES_MAX);
+
+       if (err < 0) {
+               snd_printk(KERN_ERR PFX "buffer allocation error: %d\n", err);
+               return err;
+       }
+       
+       if (rpcm)
+               *rpcm = pcm;
+       
+       return 0;
+}
+
+static void
+snd_ad1889_proc_read(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
+{
+       struct snd_ad1889 *chip = entry->private_data;
+       u16 reg;
+       int tmp;
+
+       reg = ad1889_readw(chip, AD_DS_WSMC);
+       snd_iprintf(buffer, "Wave output: %s\n",
+                       (reg & AD_DS_WSMC_WAEN) ? "enabled" : "disabled");
+       snd_iprintf(buffer, "Wave Channels: %s\n",
+                       (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
+       snd_iprintf(buffer, "Wave Quality: %d-bit linear\n",
+                       (reg & AD_DS_WSMC_WA16) ? 16 : 8);
+       
+       /* WARQ is at offset 12 */
+       tmp = (reg & AD_DS_WSMC_WARQ) ?
+                       (((reg & AD_DS_WSMC_WARQ >> 12) & 0x01) ? 12 : 18) : 4;
+       tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1;
+       
+       snd_iprintf(buffer, "Wave FIFO: %d %s words\n\n", tmp,
+                       (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
+                               
+       
+       snd_iprintf(buffer, "Synthesis output: %s\n",
+                       reg & AD_DS_WSMC_SYEN ? "enabled" : "disabled");
+       
+       /* SYRQ is at offset 4 */
+       tmp = (reg & AD_DS_WSMC_SYRQ) ?
+                       (((reg & AD_DS_WSMC_SYRQ >> 4) & 0x01) ? 12 : 18) : 4;
+       tmp /= (reg & AD_DS_WSMC_WAST) ? 2 : 1;
+       
+       snd_iprintf(buffer, "Synthesis FIFO: %d %s words\n\n", tmp,
+                       (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
+
+       reg = ad1889_readw(chip, AD_DS_RAMC);
+       snd_iprintf(buffer, "ADC input: %s\n",
+                       (reg & AD_DS_RAMC_ADEN) ? "enabled" : "disabled");
+       snd_iprintf(buffer, "ADC Channels: %s\n",
+                       (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono");
+       snd_iprintf(buffer, "ADC Quality: %d-bit linear\n",
+                       (reg & AD_DS_RAMC_AD16) ? 16 : 8);
+       
+       /* ACRQ is at offset 4 */
+       tmp = (reg & AD_DS_RAMC_ACRQ) ?
+                       (((reg & AD_DS_RAMC_ACRQ >> 4) & 0x01) ? 12 : 18) : 4;
+       tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1;
+       
+       snd_iprintf(buffer, "ADC FIFO: %d %s words\n\n", tmp,
+                       (reg & AD_DS_RAMC_ADST) ? "stereo" : "mono");
+       
+       snd_iprintf(buffer, "Resampler input: %s\n",
+                       reg & AD_DS_RAMC_REEN ? "enabled" : "disabled");
+                       
+       /* RERQ is at offset 12 */
+       tmp = (reg & AD_DS_RAMC_RERQ) ?
+                       (((reg & AD_DS_RAMC_RERQ >> 12) & 0x01) ? 12 : 18) : 4;
+       tmp /= (reg & AD_DS_RAMC_ADST) ? 2 : 1;
+       
+       snd_iprintf(buffer, "Resampler FIFO: %d %s words\n\n", tmp,
+                       (reg & AD_DS_WSMC_WAST) ? "stereo" : "mono");
+                               
+       
+       /* doc says LSB represents -1.5dB, but the max value (-94.5dB)
+       suggests that LSB is -3dB, which is more coherent with the logarithmic
+       nature of the dB scale */
+       reg = ad1889_readw(chip, AD_DS_WADA);
+       snd_iprintf(buffer, "Left: %s, -%d dB\n",
+                       (reg & AD_DS_WADA_LWAM) ? "mute" : "unmute",
+                       ((reg & AD_DS_WADA_LWAA) >> 8) * 3);
+       reg = ad1889_readw(chip, AD_DS_WADA);
+       snd_iprintf(buffer, "Right: %s, -%d dB\n",
+                       (reg & AD_DS_WADA_RWAM) ? "mute" : "unmute",
+                       ((reg & AD_DS_WADA_RWAA) >> 8) * 3);
+       
+       reg = ad1889_readw(chip, AD_DS_WAS);
+       snd_iprintf(buffer, "Wave samplerate: %u Hz\n", reg);
+       reg = ad1889_readw(chip, AD_DS_RES);
+       snd_iprintf(buffer, "Resampler samplerate: %u Hz\n", reg);
+}
+
+static void __devinit
+snd_ad1889_proc_init(struct snd_ad1889 *chip)
+{
+       snd_info_entry_t *entry;
+
+       if (!snd_card_proc_new(chip->card, chip->card->driver, &entry))
+               snd_info_set_text_ops(entry, chip, 1024, snd_ad1889_proc_read);
+}
+
+static struct ac97_quirk ac97_quirks[] = {
+       {
+               .subvendor = 0x11d4,    /* AD */
+               .subdevice = 0x1889,    /* AD1889 */
+               .codec_id = AC97_ID_AD1819,
+               .name = "AD1889",
+               .type = AC97_TUNE_HP_ONLY
+       },
+       { } /* terminator */
+};
+
+static void __devinit
+snd_ad1889_ac97_xinit(struct snd_ad1889 *chip)
+{
+       u16 reg;
+
+       reg = ad1889_readw(chip, AD_AC97_ACIC);
+       reg |= AD_AC97_ACIC_ACRD;               /* Reset Disable */
+       ad1889_writew(chip, AD_AC97_ACIC, reg);
+       ad1889_readw(chip, AD_AC97_ACIC);       /* flush posted write */
+       udelay(10);
+       /* Interface Enable */
+       reg |= AD_AC97_ACIC_ACIE;
+       ad1889_writew(chip, AD_AC97_ACIC, reg);
+       
+       snd_ad1889_ac97_ready(chip);
+
+       /* Audio Stream Output | Variable Sample Rate Mode */
+       reg = ad1889_readw(chip, AD_AC97_ACIC);
+       reg |= AD_AC97_ACIC_ASOE | AD_AC97_ACIC_VSRM;
+       ad1889_writew(chip, AD_AC97_ACIC, reg);
+       ad1889_readw(chip, AD_AC97_ACIC); /* flush posted write */
+
+}
+
+static void
+snd_ad1889_ac97_bus_free(ac97_bus_t *bus)
+{
+       struct snd_ad1889 *chip = bus->private_data;
+       chip->ac97_bus = NULL;
+}
+
+static void
+snd_ad1889_ac97_free(ac97_t *ac97)
+{
+       struct snd_ad1889 *chip = ac97->private_data;
+       chip->ac97 = NULL;
+}
+
+static int __devinit
+snd_ad1889_ac97_init(struct snd_ad1889 *chip, const char *quirk_override)
+{
+       int err;
+       ac97_template_t ac97;
+       static ac97_bus_ops_t ops = {
+               .write = snd_ad1889_ac97_write,
+               .read = snd_ad1889_ac97_read,
+       };
+
+       /* doing that here, it works. */
+       snd_ad1889_ac97_xinit(chip);
+
+       err = snd_ac97_bus(chip->card, 0, &ops, chip, &chip->ac97_bus);
+       if (err < 0)
+               return err;
+       
+       chip->ac97_bus->private_free = snd_ad1889_ac97_bus_free;
+
+       memset(&ac97, 0, sizeof(ac97));
+       ac97.private_data = chip;
+       ac97.private_free = snd_ad1889_ac97_free;
+       ac97.pci = chip->pci;
+
+       err = snd_ac97_mixer(chip->ac97_bus, &ac97, &chip->ac97);
+       if (err < 0)
+               return err;
+               
+       snd_ac97_tune_hardware(chip->ac97, ac97_quirks, quirk_override);
+       
+       return 0;
+}
+
+static int
+snd_ad1889_free(struct snd_ad1889 *chip)
+{
+       if (chip->irq < 0)
+               goto skip_hw;
+
+       spin_lock_irq(&chip->lock);
+
+       ad1889_mute(chip);
+
+       /* Turn off interrupt on count and zero DMA registers */
+       ad1889_channel_reset(chip, AD_CHAN_WAV | AD_CHAN_ADC);
+
+       /* clear DISR. If we don't, we'd better jump off the Eiffel Tower */
+       ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PTAI | AD_DMA_DISR_PMAI);
+       ad1889_readl(chip, AD_DMA_DISR);        /* flush, dammit! */
+
+       spin_unlock_irq(&chip->lock);
+
+       synchronize_irq(chip->irq);
+       
+       if (chip->irq >= 0)
+               free_irq(chip->irq, (void*)chip);
+
+skip_hw:
+       if (chip->iobase)
+               iounmap(chip->iobase);
+
+       pci_release_regions(chip->pci);
+       pci_disable_device(chip->pci);
+
+       kfree(chip);
+       return 0;
+}
+
+static inline int
+snd_ad1889_dev_free(snd_device_t *device) 
+{
+       struct snd_ad1889 *chip = device->device_data;
+       return snd_ad1889_free(chip);
+}
+
+static int __devinit
+snd_ad1889_init(struct snd_ad1889 *chip) 
+{
+       ad1889_writew(chip, AD_DS_CCS, AD_DS_CCS_CLKEN); /* turn on clock */
+       ad1889_readw(chip, AD_DS_CCS);  /* flush posted write */
+
+       mdelay(10);
+
+       /* enable Master and Target abort interrupts */
+       ad1889_writel(chip, AD_DMA_DISR, AD_DMA_DISR_PMAE | AD_DMA_DISR_PTAE);
+
+       return 0;
+}
+
+static int __devinit
+snd_ad1889_create(snd_card_t *card,
+                 struct pci_dev *pci,
+                 struct snd_ad1889 **rchip)
+{
+       int err;
+
+       struct snd_ad1889 *chip;
+       static snd_device_ops_t ops = {
+               .dev_free = snd_ad1889_dev_free,
+       };
+
+       *rchip = NULL;
+
+       if ((err = pci_enable_device(pci)) < 0)
+               return err;
+       
+       /* check PCI availability (32bit DMA) */
+       if (pci_set_dma_mask(pci, 0xffffffff) < 0 ||
+           pci_set_consistent_dma_mask(pci, 0xffffffff) < 0) {
+               printk(KERN_ERR PFX "error setting 32-bit DMA mask.\n");
+               pci_disable_device(pci);
+               return -ENXIO;
+       }
+
+       /* allocate chip specific data with zero-filled memory */
+       if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
+               pci_disable_device(pci);
+               return -ENOMEM;
+       }
+
+       chip->card = card;
+       card->private_data = chip;
+       chip->pci = pci;
+       chip->irq = -1;
+
+       /* (1) PCI resource allocation */
+       if ((err = pci_request_regions(pci, card->driver)) < 0)
+               goto free_and_ret;
+
+       chip->bar = pci_resource_start(pci, 0);
+       chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0));
+       if (chip->iobase == NULL) {
+               printk(KERN_ERR PFX "unable to reserve region.\n");
+               err = -EBUSY;
+               goto free_and_ret;
+       }
+       
+       pci_set_master(pci);
+
+       spin_lock_init(&chip->lock);    /* only now can we call ad1889_free */
+
+       if (request_irq(pci->irq, snd_ad1889_interrupt,
+                       SA_INTERRUPT|SA_SHIRQ, card->driver, (void*)chip)) {
+               printk(KERN_ERR PFX "cannot obtain IRQ %d\n", pci->irq);
+               snd_ad1889_free(chip);
+               return -EBUSY;
+       }
+
+       chip->irq = pci->irq;
+       synchronize_irq(chip->irq);
+
+       /* (2) initialization of the chip hardware */
+       if ((err = snd_ad1889_init(chip)) < 0) {
+               snd_ad1889_free(chip);
+               return err;
+       }
+
+       if ((err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops)) < 0) {
+               snd_ad1889_free(chip);
+               return err;
+       }
+
+       snd_card_set_dev(card, &pci->dev);
+
+       *rchip = chip;
+
+       return 0;
+
+free_and_ret:
+       if (chip)
+               kfree(chip);
+       pci_disable_device(pci);
+
+       return err;
+}
+
+static int __devinit
+snd_ad1889_probe(struct pci_dev *pci,
+                const struct pci_device_id *pci_id)
+{
+       int err;
+       static int devno;
+       snd_card_t *card;
+       struct snd_ad1889 *chip;
+
+       /* (1) */
+       if (devno >= SNDRV_CARDS)
+               return -ENODEV;
+       if (!enable[devno]) {
+               devno++;
+               return -ENOENT;
+       }
+
+       /* (2) */
+       card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0);
+       /* XXX REVISIT: we can probably allocate chip in this call */
+       if (card == NULL)
+               return -ENOMEM;
+
+       strcpy(card->driver, "AD1889");
+       strcpy(card->shortname, "Analog Devices AD1889");
+
+       /* (3) */
+       err = snd_ad1889_create(card, pci, &chip);
+       if (err < 0)
+               goto free_and_ret;
+
+       /* (4) */
+       sprintf(card->longname, "%s at 0x%lx irq %i",
+               card->shortname, chip->bar, chip->irq);
+
+       /* (5) */
+       /* register AC97 mixer */
+       err = snd_ad1889_ac97_init(chip, ac97_quirk[devno]);
+       if (err < 0)
+               goto free_and_ret;
+       
+       err = snd_ad1889_pcm_init(chip, 0, NULL);
+       if (err < 0)
+               goto free_and_ret;
+
+       /* register proc interface */
+       snd_ad1889_proc_init(chip);
+
+       /* (6) */
+       err = snd_card_register(card);
+       if (err < 0)
+               goto free_and_ret;
+
+       /* (7) */
+       pci_set_drvdata(pci, card);
+
+       devno++;
+       return 0;
+
+free_and_ret:
+       snd_card_free(card);
+       return err;
+}
+
+static void __devexit
+snd_ad1889_remove(struct pci_dev *pci)
+{
+       snd_card_free(pci_get_drvdata(pci));
+       pci_set_drvdata(pci, NULL);
+}
+
+static struct pci_device_id snd_ad1889_ids[] = {
+       { PCI_DEVICE(PCI_VENDOR_ID_ANALOG_DEVICES, PCI_DEVICE_ID_AD1889JS) },
+       { 0, },
+};
+MODULE_DEVICE_TABLE(pci, snd_ad1889_ids);
+
+static struct pci_driver ad1889_pci = {
+       .name = "AD1889 Audio",
+       .owner = THIS_MODULE,
+       .id_table = snd_ad1889_ids,
+       .probe = snd_ad1889_probe,
+       .remove = __devexit_p(snd_ad1889_remove),
+};
+
+static int __init
+alsa_ad1889_init(void)
+{
+       return pci_register_driver(&ad1889_pci);
+}
+
+static void __exit
+alsa_ad1889_fini(void)
+{
+       pci_unregister_driver(&ad1889_pci);
+}
+
+module_init(alsa_ad1889_init);
+module_exit(alsa_ad1889_fini);
diff --git a/sound/pci/ad1889.h b/sound/pci/ad1889.h
new file mode 100644 (file)
index 0000000..5e6dad5
--- /dev/null
@@ -0,0 +1,189 @@
+/* Analog Devices 1889 audio driver
+ * Copyright (C) 2004, Kyle McMartin <kyle@parisc-linux.org>
+ */
+
+#ifndef __AD1889_H__
+#define __AD1889_H__
+
+#define AD_DS_WSMC     0x00 /* wave/synthesis channel mixer control */
+#define  AD_DS_WSMC_SYEN 0x0004 /* synthesis channel enable */
+#define  AD_DS_WSMC_SYRQ 0x0030 /* synth. fifo request point */
+#define  AD_DS_WSMC_WA16 0x0100 /* wave channel 16bit select */
+#define  AD_DS_WSMC_WAST 0x0200 /* wave channel stereo select */
+#define  AD_DS_WSMC_WAEN 0x0400 /* wave channel enable */
+#define  AD_DS_WSMC_WARQ 0x3000 /* wave fifo request point */
+
+#define AD_DS_RAMC     0x02 /* resampler/ADC channel mixer control */
+#define  AD_DS_RAMC_AD16 0x0001 /* ADC channel 16bit select */
+#define  AD_DS_RAMC_ADST 0x0002 /* ADC channel stereo select */
+#define  AD_DS_RAMC_ADEN 0x0004 /* ADC channel enable */
+#define  AD_DS_RAMC_ACRQ 0x0030 /* ADC fifo request point */
+#define  AD_DS_RAMC_REEN 0x0400 /* resampler channel enable */
+#define  AD_DS_RAMC_RERQ 0x3000 /* res. fifo request point */
+
+#define AD_DS_WADA     0x04 /* wave channel mix attenuation */
+#define  AD_DS_WADA_RWAM 0x0080 /* right wave mute */
+#define  AD_DS_WADA_RWAA 0x001f /* right wave attenuation */
+#define  AD_DS_WADA_LWAM 0x8000 /* left wave mute */
+#define  AD_DS_WADA_LWAA 0x3e00 /* left wave attenuation */
+
+#define AD_DS_SYDA     0x06 /* synthesis channel mix attenuation */
+#define  AD_DS_SYDA_RSYM 0x0080 /* right synthesis mute */
+#define  AD_DS_SYDA_RSYA 0x001f /* right synthesis attenuation */
+#define  AD_DS_SYDA_LSYM 0x8000 /* left synthesis mute */
+#define  AD_DS_SYDA_LSYA 0x3e00 /* left synthesis attenuation */
+
+#define AD_DS_WAS      0x08 /* wave channel sample rate */
+#define  AD_DS_WAS_WAS   0xffff /* sample rate mask */
+
+#define AD_DS_RES      0x0a /* resampler channel sample rate */
+#define  AD_DS_RES_RES   0xffff /* sample rate mask */
+
+#define AD_DS_CCS      0x0c /* chip control/status */
+#define  AD_DS_CCS_ADO   0x0001 /* ADC channel overflow */
+#define  AD_DS_CCS_REO   0x0002 /* resampler channel overflow */
+#define  AD_DS_CCS_SYU   0x0004 /* synthesis channel underflow */
+#define  AD_DS_CCS_WAU   0x0008 /* wave channel underflow */
+/* bits 4 -> 7, 9, 11 -> 14 reserved */
+#define  AD_DS_CCS_XTD   0x0100 /* xtd delay control (4096 clock cycles) */
+#define  AD_DS_CCS_PDALL 0x0400 /* power */
+#define  AD_DS_CCS_CLKEN 0x8000 /* clock */
+
+#define AD_DMA_RESBA   0x40 /* RES base address */
+#define AD_DMA_RESCA   0x44 /* RES current address */
+#define AD_DMA_RESBC   0x48 /* RES base count */
+#define AD_DMA_RESCC   0x4c /* RES current count */
+
+#define AD_DMA_ADCBA   0x50 /* ADC base address */
+#define AD_DMA_ADCCA   0x54 /* ADC current address */
+#define AD_DMA_ADCBC   0x58 /* ADC base count */
+#define AD_DMA_ADCCC   0x5c /* ADC current count */
+
+#define AD_DMA_SYNBA   0x60 /* synth base address */
+#define AD_DMA_SYNCA   0x64 /* synth current address */
+#define AD_DMA_SYNBC   0x68 /* synth base count */
+#define AD_DMA_SYNCC   0x6c /* synth current count */
+
+#define AD_DMA_WAVBA   0x70 /* wave base address */
+#define AD_DMA_WAVCA   0x74 /* wave current address */
+#define AD_DMA_WAVBC   0x78 /* wave base count */
+#define AD_DMA_WAVCC   0x7c /* wave current count */
+
+#define AD_DMA_RESIC   0x80 /* RES dma interrupt current byte count */
+#define AD_DMA_RESIB   0x84 /* RES dma interrupt base byte count */
+
+#define AD_DMA_ADCIC   0x88 /* ADC dma interrupt current byte count */
+#define AD_DMA_ADCIB   0x8c /* ADC dma interrupt base byte count */
+
+#define AD_DMA_SYNIC   0x90 /* synth dma interrupt current byte count */
+#define AD_DMA_SYNIB   0x94 /* synth dma interrupt base byte count */
+
+#define AD_DMA_WAVIC   0x98 /* wave dma interrupt current byte count */
+#define AD_DMA_WAVIB   0x9c /* wave dma interrupt base byte count */
+
+#define  AD_DMA_ICC    0xffffff /* current byte count mask */
+#define  AD_DMA_IBC    0xffffff /* base byte count mask */
+/* bits 24 -> 31 reserved */
+
+/* 4 bytes pad */
+#define AD_DMA_ADC     0xa8    /* ADC      dma control and status */
+#define AD_DMA_SYNTH   0xb0    /* Synth    dma control and status */
+#define AD_DMA_WAV     0xb8    /* wave     dma control and status */
+#define AD_DMA_RES     0xa0    /* Resample dma control and status */
+
+#define  AD_DMA_SGDE   0x0001 /* SGD mode enable */
+#define  AD_DMA_LOOP   0x0002 /* loop enable */
+#define  AD_DMA_IM     0x000c /* interrupt mode mask */
+#define  AD_DMA_IM_DIS (~AD_DMA_IM)    /* disable */
+#define  AD_DMA_IM_CNT 0x0004 /* interrupt on count */
+#define  AD_DMA_IM_SGD 0x0008 /* interrupt on SGD flag */
+#define  AD_DMA_IM_EOL 0x000c /* interrupt on End of Linked List */
+#define  AD_DMA_SGDS   0x0030 /* SGD status */
+#define  AD_DMA_SFLG   0x0040 /* SGD flag */
+#define  AD_DMA_EOL    0x0080 /* SGD end of list */
+/* bits 8 -> 15 reserved */
+
+#define AD_DMA_DISR    0xc0 /* dma interrupt status */
+#define  AD_DMA_DISR_RESI 0x000001 /* resampler channel interrupt */
+#define  AD_DMA_DISR_ADCI 0x000002 /* ADC channel interrupt */
+#define  AD_DMA_DISR_SYNI 0x000004 /* synthesis channel interrupt */
+#define  AD_DMA_DISR_WAVI 0x000008 /* wave channel interrupt */
+/* bits 4, 5 reserved */
+#define  AD_DMA_DISR_SEPS 0x000040 /* serial eeprom status */
+/* bits 7 -> 13 reserved */
+#define  AD_DMA_DISR_PMAI 0x004000 /* pci master abort interrupt */
+#define  AD_DMA_DISR_PTAI 0x008000 /* pci target abort interrupt */
+#define  AD_DMA_DISR_PTAE 0x010000 /* pci target abort interrupt enable */
+#define  AD_DMA_DISR_PMAE 0x020000 /* pci master abort interrupt enable */
+/* bits 19 -> 31 reserved */
+
+/* interrupt mask */
+#define  AD_INTR_MASK     (AD_DMA_DISR_RESI|AD_DMA_DISR_ADCI| \
+                           AD_DMA_DISR_WAVI|AD_DMA_DISR_SYNI| \
+                           AD_DMA_DISR_PMAI|AD_DMA_DISR_PTAI)
+
+#define AD_DMA_CHSS    0xc4 /* dma channel stop status */
+#define  AD_DMA_CHSS_RESS 0x000001 /* resampler channel stopped */
+#define  AD_DMA_CHSS_ADCS 0x000002 /* ADC channel stopped */
+#define  AD_DMA_CHSS_SYNS 0x000004 /* synthesis channel stopped */
+#define  AD_DMA_CHSS_WAVS 0x000008 /* wave channel stopped */
+
+#define AD_GPIO_IPC    0xc8    /* gpio port control */
+#define AD_GPIO_OP     0xca    /* gpio output port status */
+#define AD_GPIO_IP     0xcc    /* gpio  input port status */
+
+#define AD_AC97_BASE   0x100   /* ac97 base register */
+
+#define AD_AC97_RESET   0x100   /* reset */
+
+#define AD_AC97_PWR_CTL        0x126   /* == AC97_POWERDOWN */
+#define  AD_AC97_PWR_ADC 0x0001 /* ADC ready status */
+#define  AD_AC97_PWR_DAC 0x0002 /* DAC ready status */
+#define  AD_AC97_PWR_PR0 0x0100 /* PR0 (ADC) powerdown */
+#define  AD_AC97_PWR_PR1 0x0200 /* PR1 (DAC) powerdown */
+
+#define AD_MISC_CTL     0x176 /* misc control */
+#define  AD_MISC_CTL_DACZ   0x8000 /* set for zero fill, unset for repeat */
+#define  AD_MISC_CTL_ARSR   0x0001 /* set for SR1, unset for SR0 */
+#define  AD_MISC_CTL_ALSR   0x0100
+#define  AD_MISC_CTL_DLSR   0x0400
+#define  AD_MISC_CTL_DRSR   0x0004
+
+#define AD_AC97_SR0     0x178 /* sample rate 0, 0xbb80 == 48K */
+#define  AD_AC97_SR0_48K 0xbb80 /* 48KHz */
+#define AD_AC97_SR1     0x17a /* sample rate 1 */
+
+#define AD_AC97_ACIC   0x180 /* ac97 codec interface control */
+#define  AD_AC97_ACIC_ACIE  0x0001 /* analog codec interface enable */
+#define  AD_AC97_ACIC_ACRD  0x0002 /* analog codec reset disable */
+#define  AD_AC97_ACIC_ASOE  0x0004 /* audio stream output enable */
+#define  AD_AC97_ACIC_VSRM  0x0008 /* variable sample rate mode */
+#define  AD_AC97_ACIC_FSDH  0x0100 /* force SDATA_OUT high */
+#define  AD_AC97_ACIC_FSYH  0x0200 /* force sync high */
+#define  AD_AC97_ACIC_ACRDY 0x8000 /* analog codec ready status */
+/* bits 10 -> 14 reserved */
+
+
+#define AD_DS_MEMSIZE  512
+#define AD_OPL_MEMSIZE 16
+#define AD_MIDI_MEMSIZE        16
+
+#define AD_WAV_STATE   0
+#define AD_ADC_STATE   1
+#define AD_MAX_STATES  2
+
+#define AD_CHAN_WAV    0x0001
+#define AD_CHAN_ADC    0x0002
+#define AD_CHAN_RES    0x0004
+#define AD_CHAN_SYN    0x0008
+
+
+/* The chip would support 4 GB buffers and 16 MB periods,
+ * but let's not overdo it ... */
+#define BUFFER_BYTES_MAX       (256 * 1024)
+#define PERIOD_BYTES_MIN       32
+#define PERIOD_BYTES_MAX       (BUFFER_BYTES_MAX / 2)
+#define PERIODS_MIN            2
+#define PERIODS_MAX            (BUFFER_BYTES_MAX / PERIOD_BYTES_MIN)
+
+#endif /* __AD1889_H__ */
index 4943299cf137dce8ab4bcb369ad9813ad0660173..d683f7736a63b16935a443da3d44803be74cf207 100644 (file)
@@ -78,15 +78,7 @@ MODULE_PARM_DESC(spdif, "Support SPDIF I/O");
  *  Constants definition
  */
 
-#ifndef PCI_VENDOR_ID_ALI
-#define PCI_VENDOR_ID_ALI      0x10b9
-#endif
-
-#ifndef PCI_DEVICE_ID_ALI_5451
-#define PCI_DEVICE_ID_ALI_5451 0x5451
-#endif
-
-#define DEVICE_ID_ALI5451      ((PCI_VENDOR_ID_ALI<<16)|PCI_DEVICE_ID_ALI_5451)
+#define DEVICE_ID_ALI5451      ((PCI_VENDOR_ID_AL<<16)|PCI_DEVICE_ID_AL_M5451)
 
 
 #define ALI_CHANNELS           32
@@ -326,13 +318,12 @@ static void ali_read_regs(ali_t *codec, int channel)
 static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
 {
        unsigned int dwVal;
-       struct pci_dev *pci_dev = NULL;
+       struct pci_dev *pci_dev;
        int i,j;
 
-
-        pci_dev = pci_find_device(vendor, deviceid, pci_dev);
-        if (pci_dev == NULL)
-                return ;
+       pci_dev = pci_get_device(vendor, deviceid, NULL);
+       if (pci_dev == NULL)
+               return ;
 
        printk("\nM%x PCI CFG\n", deviceid);
        printk("    ");
@@ -349,6 +340,7 @@ static void ali_read_cfg(unsigned int vendor, unsigned deviceid)
                }
                printk("\n");
        }
+       pci_dev_put(pci_dev);
  }
 static void ali_read_ac97regs(ali_t *codec, int secondary)
 {
@@ -2116,6 +2108,8 @@ static int snd_ali_free(ali_t * codec)
 #ifdef CONFIG_PM
        kfree(codec->image);
 #endif
+       pci_dev_put(codec->pci_m1533);
+       pci_dev_put(codec->pci_m7101);
        kfree(codec);
        return 0;
 }
@@ -2305,7 +2299,7 @@ static int __devinit snd_ali_create(snd_card_t * card,
        codec->chregs.data.ainten = 0x00;
 
        /* M1533: southbridge */
-               pci_dev = pci_find_device(0x10b9, 0x1533, NULL);
+       pci_dev = pci_get_device(0x10b9, 0x1533, NULL);
        codec->pci_m1533 = pci_dev;
        if (! codec->pci_m1533) {
                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,
                return -ENODEV;
        }
        /* M7101: power management */
-               pci_dev = pci_find_device(0x10b9, 0x7101, NULL);
+       pci_dev = pci_get_device(0x10b9, 0x7101, NULL);
        codec->pci_m7101 = pci_dev;
        if (! codec->pci_m7101 && codec->revision == ALI_5451_V02) {
                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)
 
 static struct pci_driver driver = {
        .name = "ALI 5451",
+       .owner = THIS_MODULE,
        .id_table = snd_ali_ids,
        .probe = snd_ali_probe,
        .remove = __devexit_p(snd_ali_remove),
index ca28b229c704051154ef1a05aae2a485f7234e64..196ec1c61bb4712342055924902863064e8ca200 100644 (file)
@@ -770,6 +770,7 @@ static void __devexit snd_card_als4000_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ALS4000",
+       .owner = THIS_MODULE,
        .id_table = snd_als4000_ids,
        .probe = snd_card_als4000_probe,
        .remove = __devexit_p(snd_card_als4000_remove),
index 188df085b7ee5d4ae21903bebd1b6381b48cdc6a..241eacf1e6522d086e1eeeceba1e15bc0844681f 100644 (file)
@@ -1453,6 +1453,7 @@ static int snd_atiixp_resume(snd_card_t *card)
                        atiixp_dma_t *dma = &chip->dmas[i];
                        if (dma->substream && dma->suspended) {
                                dma->ops->enable_dma(chip, 1);
+                               dma->substream->ops->prepare(dma->substream);
                                writel((u32)dma->desc_buf.addr | ATI_REG_LINKPTR_EN,
                                       chip->remap_addr + dma->ops->llp_offset);
                                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,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1644,6 +1645,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ATI IXP AC97 controller",
+       .owner = THIS_MODULE,
        .id_table = snd_atiixp_ids,
        .probe = snd_atiixp_probe,
        .remove = __devexit_p(snd_atiixp_remove),
index 8d2002951bd78381194a99e38689f8759171879a..8a59598167f9cf2e9f7cffca0d375439af666e0f 100644 (file)
@@ -1208,7 +1208,7 @@ static int __devinit snd_atiixp_create(snd_card_t *card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1318,6 +1318,7 @@ static void __devexit snd_atiixp_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ATI IXP MC97 controller",
+       .owner = THIS_MODULE,
        .id_table = snd_atiixp_ids,
        .probe = snd_atiixp_probe,
        .remove = __devexit_p(snd_atiixp_remove),
index f6236c63aaaae2c3d5cdaafe9facf7bd85e56281..04b695d6fd4839f7b77cadab3964988fdf058a2d 100644 (file)
@@ -79,19 +79,21 @@ static void vortex_fix_agp_bridge(struct pci_dev *via)
 
 static void __devinit snd_vortex_workaround(struct pci_dev *vortex, int fix)
 {
-       struct pci_dev *via;
+       struct pci_dev *via = NULL;
 
        /* autodetect if workarounds are required */
        if (fix == 255) {
                /* VIA KT133 */
-               via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL);
+               via = pci_get_device(PCI_VENDOR_ID_VIA,
+                       PCI_DEVICE_ID_VIA_8365_1, NULL);
                /* VIA Apollo */
                if (via == NULL) {
-                       via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL);
-               }
-               /* AMD Irongate */
-               if (via == NULL) {
-                       via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
+                       via = pci_get_device(PCI_VENDOR_ID_VIA,
+                               PCI_DEVICE_ID_VIA_82C598_1, NULL);
+                       /* AMD Irongate */
+                       if (via == NULL)
+                               via = pci_get_device(PCI_VENDOR_ID_AMD,
+                                       PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL);
                }
                if (via) {
                        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)
        } else {
                if (fix & 0x1)
                        vortex_fix_latency(vortex);
-               if ((fix & 0x2) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_8365_1, NULL)))
+               if ((fix & 0x2) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
+                               PCI_DEVICE_ID_VIA_8365_1, NULL)))
                        vortex_fix_agp_bridge(via);
-               if ((fix & 0x4) && (via = pci_find_device(PCI_VENDOR_ID_VIA, PCI_DEVICE_ID_VIA_82C598_1, NULL)))
+               if ((fix & 0x4) && (via = pci_get_device(PCI_VENDOR_ID_VIA,
+                               PCI_DEVICE_ID_VIA_82C598_1, NULL)))
                        vortex_fix_agp_bridge(via);
-               if ((fix & 0x8) && (via = pci_find_device(PCI_VENDOR_ID_AMD, PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
+               if ((fix & 0x8) && (via = pci_get_device(PCI_VENDOR_ID_AMD,
+                               PCI_DEVICE_ID_AMD_FE_GATE_7007, NULL)))
                        vortex_fix_agp_bridge(via);
        }
+       pci_dev_put(via);
 }
 
 // component-destructor
@@ -150,7 +156,7 @@ snd_vortex_create(snd_card_t * card, struct pci_dev *pci, vortex_t ** rchip)
        }
        pci_set_dma_mask(pci, VORTEX_DMA_MASK);
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
 
@@ -367,6 +373,7 @@ static void __devexit snd_vortex_remove(struct pci_dev *pci)
 // pci_driver definition
 static struct pci_driver driver = {
        .name = CARD_NAME_SHORT,
+       .owner = THIS_MODULE,
        .id_table = snd_vortex_ids,
        .probe = snd_vortex_probe,
        .remove = __devexit_p(snd_vortex_remove),
index 72bba7b2d983811bbba99a098cbfccbd5740ef20..d5261bdec583d5fbac6bcfe438d35e8d4ac705c3 100644 (file)
@@ -1345,7 +1345,7 @@ static int __devinit snd_azf3328_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1511,6 +1511,7 @@ static void __devexit snd_azf3328_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "AZF3328",
+       .owner = THIS_MODULE,
        .id_table = snd_azf3328_ids,
        .probe = snd_azf3328_probe,
        .remove = __devexit_p(snd_azf3328_remove),
index c5557eaf3e2e0ffafcb76a0c442fc88116bc8901..2236c958aec01b392ce72e28b1ae64405c24ce3a 100644 (file)
@@ -59,16 +59,6 @@ module_param(load_all, bool, 0444);
 MODULE_PARM_DESC(load_all, "Allow to load the non-whitelisted cards");
 
 
-#ifndef PCI_VENDOR_ID_BROOKTREE
-#define PCI_VENDOR_ID_BROOKTREE 0x109e
-#endif
-#ifndef PCI_DEVICE_ID_BROOKTREE_878
-#define PCI_DEVICE_ID_BROOKTREE_878 0x0878
-#endif
-#ifndef PCI_DEVICE_ID_BROOKTREE_879
-#define PCI_DEVICE_ID_BROOKTREE_879 0x0879
-#endif
-
 /* register offsets */
 #define REG_INT_STAT           0x100   /* interrupt status */
 #define REG_INT_MASK           0x104   /* interrupt mask */
@@ -720,7 +710,7 @@ static int __devinit snd_bt87x_create(snd_card_t *card,
        if (err < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (!chip) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -911,6 +901,7 @@ static struct pci_device_id snd_bt87x_default_ids[] = {
 
 static struct pci_driver driver = {
        .name = "Bt87x",
+       .owner = THIS_MODULE,
        .id_table = snd_bt87x_ids,
        .probe = snd_bt87x_probe,
        .remove = __devexit_p(snd_bt87x_remove),
index 7e27bfc3743985d06a4c1fee9a62a86061143b0b..ba07960921d8018f92d92957275b37ccf25105d4 100644 (file)
@@ -352,7 +352,7 @@ static int snd_ca0106_pcm_open_playback_channel(snd_pcm_substream_t *substream,
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
 
        if (epcm == NULL)
                return -ENOMEM;
@@ -419,7 +419,7 @@ static int snd_ca0106_pcm_open_capture_channel(snd_pcm_substream_t *substream, i
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL) {
                 snd_printk("open_capture_channel: failed epcm alloc\n");
                return -ENOMEM;
@@ -1144,7 +1144,7 @@ static int __devinit snd_ca0106_create(snd_card_t *card,
                return -ENXIO;
        }
   
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1390,6 +1390,7 @@ MODULE_DEVICE_TABLE(pci, snd_ca0106_ids);
 // pci_driver definition
 static struct pci_driver driver = {
        .name = "CA0106",
+       .owner = THIS_MODULE,
        .id_table = snd_ca0106_ids,
        .probe = snd_ca0106_probe,
        .remove = __devexit_p(snd_ca0106_remove),
index b6b8882ce704fb3bd70dd11b5d380f97f64bcc8d..c10e4a54301b814a0d2febb9d202d291287cd84f 100644 (file)
@@ -482,7 +482,7 @@ static int snd_ca0106_volume_put_feedback(snd_kcontrol_t * kcontrol,
 static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "Analog Front Volume",
+        .name =         "Analog Front Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_analog_front,
         .put =          snd_ca0106_volume_put_analog_front
@@ -490,7 +490,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_front =
 static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "Analog Center/LFE Volume",
+        .name =         "Analog Center/LFE Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_analog_center_lfe,
         .put =          snd_ca0106_volume_put_analog_center_lfe
@@ -498,7 +498,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_center_lfe =
 static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "Analog Side Volume",
+        .name =         "Analog Side Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_analog_unknown,
         .put =          snd_ca0106_volume_put_analog_unknown
@@ -506,7 +506,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_unknown =
 static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "Analog Rear Volume",
+        .name =         "Analog Rear Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_analog_rear,
         .put =          snd_ca0106_volume_put_analog_rear
@@ -514,7 +514,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_analog_rear =
 static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "SPDIF Front Volume",
+        .name =         "SPDIF Front Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_spdif_front,
         .put =          snd_ca0106_volume_put_spdif_front
@@ -522,7 +522,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_front =
 static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "SPDIF Center/LFE Volume",
+        .name =         "SPDIF Center/LFE Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_spdif_center_lfe,
         .put =          snd_ca0106_volume_put_spdif_center_lfe
@@ -530,7 +530,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_center_lfe =
 static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "SPDIF Unknown Volume",
+        .name =         "SPDIF Unknown Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_spdif_unknown,
         .put =          snd_ca0106_volume_put_spdif_unknown
@@ -538,7 +538,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_unknown =
 static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "SPDIF Rear Volume",
+        .name =         "SPDIF Rear Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_spdif_rear,
         .put =          snd_ca0106_volume_put_spdif_rear
@@ -547,7 +547,7 @@ static snd_kcontrol_new_t snd_ca0106_volume_control_spdif_rear =
 static snd_kcontrol_new_t snd_ca0106_volume_control_feedback =
 {
         .iface =        SNDRV_CTL_ELEM_IFACE_MIXER,
-        .name =         "CAPTURE feedback into PLAYBACK",
+        .name =         "CAPTURE feedback Playback Volume",
         .info =         snd_ca0106_volume_info,
         .get =          snd_ca0106_volume_get_feedback,
         .put =          snd_ca0106_volume_put_feedback
index b098b51099c2ddbccac84f9ebf2ebae629837b90..1eb3315d136dd2e50bbc0aab0168b32ee7cbf4b3 100644 (file)
@@ -79,13 +79,6 @@ module_param_array(joystick_port, int, NULL, 0444);
 MODULE_PARM_DESC(joystick_port, "Joystick port address.");
 #endif
 
-#ifndef PCI_DEVICE_ID_CMEDIA_CM8738
-#define PCI_DEVICE_ID_CMEDIA_CM8738    0x0111
-#endif
-#ifndef PCI_DEVICE_ID_CMEDIA_CM8738B
-#define PCI_DEVICE_ID_CMEDIA_CM8738B   0x0112
-#endif
-
 /*
  * CM8x38 registers definition
  */
@@ -347,25 +340,6 @@ MODULE_PARM_DESC(joystick_port, "Joystick port address.");
 #define CM_EXTENT_SYNTH          0x4
 
 
-/*
- * pci ids
- */
-#ifndef PCI_VENDOR_ID_CMEDIA
-#define PCI_VENDOR_ID_CMEDIA         0x13F6
-#endif
-#ifndef PCI_DEVICE_ID_CMEDIA_CM8338A
-#define PCI_DEVICE_ID_CMEDIA_CM8338A 0x0100
-#endif
-#ifndef PCI_DEVICE_ID_CMEDIA_CM8338B
-#define PCI_DEVICE_ID_CMEDIA_CM8338B 0x0101
-#endif
-#ifndef PCI_DEVICE_ID_CMEDIA_CM8738
-#define PCI_DEVICE_ID_CMEDIA_CM8738  0x0111
-#endif
-#ifndef PCI_DEVICE_ID_CMEDIA_CM8738B
-#define PCI_DEVICE_ID_CMEDIA_CM8738B 0x0112
-#endif
-
 /*
  * channels for playback / capture
  */
@@ -2801,7 +2775,7 @@ static int __devinit snd_cmipci_create(snd_card_t *card, struct pci_dev *pci,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       cm = kcalloc(1, sizeof(*cm), GFP_KERNEL);
+       cm = kzalloc(sizeof(*cm), GFP_KERNEL);
        if (cm == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -3063,6 +3037,7 @@ static void __devexit snd_cmipci_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "C-Media PCI",
+       .owner = THIS_MODULE,
        .id_table = snd_cmipci_ids,
        .probe = snd_cmipci_probe,
        .remove = __devexit_p(snd_cmipci_remove),
index c7a370d4f923f96985d33006683be294c3dd09bc..dc87e0144b5adc7fe5b1b452f33e62cf9fbde246 100644 (file)
@@ -56,17 +56,6 @@ MODULE_PARM_DESC(enable, "Enable CS4281 soundcard.");
 module_param_array(dual_codec, bool, NULL, 0444);
 MODULE_PARM_DESC(dual_codec, "Secondary Codec ID (0 = disabled).");
 
-/*
- *
- */
-
-#ifndef PCI_VENDOR_ID_CIRRUS
-#define PCI_VENDOR_ID_CIRRUS            0x1013
-#endif
-#ifndef PCI_DEVICE_ID_CIRRUS_4281
-#define PCI_DEVICE_ID_CIRRUS_4281      0x6005
-#endif
-
 /*
  *  Direct registers
  */
@@ -1394,7 +1383,7 @@ static int __devinit snd_cs4281_create(snd_card_t * card,
        *rchip = NULL;
        if ((err = pci_enable_device(pci)) < 0)
                return err;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2119,6 +2108,7 @@ static int cs4281_resume(snd_card_t *card)
 
 static struct pci_driver driver = {
        .name = "CS4281",
+       .owner = THIS_MODULE,
        .id_table = snd_cs4281_ids,
        .probe = snd_cs4281_probe,
        .remove = __devexit_p(snd_cs4281_remove),
index b9fff4ee6f9dc789db6285c08cf18bf2332b6260..32b4f8465cefb898c2fd107188621eda60109502 100644 (file)
@@ -163,6 +163,7 @@ static void __devexit snd_card_cs46xx_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Sound Fusion CS46xx",
+       .owner = THIS_MODULE,
        .id_table = snd_cs46xx_ids,
        .probe = snd_card_cs46xx_probe,
        .remove = __devexit_p(snd_card_cs46xx_remove),
index 4b052158ee3378bb32ec9c3670903a1f8350e6fb..6e3855b8b33d9922c0cafcdb59f1fd3df99e9c9f 100644 (file)
@@ -1304,7 +1304,7 @@ static int _cs46xx_playback_open_channel (snd_pcm_substream_t * substream,int pc
        cs46xx_pcm_t * cpcm;
        snd_pcm_runtime_t *runtime = substream->runtime;
 
-       cpcm = kcalloc(1, sizeof(*cpcm), GFP_KERNEL);
+       cpcm = kzalloc(sizeof(*cpcm), GFP_KERNEL);
        if (cpcm == NULL)
                return -ENOMEM;
        if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
@@ -3524,17 +3524,6 @@ static void amp_voyetra_4294(cs46xx_t *chip, int change)
 #endif
 
 
-/*
- * piix4 pci ids
- */
-#ifndef PCI_VENDOR_ID_INTEL
-#define PCI_VENDOR_ID_INTEL 0x8086
-#endif /* PCI_VENDOR_ID_INTEL */
-
-#ifndef PCI_DEVICE_ID_INTEL_82371AB_3
-#define PCI_DEVICE_ID_INTEL_82371AB_3 0x7113
-#endif /* PCI_DEVICE_ID_INTEL_82371AB_3 */
-
 /*
  *     Handle the CLKRUN on a thinkpad. We must disable CLKRUN support
  *     whenever we need to beat on the chip.
@@ -3548,7 +3537,7 @@ static void clkrun_hack(cs46xx_t *chip, int change)
 {
        u16 control, nval;
        
-       if (chip->acpi_dev == NULL)
+       if (!chip->acpi_port)
                return;
 
        chip->amplifier += change;
@@ -3571,15 +3560,20 @@ static void clkrun_hack(cs46xx_t *chip, int change)
  */
 static void clkrun_init(cs46xx_t *chip)
 {
+       struct pci_dev *pdev;
        u8 pp;
 
-       chip->acpi_dev = pci_find_device(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
-       if (chip->acpi_dev == NULL)
+       chip->acpi_port = 0;
+       
+       pdev = pci_get_device(PCI_VENDOR_ID_INTEL,
+               PCI_DEVICE_ID_INTEL_82371AB_3, NULL);
+       if (pdev == NULL)
                return;         /* Not a thinkpad thats for sure */
 
        /* Find the control port */             
-       pci_read_config_byte(chip->acpi_dev, 0x41, &pp);
+       pci_read_config_byte(pdev, 0x41, &pp);
        chip->acpi_port = pp << 8;
+       pci_dev_put(pdev);
 }
 
 
@@ -3780,7 +3774,7 @@ int __devinit snd_cs46xx_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
index fc377c4b666c6d2d7846a3c13b12b50e144bd288..b0e00f0a7c2f521380027254b8d35f0bc9c958b5 100644 (file)
@@ -223,6 +223,7 @@ static void __devexit snd_card_emu10k1_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "EMU10K1_Audigy",
+       .owner = THIS_MODULE,
        .id_table = snd_emu10k1_ids,
        .probe = snd_card_emu10k1_probe,
        .remove = __devexit_p(snd_card_emu10k1_remove),
index e69d5b739e802f84c92029d9afdd51b8456c6a9b..e87e8427f25f0a4c15e3b83f2e128baf2873b911 100644 (file)
@@ -754,12 +754,11 @@ static emu_chip_details_t emu_chip_details[] = {
         .emu10k1_chip = 1,
         .ac97_chip = 1,
         .sblive51 = 1} ,
-       /* Tested by alsa bugtrack user "hus" 12th Sept 2005 */
+       /* Tested by alsa bugtrack user "hus" bug #1297 12th Aug 2005 */
        {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80611102,
-        .driver = "EMU10K1", .name = "SBLive! Player 5.1 [SB0060]", 
+        .driver = "EMU10K1", .name = "SBLive! Platinum 5.1 [SB0060]", 
         .id = "Live",
         .emu10k1_chip = 1,
-        .ac97_chip = 1,
         .sblive51 = 1} ,
        {.vendor = 0x1102, .device = 0x0002, .subsystem = 0x80511102,
         .driver = "EMU10K1", .name = "SBLive! Value [CT4850]", 
@@ -865,7 +864,7 @@ int __devinit snd_emu10k1_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       emu = kcalloc(1, sizeof(*emu), GFP_KERNEL);
+       emu = kzalloc(sizeof(*emu), GFP_KERNEL);
        if (emu == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
index 52c7826df4402ee0e71629ff425bc5ab1f284d9a..ad15755a63c35a788bfbfea7323461713cad7f1a 100644 (file)
@@ -395,7 +395,7 @@ static int snd_emu10k1x_playback_open(snd_pcm_substream_t *substream)
        if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
                 return err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
        epcm->emu = chip;
@@ -571,7 +571,7 @@ static int snd_emu10k1x_pcm_open_capture(snd_pcm_substream_t *substream)
        if ((err = snd_pcm_hw_constraint_step(runtime, 0, SNDRV_PCM_HW_PARAM_PERIOD_BYTES, 64)) < 0)
                 return err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
 
@@ -920,7 +920,7 @@ static int __devinit snd_emu10k1x_create(snd_card_t *card,
                return -ENXIO;
        }
   
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1615,6 +1615,7 @@ MODULE_DEVICE_TABLE(pci, snd_emu10k1x_ids);
 // pci_driver definition
 static struct pci_driver driver = {
        .name = "EMU10K1X",
+       .owner = THIS_MODULE,
        .id_table = snd_emu10k1x_ids,
        .probe = snd_emu10k1x_probe,
        .remove = __devexit_p(snd_emu10k1x_remove),
index 637c555cfdb1f42b4a3be06e98dc806fe20ff839..646b5d972e6f3b8cb0281eb6f6266395a750670e 100644 (file)
@@ -470,7 +470,7 @@ static void snd_emu10k1_write_op(emu10k1_fx8010_code_t *icode, unsigned int *ptr
 {
        u_int32_t *code;
        snd_assert(*ptr < 512, return);
-       code = (u_int32_t *)icode->code + (*ptr) * 2;
+       code = (u_int32_t __force *)icode->code + (*ptr) * 2;
        set_bit(*ptr, icode->code_valid);
        code[0] = ((x & 0x3ff) << 10) | (y & 0x3ff);
        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
 {
        u_int32_t *code;
        snd_assert(*ptr < 1024, return);
-       code = (u_int32_t *)icode->code + (*ptr) * 2;
+       code = (u_int32_t __force *)icode->code + (*ptr) * 2;
        set_bit(*ptr, icode->code_valid);
        code[0] = ((x & 0x7ff) << 12) | (y & 0x7ff);
        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)
        spin_lock_init(&emu->fx8010.irq_lock);
        INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
 
-       if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL ||
+       if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL ||
            (icode->gpr_map = (u_int32_t __user *)kcalloc(512 + 256 + 256 + 2 * 1024, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||
            (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(*controls), GFP_KERNEL)) == NULL) {
                err = -ENOMEM;
                goto __err;
        }
-       gpr_map = (u32 *)icode->gpr_map;
+       gpr_map = (u32 __force *)icode->gpr_map;
 
        icode->tram_data_map = icode->gpr_map + 512;
        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))
  __err:
        kfree(controls);
        if (icode != NULL) {
-               kfree((void *)icode->gpr_map);
+               kfree((void __force *)icode->gpr_map);
                kfree(icode);
        }
        return err;
@@ -1503,15 +1503,15 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
        spin_lock_init(&emu->fx8010.irq_lock);
        INIT_LIST_HEAD(&emu->fx8010.gpr_ctl);
 
-       if ((icode = kcalloc(1, sizeof(*icode), GFP_KERNEL)) == NULL)
+       if ((icode = kzalloc(sizeof(*icode), GFP_KERNEL)) == NULL)
                return -ENOMEM;
        if ((icode->gpr_map = (u_int32_t __user *)kcalloc(256 + 160 + 160 + 2 * 512, sizeof(u_int32_t), GFP_KERNEL)) == NULL ||
             (controls = kcalloc(SND_EMU10K1_GPR_CONTROLS, sizeof(emu10k1_fx8010_control_gpr_t), GFP_KERNEL)) == NULL ||
-           (ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL)) == NULL) {
+           (ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL)) == NULL) {
                err = -ENOMEM;
                goto __err;
        }
-       gpr_map = (u32 *)icode->gpr_map;
+       gpr_map = (u32 __force *)icode->gpr_map;
 
        icode->tram_data_map = icode->gpr_map + 256;
        icode->tram_addr_map = icode->tram_data_map + 160;
@@ -2032,7 +2032,7 @@ static int __devinit _snd_emu10k1_init_efx(emu10k1_t *emu)
        kfree(ipcm);
        kfree(controls);
        if (icode != NULL) {
-               kfree((void *)icode->gpr_map);
+               kfree((void __force *)icode->gpr_map);
                kfree(icode);
        }
        return err;
@@ -2217,7 +2217,7 @@ static int snd_emu10k1_fx8010_ioctl(snd_hwdep_t * hw, struct file *file, unsigne
                kfree(ipcm);
                return res;
        case SNDRV_EMU10K1_IOCTL_PCM_PEEK:
-               ipcm = kcalloc(1, sizeof(*ipcm), GFP_KERNEL);
+               ipcm = kzalloc(sizeof(*ipcm), GFP_KERNEL);
                if (ipcm == NULL)
                        return -ENOMEM;
                if (copy_from_user(ipcm, argp, sizeof(*ipcm))) {
index 9c35f6dde1b5a49ccbb4f73f44ac723a21315b77..66ba27afe962523ea14ef5589d9448c75e9c87f9 100644 (file)
@@ -1016,7 +1016,7 @@ static int snd_emu10k1_efx_playback_open(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        int i;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
        epcm->emu = emu;
@@ -1049,7 +1049,7 @@ static int snd_emu10k1_playback_open(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        int i, err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
        epcm->emu = emu;
@@ -1094,7 +1094,7 @@ static int snd_emu10k1_capture_open(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        emu10k1_pcm_t *epcm;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
        epcm->emu = emu;
@@ -1130,7 +1130,7 @@ static int snd_emu10k1_capture_mic_open(snd_pcm_substream_t * substream)
        emu10k1_pcm_t *epcm;
        snd_pcm_runtime_t *runtime = substream->runtime;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
        epcm->emu = emu;
@@ -1170,7 +1170,7 @@ static int snd_emu10k1_capture_efx_open(snd_pcm_substream_t * substream)
        int nefx = emu->audigy ? 64 : 32;
        int idx;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        if (epcm == NULL)
                return -ENOMEM;
        epcm->emu = emu;
index a1691330d3b6f53fa8d852b4e87edf66d43ad2d8..d59c7f345ad6983eeadf1bbe5ca5b4e287389b9d 100644 (file)
@@ -178,7 +178,7 @@ static int snd_p16v_pcm_open_playback_channel(snd_pcm_substream_t *substream, in
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
         //snd_printk("epcm kcalloc: %p\n", epcm);
 
        if (epcm == NULL)
@@ -214,7 +214,7 @@ static int snd_p16v_pcm_open_capture_channel(snd_pcm_substream_t *substream, int
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err;
 
-       epcm = kcalloc(1, sizeof(*epcm), GFP_KERNEL);
+       epcm = kzalloc(sizeof(*epcm), GFP_KERNEL);
        //snd_printk("epcm kcalloc: %p\n", epcm);
 
        if (epcm == NULL)
index f06b95f41a1de5daa5e73fad55d9b7d7829bd271..bef9a59f46d7d4d2adfc26fc29a396f9c9eb33c0 100644 (file)
@@ -100,13 +100,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
 #endif
 #endif /* SUPPORT_JOYSTICK */
 
-#ifndef PCI_DEVICE_ID_ENSONIQ_CT5880
-#define PCI_DEVICE_ID_ENSONIQ_CT5880    0x5880
-#endif
-#ifndef PCI_DEVICE_ID_ENSONIQ_ES1371
-#define PCI_DEVICE_ID_ENSONIQ_ES1371   0x1371
-#endif
-
 /* ES1371 chip ID */
 /* This is a little confusing because all ES1371 compatible chips have the
    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,
        *rensoniq = NULL;
        if ((err = pci_enable_device(pci)) < 0)
                return err;
-       ensoniq = kcalloc(1, sizeof(*ensoniq), GFP_KERNEL);
+       ensoniq = kzalloc(sizeof(*ensoniq), GFP_KERNEL);
        if (ensoniq == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2394,6 +2387,7 @@ static void __devexit snd_audiopci_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = DRIVER_NAME,
+       .owner = THIS_MODULE,
        .id_table = snd_audiopci_ids,
        .probe = snd_audiopci_probe,
        .remove = __devexit_p(snd_audiopci_remove),
index b492777bc30ffda252e86e1677b9d77c75dd9148..17fa80c23870b8631b6b2a40d5269ee0d2d531c9 100644 (file)
@@ -76,13 +76,6 @@ MODULE_SUPPORTED_DEVICE("{{ESS,ES1938},"
 #define SUPPORT_JOYSTICK 1
 #endif
 
-#ifndef PCI_VENDOR_ID_ESS
-#define PCI_VENDOR_ID_ESS              0x125d
-#endif
-#ifndef PCI_DEVICE_ID_ESS_ES1938
-#define PCI_DEVICE_ID_ESS_ES1938       0x1969
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
 static 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,
                 return -ENXIO;
         }
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1753,6 +1746,7 @@ static void __devexit snd_es1938_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ESS ES1938 (Solo-1)",
+       .owner = THIS_MODULE,
        .id_table = snd_es1938_ids,
        .probe = snd_es1938_probe,
        .remove = __devexit_p(snd_es1938_remove),
index 9d7a2878393060f303bf1974571995311d29b046..ecdcada90ca25945923a938472e506400344fcd6 100644 (file)
@@ -160,25 +160,6 @@ MODULE_PARM_DESC(joystick, "Enable joystick.");
 #endif
 
 
-/* PCI Dev ID's */
-
-#ifndef PCI_VENDOR_ID_ESS
-#define PCI_VENDOR_ID_ESS      0x125D
-#endif
-
-#define PCI_VENDOR_ID_ESS_OLD  0x1285  /* Platform Tech, the people the ESS
-                                          was bought form */
-
-#ifndef PCI_DEVICE_ID_ESS_M2E
-#define PCI_DEVICE_ID_ESS_M2E  0x1978
-#endif
-#ifndef PCI_DEVICE_ID_ESS_M2
-#define PCI_DEVICE_ID_ESS_M2   0x1968
-#endif
-#ifndef PCI_DEVICE_ID_ESS_M1
-#define PCI_DEVICE_ID_ESS_M1   0x0100
-#endif
-
 #define NR_APUS                        64
 #define NR_APU_REGS            16
 
@@ -1596,7 +1577,7 @@ static int snd_es1968_playback_open(snd_pcm_substream_t *substream)
        if (apu1 < 0)
                return apu1;
 
-       es = kcalloc(1, sizeof(*es), GFP_KERNEL);
+       es = kzalloc(sizeof(*es), GFP_KERNEL);
        if (!es) {
                snd_es1968_free_apu_pair(chip, apu1);
                return -ENOMEM;
@@ -1641,7 +1622,7 @@ static int snd_es1968_capture_open(snd_pcm_substream_t *substream)
                return apu2;
        }
        
-       es = kcalloc(1, sizeof(*es), GFP_KERNEL);
+       es = kzalloc(sizeof(*es), GFP_KERNEL);
        if (!es) {
                snd_es1968_free_apu_pair(chip, apu1);
                snd_es1968_free_apu_pair(chip, apu2);
@@ -2588,7 +2569,7 @@ static int __devinit snd_es1968_create(snd_card_t * card,
                return -ENXIO;
        }
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (! chip) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2782,6 +2763,7 @@ static void __devexit snd_es1968_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ES1968 (ESS Maestro)",
+       .owner = THIS_MODULE,
        .id_table = snd_es1968_ids,
        .probe = snd_es1968_probe,
        .remove = __devexit_p(snd_es1968_remove),
index 36b2f62e857385ace4b567b846ac31edd4b0c679..e5cfa2a0c24639cdf4354e7e2aa30771ec6a63b0 100644 (file)
@@ -1263,7 +1263,7 @@ static int __devinit snd_fm801_create(snd_card_t * card,
        *rchip = NULL;
        if ((err = pci_enable_device(pci)) < 0)
                return err;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1462,6 +1462,7 @@ static void __devexit snd_card_fm801_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "FM801",
+       .owner = THIS_MODULE,
        .id_table = snd_fm801_ids,
        .probe = snd_card_fm801_probe,
        .remove = __devexit_p(snd_card_fm801_remove),
index 20f7762f714444a8ed5e516977cb0ac4bd4487bd..3815403ed0953249418e2dc86ddf227833cf4970 100644 (file)
@@ -288,7 +288,7 @@ static int init_unsol_queue(struct hda_bus *bus)
 {
        struct hda_bus_unsolicited *unsol;
 
-       unsol = kcalloc(1, sizeof(*unsol), GFP_KERNEL);
+       unsol = kzalloc(sizeof(*unsol), GFP_KERNEL);
        if (! unsol) {
                snd_printk(KERN_ERR "hda_codec: can't allocate unsolicited queue\n");
                return -ENOMEM;
@@ -358,7 +358,7 @@ int snd_hda_bus_new(snd_card_t *card, const struct hda_bus_template *temp,
        if (busp)
                *busp = NULL;
 
-       bus = kcalloc(1, sizeof(*bus), GFP_KERNEL);
+       bus = kzalloc(sizeof(*bus), GFP_KERNEL);
        if (bus == NULL) {
                snd_printk(KERN_ERR "can't allocate struct hda_bus\n");
                return -ENOMEM;
@@ -493,7 +493,7 @@ int snd_hda_codec_new(struct hda_bus *bus, unsigned int codec_addr,
                return -EBUSY;
        }
 
-       codec = kcalloc(1, sizeof(*codec), GFP_KERNEL);
+       codec = kzalloc(sizeof(*codec), GFP_KERNEL);
        if (codec == NULL) {
                snd_printk(KERN_ERR "can't allocate struct hda_codec\n");
                return -ENOMEM;
index 63a29a8a2860e34e092f852f92e86b81511abc65..bb53bcf76742ed1ccc77078e2efb4c2cdc275a40 100644 (file)
@@ -505,6 +505,7 @@ struct hda_pcm_stream {
 struct hda_pcm {
        char *name;
        struct hda_pcm_stream stream[2];
+       unsigned int is_modem;  /* modem codec? */
 };
 
 /* codec information */
index 1229227af5b5f4c98bfa2e1a998817cfb27c5471..5b829a1a4c60ea843c9621bcc9f39778b7905b01 100644 (file)
@@ -98,7 +98,7 @@ static int add_new_node(struct hda_codec *codec, struct hda_gspec *spec, hda_nid
        struct hda_gnode *node;
        int nconns;
 
-       node = kcalloc(1, sizeof(*node), GFP_KERNEL);
+       node = kzalloc(sizeof(*node), GFP_KERNEL);
        if (node == NULL)
                return -ENOMEM;
        node->nid = nid;
@@ -886,7 +886,7 @@ int snd_hda_parse_generic_codec(struct hda_codec *codec)
                return -ENODEV;
        }
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL) {
                printk(KERN_ERR "hda_generic: can't allocate spec\n");
                return -ENOMEM;
index 15107df1f490808ebc52dfc5e1a977ee7dc83d08..9590ece2099dd6e65c3cfbe159c5702ad26b2b55 100644 (file)
@@ -62,7 +62,7 @@ MODULE_PARM_DESC(enable, "Enable Intel HD audio interface.");
 module_param_array(model, charp, NULL, 0444);
 MODULE_PARM_DESC(model, "Use the given board model.");
 module_param_array(position_fix, int, NULL, 0444);
-MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = FIFO size, 1 = none, 2 = POSBUF).");
+MODULE_PARM_DESC(position_fix, "Fix DMA pointer (0 = auto, 1 = none, 2 = POSBUF, 3 = FIFO size).");
 
 MODULE_LICENSE("GPL");
 MODULE_SUPPORTED_DEVICE("{{Intel, ICH6},"
@@ -164,7 +164,9 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 /* max buffer size - no h/w limit, you can increase as you like */
 #define AZX_MAX_BUF_SIZE       (1024*1024*1024)
 /* max number of PCM devics per card */
-#define AZX_MAX_PCMS           8
+#define AZX_MAX_AUDIO_PCMS     6
+#define AZX_MAX_MODEM_PCMS     2
+#define AZX_MAX_PCMS           (AZX_MAX_AUDIO_PCMS + AZX_MAX_MODEM_PCMS)
 
 /* RIRB int mask: overrun[2], response[0] */
 #define RIRB_INT_RESPONSE      0x01
@@ -211,9 +213,10 @@ enum { SDI0, SDI1, SDI2, SDI3, SDO0, SDO1, SDO2, SDO3 };
 
 /* position fix mode */
 enum {
-       POS_FIX_FIFO,
+       POS_FIX_AUTO,
        POS_FIX_NONE,
-       POS_FIX_POSBUF
+       POS_FIX_POSBUF,
+       POS_FIX_FIFO,
 };
 
 /* Defines for ATI HD Audio support in SB450 south bridge */
@@ -243,6 +246,7 @@ struct snd_azx_dev {
        unsigned int fragsize;          /* size of each period in bytes */
        unsigned int frags;             /* number for period in the play buffer */
        unsigned int fifo_size;         /* FIFO size */
+       unsigned int last_pos;          /* last updated period position */
 
        void __iomem *sd_addr;          /* stream descriptor pointer */
 
@@ -256,6 +260,7 @@ struct snd_azx_dev {
 
        unsigned int opened: 1;
        unsigned int running: 1;
+       unsigned int period_updating: 1;
 };
 
 /* CORB/RIRB */
@@ -724,11 +729,9 @@ static void azx_init_chip(azx_t *chip)
        /* initialize the codec command I/O */
        azx_init_cmd_io(chip);
 
-       if (chip->position_fix == POS_FIX_POSBUF) {
-               /* program the position buffer */
-               azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr);
-               azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
-       }
+       /* program the position buffer */
+       azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr);
+       azx_writel(chip, DPUBASE, upper_32bit(chip->posbuf.addr));
 
        /* For ATI SB450 azalia HD audio, we need to enable snoop */
        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)
                if (status & azx_dev->sd_int_sta_mask) {
                        azx_sd_writeb(azx_dev, SD_STS, SD_INT_MASK);
                        if (azx_dev->substream && azx_dev->running) {
+                               azx_dev->period_updating = 1;
                                spin_unlock(&chip->reg_lock);
                                snd_pcm_period_elapsed(azx_dev->substream);
                                spin_lock(&chip->reg_lock);
+                               azx_dev->period_updating = 0;
                        }
                }
        }
@@ -866,11 +871,9 @@ static int azx_setup_controller(azx_t *chip, azx_dev_t *azx_dev)
        /* upper BDL address */
        azx_sd_writel(azx_dev, SD_BDLPU, upper_32bit(azx_dev->bdl_addr));
 
-       if (chip->position_fix == POS_FIX_POSBUF) {
-               /* enable the position buffer */
-               if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE))
-                       azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
-       }
+       /* enable the position buffer */
+       if (! (azx_readl(chip, DPLBASE) & ICH6_DPLBASE_ENABLE))
+               azx_writel(chip, DPLBASE, (u32)chip->posbuf.addr | ICH6_DPLBASE_ENABLE);
 
        /* set the interrupt enable bits in the descriptor control register */
        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)
                azx_dev->fifo_size = azx_sd_readw(azx_dev, SD_FIFOSIZE) + 1;
        else
                azx_dev->fifo_size = 0;
+       azx_dev->last_pos = 0;
 
        return hinfo->ops.prepare(hinfo, apcm->codec, azx_dev->stream_tag,
                                  azx_dev->format_val, substream);
@@ -1133,6 +1137,26 @@ static snd_pcm_uframes_t azx_pcm_pointer(snd_pcm_substream_t *substream)
                pos = azx_sd_readl(azx_dev, SD_LPIB);
                if (chip->position_fix == POS_FIX_FIFO)
                        pos += azx_dev->fifo_size;
+               else if (chip->position_fix == POS_FIX_AUTO && azx_dev->period_updating) {
+                       /* check the validity of DMA position */
+                       unsigned int diff = 0;
+                       azx_dev->last_pos += azx_dev->fragsize;
+                       if (azx_dev->last_pos > pos)
+                               diff = azx_dev->last_pos - pos;
+                       if (azx_dev->last_pos >= azx_dev->bufsize) {
+                               if (pos < azx_dev->fragsize)
+                                       diff = 0;
+                               azx_dev->last_pos = 0;
+                       }
+                       if (diff > 0 && diff <= azx_dev->fifo_size)
+                               pos += azx_dev->fifo_size;
+                       else {
+                               snd_printdd(KERN_INFO "hda_intel: DMA position fix %d, switching to posbuf\n", diff);
+                               chip->position_fix = POS_FIX_POSBUF;
+                               pos = *azx_dev->posbuf;
+                       }
+                       azx_dev->period_updating = 0;
+               }
        }
        if (pos >= azx_dev->bufsize)
                pos = 0;
@@ -1203,12 +1227,33 @@ static int __devinit azx_pcm_create(azx_t *chip)
        if ((err = snd_hda_build_pcms(chip->bus)) < 0)
                return err;
 
+       /* create audio PCMs */
        pcm_dev = 0;
        list_for_each(p, &chip->bus->codec_list) {
                codec = list_entry(p, struct hda_codec, list);
                for (c = 0; c < codec->num_pcms; c++) {
+                       if (codec->pcm_info[c].is_modem)
+                               continue; /* create later */
+                       if (pcm_dev >= AZX_MAX_AUDIO_PCMS) {
+                               snd_printk(KERN_ERR SFX "Too many audio PCMs\n");
+                               return -EINVAL;
+                       }
+                       err = create_codec_pcm(chip, codec, &codec->pcm_info[c], pcm_dev);
+                       if (err < 0)
+                               return err;
+                       pcm_dev++;
+               }
+       }
+
+       /* create modem PCMs */
+       pcm_dev = AZX_MAX_AUDIO_PCMS;
+       list_for_each(p, &chip->bus->codec_list) {
+               codec = list_entry(p, struct hda_codec, list);
+               for (c = 0; c < codec->num_pcms; c++) {
+                       if (! codec->pcm_info[c].is_modem)
+                               continue; /* already created */
                        if (pcm_dev >= AZX_MAX_PCMS) {
-                               snd_printk(KERN_ERR SFX "Too many PCMs\n");
+                               snd_printk(KERN_ERR SFX "Too many modem PCMs\n");
                                return -EINVAL;
                        }
                        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)
                azx_dev_t *azx_dev = &chip->azx_dev[i];
                azx_dev->bdl = (u32 *)(chip->bdl.area + off);
                azx_dev->bdl_addr = chip->bdl.addr + off;
-               if (chip->position_fix == POS_FIX_POSBUF)
-                       azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
+               azx_dev->posbuf = (volatile u32 *)(chip->posbuf.area + i * 8);
                /* offset: SDI0=0x80, SDI1=0xa0, ... SDO3=0x160 */
                azx_dev->sd_addr = chip->remap_addr + (0x20 * i + 0x80);
                /* 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,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        
        if (NULL == chip) {
                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,
                snd_printk(KERN_ERR SFX "cannot allocate BDL\n");
                goto errout;
        }
-       if (chip->position_fix == POS_FIX_POSBUF) {
-               /* allocate memory for the position buffer */
-               if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
-                                              chip->num_streams * 8, &chip->posbuf)) < 0) {
-                       snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
-                       goto errout;
-               }
+       /* allocate memory for the position buffer */
+       if ((err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, snd_dma_pci_data(chip->pci),
+                                      chip->num_streams * 8, &chip->posbuf)) < 0) {
+               snd_printk(KERN_ERR SFX "cannot allocate posbuf\n");
+               goto errout;
        }
        /* allocate CORB/RIRB */
        if ((err = azx_alloc_cmd_io(chip)) < 0)
@@ -1561,6 +1603,7 @@ MODULE_DEVICE_TABLE(pci, azx_ids);
 /* pci_driver definition */
 static struct pci_driver driver = {
        .name = "HDA Intel",
+       .owner = THIS_MODULE,
        .id_table = azx_ids,
        .probe = azx_probe,
        .remove = __devexit_p(azx_remove),
index de1217bd8e68288733f59fcdab0f4ea6441c33e2..08f6a6efc5e6b75212c2a9c62a2c6a9e735c742d 100644 (file)
@@ -207,6 +207,8 @@ static void print_codec_info(snd_info_entry_t *entry, snd_info_buffer_t *buffer)
        snd_iprintf(buffer, "Vendor Id: 0x%x\n", codec->vendor_id);
        snd_iprintf(buffer, "Subsystem Id: 0x%x\n", codec->subsystem_id);
        snd_iprintf(buffer, "Revision Id: 0x%x\n", codec->revision_id);
+       if (! codec->afg)
+               return;
        snd_iprintf(buffer, "Default PCM: ");
        print_pcm_caps(buffer, codec, codec->afg);
        snd_iprintf(buffer, "Default Amp-In caps: ");
index bceb83a42a38d50705c8eeb91d6af1e72df63013..da6874d3988cfdb44dd3d11ec07cbfaf97f3890b 100644 (file)
@@ -465,7 +465,7 @@ static int patch_ad1986a(struct hda_codec *codec)
 {
        struct ad198x_spec *spec;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
@@ -623,7 +623,7 @@ static int patch_ad1983(struct hda_codec *codec)
 {
        struct ad198x_spec *spec;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
@@ -764,7 +764,7 @@ static int patch_ad1981(struct hda_codec *codec)
 {
        struct ad198x_spec *spec;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
index 07fb4f5a54b36558c65575acf630ec6951f5b559..523c362ec44d6de4ba13173909f5531138536952 100644 (file)
@@ -667,7 +667,7 @@ static int patch_cmi9880(struct hda_codec *codec)
 {
        struct cmi_spec *spec;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
index eeb900ab79afdbb677e255a96b0fa62f3308d27e..849b5b50c921eda305f5059efa6f8221a0b3a4f1 100644 (file)
@@ -1526,6 +1526,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
        /* Back 3 jack, front 2 jack (Internal add Aux-In) */
        { .pci_subvendor = 0x1025, .pci_subdevice = 0xe310, .config = ALC880_3ST },
        { .pci_subvendor = 0x104d, .pci_subdevice = 0x81d6, .config = ALC880_3ST }, 
+       { .pci_subvendor = 0x104d, .pci_subdevice = 0x81a0, .config = ALC880_3ST },
 
        /* Back 3 jack plus 1 SPDIF out jack, front 2 jack */
        { .modelname = "3stack-digout", .config = ALC880_3ST_DIG },
@@ -1581,6 +1582,7 @@ static struct hda_board_config alc880_cfg_tbl[] = {
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1973, .config = ALC880_ASUS_DIG },
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x19b3, .config = ALC880_ASUS_DIG },
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1113, .config = ALC880_ASUS_DIG },
+       { .pci_subvendor = 0x1043, .pci_subdevice = 0x1173, .config = ALC880_ASUS_DIG },
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1993, .config = ALC880_ASUS },
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x10c3, .config = ALC880_ASUS_DIG },
        { .pci_subvendor = 0x1043, .pci_subdevice = 0x1133, .config = ALC880_ASUS },
@@ -2093,7 +2095,7 @@ static int patch_alc880(struct hda_codec *codec)
        int board_config;
        int i, err;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
@@ -2365,7 +2367,7 @@ static int patch_alc260(struct hda_codec *codec)
        struct alc_spec *spec;
        int board_config;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
@@ -2615,7 +2617,7 @@ static int patch_alc882(struct hda_codec *codec)
 {
        struct alc_spec *spec;
 
-       spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
index b0270d1b64cea38957c04eea9cdd862889a57990..d014b7bb70df8b3b1d582e745aff0bbf0966efb6 100644 (file)
@@ -214,6 +214,7 @@ static int si3054_build_pcms(struct hda_codec *codec)
        info->name = "Si3054 Modem";
        info->stream[SNDRV_PCM_STREAM_PLAYBACK] = si3054_pcm;
        info->stream[SNDRV_PCM_STREAM_CAPTURE]  = si3054_pcm;
+       info->is_modem = 1;
        return 0;
 }
 
@@ -282,7 +283,7 @@ static struct hda_codec_ops si3054_patch_ops = {
 
 static int patch_si3054(struct hda_codec *codec)
 {
-       struct si3054_spec *spec = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       struct si3054_spec *spec = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
        codec->spec = spec;
index 9d503da7320db9d21706f7f6717a834af644853c..33a8adaea768ab7ac842e0c7e65c178aedd02da6 100644 (file)
@@ -919,7 +919,7 @@ static int patch_stac9200(struct hda_codec *codec)
        struct sigmatel_spec *spec;
        int err;
 
-       spec  = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
@@ -957,7 +957,7 @@ static int patch_stac922x(struct hda_codec *codec)
        struct sigmatel_spec *spec;
        int err;
 
-       spec  = kcalloc(1, sizeof(*spec), GFP_KERNEL);
+       spec  = kzalloc(sizeof(*spec), GFP_KERNEL);
        if (spec == NULL)
                return -ENOMEM;
 
index 4405d96cbedf925d7fe9a4e928a7079694fc2e52..2e0a31613ee6c37d065e42521efddf7df50d4559 100644 (file)
@@ -1796,7 +1796,7 @@ static int __devinit aureon_init(ice1712_t *ice)
        }
 
        /* to remeber the register values of CS8415 */
-       ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
+       ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
        if (! ice->akm)
                return -ENOMEM;
        ice->akm_codecs = 1;
index b97f50d10ba308cd532bac7285c45b9107fbcbbc..a6d98013c331fe95bb69771079b88881eb48839e 100644 (file)
@@ -100,12 +100,6 @@ MODULE_PARM_DESC(cs8427_timeout, "Define reset timeout for cs8427 chip in msec r
 module_param_array(model, charp, NULL, 0444);
 MODULE_PARM_DESC(model, "Use the given board model.");
 
-#ifndef PCI_VENDOR_ID_ICE
-#define PCI_VENDOR_ID_ICE              0x1412
-#endif
-#ifndef PCI_DEVICE_ID_ICE_1712
-#define PCI_DEVICE_ID_ICE_1712         0x1712
-#endif
 
 static struct pci_device_id snd_ice1712_ids[] = {
        { 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,
                return -ENXIO;
        }
 
-       ice = kcalloc(1, sizeof(*ice), GFP_KERNEL);
+       ice = kzalloc(sizeof(*ice), GFP_KERNEL);
        if (ice == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2741,6 +2735,7 @@ static void __devexit snd_ice1712_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ICE1712",
+       .owner = THIS_MODULE,
        .id_table = snd_ice1712_ids,
        .probe = snd_ice1712_probe,
        .remove = __devexit_p(snd_ice1712_remove),
index c7af5e5fee13e1f2d318ae32b5d2ba5d7781e487..c3ce8f93740bb9bc77805eed5455896ec21fa785 100644 (file)
@@ -83,12 +83,6 @@ MODULE_PARM_DESC(enable, "Enable ICE1724 soundcard.");
 module_param_array(model, charp, NULL, 0444);
 MODULE_PARM_DESC(model, "Use the given board model.");
 
-#ifndef PCI_VENDOR_ID_ICE
-#define PCI_VENDOR_ID_ICE              0x1412
-#endif
-#ifndef PCI_DEVICE_ID_VT1724
-#define PCI_DEVICE_ID_VT1724           0x1724
-#endif
 
 /* Both VT1720 and VT1724 have the same PCI IDs */
 static struct pci_device_id snd_vt1724_ids[] = {
@@ -2130,7 +2124,7 @@ static int __devinit snd_vt1724_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       ice = kcalloc(1, sizeof(*ice), GFP_KERNEL);
+       ice = kzalloc(sizeof(*ice), GFP_KERNEL);
        if (ice == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2321,6 +2315,7 @@ static void __devexit snd_vt1724_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "ICE1724",
+       .owner = THIS_MODULE,
        .id_table = snd_vt1724_ids,
        .probe = snd_vt1724_probe,
        .remove = __devexit_p(snd_vt1724_remove),
index 3fb297b969cd78bd9844e5c58ffdc118d3dd7418..2437876a44e4e0f73c7e6f84f007022763bc2d6f 100644 (file)
@@ -182,7 +182,7 @@ static int __devinit juli_init(ice1712_t *ice)
                ice->num_total_dacs = 2;
                ice->num_total_adcs = 2;
 
-               ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
+               ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
                if (! ak)
                        return -ENOMEM;
                ice->akm_codecs = 1;
index 5bf734b04fa065f0e6999828ee177f8479e0967e..dcf1e8ca3f6601f8ae63e2ec0036ab2f5484d27f 100644 (file)
@@ -122,7 +122,7 @@ static int __devinit phase22_init(ice1712_t *ice)
        }
 
        // Initialize analog chips
-       ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
+       ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
        if (! ak)
                return -ENOMEM;
        ice->akm_codecs = 1;
@@ -386,7 +386,7 @@ static int __devinit phase28_init(ice1712_t *ice)
        ice->num_total_adcs = 2;
 
        // Initialize analog chips
-       ak = ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
+       ak = ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
        if (!ak)
                return -ENOMEM;
        ice->akm_codecs = 1;
index 25f827d8fbd9e06c126a469db7b5f69cd0eb5401..a5f852b1f575b81d4f14b68e1d63153cef27fbda 100644 (file)
@@ -781,7 +781,7 @@ static int __devinit pontis_init(ice1712_t *ice)
        ice->num_total_adcs = 2;
 
        /* to remeber the register values */
-       ice->akm = kcalloc(1, sizeof(akm4xxx_t), GFP_KERNEL);
+       ice->akm = kzalloc(sizeof(akm4xxx_t), GFP_KERNEL);
        if (! ice->akm)
                return -ENOMEM;
        ice->akm_codecs = 1;
index 7b548416dcefc086295511b6845359975bb8dda8..1a96198a17ae618f333691017e3e909293ce1650 100644 (file)
@@ -69,6 +69,7 @@ static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;     /* ID for this card */
 static int enable[SNDRV_CARDS] = SNDRV_DEFAULT_ENABLE_PNP;     /* Enable this card */
 static int ac97_clock[SNDRV_CARDS] = {[0 ... (SNDRV_CARDS - 1)] = 0};
 static char *ac97_quirk[SNDRV_CARDS];
+static int buggy_semaphore[SNDRV_CARDS];
 static int buggy_irq[SNDRV_CARDS];
 static int xbox[SNDRV_CARDS];
 
@@ -86,6 +87,8 @@ module_param_array(ac97_clock, int, NULL, 0444);
 MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
 module_param_array(ac97_quirk, charp, NULL, 0444);
 MODULE_PARM_DESC(ac97_quirk, "AC'97 workaround for strange hardware.");
+module_param_array(buggy_semaphore, bool, NULL, 0444);
+MODULE_PARM_DESC(buggy_semaphore, "Enable workaround for hardwares with problematic codec semaphores.");
 module_param_array(buggy_irq, bool, NULL, 0444);
 MODULE_PARM_DESC(buggy_irq, "Enable workaround for buggy interrupts on some motherboards.");
 module_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
 /*
  *  Direct registers
  */
-
-#ifndef PCI_DEVICE_ID_INTEL_82801
-#define PCI_DEVICE_ID_INTEL_82801       0x2415
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82901
-#define PCI_DEVICE_ID_INTEL_82901       0x2425
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82801BA
-#define PCI_DEVICE_ID_INTEL_82801BA     0x2445
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_440MX
-#define PCI_DEVICE_ID_INTEL_440MX       0x7195
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH3
-#define PCI_DEVICE_ID_INTEL_ICH3       0x2485
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH4
-#define PCI_DEVICE_ID_INTEL_ICH4       0x24c5
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH5
-#define PCI_DEVICE_ID_INTEL_ICH5       0x24d5
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ESB_5
-#define PCI_DEVICE_ID_INTEL_ESB_5      0x25a6
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH6_18
-#define PCI_DEVICE_ID_INTEL_ICH6_18    0x266e
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH7_20
-#define PCI_DEVICE_ID_INTEL_ICH7_20    0x27de
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ESB2_14
-#define PCI_DEVICE_ID_INTEL_ESB2_14    0x2698
-#endif
-#ifndef PCI_DEVICE_ID_SI_7012
-#define PCI_DEVICE_ID_SI_7012          0x7012
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_MCP_AUDIO 0x01b1
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_CK804_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_CK804_AUDIO 0x0059
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO        0x006a
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_CK8_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_CK8_AUDIO 0x008a
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO        0x00da
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO
-#define PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO        0x00ea
-#endif
-
 enum { DEVICE_INTEL, DEVICE_INTEL_ICH4, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
 
 #define ICHREG(x) ICH_REG_##x
@@ -423,6 +370,7 @@ struct _snd_intel8x0 {
        unsigned fix_nocache: 1;        /* workaround for 440MX */
        unsigned buggy_irq: 1;          /* workaround for buggy mobos */
        unsigned xbox: 1;               /* workaround for Xbox AC'97 detection */
+       unsigned buggy_semaphore: 1;    /* workaround for buggy codec semaphore */
 
        int spdif_idx;  /* SPDIF BAR index; *_SPBAR or -1 if use PCMOUT */
        unsigned int sdm_saved; /* SDM reg value */
@@ -577,6 +525,9 @@ static int snd_intel8x0_codec_semaphore(intel8x0_t *chip, unsigned int codec)
        if ((igetdword(chip, ICHREG(GLOB_STA)) & codec) == 0)
                return -EIO;
 
+       if (chip->buggy_semaphore)
+               return 0; /* just ignore ... */
+
        /* Anyone holding a semaphore for 1 msec should be shot... */
        time = 100;
        do {
@@ -1758,6 +1709,12 @@ static struct ac97_quirk ac97_quirks[] __devinitdata = {
                .name = "MS-9128",
                .type = AC97_TUNE_ALC_JACK
        },
+       {
+               .subvendor = 0x1014,
+               .subdevice = 0x0267,
+               .name = "IBM NetVista A30p",    /* AD1981B */
+               .type = AC97_TUNE_HP_ONLY
+       },
        {
                .subvendor = 0x1028,
                .subdevice = 0x00d8,
@@ -2599,6 +2556,7 @@ struct ich_reg_info {
 static int __devinit snd_intel8x0_create(snd_card_t * card,
                                         struct pci_dev *pci,
                                         unsigned long device_type,
+                                        int buggy_sem,
                                         intel8x0_t ** r_intel8x0)
 {
        intel8x0_t *chip;
@@ -2646,7 +2604,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2656,6 +2614,7 @@ static int __devinit snd_intel8x0_create(snd_card_t * card,
        chip->card = card;
        chip->pci = pci;
        chip->irq = -1;
+       chip->buggy_semaphore = buggy_sem;
 
        if (pci->vendor == PCI_VENDOR_ID_INTEL &&
            pci->device == PCI_DEVICE_ID_INTEL_440MX)
@@ -2795,19 +2754,19 @@ static struct shortname_table {
        unsigned int id;
        const char *s;
 } shortnames[] __devinitdata = {
-       { PCI_DEVICE_ID_INTEL_82801, "Intel 82801AA-ICH" },
-       { PCI_DEVICE_ID_INTEL_82901, "Intel 82901AB-ICH0" },
-       { PCI_DEVICE_ID_INTEL_82801BA, "Intel 82801BA-ICH2" },
+       { PCI_DEVICE_ID_INTEL_82801AA_5, "Intel 82801AA-ICH" },
+       { PCI_DEVICE_ID_INTEL_82801AB_5, "Intel 82901AB-ICH0" },
+       { PCI_DEVICE_ID_INTEL_82801BA_4, "Intel 82801BA-ICH2" },
        { PCI_DEVICE_ID_INTEL_440MX, "Intel 440MX" },
-       { PCI_DEVICE_ID_INTEL_ICH3, "Intel 82801CA-ICH3" },
-       { PCI_DEVICE_ID_INTEL_ICH4, "Intel 82801DB-ICH4" },
-       { PCI_DEVICE_ID_INTEL_ICH5, "Intel ICH5" },
+       { PCI_DEVICE_ID_INTEL_82801CA_5, "Intel 82801CA-ICH3" },
+       { PCI_DEVICE_ID_INTEL_82801DB_5, "Intel 82801DB-ICH4" },
+       { PCI_DEVICE_ID_INTEL_82801EB_5, "Intel ICH5" },
        { PCI_DEVICE_ID_INTEL_ESB_5, "Intel 6300ESB" },
        { PCI_DEVICE_ID_INTEL_ICH6_18, "Intel ICH6" },
        { PCI_DEVICE_ID_INTEL_ICH7_20, "Intel ICH7" },
        { PCI_DEVICE_ID_INTEL_ESB2_14, "Intel ESB2" },
        { PCI_DEVICE_ID_SI_7012, "SiS SI7012" },
-       { PCI_DEVICE_ID_NVIDIA_MCP_AUDIO, "NVidia nForce" },
+       { PCI_DEVICE_ID_NVIDIA_MCP1_AUDIO, "NVidia nForce" },
        { PCI_DEVICE_ID_NVIDIA_MCP2_AUDIO, "NVidia nForce2" },
        { PCI_DEVICE_ID_NVIDIA_MCP3_AUDIO, "NVidia nForce3" },
        { PCI_DEVICE_ID_NVIDIA_CK8S_AUDIO, "NVidia CK8S" },
@@ -2860,7 +2819,8 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
                }
        }
 
-       if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data, &chip)) < 0) {
+       if ((err = snd_intel8x0_create(card, pci, pci_id->driver_data,
+                                      buggy_semaphore[dev], &chip)) < 0) {
                snd_card_free(card);
                return err;
        }
@@ -2904,6 +2864,7 @@ static void __devexit snd_intel8x0_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Intel ICH",
+       .owner = THIS_MODULE,
        .id_table = snd_intel8x0_ids,
        .probe = snd_intel8x0_probe,
        .remove = __devexit_p(snd_intel8x0_remove),
index bb758c77d211067ab49979f0fb962f7db654ae2c..9e2060d56c244f3f6a35aa25e550c43805dc2f5b 100644 (file)
@@ -73,51 +73,6 @@ MODULE_PARM_DESC(ac97_clock, "AC'97 codec clock (0 = auto-detect).");
 /*
  *  Direct registers
  */
-
-#ifndef PCI_DEVICE_ID_INTEL_82801_6
-#define PCI_DEVICE_ID_INTEL_82801_6     0x2416
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82901_6
-#define PCI_DEVICE_ID_INTEL_82901_6     0x2426
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_82801BA_6
-#define PCI_DEVICE_ID_INTEL_82801BA_6   0x2446
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_440MX_6
-#define PCI_DEVICE_ID_INTEL_440MX_6     0x7196
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH3_6
-#define PCI_DEVICE_ID_INTEL_ICH3_6     0x2486
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH4_6
-#define PCI_DEVICE_ID_INTEL_ICH4_6     0x24c6
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH5_6
-#define PCI_DEVICE_ID_INTEL_ICH5_6     0x24d6
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH6_6
-#define PCI_DEVICE_ID_INTEL_ICH6_6     0x266d
-#endif
-#ifndef PCI_DEVICE_ID_INTEL_ICH7_6
-#define PCI_DEVICE_ID_INTEL_ICH7_6     0x27dd
-#endif
-#ifndef PCI_DEVICE_ID_SI_7013
-#define PCI_DEVICE_ID_SI_7013          0x7013
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP_MODEM 0x01c1
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP2_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP2_MODEM        0x0069
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM 0x0089
-#endif
-#ifndef PCI_DEVICE_ID_NVIDIA_MCP3_MODEM
-#define PCI_DEVICE_ID_NVIDIA_MCP3_MODEM        0x00d9
-#endif
-
-
 enum { DEVICE_INTEL, DEVICE_SIS, DEVICE_ALI, DEVICE_NFORCE };
 
 #define ICHREG(x) ICH_REG_##x
@@ -1158,7 +1113,7 @@ static int __devinit snd_intel8x0m_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1283,18 +1238,18 @@ static struct shortname_table {
        unsigned int id;
        const char *s;
 } shortnames[] __devinitdata = {
-       { PCI_DEVICE_ID_INTEL_82801_6, "Intel 82801AA-ICH" },
-       { PCI_DEVICE_ID_INTEL_82901_6, "Intel 82901AB-ICH0" },
+       { PCI_DEVICE_ID_INTEL_82801AA_6, "Intel 82801AA-ICH" },
+       { PCI_DEVICE_ID_INTEL_82801AB_6, "Intel 82901AB-ICH0" },
        { PCI_DEVICE_ID_INTEL_82801BA_6, "Intel 82801BA-ICH2" },
        { PCI_DEVICE_ID_INTEL_440MX_6, "Intel 440MX" },
-       { PCI_DEVICE_ID_INTEL_ICH3_6, "Intel 82801CA-ICH3" },
-       { PCI_DEVICE_ID_INTEL_ICH4_6, "Intel 82801DB-ICH4" },
-       { PCI_DEVICE_ID_INTEL_ICH5_6, "Intel ICH5" },
-       { PCI_DEVICE_ID_INTEL_ICH6_6, "Intel ICH6" },
-       { PCI_DEVICE_ID_INTEL_ICH7_6, "Intel ICH7" },
+       { PCI_DEVICE_ID_INTEL_82801CA_6, "Intel 82801CA-ICH3" },
+       { PCI_DEVICE_ID_INTEL_82801DB_6, "Intel 82801DB-ICH4" },
+       { PCI_DEVICE_ID_INTEL_82801EB_6, "Intel ICH5" },
+       { PCI_DEVICE_ID_INTEL_ICH6_17, "Intel ICH6" },
+       { PCI_DEVICE_ID_INTEL_ICH7_19, "Intel ICH7" },
        { 0x7446, "AMD AMD768" },
        { PCI_DEVICE_ID_SI_7013, "SiS SI7013" },
-       { PCI_DEVICE_ID_NVIDIA_MCP_MODEM, "NVidia nForce" },
+       { PCI_DEVICE_ID_NVIDIA_MCP1_MODEM, "NVidia nForce" },
        { PCI_DEVICE_ID_NVIDIA_MCP2_MODEM, "NVidia nForce2" },
        { PCI_DEVICE_ID_NVIDIA_MCP2S_MODEM, "NVidia nForce2s" },
        { PCI_DEVICE_ID_NVIDIA_MCP3_MODEM, "NVidia nForce3" },
@@ -1371,6 +1326,7 @@ static void __devexit snd_intel8x0m_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Intel ICH Modem",
+       .owner = THIS_MODULE,
        .id_table = snd_intel8x0m_ids,
        .probe = snd_intel8x0m_probe,
        .remove = __devexit_p(snd_intel8x0m_remove),
index d2aa9c82d41e44029d737e370cb8155e899a3c56..09f9cbe116a38734cea09038d60338b79916320d 100644 (file)
@@ -2220,7 +2220,7 @@ static int __devinit snd_korg1212_create(snd_card_t * card, struct pci_dev *pci,
         if ((err = pci_enable_device(pci)) < 0)
                 return err;
 
-        korg1212 = kcalloc(1, sizeof(*korg1212), GFP_KERNEL);
+        korg1212 = kzalloc(sizeof(*korg1212), GFP_KERNEL);
         if (korg1212 == NULL) {
                pci_disable_device(pci);
                 return -ENOMEM;
@@ -2534,6 +2534,7 @@ static void __devexit snd_korg1212_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "korg1212",
+       .owner = THIS_MODULE,
        .id_table = snd_korg1212_ids,
        .probe = snd_korg1212_probe,
        .remove = __devexit_p(snd_korg1212_remove),
index 39b5e7db1543b13549ece82a5adcbe7a2d53ee16..2693b6f731f3e27c03c1754a12097e2674574ce0 100644 (file)
@@ -872,35 +872,6 @@ struct snd_m3 {
 /*
  * pci ids
  */
-
-#ifndef PCI_VENDOR_ID_ESS
-#define PCI_VENDOR_ID_ESS         0x125D
-#endif
-#ifndef PCI_DEVICE_ID_ESS_ALLEGRO_1
-#define PCI_DEVICE_ID_ESS_ALLEGRO_1    0x1988
-#endif
-#ifndef PCI_DEVICE_ID_ESS_ALLEGRO
-#define PCI_DEVICE_ID_ESS_ALLEGRO      0x1989
-#endif
-#ifndef PCI_DEVICE_ID_ESS_CANYON3D_2LE
-#define PCI_DEVICE_ID_ESS_CANYON3D_2LE 0x1990
-#endif
-#ifndef PCI_DEVICE_ID_ESS_CANYON3D_2
-#define PCI_DEVICE_ID_ESS_CANYON3D_2   0x1992
-#endif
-#ifndef PCI_DEVICE_ID_ESS_MAESTRO3
-#define PCI_DEVICE_ID_ESS_MAESTRO3     0x1998
-#endif
-#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_1
-#define PCI_DEVICE_ID_ESS_MAESTRO3_1   0x1999
-#endif
-#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_HW
-#define PCI_DEVICE_ID_ESS_MAESTRO3_HW  0x199a
-#endif
-#ifndef PCI_DEVICE_ID_ESS_MAESTRO3_2
-#define PCI_DEVICE_ID_ESS_MAESTRO3_2   0x199b
-#endif
-
 static struct pci_device_id snd_m3_ids[] = {
        {PCI_VENDOR_ID_ESS, PCI_DEVICE_ID_ESS_ALLEGRO_1, PCI_ANY_ID, PCI_ANY_ID,
         PCI_CLASS_MULTIMEDIA_AUDIO << 8, 0xffff00, 0},
@@ -2689,7 +2660,7 @@ snd_m3_create(snd_card_t *card, struct pci_dev *pci,
                return -ENXIO;
        }
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -2890,6 +2861,7 @@ static void __devexit snd_m3_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Maestro3",
+       .owner = THIS_MODULE,
        .id_table = snd_m3_ids,
        .probe = snd_m3_probe,
        .remove = __devexit_p(snd_m3_remove),
index 6c868d913634cce920e35a364c930e71939cfae7..1a62c7f6c52bb396666d8b13693a4a9c7a2cd3a3 100644 (file)
@@ -1004,7 +1004,7 @@ static int __devinit snd_mixart_create(mixart_mgr_t *mgr, snd_card_t *card, int
                .dev_free = snd_mixart_chip_dev_free,
        };
 
-       mgr->chip[idx] = chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       mgr->chip[idx] = chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (! chip) {
                snd_printk(KERN_ERR "cannot allocate chip\n");
                return -ENOMEM;
@@ -1292,7 +1292,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
 
        /*
         */
-       mgr = kcalloc(1, sizeof(*mgr), GFP_KERNEL);
+       mgr = kzalloc(sizeof(*mgr), GFP_KERNEL);
        if (! mgr) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1424,6 +1424,7 @@ static void __devexit snd_mixart_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Digigram miXart",
+       .owner = THIS_MODULE,
        .id_table = snd_mixart_ids,
        .probe = snd_mixart_probe,
        .remove = __devexit_p(snd_mixart_remove),
index 2bbeb10ff7c4a0c3aa182a98176a0dde05cf461d..5c55a3b1d121b247c46cd8a5d64274a1631c847f 100644 (file)
@@ -259,21 +259,6 @@ struct snd_nm256 {
 /*
  * PCI ids
  */
-
-#ifndef PCI_VENDOR_ID_NEOMAGIC
-#define PCI_VENDOR_ID_NEOMEGIC 0x10c8
-#endif
-#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO
-#define PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO 0x8005
-#endif
-#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO
-#define PCI_DEVICE_ID_NEOMAGIC_NM256ZX_AUDIO 0x8006
-#endif
-#ifndef PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO
-#define PCI_DEVICE_ID_NEOMAGIC_NM256XL_PLUS_AUDIO 0x8016
-#endif
-
-
 static struct pci_device_id snd_nm256_ids[] = {
        {PCI_VENDOR_ID_NEOMAGIC, PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO, PCI_ANY_ID, PCI_ANY_ID, 0, 0, 0},
        {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,
        runtime->hw = *hw_ptr;
        runtime->hw.buffer_bytes_max = s->bufsize;
        runtime->hw.period_bytes_max = s->bufsize / 2;
-       runtime->dma_area = (void*) s->bufptr;
+       runtime->dma_area = (void __force *) s->bufptr;
        runtime->dma_addr = s->bufptr_addr;
        runtime->dma_bytes = s->bufsize;
        runtime->private_data = s;
@@ -1404,7 +1389,7 @@ snd_nm256_create(snd_card_t *card, struct pci_dev *pci,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1683,6 +1668,7 @@ static void __devexit snd_nm256_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "NeoMagic 256",
+       .owner = THIS_MODULE,
        .id_table = snd_nm256_ids,
        .probe = snd_nm256_probe,
        .remove = __devexit_p(snd_nm256_remove),
index 456be39e8e4a1171f296e2eab71513b0efb4d490..3daeecb9eb0e6a0b4a4da6712470354efa7bec7a 100644 (file)
@@ -192,20 +192,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Digi32}," "{RME,Digi32/8}," "{RME,Digi32 PRO}}");
 #define RME32_PRO_REVISION_WITH_8414 150
 
 
-/* PCI vendor/device ID's */
-#ifndef PCI_VENDOR_ID_XILINX_RME
-# define PCI_VENDOR_ID_XILINX_RME 0xea60
-#endif
-#ifndef PCI_DEVICE_ID_DIGI32
-# define PCI_DEVICE_ID_DIGI32 0x9896
-#endif
-#ifndef PCI_DEVICE_ID_DIGI32_PRO
-# define PCI_DEVICE_ID_DIGI32_PRO 0x9897
-#endif
-#ifndef PCI_DEVICE_ID_DIGI32_8
-# define PCI_DEVICE_ID_DIGI32_8 0x9898
-#endif
-
 typedef struct snd_rme32 {
        spinlock_t lock;
        int irq;
@@ -692,7 +678,8 @@ snd_rme32_playback_hw_params(snd_pcm_substream_t * substream,
                if (err < 0)
                        return err;
        } else {
-               runtime->dma_area = (void *)(rme32->iobase + RME32_IO_DATA_BUFFER);
+               runtime->dma_area = (void __force *)(rme32->iobase +
+                                                    RME32_IO_DATA_BUFFER);
                runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
                runtime->dma_bytes = RME32_BUFFER_SIZE;
        }
@@ -746,7 +733,8 @@ snd_rme32_capture_hw_params(snd_pcm_substream_t * substream,
                if (err < 0)
                        return err;
        } else {
-               runtime->dma_area = (void *)rme32->iobase + RME32_IO_DATA_BUFFER;
+               runtime->dma_area = (void __force *)rme32->iobase +
+                                       RME32_IO_DATA_BUFFER;
                runtime->dma_addr = rme32->port + RME32_IO_DATA_BUFFER;
                runtime->dma_bytes = RME32_BUFFER_SIZE;
        }
@@ -2024,6 +2012,7 @@ static void __devexit snd_rme32_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name =         "RME Digi32",
+       .owner =        THIS_MODULE,
        .id_table =     snd_rme32_ids,
        .probe =        snd_rme32_probe,
        .remove =       __devexit_p(snd_rme32_remove),
index 9645e9004a48e49550e7e26d08c091595a52df80..9983b66dc56448c2600f3f89a9459c7bd7d2744a 100644 (file)
@@ -200,25 +200,6 @@ MODULE_PARM_DESC(enable, "Enable RME Digi96 soundcard.");
 #define RME96_AD1852_VOL_BITS 14
 #define RME96_AD1855_VOL_BITS 10
 
-/*
- * PCI vendor/device ids, could in the future be defined in <linux/pci.h>,
- * therefore #ifndef is used.
- */
-#ifndef PCI_VENDOR_ID_XILINX
-#define PCI_VENDOR_ID_XILINX 0x10ee
-#endif
-#ifndef PCI_DEVICE_ID_DIGI96
-#define PCI_DEVICE_ID_DIGI96 0x3fc0
-#endif
-#ifndef PCI_DEVICE_ID_DIGI96_8
-#define PCI_DEVICE_ID_DIGI96_8 0x3fc1
-#endif
-#ifndef PCI_DEVICE_ID_DIGI96_8_PRO
-#define PCI_DEVICE_ID_DIGI96_8_PRO 0x3fc2
-#endif
-#ifndef PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST
-#define PCI_DEVICE_ID_DIGI96_8_PAD_OR_PST 0x3fc3
-#endif
 
 typedef struct snd_rme96 {
        spinlock_t    lock;
@@ -985,7 +966,8 @@ snd_rme96_playback_hw_params(snd_pcm_substream_t *substream,
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err, rate, dummy;
 
-       runtime->dma_area = (void *)(rme96->iobase + RME96_IO_PLAY_BUFFER);
+       runtime->dma_area = (void __force *)(rme96->iobase +
+                                            RME96_IO_PLAY_BUFFER);
        runtime->dma_addr = rme96->port + RME96_IO_PLAY_BUFFER;
        runtime->dma_bytes = RME96_BUFFER_SIZE;
 
@@ -1037,7 +1019,8 @@ snd_rme96_capture_hw_params(snd_pcm_substream_t *substream,
        snd_pcm_runtime_t *runtime = substream->runtime;
        int err, isadat, rate;
        
-       runtime->dma_area = (void *)(rme96->iobase + RME96_IO_REC_BUFFER);
+       runtime->dma_area = (void __force *)(rme96->iobase +
+                                            RME96_IO_REC_BUFFER);
        runtime->dma_addr = rme96->port + RME96_IO_REC_BUFFER;
        runtime->dma_bytes = RME96_BUFFER_SIZE;
 
@@ -2430,6 +2413,7 @@ static void __devexit snd_rme96_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "RME Digi96",
+       .owner = THIS_MODULE,
        .id_table = snd_rme96_ids,
        .probe = snd_rme96_probe,
        .remove = __devexit_p(snd_rme96_remove),
index 6694866089b5cd8061e088a1c27490d1109bbbe4..52525eb198c742dcd1f75e0a8970d6c19e3a91b3 100644 (file)
@@ -370,13 +370,6 @@ MODULE_SUPPORTED_DEVICE("{{RME Hammerfall-DSP},"
 #define UNITY_GAIN                       32768
 #define MINUS_INFINITY_GAIN              0
 
-#ifndef PCI_VENDOR_ID_XILINX
-#define PCI_VENDOR_ID_XILINX           0x10ee
-#endif
-#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP
-#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
-#endif
-
 /* the size of a substream (1 mono data stream) */
 
 #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)
        }
        
        if (!(hdsp->state & HDSP_InitializationComplete)) {
+               strcpy(card->shortname, "Hammerfall DSP");
                sprintf(card->longname, "%s at 0x%lx, irq %d", hdsp->card_name, 
                        hdsp->port, hdsp->irq);
            
@@ -5222,6 +5216,7 @@ static void __devexit snd_hdsp_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name =     "RME Hammerfall DSP",
+       .owner =    THIS_MODULE,
        .id_table = snd_hdsp_ids,
        .probe =    snd_hdsp_probe,
        .remove = __devexit_p(snd_hdsp_remove),
index 5d786d113b254422e1aa7d8aecbc31f330e8294f..fc3f3283ff37e28ccef26b506a16784cf60f97c3 100644 (file)
@@ -301,18 +301,6 @@ MODULE_SUPPORTED_DEVICE("{{RME HDSPM-MADI}}");
 #define UNITY_GAIN          32768      /* = 65536/2 */
 #define MINUS_INFINITY_GAIN 0
 
-/* PCI info */
-#ifndef PCI_VENDOR_ID_XILINX
-#define PCI_VENDOR_ID_XILINX           0x10ee
-#endif
-#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP
-#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP 0x3fc5
-#endif
-#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI
-#define PCI_DEVICE_ID_XILINX_HAMMERFALL_DSP_MADI 0x3fc6
-#endif
-
-
 /* Number of channels for different Speed Modes */
 #define MADI_SS_CHANNELS       64
 #define MADI_DS_CHANNELS       32
@@ -3652,6 +3640,7 @@ static void __devexit snd_hdspm_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "RME Hammerfall DSP MADI",
+       .owner = THIS_MODULE,
        .id_table = snd_hdspm_ids,
        .probe = snd_hdspm_probe,
        .remove = __devexit_p(snd_hdspm_remove),
index 8ee4d6fd6ea789e20b3c2b1e0180efc7cbcfe051..b600f45e183474aca9b8b9ee2bf7a2881f0c293e 100644 (file)
@@ -120,13 +120,6 @@ MODULE_SUPPORTED_DEVICE("{{RME,Hammerfall},"
 
 #define RME9652_REV15_buf_pos(x) ((((x)&0xE0000000)>>26)|((x)&RME9652_buf_pos))
 
-#ifndef PCI_VENDOR_ID_XILINX
-#define PCI_VENDOR_ID_XILINX           0x10ee
-#endif
-#ifndef PCI_DEVICE_ID_XILINX_HAMMERFALL
-#define PCI_DEVICE_ID_XILINX_HAMMERFALL        0x3fc4
-#endif
-
 /* amount of io space we remap for register access. i'm not sure we
    even need this much, but 1K is nice round number :)
 */
@@ -2661,6 +2654,7 @@ static void __devexit snd_rme9652_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name     = "RME Digi9652 (Hammerfall)",
+       .owner    = THIS_MODULE,
        .id_table = snd_rme9652_ids,
        .probe    = snd_rme9652_probe,
        .remove   = __devexit_p(snd_rme9652_remove),
index 60ecb2bdb65e79231e6bc888d7d51a98734c4f20..1f6c2bfd43fdef56faa85973b24e7b70f431d40d 100644 (file)
@@ -50,13 +50,6 @@ MODULE_SUPPORTED_DEVICE("{{S3,SonicVibes PCI}}");
 #define SUPPORT_JOYSTICK 1
 #endif
 
-#ifndef PCI_VENDOR_ID_S3
-#define PCI_VENDOR_ID_S3             0x5333
-#endif
-#ifndef PCI_DEVICE_ID_S3_SONICVIBES
-#define PCI_DEVICE_ID_S3_SONICVIBES  0xca00
-#endif
-
 static int index[SNDRV_CARDS] = SNDRV_DEFAULT_IDX;     /* Index 0-MAX */
 static char *id[SNDRV_CARDS] = SNDRV_DEFAULT_STR;      /* ID for this card */
 static 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,
                 return -ENXIO;
         }
 
-       sonic = kcalloc(1, sizeof(*sonic), GFP_KERNEL);
+       sonic = kzalloc(sizeof(*sonic), GFP_KERNEL);
        if (sonic == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
@@ -1515,6 +1508,7 @@ static void __devexit snd_sonic_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "S3 SonicVibes",
+       .owner = THIS_MODULE,
        .id_table = snd_sonic_ids,
        .probe = snd_sonic_probe,
        .remove = __devexit_p(snd_sonic_remove),
index 940d531575c098cd736776420b0b674c45094e3d..a8ca8e17853f3b0142241bd807818c738761da4e 100644 (file)
@@ -177,6 +177,7 @@ static void __devexit snd_trident_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Trident4DWaveAudio",
+       .owner = THIS_MODULE,
        .id_table = snd_trident_ids,
        .probe = snd_trident_probe,
        .remove = __devexit_p(snd_trident_remove),
index f30d9d9478629f07f39441e7dfd8043a41d70f51..777da9a7298b570e6cea4f363d416b376beab4e7 100644 (file)
@@ -2960,7 +2960,7 @@ static int __devinit snd_trident_mixer(trident_t * trident, int pcm_spdif_device
                .read = snd_trident_codec_read,
        };
 
-       uctl = kcalloc(1, sizeof(*uctl), GFP_KERNEL);
+       uctl = kzalloc(sizeof(*uctl), GFP_KERNEL);
        if (!uctl)
                return -ENOMEM;
 
@@ -3546,7 +3546,7 @@ int __devinit snd_trident_create(snd_card_t * card,
                return -ENXIO;
        }
        
-       trident = kcalloc(1, sizeof(*trident), GFP_KERNEL);
+       trident = kzalloc(sizeof(*trident), GFP_KERNEL);
        if (trident == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
index 56c6e52d7264228e965a3055db1de0219e70c2ae..6db7de6b9719532c18a9fd9d78a17530f3170090 100644 (file)
@@ -104,14 +104,6 @@ module_param_array(dxs_support, int, NULL, 0444);
 MODULE_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)");
 
 
-/* pci ids */
-#ifndef PCI_DEVICE_ID_VIA_82C686_5
-#define PCI_DEVICE_ID_VIA_82C686_5     0x3058
-#endif
-#ifndef PCI_DEVICE_ID_VIA_8233_5
-#define PCI_DEVICE_ID_VIA_8233_5       0x3059
-#endif
-
 /* revision numbers for via686 */
 #define VIA_REV_686_A          0x10
 #define VIA_REV_686_B          0x11
@@ -1935,11 +1927,12 @@ static int snd_via82xx_chip_init(via82xx_t *chip)
                 * DXS channels don't work properly with VRA if MC97 is disabled.
                 */
                struct pci_dev *pci;
-               pci = pci_find_device(0x1106, 0x3068, NULL); /* MC97 */
+               pci = pci_get_device(0x1106, 0x3068, NULL); /* MC97 */
                if (pci) {
                        unsigned char data;
                        pci_read_config_byte(pci, 0x44, &data);
                        pci_write_config_byte(pci, 0x44, data | 0x40);
+                       pci_dev_put(pci);
                }
        }
 
@@ -2065,7 +2058,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) {
+       if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
        }
@@ -2350,6 +2343,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "VIA 82xx Audio",
+       .owner = THIS_MODULE,
        .id_table = snd_via82xx_ids,
        .probe = snd_via82xx_probe,
        .remove = __devexit_p(snd_via82xx_remove),
index 5872d438a04a5f50f4f47aafe5ff3d4cabc9eb58..7eac6f6ac737fee70fee677edd319a7123030ca4 100644 (file)
@@ -1083,7 +1083,7 @@ static int __devinit snd_via82xx_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       if ((chip = kcalloc(1, sizeof(*chip), GFP_KERNEL)) == NULL) {
+       if ((chip = kzalloc(sizeof(*chip), GFP_KERNEL)) == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
        }
@@ -1207,6 +1207,7 @@ static void __devexit snd_via82xx_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "VIA 82xx Modem",
+       .owner = THIS_MODULE,
        .id_table = snd_via82xx_modem_ids,
        .probe = snd_via82xx_probe,
        .remove = __devexit_p(snd_via82xx_remove),
index dca6bd2c75806298eeacf5e5468f7141a7141240..2a7ad9dec02175409a54d8f5d2560f6150d2a51a 100644 (file)
@@ -252,6 +252,7 @@ static void __devexit snd_vx222_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Digigram VX222",
+       .owner = THIS_MODULE,
        .id_table = snd_vx222_ids,
        .probe = snd_vx222_probe,
        .remove = __devexit_p(snd_vx222_remove),
index 5b5b624b47d0c6623f79c39893de23fe2d9451f8..2e69abe51aa985dbc0947689946a2659d2cd374b 100644 (file)
@@ -352,6 +352,7 @@ static void __devexit snd_card_ymfpci_remove(struct pci_dev *pci)
 
 static struct pci_driver driver = {
        .name = "Yamaha DS-XG PCI",
+       .owner = THIS_MODULE,
        .id_table = snd_ymfpci_ids,
        .probe = snd_card_ymfpci_probe,
        .remove = __devexit_p(snd_card_ymfpci_remove),
index 054836412dc4069b60c0af957058d902b49b1498..27fa523639aea48ae451d2e73828ce6017e07f2a 100644 (file)
@@ -839,7 +839,7 @@ static int snd_ymfpci_playback_open_1(snd_pcm_substream_t * substream)
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm;
 
-       ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL);
+       ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
        if (ypcm == NULL)
                return -ENOMEM;
        ypcm->chip = chip;
@@ -957,7 +957,7 @@ static int snd_ymfpci_capture_open(snd_pcm_substream_t * substream,
        snd_pcm_runtime_t *runtime = substream->runtime;
        ymfpci_pcm_t *ypcm;
 
-       ypcm = kcalloc(1, sizeof(*ypcm), GFP_KERNEL);
+       ypcm = kzalloc(sizeof(*ypcm), GFP_KERNEL);
        if (ypcm == NULL)
                return -ENOMEM;
        ypcm->chip = chip;
@@ -2270,7 +2270,7 @@ int __devinit snd_ymfpci_create(snd_card_t * card,
        if ((err = pci_enable_device(pci)) < 0)
                return err;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL) {
                pci_disable_device(pci);
                return -ENOMEM;
index a2132e3763dd7b18be026b2cd9165a0cbac6c22e..0208c54896b36e26d031f8737dfb92e2bfb0b5fa 100644 (file)
@@ -151,7 +151,7 @@ pdacf_t *snd_pdacf_create(snd_card_t *card)
 {
        pdacf_t *chip;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return NULL;
        chip->card = card;
index 75213bf4d56728d55617987a735f8bda9bd4656a..206b9333f91f437d442d8f254aba311d782fadb0 100644 (file)
@@ -13,11 +13,24 @@ config SND_POWERMAC
        tristate "PowerMac (AWACS, DACA, Burgundy, Tumbler, Keywest)"
        depends on SND && I2C && INPUT && PPC_PMAC
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for the integrated sound device.
 
          To compile this driver as a module, choose M here: the module
          will be called snd-powermac.
 
-endmenu
+config SND_POWERMAC_AUTO_DRC
+       bool "Toggle DRC automatically at headphone/line plug-in"
+       depends on SND_POWERMAC
+       default y
+       help
+         Say Y here to enable the automatic toggle of DRC (dynamic
+         range compression) on Tumbler/Snapper.
+         If this feature is enabled, DRC is turned off when the
+         headphone/line jack is plugged, and turned on when unplugged.
 
+         Note that you can turn on/off DRC manually even without this
+         option.
+
+endmenu
index c89e82eb06a6df91840c5863e8804d643db94e09..e35b48d29c452132f875f5d328325824a97a448d 100644 (file)
@@ -988,6 +988,7 @@ static int __init snd_pmac_detect(pmac_t *chip)
                case 0x33:
                case 0x29:
                case 0x24:
+               case 0x5c:
                        chip->num_freqs = ARRAY_SIZE(tumbler_freqs);
                        chip->model = PMAC_SNAPPER;
                        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)
        snd_runtime_check(chip_return, return -EINVAL);
        *chip_return = NULL;
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
        chip->card = card;
index 231f6432ea6d08bb27023c8423860b9b2e0ac03d..a6d8cbf4064f8a749880d756956a23979918ce1c 100644 (file)
@@ -131,6 +131,9 @@ static int __init snd_pmac_probe(void)
        if (enable_beep)
                snd_pmac_attach_beep(chip);
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto __error;
+
        if ((err = snd_card_register(card)) < 0)
                goto __error;
 
index b94437c024b1dfce38f39279b3876f935589c838..65384afcfc3f39480e95b226806033421419ee8e 100644 (file)
@@ -948,7 +948,6 @@ static void device_change_handler(void *self)
                        msleep(10);
                check_mute(chip, &mix->amp_mute, 1, mix->auto_mute_notify,
                           chip->speaker_sw_ctl);
-               mix->drc_enable = 0;
        } else {
                /* unmute speaker, mute others */
                check_mute(chip, &mix->amp_mute, 0, mix->auto_mute_notify,
@@ -960,20 +959,21 @@ static void device_change_handler(void *self)
                if (mix->line_mute.addr != 0)
                        check_mute(chip, &mix->line_mute, 1, mix->auto_mute_notify,
                                   chip->lineout_sw_ctl);
-               mix->drc_enable = 1;
        }
-       if (mix->auto_mute_notify) {
+       if (mix->auto_mute_notify)
                snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
                                       &chip->hp_detect_ctl->id);
+
+#ifdef CONFIG_SND_POWERMAC_AUTO_DRC
+       mix->drc_enable = ! (headphone || lineout);
+       if (mix->auto_mute_notify)
                snd_ctl_notify(chip->card, SNDRV_CTL_EVENT_MASK_VALUE,
                               &chip->drc_sw_ctl->id);
-       }
-
-       /* first set the DRC so the speaker do not explode -ReneR */
        if (chip->model == PMAC_TUMBLER)
                tumbler_set_drc(mix);
        else
                snapper_set_drc(mix);
+#endif
 
        /* reset the master volume so the correct amplification is applied */
        tumbler_set_master_volume(mix);
@@ -1370,6 +1370,17 @@ int __init snd_pmac_tumbler_init(pmac_t *chip)
        if ((err = snd_ctl_add(chip->card, chip->drc_sw_ctl)) < 0)
                return err;
 
+       /* set initial DRC range to 60% */
+       if (chip->model == PMAC_TUMBLER)
+               mix->drc_range = (TAS3001_DRC_MAX * 6) / 10;
+       else
+               mix->drc_range = (TAS3004_DRC_MAX * 6) / 10;
+       mix->drc_enable = 1; /* will be changed later if AUTO_DRC is set */
+       if (chip->model == PMAC_TUMBLER)
+               tumbler_set_drc(mix);
+       else
+               snapper_set_drc(mix);
+
 #ifdef CONFIG_PM
        chip->suspend = tumbler_suspend;
        chip->resume = tumbler_resume;
index 25a8a558ef92b6ab201099e5e487556bba397bf7..09ab138646a641471321d1bd3ebff27877986f3a 100644 (file)
@@ -7,6 +7,7 @@ config SND_SUN_AMD7930
        tristate "Sun AMD7930"
        depends on SBUS && SND
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for AMD7930 sound device on Sun.
 
@@ -17,6 +18,7 @@ config SND_SUN_CS4231
        tristate "Sun CS4231"
        depends on SND
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for CS4231 sound device on Sun.
 
@@ -27,6 +29,7 @@ config SND_SUN_DBRI
        tristate "Sun DBRI"
        depends on SND && SBUS
        select SND_PCM
+       select SND_GENERIC_DRIVER
        help
          Say Y here to include support for DBRI sound device on Sun.
 
index bd8a850e93eaaa85bd97dd1c14e84b4289efb026..46d504ba7e0394f6ba207aafbc5b791c516f8450 100644 (file)
@@ -967,7 +967,7 @@ static int __init snd_amd7930_create(snd_card_t *card,
        int err;
 
        *ramd = NULL;
-       amd = kcalloc(1, sizeof(*amd), GFP_KERNEL);
+       amd = kzalloc(sizeof(*amd), GFP_KERNEL);
        if (amd == NULL)
                return -ENOMEM;
 
@@ -1088,6 +1088,9 @@ static int __init amd7930_attach(int prom_node, struct sbus_dev *sdev)
        if ((err = snd_amd7930_mixer(amd)) < 0)
                goto out_err;
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto out_err;
+
        if ((err = snd_card_register(card)) < 0)
                goto out_err;
 
index 36f9fe4d7beac9c76a3091311bd346fc827feb63..2fb27c4e951fcac586724b51f571715966f37fbc 100644 (file)
@@ -1915,6 +1915,9 @@ static int cs4231_attach_finish(snd_card_t *card, cs4231_t *chip)
        if ((err = snd_cs4231_timer(chip)) < 0)
                goto out_err;
 
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto out_err;
+
        if ((err = snd_card_register(card)) < 0)
                goto out_err;
 
@@ -1966,7 +1969,7 @@ static int __init snd_cs4231_sbus_create(snd_card_t *card,
        int err;
 
        *rchip = NULL;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
 
@@ -2080,7 +2083,7 @@ static int __init snd_cs4231_ebus_create(snd_card_t *card,
        int err;
 
        *rchip = NULL;
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (chip == NULL)
                return -ENOMEM;
 
index 941c7b1e7ebb959ed49e1077aa2dad14b99c4bdb..b5c4c15ae7f09ccd620c82a0de7fd1568510f8fc 100644 (file)
@@ -1,6 +1,6 @@
 /*
  * Driver for DBRI sound chip found on Sparcs.
- * Copyright (C) 2004 Martin Habets (mhabets@users.sourceforge.net)
+ * Copyright (C) 2004, 2005 Martin Habets (mhabets@users.sourceforge.net)
  *
  * Based entirely upon drivers/sbus/audio/dbri.c which is:
  * Copyright (C) 1997 Rudolf Koenig (rfkoenig@immd4.informatik.uni-erlangen.de)
  * audio devices. But the SUN HW group decided against it, at least on my
  * LX the speakerbox connector has at least 1 pin missing and 1 wrongly
  * connected.
+ *
+ * I've tried to stick to the following function naming conventions:
+ * snd_*       ALSA stuff
+ * cs4215_*    CS4215 codec specfic stuff
+ * dbri_*      DBRI high-level stuff
+ * other       DBRI low-level stuff
  */
 
 #include <sound/driver.h>
@@ -87,7 +93,7 @@ MODULE_PARM_DESC(enable, "Enable Sun DBRI soundcard.");
 #define D_DESC (1<<5)
 
 static int dbri_debug = 0;
-module_param(dbri_debug, int, 0444);
+module_param(dbri_debug, int, 0644);
 MODULE_PARM_DESC(dbri_debug, "Debug value for Sun DBRI soundcard.");
 
 #ifdef DBRI_DEBUG
@@ -320,7 +326,8 @@ typedef struct snd_dbri {
        void __iomem *regs;     /* dbri HW regs */
        int dbri_version;       /* 'e' and up is OK */
        int dbri_irqp;          /* intr queue pointer */
-       int wait_seen;
+       int wait_send;          /* sequence of command buffers send */
+       int wait_ackd;          /* sequence of command buffers acknowledged */
 
        struct dbri_pipe pipes[DBRI_NO_PIPES];  /* DBRI's 32 data pipes */
        struct dbri_desc descs[DBRI_NO_DESCS];
@@ -625,16 +632,13 @@ static __u32 reverse_bytes(__u32 b, int len)
 
 Commands are sent to the DBRI by building a list of them in memory,
 then writing the address of the first list item to DBRI register 8.
-The list is terminated with a WAIT command, which can generate a
-CPU interrupt if required.
+The list is terminated with a WAIT command, which generates a
+CPU interrupt to signal completion.
 
 Since the DBRI can run in parallel with the CPU, several means of
-synchronization present themselves.  The original scheme (Rudolf's)
-was to set a flag when we "cmdlock"ed the DBRI, clear the flag when
-an interrupt signaled completion, and wait on a wait_queue if a routine
-attempted to cmdlock while the flag was set.  The problems arose when
-we tried to cmdlock from inside an interrupt handler, which might
-cause scheduling in an interrupt (if we waited), etc, etc
+synchronization present themselves.  The method implemented here is close
+to the original scheme (Rudolf's), and uses 2 counters (wait_send and
+wait_ackd) to synchronize the command buffer between the CPU and the DBRI.
 
 A more sophisticated scheme might involve a circular command buffer
 or 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
 completion of the current command buffer, look on the list for
 the next one.
 
-I've decided to implement something much simpler - after each command,
-the CPU waits for the DBRI to finish the command by polling the P bit
-in DBRI register 0.  I've tried to implement this in such a way
-that might make implementing a more sophisticated scheme easier.
-
 Every time a routine wants to write commands to the DBRI, it must
 first call dbri_cmdlock() and get an initial pointer into dbri->dma->cmd
-in return.  After the commands have been writen, dbri_cmdsend() is
-called with the final pointer value.
+in return. dbri_cmdlock() will block if the previous commands have not
+been completed yet. After this the commands can be written to the buffer,
+and dbri_cmdsend() is called with the final pointer value to send them
+to the DBRI.
 
 */
 
+static void dbri_process_interrupt_buffer(snd_dbri_t * dbri);
+
 enum dbri_lock_t { NoGetLock, GetLock };
+#define MAXLOOPS 10
 
 static volatile s32 *dbri_cmdlock(snd_dbri_t * dbri, enum dbri_lock_t get)
 {
+       int maxloops = MAXLOOPS;
+
 #ifndef SMP
        if ((get == GetLock) && spin_is_locked(&dbri->lock)) {
                printk(KERN_ERR "DBRI: cmdlock called while in spinlock.");
        }
 #endif
 
+       /* Delay if previous commands are still being processed */
+       while ((--maxloops) > 0 && (dbri->wait_send != dbri->wait_ackd)) {
+               msleep_interruptible(1);
+               /* If dbri_cmdlock() got called from inside the
+                * interrupt handler, this will do the processing.
+                */
+               dbri_process_interrupt_buffer(dbri);
+       }
+       if (maxloops == 0) {
+               printk(KERN_ERR "DBRI: Chip never completed command buffer %d\n",
+                       dbri->wait_send);
+       } else {
+               dprintk(D_CMD, "Chip completed command buffer (%d)\n",
+                       MAXLOOPS - maxloops - 1);
+       }
+
        /*if (get == GetLock) spin_lock(&dbri->lock); */
        return &dbri->dma->cmd[0];
 }
 
-static void dbri_process_interrupt_buffer(snd_dbri_t *);
-
 static void dbri_cmdsend(snd_dbri_t * dbri, volatile s32 * cmd)
 {
-       int MAXLOOPS = 1000000;
-       int maxloops = MAXLOOPS;
        volatile s32 *ptr;
+       u32     reg;
 
        for (ptr = &dbri->dma->cmd[0]; ptr < cmd; ptr++) {
                dprintk(D_CMD, "cmd: %lx:%08x\n", (unsigned long)ptr, *ptr);
        }
 
        if ((cmd - &dbri->dma->cmd[0]) >= DBRI_NO_CMDS - 1) {
-               printk("DBRI: Command buffer overflow! (bug in driver)\n");
+               printk(KERN_ERR "DBRI: Command buffer overflow! (bug in driver)\n");
                /* Ignore the last part. */
                cmd = &dbri->dma->cmd[DBRI_NO_CMDS - 3];
        }
 
+       dbri->wait_send++;
+       dbri->wait_send &= 0xffff;      /* restrict it to a 16 bit counter. */
        *(cmd++) = DBRI_CMD(D_PAUSE, 0, 0);
-       *(cmd++) = DBRI_CMD(D_WAIT, 1, 0);
-       dbri->wait_seen = 0;
+       *(cmd++) = DBRI_CMD(D_WAIT, 1, dbri->wait_send);
+
+       /* Set command pointer and signal it is valid. */
        sbus_writel(dbri->dma_dvma, dbri->regs + REG8);
-       while ((--maxloops) > 0 && (sbus_readl(dbri->regs + REG0) & D_P))
-               barrier();
-       if (maxloops == 0) {
-               printk(KERN_ERR "DBRI: Chip never completed command buffer\n");
-               dprintk(D_CMD, "DBRI: Chip never completed command buffer\n");
-       } else {
-               while ((--maxloops) > 0 && (!dbri->wait_seen))
-                       dbri_process_interrupt_buffer(dbri);
-               if (maxloops == 0) {
-                       printk(KERN_ERR "DBRI: Chip never acked WAIT\n");
-                       dprintk(D_CMD, "DBRI: Chip never acked WAIT\n");
-               } else {
-                       dprintk(D_CMD, "Chip completed command "
-                               "buffer (%d)\n", MAXLOOPS - maxloops);
-               }
-       }
+       reg = sbus_readl(dbri->regs + REG0);
+       reg |= D_P;
+       sbus_writel(reg, dbri->regs + REG0);
 
        /*spin_unlock(&dbri->lock); */
 }
@@ -757,10 +766,11 @@ static void dbri_initialize(snd_dbri_t * dbri)
        for (n = 0; n < DBRI_NO_PIPES; n++)
                dbri->pipes[n].desc = dbri->pipes[n].first_desc = -1;
 
-       /* We should query the openprom to see what burst sizes this
-        * SBus supports.  For now, just disable all SBus bursts */
+       /* A brute approach - DBRI falls back to working burst size by itself
+        * On SS20 D_S does not work, so do not try so high. */
        tmp = sbus_readl(dbri->regs + REG0);
-       tmp &= ~(D_G | D_S | D_E);
+       tmp |= D_G | D_E;
+       tmp &= ~D_S;
        sbus_writel(tmp, dbri->regs + REG0);
 
        /*
@@ -805,13 +815,13 @@ static void reset_pipe(snd_dbri_t * dbri, int pipe)
        volatile int *cmd;
 
        if (pipe < 0 || pipe > 31) {
-               printk("DBRI: reset_pipe called with illegal pipe number\n");
+               printk(KERN_ERR "DBRI: reset_pipe called with illegal pipe number\n");
                return;
        }
 
        sdp = dbri->pipes[pipe].sdp;
        if (sdp == 0) {
-               printk("DBRI: reset_pipe called on uninitialized pipe\n");
+               printk(KERN_ERR "DBRI: reset_pipe called on uninitialized pipe\n");
                return;
        }
 
@@ -834,12 +844,12 @@ static void reset_pipe(snd_dbri_t * dbri, int pipe)
 static void setup_pipe(snd_dbri_t * dbri, int pipe, int sdp)
 {
        if (pipe < 0 || pipe > 31) {
-               printk("DBRI: setup_pipe called with illegal pipe number\n");
+               printk(KERN_ERR "DBRI: setup_pipe called with illegal pipe number\n");
                return;
        }
 
        if ((sdp & 0xf800) != sdp) {
-               printk("DBRI: setup_pipe called with strange SDP value\n");
+               printk(KERN_ERR "DBRI: setup_pipe called with strange SDP value\n");
                /* sdp &= 0xf800; */
        }
 
@@ -872,13 +882,13 @@ static void link_time_slot(snd_dbri_t * dbri, int pipe,
        int nextpipe;
 
        if (pipe < 0 || pipe > 31 || basepipe < 0 || basepipe > 31) {
-               printk
-                   ("DBRI: link_time_slot called with illegal pipe number\n");
+               printk(KERN_ERR 
+                   "DBRI: link_time_slot called with illegal pipe number\n");
                return;
        }
 
        if (dbri->pipes[pipe].sdp == 0 || dbri->pipes[basepipe].sdp == 0) {
-               printk("DBRI: link_time_slot called on uninitialized pipe\n");
+               printk(KERN_ERR "DBRI: link_time_slot called on uninitialized pipe\n");
                return;
        }
 
@@ -960,8 +970,8 @@ static void unlink_time_slot(snd_dbri_t * dbri, int pipe,
        int val;
 
        if (pipe < 0 || pipe > 31 || prevpipe < 0 || prevpipe > 31) {
-               printk
-                   ("DBRI: unlink_time_slot called with illegal pipe number\n");
+               printk(KERN_ERR 
+                   "DBRI: unlink_time_slot called with illegal pipe number\n");
                return;
        }
 
@@ -1001,22 +1011,22 @@ static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data)
        volatile s32 *cmd;
 
        if (pipe < 16 || pipe > 31) {
-               printk("DBRI: xmit_fixed: Illegal pipe number\n");
+               printk(KERN_ERR "DBRI: xmit_fixed: Illegal pipe number\n");
                return;
        }
 
        if (D_SDP_MODE(dbri->pipes[pipe].sdp) == 0) {
-               printk("DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe);
+               printk(KERN_ERR "DBRI: xmit_fixed: Uninitialized pipe %d\n", pipe);
                return;
        }
 
        if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
-               printk("DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe);
+               printk(KERN_ERR "DBRI: xmit_fixed: Non-fixed pipe %d\n", pipe);
                return;
        }
 
        if (!(dbri->pipes[pipe].sdp & D_SDP_TO_SER)) {
-               printk("DBRI: xmit_fixed: Called on receive pipe %d\n", pipe);
+               printk(KERN_ERR "DBRI: xmit_fixed: Called on receive pipe %d\n", pipe);
                return;
        }
 
@@ -1036,17 +1046,17 @@ static void xmit_fixed(snd_dbri_t * dbri, int pipe, unsigned int data)
 static void recv_fixed(snd_dbri_t * dbri, int pipe, volatile __u32 * ptr)
 {
        if (pipe < 16 || pipe > 31) {
-               printk("DBRI: recv_fixed called with illegal pipe number\n");
+               printk(KERN_ERR "DBRI: recv_fixed called with illegal pipe number\n");
                return;
        }
 
        if (D_SDP_MODE(dbri->pipes[pipe].sdp) != D_SDP_FIXED) {
-               printk("DBRI: recv_fixed called on non-fixed pipe %d\n", pipe);
+               printk(KERN_ERR "DBRI: recv_fixed called on non-fixed pipe %d\n", pipe);
                return;
        }
 
        if (dbri->pipes[pipe].sdp & D_SDP_TO_SER) {
-               printk("DBRI: recv_fixed called on transmit pipe %d\n", pipe);
+               printk(KERN_ERR "DBRI: recv_fixed called on transmit pipe %d\n", pipe);
                return;
        }
 
@@ -1075,12 +1085,12 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
        int last_desc = -1;
 
        if (info->pipe < 0 || info->pipe > 15) {
-               printk("DBRI: setup_descs: Illegal pipe number\n");
+               printk(KERN_ERR "DBRI: setup_descs: Illegal pipe number\n");
                return -2;
        }
 
        if (dbri->pipes[info->pipe].sdp == 0) {
-               printk("DBRI: setup_descs: Uninitialized pipe %d\n",
+               printk(KERN_ERR "DBRI: setup_descs: Uninitialized pipe %d\n",
                       info->pipe);
                return -2;
        }
@@ -1090,20 +1100,20 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
 
        if (streamno == DBRI_PLAY) {
                if (!(dbri->pipes[info->pipe].sdp & D_SDP_TO_SER)) {
-                       printk("DBRI: setup_descs: Called on receive pipe %d\n",
+                       printk(KERN_ERR "DBRI: setup_descs: Called on receive pipe %d\n",
                               info->pipe);
                        return -2;
                }
        } else {
                if (dbri->pipes[info->pipe].sdp & D_SDP_TO_SER) {
-                       printk
-                           ("DBRI: setup_descs: Called on transmit pipe %d\n",
+                       printk(KERN_ERR 
+                           "DBRI: setup_descs: Called on transmit pipe %d\n",
                             info->pipe);
                        return -2;
                }
                /* Should be able to queue multiple buffers to receive on a pipe */
                if (pipe_active(dbri, info->pipe)) {
-                       printk("DBRI: recv_on_pipe: Called on active pipe %d\n",
+                       printk(KERN_ERR "DBRI: recv_on_pipe: Called on active pipe %d\n",
                               info->pipe);
                        return -2;
                }
@@ -1120,7 +1130,7 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
                                break;
                }
                if (desc == DBRI_NO_DESCS) {
-                       printk("DBRI: setup_descs: No descriptors\n");
+                       printk(KERN_ERR "DBRI: setup_descs: No descriptors\n");
                        return -1;
                }
 
@@ -1165,7 +1175,7 @@ static int setup_descs(snd_dbri_t * dbri, int streamno, unsigned int period)
        }
 
        if (first_desc == -1 || last_desc == -1) {
-               printk("DBRI: setup_descs: Not enough descriptors available\n");
+               printk(KERN_ERR "DBRI: setup_descs: Not enough descriptors available\n");
                return -1;
        }
 
@@ -1270,7 +1280,7 @@ static void reset_chi(snd_dbri_t * dbri, enum master_or_slave master_or_slave,
                int divisor = 12288 / clockrate;
 
                if (divisor > 255 || divisor * clockrate != 12288)
-                       printk("DBRI: illegal bits_per_frame in setup_chi\n");
+                       printk(KERN_ERR "DBRI: illegal bits_per_frame in setup_chi\n");
 
                *(cmd++) = DBRI_CMD(D_CHI, 0, D_CHI_CHICM(divisor) | D_CHI_FD
                                    | D_CHI_BPF(bits_per_frame));
@@ -1474,7 +1484,6 @@ static int cs4215_setctrl(snd_dbri_t * dbri)
        /* Temporarily mute outputs, and wait 1/8000 sec (125 us)
         * to make sure this takes.  This avoids clicking noises.
         */
-
        cs4215_setdata(dbri, 1);
        udelay(125);
 
@@ -1530,8 +1539,8 @@ static int cs4215_setctrl(snd_dbri_t * dbri)
        tmp |= D_C;             /* Enable CHI */
        sbus_writel(tmp, dbri->regs + REG0);
 
-       for (i = 64; ((dbri->mm.status & 0xe4) != 0x20); --i) {
-               udelay(125);
+       for (i = 10; ((dbri->mm.status & 0xe4) != 0x20); --i) {
+               msleep_interruptible(1);
        }
        if (i == 0) {
                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.
 Complicated interrupts are handled by dedicated functions (which
 appear first in this file).  Any pending interrupts can be serviced by
 calling dbri_process_interrupt_buffer(), which works even if the CPU's
-interrupts are disabled.  This function is used by dbri_cmdsend()
-to make sure we're synced up with the chip after each command sequence,
+interrupts are disabled.  This function is used by dbri_cmdlock()
+to make sure we're synced up with the chip before each command sequence,
 even if we're running cli'ed.
 
 */
@@ -1765,11 +1774,13 @@ DECLARE_TASKLET(xmit_descs_task, xmit_descs, 0);
  * Called by main interrupt handler when DBRI signals transmission complete
  * on a pipe (interrupt triggered by the B bit in a transmit descriptor).
  *
- * Walks through the pipe's list of transmit buffer descriptors, releasing
- * each one's DMA buffer (if present), flagging the descriptor available,
- * and signaling its callback routine (if present), before proceeding
- * to the next one.  Stops when the first descriptor is found without
+ * Walks through the pipe's list of transmit buffer descriptors and marks
+ * them as available. Stops when the first descriptor is found without
  * TBC (Transmit Buffer Complete) set, or we've run through them all.
+ *
+ * The DMA buffers are not released, but re-used. Since the transmit buffer
+ * descriptors are not clobbered, they can be re-submitted as is. This is
+ * done by the xmit_descs() tasklet above since that could take longer.
  */
 
 static 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)
        }
 
        if (channel == D_INTR_CMD && command == D_WAIT) {
-               dbri->wait_seen++;
+               dbri->wait_ackd = val;
+               if (dbri->wait_send != val) {
+                       printk(KERN_ERR "Processing wait command %d when %d was send.\n",
+                              val, dbri->wait_send);
+               }
                return;
        }
 
@@ -1994,8 +2009,7 @@ static irqreturn_t snd_dbri_interrupt(int irq, void *dev_id,
                 * The only one I've seen is MRR, which will be triggered
                 * if you let a transmit pipe underrun, then try to CDP it.
                 *
-                * If these things persist, we should probably reset
-                * and re-init the chip.
+                * If these things persist, we reset the chip.
                 */
                if ((++errcnt) % 10 == 0) {
                        dprintk(D_INT, "Interrupt errors exceeded.\n");
@@ -2094,7 +2108,7 @@ static int snd_dbri_hw_params(snd_pcm_substream_t * substream,
 
        if ((ret = snd_pcm_lib_malloc_pages(substream,
                                params_buffer_bytes(hw_params))) < 0) {
-               snd_printk(KERN_ERR "malloc_pages failed with %d\n", ret);
+               printk(KERN_ERR "malloc_pages failed with %d\n", ret);
                return ret;
        }
 
@@ -2455,8 +2469,7 @@ static int __init snd_dbri_mixer(snd_dbri_t * dbri)
 
        for (idx = 0; idx < NUM_CS4215_CONTROLS; idx++) {
                if ((err = snd_ctl_add(card,
-                                      snd_ctl_new1(&dbri_controls[idx],
-                                                   dbri))) < 0)
+                               snd_ctl_new1(&dbri_controls[idx], dbri))) < 0)
                        return err;
        }
 
@@ -2490,8 +2503,6 @@ static void dbri_debug_read(snd_info_entry_t * entry,
        int pipe;
        snd_iprintf(buffer, "debug=%d\n", dbri_debug);
 
-       snd_iprintf(buffer, "CHI pipe in=%d, out=%d\n",
-                   dbri->chi_in_pipe, dbri->chi_out_pipe);
        for (pipe = 0; pipe < 32; pipe++) {
                if (pipe_active(dbri, pipe)) {
                        struct dbri_pipe *pptr = &dbri->pipes[pipe];
@@ -2506,18 +2517,6 @@ static void dbri_debug_read(snd_info_entry_t * entry,
                }
        }
 }
-
-static void dbri_debug_write(snd_info_entry_t * entry,
-                            snd_info_buffer_t * buffer)
-{
-       char line[80];
-       int i;
-
-       if (snd_info_get_line(buffer, line, 80) == 0) {
-               sscanf(line, "%d\n", &i);
-               dbri_debug = i & 0x3f;
-       }
-}
 #endif
 
 void snd_dbri_proc(snd_dbri_t * dbri)
@@ -2531,9 +2530,7 @@ void snd_dbri_proc(snd_dbri_t * dbri)
 #ifdef DBRI_DEBUG
        err = snd_card_proc_new(dbri->card, "debug", &entry);
        snd_info_set_text_ops(entry, dbri, 4096, dbri_debug_read);
-       entry->mode = S_IFREG | S_IRUGO | S_IWUSR; /* Writable for root */
-       entry->c.text.write_size = 256;
-       entry->c.text.write = dbri_debug_write;
+       entry->mode = S_IFREG | S_IRUGO;        /* Readable only. */
 #endif
 }
 
@@ -2637,7 +2634,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
                return -ENOENT;
        }
 
-       prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq));
+       err = prom_getproperty(prom_node, "intr", (char *)&irq, sizeof(irq));
+       if (err < 0) {
+               printk(KERN_ERR "DBRI-%d: Firmware node lacks IRQ property.\n", dev);
+               return -ENODEV;
+       }
 
        card = snd_card_new(index[dev], id[dev], THIS_MODULE,
                            sizeof(snd_dbri_t));
@@ -2657,26 +2658,20 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
        }
 
        dbri = (snd_dbri_t *) card->private_data;
-       if ((err = snd_dbri_pcm(dbri)) < 0) {
-               snd_dbri_free(dbri);
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_dbri_pcm(dbri)) < 0)
+               goto _err;
 
-       if ((err = snd_dbri_mixer(dbri)) < 0) {
-               snd_dbri_free(dbri);
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_dbri_mixer(dbri)) < 0)
+               goto _err;
 
        /* /proc file handling */
        snd_dbri_proc(dbri);
 
-       if ((err = snd_card_register(card)) < 0) {
-               snd_dbri_free(dbri);
-               snd_card_free(card);
-               return err;
-       }
+       if ((err = snd_card_set_generic_dev(card)) < 0)
+               goto _err;
+
+       if ((err = snd_card_register(card)) < 0)
+               goto _err;
 
        printk(KERN_INFO "audio%d at %p (irq %d) is DBRI(%c)+CS4215(%d)\n",
               dev, dbri->regs,
@@ -2684,6 +2679,11 @@ static int __init dbri_attach(int prom_node, struct sbus_dev *sdev)
        dev++;
 
        return 0;
+
+ _err:
+       snd_dbri_free(dbri);
+       snd_card_free(card);
+       return err;
 }
 
 /* Probe for the dbri chip and then attach the driver. */
index 60d0b2c6669848a79f4c83653918b84e40cf277e..9e2b4c0c8a8a98f195cd58f4d881a669d0c05e80 100644 (file)
@@ -40,7 +40,7 @@ int snd_emux_new(snd_emux_t **remu)
        snd_emux_t *emu;
 
        *remu = NULL;
-       emu = kcalloc(1, sizeof(*emu), GFP_KERNEL);
+       emu = kzalloc(sizeof(*emu), GFP_KERNEL);
        if (emu == NULL)
                return -ENOMEM;
 
index e41b28d9bf52e6b6c4694a7f470732b79d2d3bc5..8ccd33f4aa577bbe18c44242dd81a96191331a66 100644 (file)
@@ -146,7 +146,7 @@ snd_emux_create_port(snd_emux_t *emu, char *name,
        int i, type, cap;
 
        /* Allocate structures for this channel */
-       if ((p = kcalloc(1, sizeof(*p), GFP_KERNEL)) == NULL) {
+       if ((p = kzalloc(sizeof(*p), GFP_KERNEL)) == NULL) {
                snd_printk("no memory\n");
                return NULL;
        }
index 901a7db05bdef5ed70724886f3e60ff8d57424c4..d0925ea50838d2b6497bc3dc399b037587b02d33 100644 (file)
@@ -266,7 +266,7 @@ newsf(snd_sf_list_t *sflist, int type, char *name)
        }
 
        /* not found -- create a new one */
-       sf = kcalloc(1, sizeof(*sf), GFP_KERNEL);
+       sf = kzalloc(sizeof(*sf), GFP_KERNEL);
        if (sf == NULL)
                return NULL;
        sf->id = sflist->fonts_size;
@@ -346,7 +346,7 @@ sf_zone_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
 {
        snd_sf_zone_t *zp;
 
-       if ((zp = kcalloc(1, sizeof(*zp), GFP_KERNEL)) == NULL)
+       if ((zp = kzalloc(sizeof(*zp), GFP_KERNEL)) == NULL)
                return NULL;
        zp->next = sf->zones;
        sf->zones = zp;
@@ -377,7 +377,7 @@ sf_sample_new(snd_sf_list_t *sflist, snd_soundfont_t *sf)
 {
        snd_sf_sample_t *sp;
 
-       if ((sp = kcalloc(1, sizeof(*sp), GFP_KERNEL)) == NULL)
+       if ((sp = kzalloc(sizeof(*sp), GFP_KERNEL)) == NULL)
                return NULL;
 
        sp->next = sf->samples;
@@ -1362,7 +1362,7 @@ snd_sf_new(snd_sf_callback_t *callback, snd_util_memhdr_t *hdr)
 {
        snd_sf_list_t *sflist;
 
-       if ((sflist = kcalloc(1, sizeof(*sflist), GFP_KERNEL)) == NULL)
+       if ((sflist = kzalloc(sizeof(*sflist), GFP_KERNEL)) == NULL)
                return NULL;
 
        init_MUTEX(&sflist->presets_mutex);
index 8b131a11e5492f3c3f6597e70b06972694a718ce..5f75bf31bc36b6706e6408eacbd585cf0f4479c0 100644 (file)
@@ -38,7 +38,7 @@ snd_util_memhdr_new(int memsize)
 {
        snd_util_memhdr_t *hdr;
 
-       hdr = kcalloc(1, sizeof(*hdr), GFP_KERNEL);
+       hdr = kzalloc(sizeof(*hdr), GFP_KERNEL);
        if (hdr == NULL)
                return NULL;
        hdr->size = memsize;
index bfbec5876659caf00bd95c0e2d700402f3649730..d5ae2055b896f2cef2eb78c0cb27811789c26c93 100644 (file)
@@ -1439,9 +1439,11 @@ static int snd_usb_pcm_prepare(snd_pcm_substream_t *substream)
 
 static snd_pcm_hardware_t snd_usb_playback =
 {
-       .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
-                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                                SNDRV_PCM_INFO_MMAP_VALID),
+       .info =                 SNDRV_PCM_INFO_MMAP |
+                               SNDRV_PCM_INFO_MMAP_VALID |
+                               SNDRV_PCM_INFO_BATCH |
+                               SNDRV_PCM_INFO_INTERLEAVED |
+                               SNDRV_PCM_INFO_BLOCK_TRANSFER,
        .buffer_bytes_max =     (256*1024),
        .period_bytes_min =     64,
        .period_bytes_max =     (128*1024),
@@ -1451,9 +1453,11 @@ static snd_pcm_hardware_t snd_usb_playback =
 
 static snd_pcm_hardware_t snd_usb_capture =
 {
-       .info =                 (SNDRV_PCM_INFO_MMAP | SNDRV_PCM_INFO_INTERLEAVED |
-                                SNDRV_PCM_INFO_BLOCK_TRANSFER |
-                                SNDRV_PCM_INFO_MMAP_VALID),
+       .info =                 SNDRV_PCM_INFO_MMAP |
+                               SNDRV_PCM_INFO_MMAP_VALID |
+                               SNDRV_PCM_INFO_BATCH |
+                               SNDRV_PCM_INFO_INTERLEAVED |
+                               SNDRV_PCM_INFO_BLOCK_TRANSFER,
        .buffer_bytes_max =     (256*1024),
        .period_bytes_min =     64,
        .period_bytes_max =     (128*1024),
@@ -3132,7 +3136,7 @@ static int snd_usb_audio_create(struct usb_device *dev, int idx,
                return -ENOMEM;
        }
 
-       chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
+       chip = kzalloc(sizeof(*chip), GFP_KERNEL);
        if (! chip) {
                snd_card_free(card);
                return -ENOMEM;
index 93dedde3c42877137bded1e0d88f21f7ee98079e..e0d0365453b346bb13117df9d7a6356d643f64a3 100644 (file)
@@ -841,7 +841,7 @@ static int snd_usbmidi_in_endpoint_create(snd_usb_midi_t* umidi,
        int length;
 
        rep->in = NULL;
-       ep = kcalloc(1, sizeof(*ep), GFP_KERNEL);
+       ep = kzalloc(sizeof(*ep), GFP_KERNEL);
        if (!ep)
                return -ENOMEM;
        ep->umidi = umidi;
@@ -913,7 +913,7 @@ static int snd_usbmidi_out_endpoint_create(snd_usb_midi_t* umidi,
        void* buffer;
 
        rep->out = NULL;
-       ep = kcalloc(1, sizeof(*ep), GFP_KERNEL);
+       ep = kzalloc(sizeof(*ep), GFP_KERNEL);
        if (!ep)
                return -ENOMEM;
        ep->umidi = umidi;
@@ -1537,7 +1537,7 @@ int snd_usb_create_midi_interface(snd_usb_audio_t* chip,
        int out_ports, in_ports;
        int i, err;
 
-       umidi = kcalloc(1, sizeof(*umidi), GFP_KERNEL);
+       umidi = kzalloc(sizeof(*umidi), GFP_KERNEL);
        if (!umidi)
                return -ENOMEM;
        umidi->chip = chip;
index fa7056f5caaf761d9b054a1add45c619ab3bd6e3..c3c08c9cb46edfceca5b018f9f5efe7897201aa0 100644 (file)
@@ -824,7 +824,7 @@ static void build_feature_ctl(mixer_build_t *state, unsigned char *desc,
        if (check_ignored_ctl(state, unitid, control))
                return;
 
-       cval = kcalloc(1, sizeof(*cval), GFP_KERNEL);
+       cval = kzalloc(sizeof(*cval), GFP_KERNEL);
        if (! cval) {
                snd_printk(KERN_ERR "cannot malloc kcontrol\n");
                return;
@@ -997,7 +997,7 @@ static void build_mixer_unit_ctl(mixer_build_t *state, unsigned char *desc,
        if (check_ignored_ctl(state, unitid, 0))
                return;
 
-       cval = kcalloc(1, sizeof(*cval), GFP_KERNEL);
+       cval = kzalloc(sizeof(*cval), GFP_KERNEL);
        if (! cval)
                return;
 
@@ -1244,7 +1244,7 @@ static int build_audio_procunit(mixer_build_t *state, int unitid, unsigned char
                        continue;
                if (check_ignored_ctl(state, unitid, valinfo->control))
                        continue;
-               cval = kcalloc(1, sizeof(*cval), GFP_KERNEL);
+               cval = kzalloc(sizeof(*cval), GFP_KERNEL);
                if (! cval) {
                        snd_printk(KERN_ERR "cannot malloc kcontrol\n");
                        return -ENOMEM;
@@ -1430,7 +1430,7 @@ static int parse_audio_selector_unit(mixer_build_t *state, int unitid, unsigned
        if (check_ignored_ctl(state, unitid, 0))
                return 0;
 
-       cval = kcalloc(1, sizeof(*cval), GFP_KERNEL);
+       cval = kzalloc(sizeof(*cval), GFP_KERNEL);
        if (! cval) {
                snd_printk(KERN_ERR "cannot malloc kcontrol\n");
                return -ENOMEM;
@@ -1945,7 +1945,7 @@ int snd_usb_create_mixer(snd_usb_audio_t *chip, int ctrlif)
 
        strcpy(chip->card->mixername, "USB Mixer");
 
-       mixer = kcalloc(1, sizeof(*mixer), GFP_KERNEL);
+       mixer = kzalloc(sizeof(*mixer), GFP_KERNEL);
        if (!mixer)
                return -ENOMEM;
        mixer->chip = chip;
index 62dfd28b3b07f909ec66bfebca5a9c1de614a9ac..0f09e0de52dd4cb4a4dc8128217cfe088a95fdfd 100644 (file)
@@ -957,7 +957,7 @@ static int usX2Y_audio_stream_new(snd_card_t *card, int playback_endpoint, int c
 
        for (i = playback_endpoint ? SNDRV_PCM_STREAM_PLAYBACK : SNDRV_PCM_STREAM_CAPTURE;
             i <= SNDRV_PCM_STREAM_CAPTURE; ++i) {
-               usX2Y_substream[i] = kcalloc(1, sizeof(snd_usX2Y_substream_t), GFP_KERNEL);
+               usX2Y_substream[i] = kzalloc(sizeof(snd_usX2Y_substream_t), GFP_KERNEL);
                if (NULL == usX2Y_substream[i]) {
                        snd_printk(KERN_ERR "cannot malloc\n");
                        return -ENOMEM;