Merge branch 'topic/snd_card_new-err' into topic/drop-l3

This commit is contained in:
Takashi Iwai 2009-03-17 17:57:37 +01:00
commit dbe36c9dd5
111 changed files with 617 additions and 516 deletions

View File

@ -492,9 +492,9 @@
} }
/* (2) */ /* (2) */
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
/* (3) */ /* (3) */
err = snd_mychip_create(card, pci, &chip); err = snd_mychip_create(card, pci, &chip);
@ -590,8 +590,9 @@
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
struct snd_card *card; struct snd_card *card;
int err;
.... ....
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
]]> ]]>
</programlisting> </programlisting>
</informalexample> </informalexample>
@ -809,26 +810,28 @@
<para> <para>
As mentioned above, to create a card instance, call As mentioned above, to create a card instance, call
<function>snd_card_new()</function>. <function>snd_card_create()</function>.
<informalexample> <informalexample>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
struct snd_card *card; struct snd_card *card;
card = snd_card_new(index, id, module, extra_size); int err;
err = snd_card_create(index, id, module, extra_size, &card);
]]> ]]>
</programlisting> </programlisting>
</informalexample> </informalexample>
</para> </para>
<para> <para>
The function takes four arguments, the card-index number, the The function takes five arguments, the card-index number, the
id string, the module pointer (usually id string, the module pointer (usually
<constant>THIS_MODULE</constant>), <constant>THIS_MODULE</constant>),
and the size of extra-data space. The last argument is used to the size of extra-data space, and the pointer to return the
card instance. The extra_size argument is used to
allocate card-&gt;private_data for the allocate card-&gt;private_data for the
chip-specific data. Note that these data chip-specific data. Note that these data
are allocated by <function>snd_card_new()</function>. are allocated by <function>snd_card_create()</function>.
</para> </para>
</section> </section>
@ -915,15 +918,16 @@
</para> </para>
<section id="card-management-chip-specific-snd-card-new"> <section id="card-management-chip-specific-snd-card-new">
<title>1. Allocating via <function>snd_card_new()</function>.</title> <title>1. Allocating via <function>snd_card_create()</function>.</title>
<para> <para>
As mentioned above, you can pass the extra-data-length As mentioned above, you can pass the extra-data-length
to the 4th argument of <function>snd_card_new()</function>, i.e. to the 4th argument of <function>snd_card_create()</function>, i.e.
<informalexample> <informalexample>
<programlisting> <programlisting>
<![CDATA[ <![CDATA[
card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct mychip)); err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct mychip), &card);
]]> ]]>
</programlisting> </programlisting>
</informalexample> </informalexample>
@ -952,8 +956,8 @@
<para> <para>
After allocating a card instance via After allocating a card instance via
<function>snd_card_new()</function> (with <function>snd_card_create()</function> (with
<constant>NULL</constant> on the 4th arg), call <constant>0</constant> on the 4th arg), call
<function>kzalloc()</function>. <function>kzalloc()</function>.
<informalexample> <informalexample>
@ -961,7 +965,7 @@
<![CDATA[ <![CDATA[
struct snd_card *card; struct snd_card *card;
struct mychip *chip; struct mychip *chip;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
..... .....
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL);
]]> ]]>
@ -5750,8 +5754,9 @@ struct _snd_pcm_runtime {
.... ....
struct snd_card *card; struct snd_card *card;
struct mychip *chip; struct mychip *chip;
int err;
.... ....
card = snd_card_new(index[dev], id[dev], THIS_MODULE, NULL); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
.... ....
chip = kzalloc(sizeof(*chip), GFP_KERNEL); chip = kzalloc(sizeof(*chip), GFP_KERNEL);
.... ....
@ -5763,7 +5768,7 @@ struct _snd_pcm_runtime {
</informalexample> </informalexample>
When you created the chip data with When you created the chip data with
<function>snd_card_new()</function>, it's anyway accessible <function>snd_card_create()</function>, it's anyway accessible
via <structfield>private_data</structfield> field. via <structfield>private_data</structfield> field.
<informalexample> <informalexample>
@ -5775,9 +5780,10 @@ struct _snd_pcm_runtime {
.... ....
struct snd_card *card; struct snd_card *card;
struct mychip *chip; struct mychip *chip;
int err;
.... ....
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct mychip)); sizeof(struct mychip), &card);
.... ....
chip = card->private_data; chip = card->private_data;
.... ....

View File

@ -803,9 +803,10 @@ static int __devinit cx88_audio_initdev(struct pci_dev *pci,
return (-ENOENT); return (-ENOENT);
} }
card = snd_card_new(index[devno], id[devno], THIS_MODULE, sizeof(snd_cx88_card_t)); err = snd_card_create(index[devno], id[devno], THIS_MODULE,
if (!card) sizeof(snd_cx88_card_t), &card);
return (-ENOMEM); if (err < 0)
return err;
card->private_free = snd_cx88_dev_free; card->private_free = snd_cx88_dev_free;

View File

@ -438,9 +438,10 @@ static int em28xx_audio_init(struct em28xx *dev)
printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus " printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
"Rechberger\n"); "Rechberger\n");
card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0); err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0,
if (card == NULL) &card);
return -ENOMEM; if (err < 0)
return err;
spin_lock_init(&adev->slock); spin_lock_init(&adev->slock);
err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm); err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm);

View File

@ -990,10 +990,10 @@ static int alsa_card_saa7134_create(struct saa7134_dev *dev, int devnum)
if (!enable[devnum]) if (!enable[devnum])
return -ENODEV; return -ENODEV;
card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t)); err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
sizeof(snd_card_saa7134_t), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "SAA7134"); strcpy(card->driver, "SAA7134");

View File

@ -248,10 +248,11 @@ int go7007_snd_init(struct go7007 *go)
spin_lock_init(&gosnd->lock); spin_lock_init(&gosnd->lock);
gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0; gosnd->hw_ptr = gosnd->w_idx = gosnd->avail = 0;
gosnd->capturing = 0; gosnd->capturing = 0;
gosnd->card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); ret = snd_card_create(index[dev], id[dev], THIS_MODULE, 0,
if (gosnd->card == NULL) { &gosnd->card);
if (ret < 0) {
kfree(gosnd); kfree(gosnd);
return -ENOMEM; return ret;
} }
ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go, ret = snd_device_new(gosnd->card, SNDRV_DEV_LOWLEVEL, go,
&go7007_snd_device_ops); &go7007_snd_device_ops);

View File

@ -1099,10 +1099,9 @@ static int gmidi_register_card(struct gmidi_device *dev)
.dev_free = gmidi_snd_free, .dev_free = gmidi_snd_free,
}; };
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (!card) { if (err < 0) {
ERROR(dev, "snd_card_new failed\n"); ERROR(dev, "snd_card_create failed\n");
err = -ENOMEM;
goto fail; goto fail;
} }
dev->card = card; dev->card = card;

View File

@ -296,8 +296,20 @@ int snd_card_locked(int card);
extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd); extern int (*snd_mixer_oss_notify_callback)(struct snd_card *card, int cmd);
#endif #endif
int snd_card_create(int idx, const char *id,
struct module *module, int extra_size,
struct snd_card **card_ret);
static inline __deprecated
struct snd_card *snd_card_new(int idx, const char *id, struct snd_card *snd_card_new(int idx, const char *id,
struct module *module, int extra_size); struct module *module, int extra_size)
{
struct snd_card *card;
if (snd_card_create(idx, id, module, extra_size, &card) < 0)
return NULL;
return card;
}
int snd_card_disconnect(struct snd_card *card); int snd_card_disconnect(struct snd_card *card);
int snd_card_free(struct snd_card *card); int snd_card_free(struct snd_card *card);
int snd_card_free_when_closed(struct snd_card *card); int snd_card_free_when_closed(struct snd_card *card);

View File

