2
0
mirror of https://github.com/edk2-porting/linux-next.git synced 2024-11-19 16:14:13 +08:00

Merge master.kernel.org:/pub/scm/linux/kernel/git/perex/alsa-current

This commit is contained in:
Linus Torvalds 2005-09-13 09:46:22 -07:00
commit 63f3d1df1a
189 changed files with 2984 additions and 1643 deletions

View 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

View File

@ -447,7 +447,7 @@
....
/* 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;
@ -949,7 +949,7 @@
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>
@ -958,7 +958,7 @@
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>
@ -1136,7 +1136,7 @@
return -ENXIO;
}
chip = kcalloc(1, sizeof(*chip), GFP_KERNEL);
chip = kzalloc(sizeof(*chip), GFP_KERNEL);
if (chip == NULL) {
pci_disable_device(pci);
return -ENOMEM;
@ -1292,7 +1292,7 @@
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>

View File

@ -447,6 +447,10 @@
#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
@ -682,7 +686,9 @@
#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
@ -993,6 +999,7 @@
#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
@ -1111,6 +1118,9 @@
#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
@ -1157,10 +1167,13 @@
#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
@ -1175,6 +1188,7 @@
#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
@ -1182,6 +1196,7 @@
#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
@ -1232,6 +1247,7 @@
#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
@ -1336,6 +1352,13 @@
#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
@ -1811,6 +1834,14 @@
#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
@ -1970,6 +2001,9 @@
#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
@ -2058,6 +2092,10 @@
#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
@ -2538,6 +2576,7 @@
#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
@ -2644,6 +2683,11 @@
#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

View 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 */

View File

@ -29,19 +29,6 @@
#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) */

View File

@ -35,13 +35,6 @@
#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

View 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

View 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;

View File

@ -33,23 +33,6 @@
//#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)

View 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)"

View File

@ -28,28 +28,6 @@
#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
*/

View 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.

View 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,

View 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;

View 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

View 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;

View 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;

View 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;

View 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;

View 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);

View 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)

View 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));

View 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) {

View 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;

View 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) {

View 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;

View 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;

View 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:

View 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;

View 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;
}

View 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;

View 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]);

View 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;

View 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;
}

View 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;
}

View 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;
}

View 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;

View 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;

View 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;

View 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 */

View 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

View 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;

View 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;

View 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;

View 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);

View 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;

View 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);

View 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) {

View 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;

View 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;

View 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;

View 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);

View 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;

View 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;

View 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

View 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;

View 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.

View 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;

View 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)

View 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;

View 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);

View 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;

View 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 */

View 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;

View 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)

View 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;

View 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;

View 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);

View 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;

View 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;

View 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;

View 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);

View 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);

View 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) {

View 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).

View 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;

View 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)

View 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);

View 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++;
}

View 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)

View 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;

View 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++;
}

View 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)

View 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;

View 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++;
}

View 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;

View 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;

View 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;

View 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)

View 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;

View 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;
}
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;
}
&cs4231)) < 0)
goto _err;
if ((err = snd_gf1_rawmidi_new(gus, 0, NULL)) < 0) {
snd_card_free(card);
return 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)
goto _err;
}
if ((err = snd_gusmax_mixer(cs4231)) < 0)
goto _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)

View 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)

View 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;

View 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 */

View 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);

View 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;

View 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;

View 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;
}

View 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)

View 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);

Some files were not shown because too many files have changed in this diff Show More