]> pilppa.org Git - linux-2.6-omap-h63xx.git/commitdiff
Merge branch 'topic/snd_card_new-err' into topic/oxygen
authorTakashi Iwai <tiwai@suse.de>
Thu, 19 Feb 2009 09:22:14 +0000 (10:22 +0100)
committerTakashi Iwai <tiwai@suse.de>
Thu, 19 Feb 2009 09:22:14 +0000 (10:22 +0100)
1  2 
drivers/media/video/em28xx/em28xx-audio.c
drivers/media/video/saa7134/saa7134-alsa.c
sound/arm/aaci.c
sound/drivers/mtpav.c
sound/pci/hda/hda_intel.c
sound/pci/intel8x0.c
sound/ppc/snd_ps3.c
sound/soc/soc-core.c
sound/usb/caiaq/caiaq-device.c
sound/usb/usbaudio.c

index 5d882a44e3eee5444c00062f3e5edf70b118cc4e,66579508e17569e92dd68de337dff1fd4b38f741..4c606d43d6c0a08eed9284ceec1ff1092d7a2d7d
@@@ -62,15 -62,9 +62,15 @@@ static int em28xx_isoc_audio_deinit(str
  
        dprintk("Stopping isoc\n");
        for (i = 0; i < EM28XX_AUDIO_BUFS; i++) {
 -              usb_unlink_urb(dev->adev.urb[i]);
 +              if (!irqs_disabled())
 +                      usb_kill_urb(dev->adev.urb[i]);
 +              else
 +                      usb_unlink_urb(dev->adev.urb[i]);
                usb_free_urb(dev->adev.urb[i]);
                dev->adev.urb[i] = NULL;
 +
 +              kfree(dev->adev.transfer_buffer[i]);
 +              dev->adev.transfer_buffer[i] = NULL;
        }
  
        return 0;
@@@ -395,15 -389,11 +395,15 @@@ static int snd_em28xx_capture_trigger(s
  static snd_pcm_uframes_t snd_em28xx_capture_pointer(struct snd_pcm_substream
                                                    *substream)
  {
 -      struct em28xx *dev;
 +       unsigned long flags;
  
 +      struct em28xx *dev;
        snd_pcm_uframes_t hwptr_done;
 +
        dev = snd_pcm_substream_chip(substream);
 +       spin_lock_irqsave(&dev->adev.slock, flags);
        hwptr_done = dev->adev.hwptr_done_capture;
 +       spin_unlock_irqrestore(&dev->adev.slock, flags);
  
        return hwptr_done;
  }
@@@ -448,9 -438,10 +448,10 @@@ static int em28xx_audio_init(struct em2
        printk(KERN_INFO "em28xx-audio.c: Copyright (C) 2006 Markus "
                         "Rechberger\n");
  
-       card = snd_card_new(index[devnr], "Em28xx Audio", THIS_MODULE, 0);
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index[devnr], "Em28xx Audio", THIS_MODULE, 0,
+                             &card);
+       if (err < 0)
+               return err;
  
        spin_lock_init(&adev->slock);
        err = snd_pcm_new(card, "Em28xx Audio", 0, 0, 1, &pcm);
index c750d3dd57d20c2f8a858c342ada09b21fd1b1c1,482be1436e9262cb0511da8a3d07bb5232147d0d..8b0b64a89874dcbaa1e591c72af22074477a8c88
@@@ -990,10 -990,10 +990,10 @@@ static int alsa_card_saa7134_create(str
        if (!enable[devnum])
                return -ENODEV;
  
-       card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, sizeof(snd_card_saa7134_t));
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index[devnum], id[devnum], THIS_MODULE,
+                             sizeof(snd_card_saa7134_t), &card);
+       if (err < 0)
+               return err;
  
        strcpy(card->driver, "SAA7134");
  
@@@ -1089,11 -1089,7 +1089,11 @@@ static int saa7134_alsa_init(void
  
        list_for_each(list,&saa7134_devlist) {
                dev = list_entry(list, struct saa7134_dev, devlist);
 -              alsa_device_init(dev);
 +              if (dev->pci->device == PCI_DEVICE_ID_PHILIPS_SAA7130)
 +                      printk(KERN_INFO "%s/alsa: %s doesn't support digital audio\n",
 +                              dev->name, saa7134_boards[dev->board].name);
 +              else
 +                      alsa_device_init(dev);
        }
  
        if (dev == NULL)
diff --combined sound/arm/aaci.c
index 772901e41ecb5fe86d83633e0e2137847233a745,7d39aac9ec14eafc88681773a2a2b86f69acf2e4..7fbd68fab944e08ecba5bd4424331007198705e2
@@@ -90,7 -90,7 +90,7 @@@ static void aaci_ac97_write(struct snd_
         */
        do {
                v = readl(aaci->base + AACI_SLFR);
 -      } while ((v & (SLFR_1TXB|SLFR_2TXB)) && timeout--);
 +      } while ((v & (SLFR_1TXB|SLFR_2TXB)) && --timeout);
  
        if (!timeout)
                dev_err(&aaci->dev->dev,
@@@ -126,7 -126,7 +126,7 @@@ static unsigned short aaci_ac97_read(st
         */
        do {
                v = readl(aaci->base + AACI_SLFR);
 -      } while ((v & SLFR_1TXB) && timeout--);
 +      } while ((v & SLFR_1TXB) && --timeout);
  
        if (!timeout) {
                dev_err(&aaci->dev->dev, "timeout on slot 1 TX busy\n");
        do {
                cond_resched();
                v = readl(aaci->base + AACI_SLFR) & (SLFR_1RXV|SLFR_2RXV);
 -      } while ((v != (SLFR_1RXV|SLFR_2RXV)) && timeout--);
 +      } while ((v != (SLFR_1RXV|SLFR_2RXV)) && --timeout);
  
        if (!timeout) {
                dev_err(&aaci->dev->dev, "timeout on RX valid\n");
@@@ -995,10 -995,11 +995,11 @@@ static struct aaci * __devinit aaci_ini
  {
        struct aaci *aaci;
        struct snd_card *card;
+       int err;
  
-       card = snd_card_new(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
-                           THIS_MODULE, sizeof(struct aaci));
-       if (card == NULL)
+       err = snd_card_create(SNDRV_DEFAULT_IDX1, SNDRV_DEFAULT_STR1,
+                             THIS_MODULE, sizeof(struct aaci), &card);
+       if (err < 0)
                return NULL;
  
        card->private_free = aaci_free_card;
diff --combined sound/drivers/mtpav.c
index 48b64e6b26701e14ace4015b5df08b7f56408d5a,c3e9833dcfd9af1ffc2d8c53e49a6894a9ed1ef3..0e17d2b5ce19bedbee5f6d35fe076949283dd143
@@@ -696,9 -696,9 +696,9 @@@ static int __devinit snd_mtpav_probe(st
        int err;
        struct mtpav *mtp_card;
  
-       card = snd_card_new(index, id, THIS_MODULE, sizeof(*mtp_card));
-       if (! card)
-               return -ENOMEM;
+       err = snd_card_create(index, id, THIS_MODULE, sizeof(*mtp_card), &card);
+       if (err < 0)
+               return err;
  
        mtp_card = card->private_data;
        spin_lock_init(&mtp_card->spinlock);
        mtp_card->card = card;
        mtp_card->irq = -1;
        mtp_card->share_irq = 0;
 -      mtp_card->inmidiport = 0xffffffff;
        mtp_card->inmidistate = 0;
        mtp_card->outmidihwport = 0xffffffff;
        init_timer(&mtp_card->timer);
        if (err < 0)
                goto __error;
  
 +      mtp_card->inmidiport = mtp_card->num_ports + MTPAV_PIDX_BROADCAST;
 +
        err = snd_mtpav_get_ISA(mtp_card);
        if (err < 0)
                goto __error;
index 11e791b965f6a772588ac7dff64437b3ec836e70,ad5df2ae6f7d6d638611e7cbf8d60af1105e1e60..f9603443f08679be8a2b3b66aabfaf22eb30256c
@@@ -996,11 -996,10 +996,11 @@@ static irqreturn_t azx_interrupt(int ir
                                spin_unlock(&chip->reg_lock);
                                snd_pcm_period_elapsed(azx_dev->substream);
                                spin_lock(&chip->reg_lock);
 -                      } else {
 +                      } else if (chip->bus && chip->bus->workq) {
                                /* bogus IRQ, process it later */
                                azx_dev->irq_pending = 1;
 -                              schedule_work(&chip->irq_pending_work);
 +                              queue_work(chip->bus->workq,
 +                                         &chip->irq_pending_work);
                        }
                }
        }
@@@ -1742,6 -1741,7 +1742,6 @@@ static void azx_clear_irq_pending(struc
        for (i = 0; i < chip->num_streams; i++)
                chip->azx_dev[i].irq_pending = 0;
        spin_unlock_irq(&chip->reg_lock);
 -      flush_scheduled_work();
  }
  
  static struct snd_pcm_ops azx_pcm_ops = {
@@@ -2335,10 -2335,10 +2335,10 @@@ static int __devinit azx_probe(struct p
                return -ENOENT;
        }
  
-       card = snd_card_new(index[dev], id[dev], THIS_MODULE, 0);
-       if (!card) {
+       err = snd_card_create(index[dev], id[dev], THIS_MODULE, 0, &card);
+       if (err < 0) {
                snd_printk(KERN_ERR SFX "Error creating card!\n");
-               return -ENOMEM;
+               return err;
        }
  
        err = azx_create(card, pci, dev, pci_id->driver_data, &chip);
diff --combined sound/pci/intel8x0.c
index e900cdc84849ae7a7e8eb1225c917ebfc8639dd3,671ff65db0298974494d7ca6e362c7a7559dc57e..608655e9275e5e27e846665dd6dff1f91a010fc1
@@@ -617,7 -617,7 +617,7 @@@ static int snd_intel8x0_ali_codec_semap
        int time = 100;
        if (chip->buggy_semaphore)
                return 0; /* just ignore ... */
 -      while (time-- && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
 +      while (--time && (igetdword(chip, ICHREG(ALI_CAS)) & ALI_CAS_SEM_BUSY))
                udelay(1);
        if (! time && ! chip->in_ac97_init)
                snd_printk(KERN_WARNING "ali_codec_semaphore timeout\n");
@@@ -3058,9 -3058,9 +3058,9 @@@ static int __devinit snd_intel8x0_probe
        int err;
        struct shortname_table *name;
  
-       card = snd_card_new(index, id, THIS_MODULE, 0);
-       if (card == NULL)
-               return -ENOMEM;
+       err = snd_card_create(index, id, THIS_MODULE, 0, &card);
+       if (err < 0)
+               return err;
  
        if (spdif_aclink < 0)
                spdif_aclink = check_default_spdif_aclink(pci);
diff --combined sound/ppc/snd_ps3.c
index ff321110ec029604bd8cd0e4862940fe1e1b88c4,ef2c3f417175aaec7b2cd656e43866f28f9289db..f361c26506aacefd1b5a683c232163294c6f9480
@@@ -477,7 -477,7 +477,7 @@@ static int snd_ps3_pcm_prepare(struct s
                card->dma_start_bus_addr[SND_PS3_CH_R] =
                        runtime->dma_addr + (runtime->dma_bytes / 2);
  
 -              pr_debug("%s: vaddr=%p bus=%#lx\n", __func__,
 +              pr_debug("%s: vaddr=%p bus=%#llx\n", __func__,
                         card->dma_start_vaddr[SND_PS3_CH_L],
                         card->dma_start_bus_addr[SND_PS3_CH_L]);
  
@@@ -969,11 -969,9 +969,9 @@@ static int __init snd_ps3_driver_probe(
        }
  
        /* create card instance */
-       the_card.card = snd_card_new(index, id, THIS_MODULE, 0);
-       if (!the_card.card) {
-               ret = -ENXIO;
+       ret = snd_card_create(index, id, THIS_MODULE, 0, &the_card.card);
+       if (ret < 0)
                goto clean_irq;
-       }
  
        strcpy(the_card.card->driver, "PS3");
        strcpy(the_card.card->shortname, "PS3");
                pr_info("%s: nullbuffer alloc failed\n", __func__);
                goto clean_preallocate;
        }
 -      pr_debug("%s: null vaddr=%p dma=%#lx\n", __func__,
 +      pr_debug("%s: null vaddr=%p dma=%#llx\n", __func__,
                 the_card.null_buffer_start_vaddr,
                 the_card.null_buffer_start_dma_addr);
        /* set default sample rate/word width */
diff --combined sound/soc/soc-core.c
index ec3f8bb4b51d9805d827279e8b025aeeb12d657a,318dfdd54d7f00065002d1d834e382bd827dea07..637f0d1ea98ed46811e960aefe13b866c3683355
@@@ -1311,17 -1311,17 +1311,17 @@@ int snd_soc_new_pcms(struct snd_soc_dev
  {
        struct snd_soc_codec *codec = socdev->codec;
        struct snd_soc_card *card = socdev->card;
-       int ret = 0, i;
+       int ret, i;
  
        mutex_lock(&codec->mutex);
  
        /* register a sound card */
-       codec->card = snd_card_new(idx, xid, codec->owner, 0);
-       if (!codec->card) {
+       ret = snd_card_create(idx, xid, codec->owner, 0, &codec->card);
+       if (ret < 0) {
                printk(KERN_ERR "asoc: can't create sound card for codec %s\n",
                        codec->name);
                mutex_unlock(&codec->mutex);
-               return -ENODEV;
+               return ret;
        }
  
        codec->card->dev = socdev->dev;
@@@ -1385,10 -1385,7 +1385,10 @@@ int snd_soc_init_card(struct snd_soc_de
  
        mutex_lock(&codec->mutex);
  #ifdef CONFIG_SND_SOC_AC97_BUS
 -      if (ac97) {
 +      /* Only instantiate AC97 if not already done by the adaptor
 +       * for the generic AC97 subsystem.
 +       */
 +      if (ac97 && strcmp(codec->name, "AC97") != 0) {
                ret = soc_ac97_dev_register(codec);
                if (ret < 0) {
                        printk(KERN_ERR "asoc: AC97 device register failed\n");
@@@ -1587,6 -1584,37 +1587,6 @@@ int snd_soc_put_enum_double(struct snd_
  }
  EXPORT_SYMBOL_GPL(snd_soc_put_enum_double);
  
 -/**
 - * snd_soc_info_value_enum_double - semi enumerated double mixer info callback
 - * @kcontrol: mixer control
 - * @uinfo: control element information
 - *
 - * Callback to provide information about a double semi enumerated
 - * mixer control.
 - *
 - * Semi enumerated mixer: the enumerated items are referred as values. Can be
 - * used for handling bitfield coded enumeration for example.
 - *
 - * Returns 0 for success.
 - */
 -int snd_soc_info_value_enum_double(struct snd_kcontrol *kcontrol,
 -      struct snd_ctl_elem_info *uinfo)
 -{
 -      struct soc_value_enum *e = (struct soc_value_enum *)
 -                      kcontrol->private_value;
 -
 -      uinfo->type = SNDRV_CTL_ELEM_TYPE_ENUMERATED;
 -      uinfo->count = e->shift_l == e->shift_r ? 1 : 2;
 -      uinfo->value.enumerated.items = e->max;
 -
 -      if (uinfo->value.enumerated.item > e->max - 1)
 -              uinfo->value.enumerated.item = e->max - 1;
 -      strcpy(uinfo->value.enumerated.name,
 -              e->texts[uinfo->value.enumerated.item]);
 -      return 0;
 -}
 -EXPORT_SYMBOL_GPL(snd_soc_info_value_enum_double);
 -
  /**
   * snd_soc_get_value_enum_double - semi enumerated double mixer get callback
   * @kcontrol: mixer control
@@@ -1603,7 -1631,8 +1603,7 @@@ int snd_soc_get_value_enum_double(struc
        struct snd_ctl_elem_value *ucontrol)
  {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
 -      struct soc_value_enum *e = (struct soc_value_enum *)
 -                      kcontrol->private_value;
 +      struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        unsigned short reg_val, val, mux;
  
        reg_val = snd_soc_read(codec, e->reg);
@@@ -1642,7 -1671,8 +1642,7 @@@ int snd_soc_put_value_enum_double(struc
        struct snd_ctl_elem_value *ucontrol)
  {
        struct snd_soc_codec *codec = snd_kcontrol_chip(kcontrol);
 -      struct soc_value_enum *e = (struct soc_value_enum *)
 -                      kcontrol->private_value;
 +      struct soc_enum *e = (struct soc_enum *)kcontrol->private_value;
        unsigned short val;
        unsigned short mask;
  
index 41c36b055f6b3f980b7c8217ce6b1496efe6bc43,55a9075cb097371e67a86fd3558e80047f128f1d..09aed2363cc94f466aca559730f64f03f5e0ac08
@@@ -42,7 -42,7 +42,7 @@@
  #endif
  
  MODULE_AUTHOR("Daniel Mack <daniel@caiaq.de>");
 -MODULE_DESCRIPTION("caiaq USB audio, version 1.3.9");
 +MODULE_DESCRIPTION("caiaq USB audio, version 1.3.10");
  MODULE_LICENSE("GPL");
  MODULE_SUPPORTED_DEVICE("{{Native Instruments, RigKontrol2},"
                         "{Native Instruments, RigKontrol3},"
@@@ -336,9 -336,10 +336,10 @@@ static void __devinit setup_card(struc
                log("Unable to set up control system (ret=%d)\n", ret);
  }
  
- static struct snd_card* create_card(struct usb_device* usb_dev)
+ static int create_card(struct usb_device* usb_dev, struct snd_card **cardp)
  {
        int devnum;
+       int err;
        struct snd_card *card;
        struct snd_usb_caiaqdev *dev;
  
                        break;
  
        if (devnum >= SNDRV_CARDS)
-               return NULL;
+               return -ENODEV;
  
-       card = snd_card_new(index[devnum], id[devnum], THIS_MODULE, 
-                                       sizeof(struct snd_usb_caiaqdev));
-       if (!card)
-               return NULL;
+       err = snd_card_create(index[devnum], id[devnum], THIS_MODULE, 
+                             sizeof(struct snd_usb_caiaqdev), &card);
+       if (err < 0)
+               return err;
  
        dev = caiaqdev(card);
        dev->chip.dev = usb_dev;
        spin_lock_init(&dev->spinlock);
        snd_card_set_dev(card, &usb_dev->dev);
  
-       return card;
+       *cardp = card;
+       return 0;
  }
  
  static int __devinit init_card(struct snd_usb_caiaqdev *dev)
@@@ -441,10 -443,10 +443,10 @@@ static int __devinit snd_probe(struct u
        struct snd_card *card;
        struct usb_device *device = interface_to_usbdev(intf);
        
-       card = create_card(device);
+       ret = create_card(device, &card);
        
-       if (!card)
-               return -ENOMEM;
+       if (ret < 0)
+               return ret;
                        
        usb_set_intfdata(intf, card);
        ret = init_card(caiaqdev(card));
diff --combined sound/usb/usbaudio.c
index 2ab83129d9b04b846c7fd15a076a53cdef1d1c21,eec32e1a3020ccfe23798e005e0a97a636676b2b..f8c59210403e969baff5bf6eb8801a3ff4466eae
@@@ -2966,7 -2966,6 +2966,7 @@@ static int create_fixed_stream_quirk(st
                return -EINVAL;
        }
        alts = &iface->altsetting[fp->altset_idx];
 +      fp->maxpacksize = le16_to_cpu(get_endpoint(alts, 0)->wMaxPacketSize);
        usb_set_interface(chip->dev, fp->iface, 0);
        init_usb_pitch(chip->dev, fp->iface, alts, fp);
        init_usb_sample_rate(chip->dev, fp->iface, alts, fp, fp->rate_max);
@@@ -3464,10 -3463,10 +3464,10 @@@ static int snd_usb_audio_create(struct 
                return -ENXIO;
        }
  
-       card = snd_card_new(index[idx], id[idx], THIS_MODULE, 0);
-       if (card == NULL) {
+       err = snd_card_create(index[idx], id[idx], THIS_MODULE, 0, &card);
+       if (err < 0) {
                snd_printk(KERN_ERR "cannot create card instance %d\n", idx);
-               return -ENOMEM;
+               return err;
        }
  
        chip = kzalloc(sizeof(*chip), GFP_KERNEL);