Changeset 713


Ignore:
Timestamp:
Aug 7, 2022, 1:51:08 AM (3 years ago)
Author:
Paul Smedley
Message:

Fixes

Location:
GPL/branches/uniaud32-next
Files:
11 edited

Legend:

Unmodified
Added
Removed
  • GPL/branches/uniaud32-next/alsa-kernel/core/memalloc.c

    r710 r713  
    334334}
    335335#endif
     336
     337/* called by devres */
     338static void __snd_release_pages(struct device *dev, void *res)
     339{
     340        snd_dma_free_pages(res);
     341}
     342
     343/**
     344 * snd_devm_alloc_pages - allocate the buffer and manage with devres
     345 * @dev: the device pointer
     346 * @type: the DMA buffer type
     347 * @size: the buffer size to allocate
     348 *
     349 * Allocate buffer pages depending on the given type and manage using devres.
     350 * The pages will be released automatically at the device removal.
     351 *
     352 * Unlike snd_dma_alloc_pages(), this function requires the real device pointer,
     353 * hence it can't work with SNDRV_DMA_TYPE_CONTINUOUS or
     354 * SNDRV_DMA_TYPE_VMALLOC type.
     355 *
     356 * The function returns the snd_dma_buffer object at success, or NULL if failed.
     357 */
     358struct snd_dma_buffer *
     359snd_devm_alloc_pages(struct device *dev, int type, size_t size)
     360{
     361        struct snd_dma_buffer *dmab;
     362        int err;
     363
     364        if (WARN_ON(type == SNDRV_DMA_TYPE_CONTINUOUS ||
     365                    type == SNDRV_DMA_TYPE_VMALLOC))
     366                return NULL;
     367
     368        dmab = devres_alloc(__snd_release_pages, sizeof(*dmab), GFP_KERNEL);
     369        if (!dmab)
     370                return NULL;
     371
     372        err = snd_dma_alloc_pages(type, dev, size, dmab);
     373        if (err < 0) {
     374                devres_free(dmab);
     375                return NULL;
     376        }
     377
     378        devres_add(dev, dmab);
     379        return dmab;
     380}
     381EXPORT_SYMBOL_GPL(snd_devm_alloc_pages);
  • GPL/branches/uniaud32-next/alsa-kernel/core/pcm_native.c

    r711 r713  
    677677}
    678678
    679 #ifndef TARGET_OS2
    680679/* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise
    681680 * block the further r/w operations
     
    683682static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime)
    684683{
     684#ifndef TARGET_OS2
    685685        if (!atomic_dec_unless_positive(&runtime->buffer_accessing))
    686686                return -EBUSY;
     687#endif
    687688        mutex_lock(&runtime->buffer_mutex);
    688689        return 0; /* keep buffer_mutex, unlocked by below */
    689690}
    690 #endif
    691691
    692692/* release buffer_mutex and clear r/w access flag */
     
    714714                return -ENXIO;
    715715        runtime = substream->runtime;
    716 #ifndef TARGET_OS2
    717716        err = snd_pcm_buffer_access_lock(runtime);
    718717        if (err < 0)
    719718                return err;
    720 #endif
    721719        snd_pcm_stream_lock_irq(substream);
    722720        switch (runtime->status->state) {
     
    881879                return -ENXIO;
    882880        runtime = substream->runtime;
    883 #ifndef TARGET_OS2
    884881        result = snd_pcm_buffer_access_lock(runtime);
    885882        if (result < 0)
    886883                return result;
    887 #endif
    888884        snd_pcm_stream_lock_irq(substream);
    889885        switch (runtime->status->state) {
     
    14101406        /* Guarantee the group members won't change during non-atomic action */
    14111407        down_read(&snd_pcm_link_rwsem);
    1412 #ifndef TARGET_OS2
    14131408        res = snd_pcm_buffer_access_lock(substream->runtime);
    14141409        if (res < 0)
    14151410                goto unlock;
    1416 #endif
    14171411        if (snd_pcm_stream_linked(substream))
    14181412                res = snd_pcm_action_group(ops, substream, state, false);
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ca0106/ca0106_main.c

    r711 r713  
    16121612
    16131613        /* This stores the periods table. */
    1614 #ifndef TARGET_OS2
    16151614        chip->buffer = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, 1024);
    16161615        if (!chip->buffer)
    16171616                return -ENOMEM;
    1618 #else
    1619         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
    1620                                 1024, &chip->buffer) < 0) {
    1621                 snd_ca0106_free(chip);
    1622                 return -ENOMEM;
    1623         }
    1624 #endif
    16251617        pci_set_master(pci);
    16261618        /* read serial */
  • GPL/branches/uniaud32-next/alsa-kernel/pci/emu10k1/emu10k1.c

    r710 r713  
    140140                return err;
    141141        /* This stores the periods table. */
    142 #ifndef TARGET_OS2
    143142        if (emu->card_capabilities->ca0151_chip) { /* P16V */   
    144143                emu->p16v_buffer =
     
    147146                        return -ENOMEM;
    148147        }
    149 #else
    150         if (emu->card_capabilities->ca0151_chip) { /* P16V */   
    151                 err = snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
    152                                           1024, &emu->p16v_buffer);
    153                 if (err < 0)
    154                         return -ENOMEM;
    155         }
    156 #endif
    157148        err = snd_emu10k1_mixer(emu, 0, 3);
    158149        if (err < 0)
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ens1370.c

    r711 r713  
    20452045                        KBUILD_MODNAME, ensoniq)) {
    20462046                dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq);
    2047                 snd_ensoniq_free(ensoniq);
     2047                snd_ensoniq_free(card);
    20482048                return -EBUSY;
    20492049        }
     
    20522052        card->sync_irq = ensoniq->irq;
    20532053#ifdef CHIP1370
    2054 #ifndef TARGET_OS2
    20552054        ensoniq->dma_bug =
    20562055                snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, 16);
    20572056        if (!ensoniq->dma_bug)
    20582057                return -ENOMEM;
    2059 #else
    2060         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &pci->dev,
    2061                                 16, &ensoniq->dma_bug) < 0) {
    2062                 dev_err(card->dev, "unable to allocate space for phantom area - dma_bug\n");
    2063                 snd_ensoniq_free(ensoniq);
    2064                 return -EBUSY;
    2065         }
    2066 #endif
    20672058#endif
    20682059        pci_set_master(pci);
  • GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_codec.c

    r711 r713  
    768768        list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list, struct hda_pcm) {
    769769                list_del(&pcm->list);
     770#ifndef TARGET_OS2
     771                /* don't do this on OS/2 - results in the device being free'd and can't be re-opened */
    770772                if (pcm->pcm)
    771773                        snd_device_free(pcm->codec->card, pcm->pcm);
     774#endif
    772775                clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits);
    773776                kfree(pcm->name);
  • GPL/branches/uniaud32-next/alsa-kernel/pci/intel8x0.c

    r711 r713  
    30123012        /* allocate buffer descriptor lists */
    30133013        /* the start of each lists must be aligned to 8 bytes */
    3014 #ifndef TARGET_OS2
    30153014        chip->bdbars = snd_devm_alloc_pages(&pci->dev, intel8x0_dma_type(chip),
    30163015                                            chip->bdbars_count * sizeof(u32) *
     
    30183017        if (!chip->bdbars)
    30193018                return -ENOMEM;
    3020 #else
    3021         if (snd_dma_alloc_pages(intel8x0_dma_type(chip), &pci->dev,
    3022                                 chip->bdbars_count * sizeof(u32) * ICH_MAX_FRAGS * 2,
    3023                                 &chip->bdbars) < 0) {
    3024                 snd_intel8x0_free(chip);
    3025                 dev_err(card->dev, "cannot allocate buffer descriptors\n");
    3026                 return -ENOMEM;
    3027         }
    3028 #endif
    30293019        /* tables must be aligned to 8 bytes here, but the kernel pages
    30303020           are much bigger, so we don't care (on i386) */
  • GPL/branches/uniaud32-next/alsa-kernel/pci/trident/trident_main.c

    r710 r713  
    33313331           32kB region and correct offset when necessary */
    33323332
    3333 #ifndef TARGET_OS2
    33343333        trident->tlb.buffer =
    33353334                snd_devm_alloc_pages(&trident->pci->dev, SNDRV_DMA_TYPE_DEV,
     
    33393338                return -ENOMEM;
    33403339        }
    3341 #else
    3342         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &trident->pci->dev,
    3343                                 2 * SNDRV_TRIDENT_MAX_PAGES * 4, &trident->tlb.buffer) < 0) {
    3344                 dev_err(trident->card->dev, "unable to allocate TLB buffer\n");
    3345                 return -ENOMEM;
    3346         }
    3347 #endif
    33483340        trident->tlb.entries = (__le32 *)ALIGN((unsigned long)trident->tlb.buffer->area, SNDRV_TRIDENT_MAX_PAGES * 4);
    33493341        trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer->addr, SNDRV_TRIDENT_MAX_PAGES * 4);
    33503342
    33513343        /* allocate and setup silent page and initialise TLB entries */
    3352 #ifndef TARGET_OS2
    33533344        trident->tlb.silent_page =
    33543345                snd_devm_alloc_pages(&trident->pci->dev, SNDRV_DMA_TYPE_DEV,
     
    33583349                return -ENOMEM;
    33593350        }
    3360 #else
    3361         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &trident->pci->dev,
    3362                                 SNDRV_TRIDENT_PAGE_SIZE, &trident->tlb.silent_page) < 0) {
    3363                 dev_err(trident->card->dev, "unable to allocate silent page\n");
    3364                 return -ENOMEM;
    3365         }
    3366 #endif
    33673351        memset(trident->tlb.silent_page->area, 0, SNDRV_TRIDENT_PAGE_SIZE);
    33683352        for (i = 0; i < SNDRV_TRIDENT_MAX_PAGES; i++)
  • GPL/branches/uniaud32-next/alsa-kernel/pci/ymfpci/ymfpci_main.c

    r710 r713  
    21212121        /* work_ptr must be aligned to 256 bytes, but it's already
    21222122           covered with the kernel page allocation mechanism */
    2123 #ifndef TARGET_OS2
    21242123        chip->work_ptr = snd_devm_alloc_pages(&chip->pci->dev,
    21252124                                              SNDRV_DMA_TYPE_DEV, size);
    21262125        if (!chip->work_ptr)
    21272126                return -ENOMEM;
    2128 #else
    2129         if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,
    2130                                 size, &chip->work_ptr) < 0)
    2131                 return -ENOMEM;
    2132 #endif
    21332127        ptr = chip->work_ptr->area;
    21342128        ptr_addr = chip->work_ptr->addr;
  • GPL/branches/uniaud32-next/include/linux/pci.h

    r710 r713  
    770770
    771771#define dev_is_pci(d) (true)
    772 #define pcim_enable_device pci_enable_device
     772int pcim_enable_device(struct pci_dev *pdev);
    773773#define pcim_iomap pci_iomap
    774774#endif /* LINUX_PCI_H */
  • GPL/branches/uniaud32-next/lib32/pci.c

    r671 r713  
    455455
    456456/**
     457 * pcim_enable_device - Managed pci_enable_device()
     458 * @pdev: PCI device to be initialized
     459 *
     460 * Managed pci_enable_device().
     461 */
     462int pcim_enable_device(struct pci_dev *pdev)
     463{
     464        int rc;
     465
     466        rc = pci_enable_device(pdev);
     467        return rc;
     468}
     469
     470/**
    457471 *  Initialize device before it's used by a driver. Ask low-level code
    458472 *  to enable I/O and memory. Wake up the device if it was suspended.
Note: See TracChangeset for help on using the changeset viewer.