ALSA: Convert to snd_card_create() in sound/isa/*

Convert from snd_card_new() to the new snd_card_create() function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
Takashi Iwai 2008-12-28 16:43:35 +01:00 committed by Takashi Iwai
parent 53fb1e6359
commit c95eadd2f1
25 changed files with 122 additions and 100 deletions

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_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_ad1816a))) == NULL)
return -ENOMEM;
error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_ad1816a), &card);
if (error < 0)
return error;
acard = (struct snd_card_ad1816a *)card->private_data;
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;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], -1,
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;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card) {
error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0) {
dev_err(dev, "could not create card\n");
return -EINVAL;
return error;
}
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_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_als100))) == NULL)
return -ENOMEM;
error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_als100), &card);
if (error < 0)
return error;
acard = card->private_data;
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_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_azt2320))) == NULL)
return -ENOMEM;
error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_azt2320), &card);
if (error < 0)
return error;
acard = (struct snd_card_azt2320 *)card->private_data;
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: "
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_cmi8330 *acard;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cmi8330));
if (card == NULL) {
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_cmi8330), &card);
if (err < 0) {
snd_printk(KERN_ERR PFX "could not get a new card\n");
return NULL;
return err;
}
acard = card->private_data;
acard->card = card;
return card;
*cardp = card;
return 0;
}
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;
int err;
card = snd_cmi8330_card_new(dev);
if (! card)
return -ENOMEM;
err = snd_cmi8330_card_new(dev, &card);
if (err < 0)
return err;
snd_card_set_dev(card, pdev);
if ((err = snd_cmi8330_probe(card, dev)) < 0) {
snd_card_free(card);
@ -628,9 +630,9 @@ static int __devinit snd_cmi8330_pnp_detect(struct pnp_card_link *pcard,
if (dev >= SNDRV_CARDS)
return -ENODEV;
card = snd_cmi8330_card_new(dev);
if (! card)
return -ENOMEM;
res = snd_cmi8330_card_new(dev, &card);
if (res < 0)
return res;
if ((res = snd_cmi8330_pnp(dev, card->private_data, pcard, pid)) < 0) {
snd_printk(KERN_ERR PFX "PnP detection failed\n");
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;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
error = snd_wss_create(card, port[n], -1, irq[n], dma1[n], dma2[n],
WSS_HW_DETECT, 0, &chip);

View File

@ -385,10 +385,11 @@ static void snd_card_cs4236_free(struct snd_card *card)
static struct snd_card *snd_cs423x_card_new(int dev)
{
struct snd_card *card;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_cs4236));
if (card == NULL)
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_cs4236), &card);
if (err < 0)
return NULL;
card->private_free = snd_card_cs4236_free;
return card;

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_opl3 *opl3;
if ((card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_dt019x))) == NULL)
return -ENOMEM;
error = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_dt019x), &card);
if (error < 0)
return error;
acard = card->private_data;
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;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
error = snd_es1688_legacy_create(card, dev, n, &chip);
if (error < 0)

View File

@ -2127,8 +2127,11 @@ static int __devinit snd_audiodrive_pnpc(int dev, struct snd_audiodrive *acard,
static struct snd_card *snd_es18xx_card_new(int dev)
{
return snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_audiodrive));
struct snd_card *card;
if (snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_audiodrive), &card) < 0)
return NULL;
return card;
}
static int __devinit snd_audiodrive_probe(struct snd_card *card, int dev)

View File

@ -148,9 +148,9 @@ static int __devinit snd_gusclassic_probe(struct device *dev, unsigned int n)
struct snd_gus_card *gus;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
if (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;
int error;
card = snd_card_new(index[n], id[n], THIS_MODULE, 0);
if (!card)
return -EINVAL;
error = snd_card_create(index[n], id[n], THIS_MODULE, 0, &card);
if (error < 0)
return error;
if (mpu_port[n] == SNDRV_AUTO_PORT)
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_gusmax *maxcard;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_gusmax));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_gusmax), &card);
if (err < 0)
return err;
card->private_free = snd_gusmax_free;
maxcard = (struct snd_gusmax *)card->private_data;
maxcard->card = card;

View File

@ -630,10 +630,11 @@ static struct snd_card *snd_interwave_card_new(int dev)
{
struct snd_card *card;
struct snd_interwave *iwcard;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_interwave));
if (card == NULL)
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_interwave), &card);
if (err < 0)
return NULL;
iwcard = card->private_data;
iwcard->card = card;

View File

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

View File

@ -833,9 +833,11 @@ static int __devinit snd_opti9xx_probe(struct snd_card *card)
static struct snd_card *snd_opti9xx_card_new(void)
{
struct snd_card *card;
int err;
card = snd_card_new(index, id, THIS_MODULE, sizeof(struct snd_opti9xx));
if (! card)
err = snd_card_create(index, id, THIS_MODULE,
sizeof(struct snd_opti9xx), &card);
if (err < 0)
return NULL;
card->private_free = snd_card_opti9xx_free;
return card;

View File

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

View File

@ -326,9 +326,12 @@ static void snd_sb16_free(struct snd_card *card)
static struct snd_card *snd_sb16_card_new(int dev)
{
struct snd_card *card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_sb16));
if (card == NULL)
struct snd_card *card;
int err;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_card_sb16), &card);
if (err < 0)
return NULL;
card->private_free = snd_sb16_free;
return card;

View File

@ -103,10 +103,10 @@ static int __devinit snd_sb8_probe(struct device *pdev, unsigned int dev)
struct snd_opl3 *opl3;
int err;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_sb8));
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct snd_sb8), &card);
if (err < 0)
return err;
acard = card->private_data;
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;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (!card)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0)
return err;
if (xirq == SNDRV_AUTO_IRQ) {
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_wss *chip;
card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
if (card == NULL)
return -ENOMEM;
err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
if (err < 0)
return err;
xirq = irq[dev];
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;
int ret;
card = snd_card_new(index[dev], id[dev], THIS_MODULE,
sizeof(struct soundscape));
if (!card)
return -ENOMEM;
ret = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(struct soundscape), &card);
if (ret < 0)
return ret;
sscape = get_card_soundscape(card);
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
* of detecting our hardware ...
*/
card = snd_card_new(index[idx], id[idx], THIS_MODULE,
sizeof(struct soundscape));
if (!card)
return -ENOMEM;
ret = snd_card_create(index[idx], id[idx], THIS_MODULE,
sizeof(struct soundscape), &card);
if (ret < 0)
return ret;
sscape = get_card_soundscape(card);

View File

@ -342,10 +342,11 @@ static struct snd_card *snd_wavefront_card_new(int dev)
{
struct snd_card *card;
snd_wavefront_card_t *acard;
int err;
card = snd_card_new (index[dev], id[dev], THIS_MODULE,
sizeof(snd_wavefront_card_t));
if (card == NULL)
err = snd_card_create(index[dev], id[dev], THIS_MODULE,
sizeof(snd_wavefront_card_t), &card);
if (err < 0)
return NULL;
acard = card->private_data;