ALSA: Convert to snd_card_create() in sound/isa/*
authorTakashi Iwai <tiwai@alsa3.local>
Sun, 28 Dec 2008 15:43:35 +0000 (16:43 +0100)
committerTakashi Iwai <tiwai@suse.de>
Mon, 12 Jan 2009 14:20:26 +0000 (15:20 +0100)
Convert from snd_card_new() to the new snd_card_create() function.

Signed-off-by: Takashi Iwai <tiwai@suse.de>
25 files changed:
sound/isa/ad1816a/ad1816a.c
sound/isa/ad1848/ad1848.c
sound/isa/adlib.c
sound/isa/als100.c
sound/isa/azt2320.c
sound/isa/cmi8330.c
sound/isa/cs423x/cs4231.c
sound/isa/cs423x/cs4236.c
sound/isa/dt019x.c
sound/isa/es1688/es1688.c
sound/isa/es18xx.c
sound/isa/gus/gusclassic.c
sound/isa/gus/gusextreme.c
sound/isa/gus/gusmax.c
sound/isa/gus/interwave.c
sound/isa/opl3sa2.c
sound/isa/opti9xx/miro.c
sound/isa/opti9xx/opti92x-ad1848.c
sound/isa/sb/es968.c
sound/isa/sb/sb16.c
sound/isa/sb/sb8.c
sound/isa/sc6000.c
sound/isa/sgalaxy.c
sound/isa/sscape.c
sound/isa/wavefront/wavefront.c

index 7752424..9660e59 100644 (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))) {
index 223a6c0..4beeb6f 100644 (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,
index 374b717..7465ae0 100644 (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);
index f1ce30f..5fd52e4 100644 (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))) {
index 3e74d1a..f7aa637 100644 (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))) {
index e49aec7..24e6090 100644 (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);
index f019d44..cb9153e 100644 (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);
index 019c940..db83068 100644 (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;
index a0242c3..80f5b1a 100644 (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);
index b463771..d746750 100644 (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)
index 90498e4..c24c632 100644 (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)
index 426532a..086b8f0 100644 (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;
index 7ad4c3b..180a8de 100644 (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;
index f94c197..f26eac8 100644 (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;
index 5faecfb..e040c76 100644 (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;
index 58c972b..645491a 100644 (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);
index 440755c..02e30d7 100644 (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;
index 19706b0..5750f38 100644 (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;
index c8c8e21..cafc3a7 100644 (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);
index 2c201f7..adf4fdd 100644 (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;
index ea06877..3cd57ee 100644 (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;
 
index ca35924..7a14703 100644 (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);
index 2c7503b..6fe27b9 100644 (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) {
index 48a16d8..4025fb5 100644 (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);
 
index 4c095bc..82b8fb7 100644 (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;