@ -23,9 +23,10 @@ int aoa_alsa_init(char *name, struct module *mod, struct device *dev)
/* cannot be EEXIST due to usage in aoa_fabric_register */ /* cannot be EEXIST due to usage in aoa_fabric_register */
return -EBUSY; return -EBUSY;
alsa_card = snd_card_new(index, name, mod, sizeof(struct aoa_card)); err = snd_card_create(index, name, mod, sizeof(struct aoa_card),
if (!alsa_card) &alsa_card);
return -ENOMEM; if (err < 0)
return err;
aoa_card = alsa_card->private_data; aoa_card = alsa_card->private_data;
aoa_card->alsa_card = alsa_card; aoa_card->alsa_card = alsa_card;
alsa_card->dev = dev; alsa_card->dev = dev;

View File

@ -995,10 +995,11 @@ static struct aaci * __devinit aaci_init_card(struct amba_device *dev)
{ {
struct aaci *aaci; struct aaci *aaci;
struct snd_card *card; struct snd_card *card;
int err;
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
THIS_MODULE, sizeof(struct aaci)); THIS_MODULE, sizeof(struct aaci), &card);
if (card == NULL) if (err < 0)
return NULL; return NULL;
card->private_free = aaci_free_card; card->private_free = aaci_free_card;

View File

@ -173,10 +173,9 @@ static int __devinit pxa2xx_ac97_probe(struct platform_device *dev)
struct snd_ac97_template ac97_template; struct snd_ac97_template ac97_template;
int ret; int ret;
ret = -ENOMEM; ret = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1, THIS_MODULE, 0, &card);
THIS_MODULE, 0); if (ret < 0)
if (!card)
goto err; goto err;
card->dev = &dev->dev; card->dev = &dev->dev;

View File

@ -887,9 +887,10 @@ static int __devinit sa11xx_uda1341_probe(struct platform_device *devptr)
struct sa11xx_uda1341 *chip; struct sa11xx_uda1341 *chip;
/* register the soundcard */ /* register the soundcard */
card = snd_card_new(-1, id, THIS_MODULE, sizeof(struct sa11xx_uda1341)); err = snd_card_create(-1, id, THIS_MODULE,
if (card == NULL) sizeof(struct sa11xx_uda1341), &card);
return -ENOMEM; if (err < 0)
return err;
chip = card->private_data; chip = card->private_data;
spin_lock_init(&chip->s[0].dma_lock); spin_lock_init(&chip->s[0].dma_lock);

View File

@ -121,31 +121,44 @@ static inline int init_info_for_card(struct snd_card *card)
#endif #endif
/** /**
* snd_card_new - create and initialize a soundcard structure * snd_card_create - create and initialize a soundcard structure
* @idx: card index (address) [0 ... (SNDRV_CARDS-1)] * @idx: card index (address) [0 ... (SNDRV_CARDS-1)]
* @xid: card identification (ASCII string) * @xid: card identification (ASCII string)
* @module: top level module for locking * @module: top level module for locking
* @extra_size: allocate this extra size after the main soundcard structure * @extra_size: allocate this extra size after the main soundcard structure
* @card_ret: the pointer to store the created card instance
* *
* Creates and initializes a soundcard structure. * Creates and initializes a soundcard structure.
* *
* Returns kmallocated snd_card structure. Creates the ALSA control interface * The function allocates snd_card instance via kzalloc with the given
* (which is blocked until snd_card_register function is called). * space for the driver to use freely. The allocated struct is stored
* in the given card_ret pointer.
*
* Returns zero if successful or a negative error code.
*/ */
struct snd_card *snd_card_new(int idx, const char *xid, int snd_card_create(int idx, const char *xid,
struct module *module, int extra_size) struct module *module, int extra_size,
struct snd_card **card_ret)
{ {
struct snd_card *card; struct snd_card *card;
int err, idx2; int err, idx2;
if (snd_BUG_ON(!card_ret))
return -EINVAL;
*card_ret = NULL;
if (extra_size < 0) if (extra_size < 0)
extra_size = 0; extra_size = 0;
card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL); card = kzalloc(sizeof(*card) + extra_size, GFP_KERNEL);
if (card == NULL) if (!card)
return NULL; return -ENOMEM;
if (xid) { if (xid) {
if (!snd_info_check_reserved_words(xid)) if (!snd_info_check_reserved_words(xid)) {
snd_printk(KERN_ERR
"given id string '%s' is reserved.\n", xid);
err = -EBUSY;
goto __error; goto __error;
}
strlcpy(card->id, xid, sizeof(card->id)); strlcpy(card->id, xid, sizeof(card->id));
} }
err = 0; err = 0;
@ -202,26 +215,28 @@ struct snd_card *snd_card_new(int idx, const char *xid,
#endif #endif
/* the control interface cannot be accessed from the user space until */ /* the control interface cannot be accessed from the user space until */
/* snd_cards_bitmask and snd_cards are set with snd_card_register */ /* snd_cards_bitmask and snd_cards are set with snd_card_register */
if ((err = snd_ctl_create(card)) < 0) { err = snd_ctl_create(card);
snd_printd("unable to register control minors\n"); if (err < 0) {
snd_printk(KERN_ERR "unable to register control minors\n");
goto __error; goto __error;
} }
if ((err = snd_info_card_create(card)) < 0) { err = snd_info_card_create(card);
snd_printd("unable to create card info\n"); if (err < 0) {
snd_printk(KERN_ERR "unable to create card info\n");
goto __error_ctl; goto __error_ctl;
} }
if (extra_size > 0) if (extra_size > 0)
card->private_data = (char *)card + sizeof(struct snd_card); card->private_data = (char *)card + sizeof(struct snd_card);
return card; *card_ret = card;
return 0;
__error_ctl: __error_ctl:
snd_device_free_all(card, SNDRV_DEV_CMD_PRE); snd_device_free_all(card, SNDRV_DEV_CMD_PRE);
__error: __error:
kfree(card); kfree(card);
return NULL; return err;
} }
EXPORT_SYMBOL(snd_card_create);
EXPORT_SYMBOL(snd_card_new);
/* return non-zero if a card is already locked */ /* return non-zero if a card is already locked */
int snd_card_locked(int card) int snd_card_locked(int card)

View File

@ -588,10 +588,10 @@ static int __devinit snd_dummy_probe(struct platform_device *devptr)
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_dummy)); sizeof(struct snd_dummy), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
dummy = card->private_data; dummy = card->private_data;
dummy->card = card; dummy->card = card;
for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) { for (idx = 0; idx < MAX_PCM_DEVICES && idx < pcm_devs[dev]; idx++) {

View File

@ -1279,9 +1279,9 @@ static int __devinit snd_ml403_ac97cr_probe(struct platform_device *pfdev)
if (!enable[dev]) if (!enable[dev])
return -ENOENT; return -ENOENT;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr); err = snd_ml403_ac97cr_create(card, pfdev, &ml403_ac97cr);
if (err < 0) { if (err < 0) {
PDEBUG(INIT_FAILURE, "probe(): create failed!\n"); PDEBUG(INIT_FAILURE, "probe(): create failed!\n");

View File

@ -73,9 +73,9 @@ static int snd_mpu401_create(int dev, struct snd_card **rcard)
snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n"); snd_printk(KERN_ERR "the uart_enter option is obsolete; remove it\n");
*rcard = NULL; *rcard = NULL;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "MPU-401 UART"); strcpy(card->driver, "MPU-401 UART");
strcpy(card->shortname, card->driver); strcpy(card->shortname, card->driver);
sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]); sprintf(card->longname, "%s at %#lx, ", card->shortname, port[dev]);

View File

@ -698,9 +698,9 @@ static int __devinit snd_mtpav_probe(struct platform_device *dev)
int err; int err;
struct mtpav *mtp_card; struct mtpav *mtp_card;
card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card)); err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
mtp_card = card->private_data; mtp_card = card->private_data;
spin_lock_init(&mtp_card->spinlock); spin_lock_init(&mtp_card->spinlock);

View File

@ -957,10 +957,10 @@ static int __devinit snd_mts64_probe(struct platform_device *pdev)
if ((err = snd_mts64_probe_port(p)) < 0) if ((err = snd_mts64_probe_port(p)) < 0)
return err; return err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printd("Cannot create card\n"); snd_printd("Cannot create card\n");
return -ENOMEM; return err;
} }
strcpy(card->driver, DRIVER_NAME); strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, "ESI " CARD_NAME); strcpy(card->shortname, "ESI " CARD_NAME);

