Changeset 713
- Timestamp:
- Aug 7, 2022, 1:51:08 AM (3 years ago)
- Location:
- GPL/branches/uniaud32-next
- Files:
-
- 11 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/alsa-kernel/core/memalloc.c
r710 r713 334 334 } 335 335 #endif 336 337 /* called by devres */ 338 static 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 */ 358 struct snd_dma_buffer * 359 snd_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 } 381 EXPORT_SYMBOL_GPL(snd_devm_alloc_pages); -
GPL/branches/uniaud32-next/alsa-kernel/core/pcm_native.c
r711 r713 677 677 } 678 678 679 #ifndef TARGET_OS2680 679 /* acquire buffer_mutex; if it's in r/w operation, return -EBUSY, otherwise 681 680 * block the further r/w operations … … 683 682 static int snd_pcm_buffer_access_lock(struct snd_pcm_runtime *runtime) 684 683 { 684 #ifndef TARGET_OS2 685 685 if (!atomic_dec_unless_positive(&runtime->buffer_accessing)) 686 686 return -EBUSY; 687 #endif 687 688 mutex_lock(&runtime->buffer_mutex); 688 689 return 0; /* keep buffer_mutex, unlocked by below */ 689 690 } 690 #endif691 691 692 692 /* release buffer_mutex and clear r/w access flag */ … … 714 714 return -ENXIO; 715 715 runtime = substream->runtime; 716 #ifndef TARGET_OS2717 716 err = snd_pcm_buffer_access_lock(runtime); 718 717 if (err < 0) 719 718 return err; 720 #endif721 719 snd_pcm_stream_lock_irq(substream); 722 720 switch (runtime->status->state) { … … 881 879 return -ENXIO; 882 880 runtime = substream->runtime; 883 #ifndef TARGET_OS2884 881 result = snd_pcm_buffer_access_lock(runtime); 885 882 if (result < 0) 886 883 return result; 887 #endif888 884 snd_pcm_stream_lock_irq(substream); 889 885 switch (runtime->status->state) { … … 1410 1406 /* Guarantee the group members won't change during non-atomic action */ 1411 1407 down_read(&snd_pcm_link_rwsem); 1412 #ifndef TARGET_OS21413 1408 res = snd_pcm_buffer_access_lock(substream->runtime); 1414 1409 if (res < 0) 1415 1410 goto unlock; 1416 #endif1417 1411 if (snd_pcm_stream_linked(substream)) 1418 1412 res = snd_pcm_action_group(ops, substream, state, false); -
GPL/branches/uniaud32-next/alsa-kernel/pci/ca0106/ca0106_main.c
r711 r713 1612 1612 1613 1613 /* This stores the periods table. */ 1614 #ifndef TARGET_OS21615 1614 chip->buffer = snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, 1024); 1616 1615 if (!chip->buffer) 1617 1616 return -ENOMEM; 1618 #else1619 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 #endif1625 1617 pci_set_master(pci); 1626 1618 /* read serial */ -
GPL/branches/uniaud32-next/alsa-kernel/pci/emu10k1/emu10k1.c
r710 r713 140 140 return err; 141 141 /* This stores the periods table. */ 142 #ifndef TARGET_OS2143 142 if (emu->card_capabilities->ca0151_chip) { /* P16V */ 144 143 emu->p16v_buffer = … … 147 146 return -ENOMEM; 148 147 } 149 #else150 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 #endif157 148 err = snd_emu10k1_mixer(emu, 0, 3); 158 149 if (err < 0) -
GPL/branches/uniaud32-next/alsa-kernel/pci/ens1370.c
r711 r713 2045 2045 KBUILD_MODNAME, ensoniq)) { 2046 2046 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); 2047 snd_ensoniq_free( ensoniq);2047 snd_ensoniq_free(card); 2048 2048 return -EBUSY; 2049 2049 } … … 2052 2052 card->sync_irq = ensoniq->irq; 2053 2053 #ifdef CHIP1370 2054 #ifndef TARGET_OS22055 2054 ensoniq->dma_bug = 2056 2055 snd_devm_alloc_pages(&pci->dev, SNDRV_DMA_TYPE_DEV, 16); 2057 2056 if (!ensoniq->dma_bug) 2058 2057 return -ENOMEM; 2059 #else2060 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 #endif2067 2058 #endif 2068 2059 pci_set_master(pci); -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_codec.c
r711 r713 768 768 list_for_each_entry_safe(pcm, n, &codec->pcm_list_head, list, struct hda_pcm) { 769 769 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 */ 770 772 if (pcm->pcm) 771 773 snd_device_free(pcm->codec->card, pcm->pcm); 774 #endif 772 775 clear_bit(pcm->device, pcm->codec->bus->pcm_dev_bits); 773 776 kfree(pcm->name); -
GPL/branches/uniaud32-next/alsa-kernel/pci/intel8x0.c
r711 r713 3012 3012 /* allocate buffer descriptor lists */ 3013 3013 /* the start of each lists must be aligned to 8 bytes */ 3014 #ifndef TARGET_OS23015 3014 chip->bdbars = snd_devm_alloc_pages(&pci->dev, intel8x0_dma_type(chip), 3016 3015 chip->bdbars_count * sizeof(u32) * … … 3018 3017 if (!chip->bdbars) 3019 3018 return -ENOMEM; 3020 #else3021 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 #endif3029 3019 /* tables must be aligned to 8 bytes here, but the kernel pages 3030 3020 are much bigger, so we don't care (on i386) */ -
GPL/branches/uniaud32-next/alsa-kernel/pci/trident/trident_main.c
r710 r713 3331 3331 32kB region and correct offset when necessary */ 3332 3332 3333 #ifndef TARGET_OS23334 3333 trident->tlb.buffer = 3335 3334 snd_devm_alloc_pages(&trident->pci->dev, SNDRV_DMA_TYPE_DEV, … … 3339 3338 return -ENOMEM; 3340 3339 } 3341 #else3342 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 #endif3348 3340 trident->tlb.entries = (__le32 *)ALIGN((unsigned long)trident->tlb.buffer->area, SNDRV_TRIDENT_MAX_PAGES * 4); 3349 3341 trident->tlb.entries_dmaaddr = ALIGN(trident->tlb.buffer->addr, SNDRV_TRIDENT_MAX_PAGES * 4); 3350 3342 3351 3343 /* allocate and setup silent page and initialise TLB entries */ 3352 #ifndef TARGET_OS23353 3344 trident->tlb.silent_page = 3354 3345 snd_devm_alloc_pages(&trident->pci->dev, SNDRV_DMA_TYPE_DEV, … … 3358 3349 return -ENOMEM; 3359 3350 } 3360 #else3361 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 #endif3367 3351 memset(trident->tlb.silent_page->area, 0, SNDRV_TRIDENT_PAGE_SIZE); 3368 3352 for (i = 0; i < SNDRV_TRIDENT_MAX_PAGES; i++) -
GPL/branches/uniaud32-next/alsa-kernel/pci/ymfpci/ymfpci_main.c
r710 r713 2121 2121 /* work_ptr must be aligned to 256 bytes, but it's already 2122 2122 covered with the kernel page allocation mechanism */ 2123 #ifndef TARGET_OS22124 2123 chip->work_ptr = snd_devm_alloc_pages(&chip->pci->dev, 2125 2124 SNDRV_DMA_TYPE_DEV, size); 2126 2125 if (!chip->work_ptr) 2127 2126 return -ENOMEM; 2128 #else2129 if (snd_dma_alloc_pages(SNDRV_DMA_TYPE_DEV, &chip->pci->dev,2130 size, &chip->work_ptr) < 0)2131 return -ENOMEM;2132 #endif2133 2127 ptr = chip->work_ptr->area; 2134 2128 ptr_addr = chip->work_ptr->addr; -
GPL/branches/uniaud32-next/include/linux/pci.h
r710 r713 770 770 771 771 #define dev_is_pci(d) (true) 772 #define pcim_enable_device pci_enable_device 772 int pcim_enable_device(struct pci_dev *pdev); 773 773 #define pcim_iomap pci_iomap 774 774 #endif /* LINUX_PCI_H */ -
GPL/branches/uniaud32-next/lib32/pci.c
r671 r713 455 455 456 456 /** 457 * pcim_enable_device - Managed pci_enable_device() 458 * @pdev: PCI device to be initialized 459 * 460 * Managed pci_enable_device(). 461 */ 462 int pcim_enable_device(struct pci_dev *pdev) 463 { 464 int rc; 465 466 rc = pci_enable_device(pdev); 467 return rc; 468 } 469 470 /** 457 471 * Initialize device before it's used by a driver. Ask low-level code 458 472 * to enable I/O and memory. Wake up the device if it was suspended.
Note:
See TracChangeset
for help on using the changeset viewer.