View File

@ -98,9 +98,9 @@ static int __devinit snd_card_pcsp_probe(int devnum, struct device *dev)
hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL); hrtimer_init(&pcsp_chip.timer, CLOCK_MONOTONIC, HRTIMER_MODE_REL);
pcsp_chip.timer.function = pcsp_do_timer; pcsp_chip.timer.function = pcsp_do_timer;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
err = snd_pcsp_create(card); err = snd_pcsp_create(card);
if (err < 0) { if (err < 0) {

View File

@ -746,10 +746,10 @@ static int __devinit snd_portman_probe(struct platform_device *pdev)
if ((err = snd_portman_probe_port(p)) < 0) if ((err = snd_portman_probe_port(p)) < 0)
return err; return err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printd("Cannot create card\n"); snd_printd("Cannot create card\n");
return -ENOMEM; return err;
} }
strcpy(card->driver, DRIVER_NAME); strcpy(card->driver, DRIVER_NAME);
strcpy(card->shortname, CARD_NAME); strcpy(card->shortname, CARD_NAME);

View File

@ -942,9 +942,9 @@ static int __devinit snd_serial_probe(struct platform_device *devptr)
return -ENODEV; return -ENODEV;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "Serial"); strcpy(card->driver, "Serial");
strcpy(card->shortname, "Serial MIDI (UART16550A)"); strcpy(card->shortname, "Serial MIDI (UART16550A)");

View File

@ -90,10 +90,10 @@ static int __devinit snd_virmidi_probe(struct platform_device *devptr)
int idx, err; int idx, err;
int dev = devptr->id; int dev = devptr->id;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_virmidi)); sizeof(struct snd_card_virmidi), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
vmidi = (struct snd_card_virmidi *)card->private_data; vmidi = (struct snd_card_virmidi *)card->private_data;
vmidi->card = card; vmidi->card = card;

View File

@ -157,9 +157,10 @@ static int __devinit snd_card_ad1816a_probe(int dev, struct pnp_card_link *pcard
struct snd_ad1816a *chip; struct snd_ad1816a *chip;
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_ad1816a))) == NULL) sizeof(struct snd_card_ad1816a), &card);
return -ENOMEM; if (error < 0)
return error;
acard = (struct snd_card_ad1816a *)card->private_data; acard = (struct snd_card_ad1816a *)card->private_data;
if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) { if ((error = snd_card_ad1816a_pnp(dev, acard, pcard, pid))) {

View File

@ -91,9 +91,9 @@ static int __devinit snd_ad1848_probe(struct device *dev, unsigned int n)
struct snd_pcm *pcm; struct snd_pcm *pcm;
int error; int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0); error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (!card) if (error < 0)
return -EINVAL; return error;
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1, error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1,
thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT, thinkpad[n] ? WSS_HW_THINKPAD : WSS_HW_DETECT,

View File

@ -53,10 +53,10 @@ static int __devinit snd_adlib_probe(struct device *dev, unsigned int n)
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
int error; int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0); error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (!card) { if (error < 0) {
dev_err(dev, "could not create card\n"); dev_err(dev, "could not create card\n");
return -EINVAL; return error;
} }
card->private_data = request_region(port[n], 4, CRD_NAME); card->private_data = request_region(port[n], 4, CRD_NAME);

View File

@ -163,9 +163,10 @@ static int __devinit snd_card_als100_probe(int dev,
struct snd_card_als100 *acard; struct snd_card_als100 *acard;
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_als100))) == NULL) sizeof(struct snd_card_als100), &card);
return -ENOMEM; if (error < 0)
return error;
acard = card->private_data; acard = card->private_data;
if ((error = snd_card_als100_pnp(dev, acard, pcard, pid))) { if ((error = snd_card_als100_pnp(dev, acard, pcard, pid))) {

View File

@ -184,9 +184,10 @@ static int __devinit snd_card_azt2320_probe(int dev,
struct snd_wss *chip; struct snd_wss *chip;
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_azt2320))) == NULL) sizeof(struct snd_card_azt2320), &card);
return -ENOMEM; if (error < 0)
return error;
acard = (struct snd_card_azt2320 *)card->private_data; acard = (struct snd_card_azt2320 *)card->private_data;
if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) { if ((error = snd_card_azt2320_pnp(dev, acard, pcard, pid))) {

View File

@ -467,20 +467,22 @@ static int snd_cmi8330_resume(struct snd_card *card)
#define PFX "cmi8330: " #define PFX "cmi8330: "
static struct snd_card *snd_cmi8330_card_new(int dev) static int snd_cmi8330_card_new(int dev, struct snd_card **cardp)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_cmi8330 *acard; struct snd_cmi8330 *acard;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cmi8330)); sizeof(struct snd_cmi8330), &card);
if (card == NULL) { if (err < 0) {
snd_printk(KERN_ERR PFX "could not get a new card\n"); snd_printk(KERN_ERR PFX "could not get a new card\n");
return NULL; return err;
} }
acard = card->private_data; acard = card->private_data;
acard->card = card; acard->card = card;
return card; *cardp = card;
return 0;
} }
static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev) static int __devinit snd_cmi8330_probe(struct snd_card *card, int dev)
@ -564,9 +566,9 @@ static int __devinit snd_cmi8330_isa_probe(struct device *pdev,
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_cmi8330_card_new(dev); err = snd_cmi8330_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, pdev); snd_card_set_dev(card, pdev);
if ((err = snd_cmi8330_probe(card, dev)) < 0) { if ((err = snd_cmi8330_probe(card, dev)) < 0) {
snd_card_free(card); snd_card_free(card);
@ -628,9 +630,9 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_cmi8330_card_new(dev); res = snd_cmi8330_card_new(dev, &card);
if (! card) if (res < 0)
return -ENOMEM; return res;
if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) { if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) {
snd_printk(KERN_ERR PFX "PnP detection failed\n"); snd_printk(KERN_ERR PFX "PnP detection failed\n");
snd_card_free(card); snd_card_free(card);

View File

@ -95,9 +95,9 @@ static int __devinit snd_cs4231_probe(struct device *dev, unsigned int n)
struct snd_pcm *pcm; struct snd_pcm *pcm;
int error; int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0); error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (!card) if (error < 0)
return -EINVAL; return error;
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n], error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
WSS_HW_DETECT, 0, &chip); WSS_HW_DETECT, 0, &chip);

View File

@ -382,16 +382,18 @@ static void snd_card_cs4236_free(struct snd_card *card)
release_and_free_resource(acard->res_sb_port); release_and_free_resource(acard->res_sb_port);
} }
static struct snd_card *snd_cs423x_card_new(int dev) static int snd_cs423x_card_new(int dev, struct snd_card **cardp)
{ {
struct snd_card *card; struct snd_card *card;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_cs4236)); sizeof(struct snd_card_cs4236), &card);
if (card == NULL) if (err < 0)
return NULL; return err;
card->private_free = snd_card_cs4236_free; card->private_free = snd_card_cs4236_free;
return card; *cardp = card;
return 0;
} }
static int __devinit snd_cs423x_probe(struct snd_card *card, int dev) static int __devinit snd_cs423x_probe(struct snd_card *card, int dev)
@ -512,9 +514,9 @@ static int __devinit snd_cs423x_isa_probe(struct device *pdev,
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_cs423x_card_new(dev); err = snd_cs423x_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, pdev); snd_card_set_dev(card, pdev);
if ((err = snd_cs423x_probe(card, dev)) < 0) { if ((err = snd_cs423x_probe(card, dev)) < 0) {
snd_card_free(card); snd_card_free(card);
@ -594,9 +596,9 @@ static int __devinit snd_cs4232_pnpbios_detect(struct pnp_dev *pdev,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_cs423x_card_new(dev); err = snd_cs423x_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) { if ((err = snd_card_cs4232_pnp(dev, card->private_data, pdev)) < 0) {
printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n"); printk(KERN_ERR "PnP BIOS detection failed for " IDENT "\n");
snd_card_free(card); snd_card_free(card);
@ -656,9 +658,9 @@ static int __devinit snd_cs423x_pnpc_detect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_cs423x_card_new(dev); res = snd_cs423x_card_new(dev, &card);
if (! card) if (res < 0)
return -ENOMEM; return res;
if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) { if ((res = snd_card_cs423x_pnpc(dev, card->private_data, pcard, pid)) < 0) {
printk(KERN_ERR "isapnp detection failed and probing for " IDENT printk(KERN_ERR "isapnp detection failed and probing for " IDENT
" is not supported\n"); " is not supported\n");

View File

@ -150,9 +150,10 @@ static int __devinit snd_card_dt019x_probe(int dev, struct pnp_card_link *pcard,
struct snd_card_dt019x *acard; struct snd_card_dt019x *acard;
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_dt019x))) == NULL) sizeof(struct snd_card_dt019x), &card);
return -ENOMEM; if (error < 0)
return error;
acard = card->private_data; acard = card->private_data;
snd_card_set_dev(card, &pcard->card->dev); snd_card_set_dev(card, &pcard->card->dev);

View File

@ -122,9 +122,9 @@ static int __devinit snd_es1688_probe(struct device *dev, unsigned int n)
struct snd_pcm *pcm; struct snd_pcm *pcm;
int error; int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0); error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (!card) if (error < 0)
return -EINVAL; return error;
error = snd_es1688_legacy_create(card, dev, n, &chip); error = snd_es1688_legacy_create(card, dev, n, &chip);
if (error < 0) if (error < 0)

View File

@ -2125,10 +2125,10 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard,
#define is_isapnp_selected(dev) 0 #define is_isapnp_selected(dev) 0
#endif #endif
static struct snd_card *snd_es18xx_card_new(int dev) static int snd_es18xx_card_new(int dev, struct snd_card **cardp)
{ {
return snd_card_new(index[dev], id[dev], THIS_MODULE, return snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_audiodrive)); sizeof(struct snd_audiodrive), cardp);
} }
static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev) static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)
@ -2197,9 +2197,9 @@ static int __devinit snd_es18xx_isa_probe1(int dev, struct device *devptr)
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_es18xx_card_new(dev); err = snd_es18xx_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, devptr); snd_card_set_dev(card, devptr);
if ((err = snd_audiodrive_probe(card, dev)) < 0) { if ((err = snd_audiodrive_probe(card, dev)) < 0) {
snd_card_free(card); snd_card_free(card);
@ -2303,9 +2303,9 @@ static int __devinit snd_audiodrive_pnp_detect(struct pnp_dev *pdev,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_es18xx_card_new(dev); err = snd_es18xx_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) { if ((err = snd_audiodrive_pnp(dev, card->private_data, pdev)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
@ -2362,9 +2362,9 @@ static int __devinit snd_audiodrive_pnpc_detect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_es18xx_card_new(dev); res = snd_es18xx_card_new(dev, &card);
if (! card) if (res < 0)
return -ENOMEM; return res;
if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) { if ((res = snd_audiodrive_pnpc(dev, card->private_data, pcard, pid)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -148,9 +148,9 @@ static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n)
struct snd_gus_card *gus; struct snd_gus_card *gus;
int error; int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0); error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (!card) if (error < 0)
return -EINVAL; return error;
if (pcm_channels[n] < 2) if (pcm_channels[n] < 2)
pcm_channels[n] = 2; pcm_channels[n] = 2;

View File

@ -241,9 +241,9 @@ static int __devinit snd_gusextreme_probe(struct device *dev, unsigned int n)
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
int error; int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0); error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (!card) if (error < 0)
return -EINVAL; return error;
if (mpu_port[n] == SNDRV_AUTO_PORT) if (mpu_port[n] == SNDRV_AUTO_PORT)
mpu_port[n] = 0; mpu_port[n] = 0;

View File

@ -214,10 +214,10 @@ static int __devinit snd_gusmax_probe(struct device *pdev, unsigned int dev)
struct snd_wss *wss; struct snd_wss *wss;
struct snd_gusmax *maxcard; struct snd_gusmax *maxcard;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_gusmax)); sizeof(struct snd_gusmax), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
card->private_free = snd_gusmax_free; card->private_free = snd_gusmax_free;
maxcard = (struct snd_gusmax *)card->private_data; maxcard = (struct snd_gusmax *)card->private_data;
maxcard->card = card; maxcard->card = card;

View File

@ -626,20 +626,22 @@ static void snd_interwave_free(struct snd_card *card)
free_irq(iwcard->irq, (void *)iwcard); free_irq(iwcard->irq, (void *)iwcard);
} }
static struct snd_card *snd_interwave_card_new(int dev) static int snd_interwave_card_new(int dev, struct snd_card **cardp)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_interwave *iwcard; struct snd_interwave *iwcard;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_interwave)); sizeof(struct snd_interwave), &card);
if (card == NULL) if (err < 0)
return NULL; return err;
iwcard = card->private_data; iwcard = card->private_data;
iwcard->card = card; iwcard->card = card;
iwcard->irq = -1; iwcard->irq = -1;
card->private_free = snd_interwave_free; card->private_free = snd_interwave_free;
return card; *cardp = card;
return 0;
} }
static int __devinit snd_interwave_probe(struct snd_card *card, int dev) static int __devinit snd_interwave_probe(struct snd_card *card, int dev)
@ -778,9 +780,9 @@ static int __devinit snd_interwave_isa_probe1(int dev, struct device *devptr)
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_interwave_card_new(dev); err = snd_interwave_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, devptr); snd_card_set_dev(card, devptr);
if ((err = snd_interwave_probe(card, dev)) < 0) { if ((err = snd_interwave_probe(card, dev)) < 0) {
@ -876,9 +878,9 @@ static int __devinit snd_interwave_pnp_detect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_interwave_card_new(dev); res = snd_interwave_card_new(dev, &card);
if (! card) if (res < 0)
return -ENOMEM; return res;
if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) { if ((res = snd_interwave_pnp(dev, card->private_data, pcard, pid)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -617,21 +617,24 @@ static void snd_opl3sa2_free(struct snd_card *card)
release_and_free_resource(chip->res_port); release_and_free_resource(chip->res_port);
} }
static struct snd_card *snd_opl3sa2_card_new(int dev) static int snd_opl3sa2_card_new(int dev, struct snd_card **cardp)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_opl3sa2 *chip; struct snd_opl3sa2 *chip;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct snd_opl3sa2)); err = snd_card_create(index[dev], id[dev], THIS_MODULE,
if (card == NULL) sizeof(struct snd_opl3sa2), &card);
return NULL; if (err < 0)
return err;
strcpy(card->driver, "OPL3SA2"); strcpy(card->driver, "OPL3SA2");
strcpy(card->shortname, "Yamaha OPL3-SA2"); strcpy(card->shortname, "Yamaha OPL3-SA2");
chip = card->private_data; chip = card->private_data;
spin_lock_init(&chip->reg_lock); spin_lock_init(&chip->reg_lock);
chip->irq = -1; chip->irq = -1;
card->private_free = snd_opl3sa2_free; card->private_free = snd_opl3sa2_free;
return card; *cardp = card;
return 0;
} }
static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev) static int __devinit snd_opl3sa2_probe(struct snd_card *card, int dev)
@ -723,9 +726,9 @@ static int __devinit snd_opl3sa2_pnp_detect(struct pnp_dev *pdev,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_opl3sa2_card_new(dev); err = snd_opl3sa2_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
@ -789,9 +792,9 @@ static int __devinit snd_opl3sa2_pnp_cdetect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_opl3sa2_card_new(dev); err = snd_opl3sa2_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) { if ((err = snd_opl3sa2_pnp(dev, card->private_data, pdev)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;
@ -870,9 +873,9 @@ static int __devinit snd_opl3sa2_isa_probe(struct device *pdev,
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_opl3sa2_card_new(dev); err = snd_opl3sa2_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, pdev); snd_card_set_dev(card, pdev);
if ((err = snd_opl3sa2_probe(card, dev)) < 0) { if ((err = snd_opl3sa2_probe(card, dev)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -1228,9 +1228,10 @@ static int __devinit snd_miro_probe(struct device *devptr, unsigned int n)
struct snd_pcm *pcm; struct snd_pcm *pcm;
struct snd_rawmidi *rmidi; struct snd_rawmidi *rmidi;
if (!(card = snd_card_new(index, id, THIS_MODULE, error = snd_card_create(index, id, THIS_MODULE,
sizeof(struct snd_miro)))) sizeof(struct snd_miro), &card);
return -ENOMEM; if (error < 0)
return error;
card->private_free = snd_card_miro_free; card->private_free = snd_card_miro_free;
miro = card->private_data; miro = card->private_data;

View File

@ -830,15 +830,18 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
return snd_card_register(card); return snd_card_register(card);
} }
static struct snd_card *snd_opti9xx_card_new(void) static int snd_opti9xx_card_new(struct snd_card **cardp)
{ {
struct snd_card *card; struct snd_card *card;
int err;
card = snd_card_new(index, id, THIS_MODULE, sizeof(struct snd_opti9xx)); err = snd_card_create(index, id, THIS_MODULE,
if (! card) sizeof(struct snd_opti9xx), &card);
return NULL; if (err < 0)
return err;
card->private_free = snd_card_opti9xx_free; card->private_free = snd_card_opti9xx_free;
return card; *cardp = card;
return 0;
} }
static int __devinit snd_opti9xx_isa_match(struct device *devptr, static int __devinit snd_opti9xx_isa_match(struct device *devptr,
@ -903,9 +906,9 @@ static int __devinit snd_opti9xx_isa_probe(struct device *devptr,
} }
#endif #endif
card = snd_opti9xx_card_new(); error = snd_opti9xx_card_new(&card);
if (! card) if (error < 0)
return -ENOMEM; return error;
if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) { if ((error = snd_card_opti9xx_detect(card, card->private_data)) < 0) {
snd_card_free(card); snd_card_free(card);
@ -950,9 +953,9 @@ static int __devinit snd_opti9xx_pnp_probe(struct pnp_card_link *pcard,
return -EBUSY; return -EBUSY;
if (! isapnp) if (! isapnp)
return -ENODEV; return -ENODEV;
card = snd_opti9xx_card_new(); error = snd_opti9xx_card_new(&card);
if (! card) if (error < 0)
return -ENOMEM; return error;
chip = card->private_data; chip = card->private_data;
hw = snd_card_opti9xx_pnp(chip, pcard, pid); hw = snd_card_opti9xx_pnp(chip, pcard, pid);

View File

@ -108,9 +108,10 @@ static int __devinit snd_card_es968_probe(int dev,
struct snd_card *card; struct snd_card *card;
struct snd_card_es968 *acard; struct snd_card_es968 *acard;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_es968))) == NULL) sizeof(struct snd_card_es968), &card);
return -ENOMEM; if (error < 0)
return error;
acard = card->private_data; acard = card->private_data;
if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) { if ((error = snd_card_es968_pnp(dev, acard, pcard, pid))) {
snd_card_free(card); snd_card_free(card);

View File

@ -324,14 +324,18 @@ static void snd_sb16_free(struct snd_card *card)
#define is_isapnp_selected(dev) 0 #define is_isapnp_selected(dev) 0
#endif #endif
static struct snd_card *snd_sb16_card_new(int dev) static int snd_sb16_card_new(int dev, struct snd_card **cardp)
{ {
struct snd_card *card = snd_card_new(index[dev], id[dev], THIS_MODULE, struct snd_card *card;
sizeof(struct snd_card_sb16)); int err;
if (card == NULL)
return NULL; err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_sb16), &card);
if (err < 0)
return err;
card->private_free = snd_sb16_free; card->private_free = snd_sb16_free;
return card; *cardp = card;
return 0;
} }
static int __devinit snd_sb16_probe(struct snd_card *card, int dev) static int __devinit snd_sb16_probe(struct snd_card *card, int dev)
@ -489,9 +493,9 @@ static int __devinit snd_sb16_isa_probe1(int dev, struct device *pdev)
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_sb16_card_new(dev); err = snd_sb16_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
acard = card->private_data; acard = card->private_data;
/* non-PnP FM port address is hardwired with base port address */ /* non-PnP FM port address is hardwired with base port address */
@ -610,9 +614,9 @@ static int __devinit snd_sb16_pnp_detect(struct pnp_card_link *pcard,
for ( ; dev < SNDRV_CARDS; dev++) { for ( ; dev < SNDRV_CARDS; dev++) {
if (!enable[dev] || !isapnp[dev]) if (!enable[dev] || !isapnp[dev])
continue; continue;
card = snd_sb16_card_new(dev); res = snd_sb16_card_new(dev, &card);
if (! card) if (res < 0)
return -ENOMEM; return res;
snd_card_set_dev(card, &pcard->card->dev); snd_card_set_dev(card, &pcard->card->dev);
if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 || if ((res = snd_card_sb16_pnp(dev, card->private_data, pcard, pid)) < 0 ||
(res = snd_sb16_probe(card, dev)) < 0) { (res = snd_sb16_probe(card, dev)) < 0) {

View File

@ -103,10 +103,10 @@ static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev)
struct snd_opl3 *opl3; struct snd_opl3 *opl3;
int err; int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_sb8)); sizeof(struct snd_sb8), &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
acard = card->private_data; acard = card->private_data;
card->private_free = snd_sb8_free; card->private_free = snd_sb8_free;

View File

@ -489,9 +489,9 @@ static int __devinit snd_sc6000_probe(struct device *devptr, unsigned int dev)
char __iomem *vmss_port; char __iomem *vmss_port;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
if (xirq == SNDRV_AUTO_IRQ) { if (xirq == SNDRV_AUTO_IRQ) {
xirq = snd_legacy_find_free_irq(possible_irqs); xirq = snd_legacy_find_free_irq(possible_irqs);

View File

@ -243,9 +243,9 @@ static int __devinit snd_sgalaxy_probe(struct device *devptr, unsigned int dev)
struct snd_card *card; struct snd_card *card;
struct snd_wss *chip; struct snd_wss *chip;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
xirq = irq[dev]; xirq = irq[dev];
if (xirq == SNDRV_AUTO_IRQ) { if (xirq == SNDRV_AUTO_IRQ) {

View File

@ -1357,10 +1357,10 @@ static int __devinit snd_sscape_probe(struct device *pdev, unsigned int dev)
struct soundscape *sscape; struct soundscape *sscape;
int ret; int ret;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, ret = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct soundscape)); sizeof(struct soundscape), &card);
if (!card) if (ret < 0)
return -ENOMEM; return ret;
sscape = get_card_soundscape(card); sscape = get_card_soundscape(card);
sscape->type = SSCAPE; sscape->type = SSCAPE;
@ -1462,10 +1462,10 @@ static int __devinit sscape_pnp_detect(struct pnp_card_link *pcard,
* Create a new ALSA sound card entry, in anticipation * Create a new ALSA sound card entry, in anticipation
* of detecting our hardware ... * of detecting our hardware ...
*/ */
card = snd_card_new(index[idx], id[idx], THIS_MODULE, ret = snd_card_create(index[idx], id[idx], THIS_MODULE,
sizeof(struct soundscape)); sizeof(struct soundscape), &card);
if (!card) if (ret < 0)
return -ENOMEM; return ret;
sscape = get_card_soundscape(card); sscape = get_card_soundscape(card);

View File

@ -338,15 +338,16 @@ snd_wavefront_free(struct snd_card *card)
} }
} }
static struct snd_card *snd_wavefront_card_new(int dev) static int snd_wavefront_card_new(int dev, struct snd_card **cardp)
{ {
struct snd_card *card; struct snd_card *card;
snd_wavefront_card_t *acard; snd_wavefront_card_t *acard;
int err;
card = snd_card_new (index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(snd_wavefront_card_t)); sizeof(snd_wavefront_card_t), &card);
if (card == NULL) if (err < 0)
return NULL; return err;
acard = card->private_data; acard = card->private_data;
acard->wavefront.irq = -1; acard->wavefront.irq = -1;
@ -357,7 +358,8 @@ static struct snd_card *snd_wavefront_card_new(int dev)
acard->wavefront.card = card; acard->wavefront.card = card;
card->private_free = snd_wavefront_free; card->private_free = snd_wavefront_free;
return card; *cardp = card;
return 0;
} }
static int __devinit static int __devinit
@ -567,9 +569,9 @@ static int __devinit snd_wavefront_isa_probe(struct device *pdev,
struct snd_card *card; struct snd_card *card;
int err; int err;
card = snd_wavefront_card_new(dev); err = snd_wavefront_card_new(dev, &card);
if (! card) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, pdev); snd_card_set_dev(card, pdev);
if ((err = snd_wavefront_probe(card, dev)) < 0) { if ((err = snd_wavefront_probe(card, dev)) < 0) {
snd_card_free(card); snd_card_free(card);
@ -616,9 +618,9 @@ static int __devinit snd_wavefront_pnp_detect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS) if (dev >= SNDRV_CARDS)
return -ENODEV; return -ENODEV;
card = snd_wavefront_card_new(dev); res = snd_wavefront_card_new(dev, &card);
if (! card) if (res < 0)
return -ENOMEM; return res;
if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) { if (snd_wavefront_pnp (dev, card->private_data, pcard, pid) < 0) {
if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) { if (cs4232_pcm_port[dev] == SNDRV_AUTO_PORT) {

View File

@ -636,9 +636,10 @@ au1000_init(void)
struct snd_card *card; struct snd_card *card;
struct snd_au1000 *au1000; struct snd_au1000 *au1000;
card = snd_card_new(-1, "AC97", THIS_MODULE, sizeof(struct snd_au1000)); err = snd_card_create(-1, "AC97", THIS_MODULE,
if (card == NULL) sizeof(struct snd_au1000), &card);
return -ENOMEM; if (err < 0)
return err;
card->private_free = snd_au1000_free; card->private_free = snd_au1000_free;
au1000 = card->private_data; au1000 = card->private_data;

View File

@ -878,9 +878,9 @@ static int __devinit hal2_probe(struct platform_device *pdev)
struct snd_hal2 *chip; struct snd_hal2 *chip;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = hal2_create(card, &chip); err = hal2_create(card, &chip);
if (err < 0) { if (err < 0) {

View File

@ -936,9 +936,9 @@ static int __devinit snd_sgio2audio_probe(struct platform_device *pdev)
struct snd_sgio2audio *chip; struct snd_sgio2audio *chip;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_sgio2audio_create(card, &chip); err = snd_sgio2audio_create(card, &chip);
if (err < 0) { if (err < 0) {

View File

@ -975,9 +975,9 @@ snd_harmony_probe(struct parisc_device *padev)
struct snd_card *card; struct snd_card *card;
struct snd_harmony *h; struct snd_harmony *h;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_harmony_create(card, padev, &h); err = snd_harmony_create(card, padev, &h);
if (err < 0) if (err < 0)

View File

@ -995,10 +995,10 @@ snd_ad1889_probe(struct pci_dev *pci,
} }
/* (2) */ /* (2) */
card = snd_card_new(index[devno], id[devno], THIS_MODULE, 0); err = snd_card_create(index[devno], id[devno], THIS_MODULE, 0, &card);
/* XXX REVISIT: we can probably allocate chip in this call */ /* XXX REVISIT: we can probably allocate chip in this call */
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "AD1889"); strcpy(card->driver, "AD1889");
strcpy(card->shortname, "Analog Devices AD1889"); strcpy(card->shortname, "Analog Devices AD1889");

View File

@ -2307,9 +2307,9 @@ static int __devinit snd_ali_probe(struct pci_dev *pci,
snd_ali_printk("probe ...\n"); snd_ali_printk("probe ...\n");
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
err = snd_ali_create(card, pci, pcm_channels, spdif, &codec); err = snd_ali_create(card, pci, pcm_channels, spdif, &codec);
if (err < 0) if (err < 0)

View File

@ -812,10 +812,10 @@ static int __devinit snd_als300_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
chip_type = pci_id->driver_data; chip_type = pci_id->driver_data;

View File

@ -889,12 +889,13 @@ static int __devinit snd_card_als4000_probe(struct pci_dev *pci,
pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO); pci_write_config_word(pci, PCI_COMMAND, word | PCI_COMMAND_IO);
pci_set_master(pci); pci_set_master(pci);
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(*acard) /* private_data: acard */); sizeof(*acard) /* private_data: acard */,
if (card == NULL) { &card);
if (err < 0) {
pci_release_regions(pci); pci_release_regions(pci);
pci_disable_device(pci); pci_disable_device(pci);
return -ENOMEM; return err;
} }
acard = card->private_data; acard = card->private_data;

View File

@ -1645,9 +1645,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
struct atiixp *chip; struct atiixp *chip;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA"); strcpy(card->driver, spdif_aclink ? "ATIIXP" : "ATIIXP-SPDMA");
strcpy(card->shortname, "ATI IXP"); strcpy(card->shortname, "ATI IXP");

View File

@ -1288,9 +1288,9 @@ static int __devinit snd_atiixp_probe(struct pci_dev *pci,
struct atiixp_modem *chip; struct atiixp_modem *chip;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "ATIIXP-MODEM"); strcpy(card->driver, "ATIIXP-MODEM");
strcpy(card->shortname, "ATI IXP Modem"); strcpy(card->shortname, "ATI IXP Modem");

View File

@ -250,9 +250,9 @@ snd_vortex_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return -ENOENT; return -ENOENT;
} }
// (2) // (2)
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
// (3) // (3)
if ((err = snd_vortex_create(card, pci, &chip)) < 0) { if ((err = snd_vortex_create(card, pci, &chip)) < 0) {

View File

@ -368,9 +368,9 @@ static int __devinit snd_aw2_probe(struct pci_dev *pci,
} }
/* (2) Create card instance */ /* (2) Create card instance */
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
/* (3) Create main component */ /* (3) Create main component */
err = snd_aw2_create(card, pci, &chip); err = snd_aw2_create(card, pci, &chip);

View File

@ -2216,9 +2216,9 @@ snd_azf3328_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "AZF3328"); strcpy(card->driver, "AZF3328");
strcpy(card->shortname, "Aztech AZF3328 (PCI168)"); strcpy(card->shortname, "Aztech AZF3328 (PCI168)");

View File

@ -888,9 +888,9 @@ static int __devinit snd_bt87x_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
err = snd_bt87x_create(card, pci, &chip); err = snd_bt87x_create(card, pci, &chip);
if (err < 0) if (err < 0)

View File

@ -1758,9 +1758,9 @@ static int __devinit snd_ca0106_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_ca0106_create(dev, card, pci, &chip); err = snd_ca0106_create(dev, card, pci, &chip);
if (err < 0) if (err < 0)

View File

@ -3272,9 +3272,9 @@ static int __devinit snd_cmipci_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
switch (pci->device) { switch (pci->device) {
case PCI_DEVICE_ID_CMEDIA_CM8738: case PCI_DEVICE_ID_CMEDIA_CM8738:

View File

@ -1929,9 +1929,9 @@ static int __devinit snd_cs4281_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) { if ((err = snd_cs4281_create(card, pci, &chip, dual_codec[dev])) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -88,9 +88,9 @@ static int __devinit snd_card_cs46xx_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_cs46xx_create(card, pci, if ((err = snd_cs46xx_create(card, pci,
external_amp[dev], thinkpad[dev], external_amp[dev], thinkpad[dev],
&chip)) < 0) { &chip)) < 0) {

View File

@ -258,10 +258,10 @@ static int __devinit snd_cs5530_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
err = snd_cs5530_create(card, pci, &chip); err = snd_cs5530_create(card, pci, &chip);
if (err < 0) { if (err < 0) {

View File

@ -353,9 +353,9 @@ static int __devinit snd_cs5535audio_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0) if ((err = snd_cs5535audio_create(card, pci, &cs5535au)) < 0)
goto probefail_out; goto probefail_out;

View File

@ -1997,9 +1997,9 @@ static int __devinit snd_echo_probe(struct pci_dev *pci,
DE_INIT(("Echoaudio driver starting...\n")); DE_INIT(("Echoaudio driver starting...\n"));
i = 0; i = 0;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
snd_card_set_dev(card, &pci->dev); snd_card_set_dev(card, &pci->dev);

View File

@ -114,9 +114,9 @@ static int __devinit snd_card_emu10k1_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if (max_buffer_size[dev] < 32) if (max_buffer_size[dev] < 32)
max_buffer_size[dev] = 32; max_buffer_size[dev] = 32;
else if (max_buffer_size[dev] > 1024) else if (max_buffer_size[dev] > 1024)

View File

@ -1544,9 +1544,9 @@ static int __devinit snd_emu10k1x_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) { if ((err = snd_emu10k1x_create(card, pci, &chip)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -2410,9 +2410,9 @@ static int __devinit snd_audiopci_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) { if ((err = snd_ensoniq_create(card, pci, &ensoniq)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -1806,9 +1806,9 @@ static int __devinit snd_es1938_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
for (idx = 0; idx < 5; idx++) { for (idx = 0; idx < 5; idx++) {
if (pci_resource_start(pci, idx) == 0 || if (pci_resource_start(pci, idx) == 0 ||
!(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) {

View File

@ -2645,9 +2645,9 @@ static int __devinit snd_es1968_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
if (total_bufsize[dev] < 128) if (total_bufsize[dev] < 128)
total_bufsize[dev] = 128; total_bufsize[dev] = 128;

View File

@ -1468,9 +1468,9 @@ static int __devinit snd_card_fm801_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) { if ((err = snd_fm801_create(card, pci, tea575x_tuner[dev], &chip)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;

View File

@ -2335,10 +2335,10 @@ static int __devinit azx_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (!card) { if (err < 0) {
snd_printk(KERN_ERR SFX "Error creating card!\n"); snd_printk(KERN_ERR SFX "Error creating card!\n");
return -ENOMEM; return err;
} }
err = azx_create(card, pci, dev, pci_id->driver_data, &chip); err = azx_create(card, pci, dev, pci_id->driver_data, &chip);

View File

@ -2648,9 +2648,9 @@ static int __devinit snd_ice1712_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "ICE1712"); strcpy(card->driver, "ICE1712");
strcpy(card->shortname, "ICEnsemble ICE1712"); strcpy(card->shortname, "ICEnsemble ICE1712");

View File

@ -2456,9 +2456,9 @@ static int __devinit snd_vt1724_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "ICE1724"); strcpy(card->driver, "ICE1724");
strcpy(card->shortname, "ICEnsemble ICE1724"); strcpy(card->shortname, "ICEnsemble ICE1724");

View File

@ -3058,9 +3058,9 @@ static int __devinit snd_intel8x0_probe(struct pci_dev *pci,
int err; int err;
struct shortname_table *name; struct shortname_table *name;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if (spdif_aclink < 0) if (spdif_aclink < 0)
spdif_aclink = check_default_spdif_aclink(pci); spdif_aclink = check_default_spdif_aclink(pci);

View File

@ -1269,9 +1269,9 @@ static int __devinit snd_intel8x0m_probe(struct pci_dev *pci,
int err; int err;
struct shortname_table *name; struct shortname_table *name;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
strcpy(card->driver, "ICH-MODEM"); strcpy(card->driver, "ICH-MODEM");
strcpy(card->shortname, "Intel ICH"); strcpy(card->shortname, "Intel ICH");

View File

@ -2443,9 +2443,9 @@ snd_korg1212_probe(struct pci_dev *pci,
dev++; dev++;
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) { if ((err = snd_korg1212_create(card, pci, &korg1212)) < 0) {
snd_card_free(card); snd_card_free(card);

View File

@ -2691,9 +2691,9 @@ snd_m3_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
switch (pci->device) { switch (pci->device) {
case PCI_DEVICE_ID_ESS_ALLEGRO: case PCI_DEVICE_ID_ESS_ALLEGRO:

View File

@ -1365,12 +1365,12 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
else else
idx = index[dev] + i; idx = index[dev] + i;
snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i); snprintf(tmpid, sizeof(tmpid), "%s-%d", id[dev] ? id[dev] : "MIXART", i);
card = snd_card_new(idx, tmpid, THIS_MODULE, 0); err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card);
if (! card) { if (err < 0) {
snd_printk(KERN_ERR "cannot allocate the card %d\n", i); snd_printk(KERN_ERR "cannot allocate the card %d\n", i);
snd_mixart_free(mgr); snd_mixart_free(mgr);
return -ENOMEM; return err;
} }
strcpy(card->driver, CARD_NAME); strcpy(card->driver, CARD_NAME);

View File

@ -1668,9 +1668,9 @@ static int __devinit snd_nm256_probe(struct pci_dev *pci,
} }
} }
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
switch (pci->device) { switch (pci->device) {
case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO: case PCI_DEVICE_ID_NEOMAGIC_NM256AV_AUDIO:

View File

@ -459,10 +459,10 @@ int oxygen_pci_probe(struct pci_dev *pci, int index, char *id,
struct oxygen *chip; struct oxygen *chip;
int err; int err;
card = snd_card_new(index, id, model->owner, err = snd_card_create(index, id, model->owner,
sizeof *chip + model->model_data_size); sizeof(*chip) + model->model_data_size, &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
chip = card->private_data; chip = card->private_data;
chip->card = card; chip->card = card;

View File

@ -1510,12 +1510,12 @@ static int __devinit pcxhr_probe(struct pci_dev *pci,
snprintf(tmpid, sizeof(tmpid), "%s-%d", snprintf(tmpid, sizeof(tmpid), "%s-%d",
id[dev] ? id[dev] : card_name, i); id[dev] ? id[dev] : card_name, i);
card = snd_card_new(idx, tmpid, THIS_MODULE, 0); err = snd_card_create(idx, tmpid, THIS_MODULE, 0, &card);
if (! card) { if (err < 0) {
snd_printk(KERN_ERR "cannot allocate the card %d\n", i); snd_printk(KERN_ERR "cannot allocate the card %d\n", i);
pcxhr_free(mgr); pcxhr_free(mgr);
return -ENOMEM; return err;
} }
strcpy(card->driver, DRIVER_NAME); strcpy(card->driver, DRIVER_NAME);

View File

@ -2102,9 +2102,9 @@ snd_card_riptide_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_riptide_create(card, pci, &chip)) < 0) { if ((err = snd_riptide_create(card, pci, &chip)) < 0) {
snd_card_free(card); snd_card_free(card);
return err; return err;

View File

@ -1941,9 +1941,10 @@ snd_rme32_probe(struct pci_dev *pci, const struct pci_device_id *pci_id)
return -ENOENT; return -ENOENT;
} }
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct rme32))) == NULL) sizeof(struct rme32), &card);
return -ENOMEM; if (err < 0)
return err;
card->private_free = snd_rme32_card_free; card->private_free = snd_rme32_card_free;
rme32 = (struct rme32 *) card->private_data; rme32 = (struct rme32 *) card->private_data;
rme32->card = card; rme32->card = card;

View File

@ -2348,9 +2348,10 @@ snd_rme96_probe(struct pci_dev *pci,
dev++; dev++;
return -ENOENT; return -ENOENT;
} }
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct rme96))) == NULL) sizeof(struct rme96), &card);
return -ENOMEM; if (err < 0)
return err;
card->private_free = snd_rme96_card_free; card->private_free = snd_rme96_card_free;
rme96 = (struct rme96 *)card->private_data; rme96 = (struct rme96 *)card->private_data;
rme96->card = card; rme96->card = card;

View File

@ -5158,8 +5158,10 @@ static int __devinit snd_hdsp_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
if (!(card = snd_card_new(index[dev], id[dev], THIS_MODULE, sizeof(struct hdsp)))) err = snd_card_create(index[dev], id[dev], THIS_MODULE,
return -ENOMEM; sizeof(struct hdsp), &card);
if (err < 0)
return err;
hdsp = (struct hdsp *) card->private_data; hdsp = (struct hdsp *) card->private_data;
card->private_free = snd_hdsp_card_free; card->private_free = snd_hdsp_card_free;

View File

@ -4503,10 +4503,10 @@ static int __devinit snd_hdspm_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], err = snd_card_create(index[dev], id[dev],
THIS_MODULE, sizeof(struct hdspm)); THIS_MODULE, sizeof(struct hdspm), &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
hdspm = card->private_data; hdspm = card->private_data;
card->private_free = snd_hdspm_card_free; card->private_free = snd_hdspm_card_free;

View File

@ -2594,11 +2594,11 @@ static int __devinit snd_rme9652_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_rme9652)); sizeof(struct snd_rme9652), &card);
if (!card) if (err < 0)
return -ENOMEM; return err;
rme9652 = (struct snd_rme9652 *) card->private_data; rme9652 = (struct snd_rme9652 *) card->private_data;
card->private_free = snd_rme9652_card_free; card->private_free = snd_rme9652_card_free;

View File

@ -1387,9 +1387,8 @@ static int __devinit snd_sis7019_probe(struct pci_dev *pci,
if (!enable) if (!enable)
goto error_out; goto error_out;
rc = -ENOMEM; rc = snd_card_create(index, id, THIS_MODULE, sizeof(*sis), &card);
card = snd_card_new(index, id, THIS_MODULE, sizeof(*sis)); if (rc < 0)
if (!card)
goto error_out; goto error_out;
strcpy(card->driver, "SiS7019"); strcpy(card->driver, "SiS7019");

View File

@ -1458,9 +1458,9 @@ static int __devinit snd_sonic_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
for (idx = 0; idx < 5; idx++) { for (idx = 0; idx < 5; idx++) {
if (pci_resource_start(pci, idx) == 0 || if (pci_resource_start(pci, idx) == 0 ||
!(pci_resource_flags(pci, idx) & IORESOURCE_IO)) { !(pci_resource_flags(pci, idx) & IORESOURCE_IO)) {

View File

@ -89,9 +89,9 @@ static int __devinit snd_trident_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_trident_create(card, pci, if ((err = snd_trident_create(card, pci,
pcm_channels[dev], pcm_channels[dev],

View File

@ -2436,9 +2436,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
unsigned int i; unsigned int i;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
card_type = pci_id->driver_data; card_type = pci_id->driver_data;
switch (card_type) { switch (card_type) {

View File

@ -1170,9 +1170,9 @@ static int __devinit snd_via82xx_probe(struct pci_dev *pci,
unsigned int i; unsigned int i;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
card_type = pci_id->driver_data; card_type = pci_id->driver_data;
switch (card_type) { switch (card_type) {

View File

@ -204,9 +204,9 @@ static int __devinit snd_vx222_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
switch ((int)pci_id->driver_data) { switch ((int)pci_id->driver_data) {
case VX_PCI_VX222_OLD: case VX_PCI_VX222_OLD:

View File

@ -187,9 +187,9 @@ static int __devinit snd_card_ymfpci_probe(struct pci_dev *pci,
return -ENOENT; return -ENOENT;
} }
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0); err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
switch (pci_id->device) { switch (pci_id->device) {
case 0x0004: str = "YMF724"; model = "DS-1"; break; case 0x0004: str = "YMF724"; model = "DS-1"; break;

View File

@ -91,7 +91,7 @@ static int snd_pdacf_dev_free(struct snd_device *device)
*/ */
static int snd_pdacf_probe(struct pcmcia_device *link) static int snd_pdacf_probe(struct pcmcia_device *link)
{ {
int i; int i, err;
struct snd_pdacf *pdacf; struct snd_pdacf *pdacf;
struct snd_card *card; struct snd_card *card;
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
@ -112,20 +112,23 @@ static int snd_pdacf_probe(struct pcmcia_device *link)
return -ENODEV; /* disabled explicitly */ return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */ /* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0); err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printk(KERN_ERR "pdacf: cannot create a card instance\n"); snd_printk(KERN_ERR "pdacf: cannot create a card instance\n");
return -ENOMEM; return err;
} }
pdacf = snd_pdacf_create(card); pdacf = snd_pdacf_create(card);
if (! pdacf) if (!pdacf) {
return -EIO; snd_card_free(card);
return -ENOMEM;
}
if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops) < 0) { err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, pdacf, &ops);
if (err < 0) {
kfree(pdacf); kfree(pdacf);
snd_card_free(card); snd_card_free(card);
return -ENODEV; return err;
} }
snd_card_set_dev(card, &handle_to_dev(link)); snd_card_set_dev(card, &handle_to_dev(link));

View File

@ -130,23 +130,26 @@ static struct snd_vx_hardware vxp440_hw = {
/* /*
* create vxpocket instance * create vxpocket instance
*/ */
static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl, static int snd_vxpocket_new(struct snd_card *card, int ibl,
struct pcmcia_device *link) struct pcmcia_device *link,
struct snd_vxpocket **chip_ret)
{ {
struct vx_core *chip; struct vx_core *chip;
struct snd_vxpocket *vxp; struct snd_vxpocket *vxp;
static struct snd_device_ops ops = { static struct snd_device_ops ops = {
.dev_free = snd_vxpocket_dev_free, .dev_free = snd_vxpocket_dev_free,
}; };
int err;
chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops, chip = snd_vx_create(card, &vxpocket_hw, &snd_vxpocket_ops,
sizeof(struct snd_vxpocket) - sizeof(struct vx_core)); sizeof(struct snd_vxpocket) - sizeof(struct vx_core));
if (!chip) if (!chip)
return NULL; return -ENOMEM;
if (snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops) < 0) { err = snd_device_new(card, SNDRV_DEV_LOWLEVEL, chip, &ops);
if (err < 0) {
kfree(chip); kfree(chip);
return NULL; return err;
} }
chip->ibl.size = ibl; chip->ibl.size = ibl;
@ -169,7 +172,8 @@ static struct snd_vxpocket *snd_vxpocket_new(struct snd_card *card, int ibl,
link->conf.ConfigIndex = 1; link->conf.ConfigIndex = 1;
link->conf.Present = PRESENT_OPTION; link->conf.Present = PRESENT_OPTION;
return vxp; *chip_ret = vxp;
return 0;
} }
@ -292,7 +296,7 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
{ {
struct snd_card *card; struct snd_card *card;
struct snd_vxpocket *vxp; struct snd_vxpocket *vxp;
int i; int i, err;
/* find an empty slot from the card list */ /* find an empty slot from the card list */
for (i = 0; i < SNDRV_CARDS; i++) { for (i = 0; i < SNDRV_CARDS; i++) {
@ -307,16 +311,16 @@ static int vxpocket_probe(struct pcmcia_device *p_dev)
return -ENODEV; /* disabled explicitly */ return -ENODEV; /* disabled explicitly */
/* ok, create a card instance */ /* ok, create a card instance */
card = snd_card_new(index[i], id[i], THIS_MODULE, 0); err = snd_card_create(index[i], id[i], THIS_MODULE, 0, &card);
if (card == NULL) { if (err < 0) {
snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n"); snd_printk(KERN_ERR "vxpocket: cannot create a card instance\n");
return -ENOMEM; return err;
} }
vxp = snd_vxpocket_new(card, ibl[i], p_dev); err = snd_vxpocket_new(card, ibl[i], p_dev, &vxp);
if (! vxp) { if (err < 0) {
snd_card_free(card); snd_card_free(card);
return -ENODEV; return err;
} }
card->private_data = vxp; card->private_data = vxp;

View File

@ -58,9 +58,9 @@ static int __init snd_pmac_probe(struct platform_device *devptr)
char *name_ext; char *name_ext;
int err; int err;
card = snd_card_new(index, id, THIS_MODULE, 0); err = snd_card_create(index, id, THIS_MODULE, 0, &card);
if (card == NULL) if (err < 0)
return -ENOMEM; return err;
if ((err = snd_pmac_new(card, &chip)) < 0) if ((err = snd_pmac_new(card, &chip)) < 0)
goto __error; goto __error;

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