Changeset 745
- Timestamp:
- Sep 18, 2022, 11:24:34 AM (3 years ago)
- Location:
- GPL/branches/uniaud32-next
- Files:
-
- 10 edited
Legend:
- Unmodified
- Added
- Removed
-
GPL/branches/uniaud32-next/alsa-kernel/pci/atiixp.c
r715 r745 564 564 dev_dbg(&pci->dev, "atiixp quirk for %s. Forcing codec %d\n", 565 565 snd_pci_quirk_name(q), q->value); 566 567 566 return q->value; 568 567 } … … 1563 1562 chip->pci = pci; 1564 1563 chip->irq = -1; 1565 #ifndef TARGET_OS21566 1564 err = pcim_iomap_regions(pci, 1 << 0, "ATI IXP AC97"); 1567 1565 if (err < 0) 1568 1566 return err; 1569 #else1570 err = pci_request_regions(pci, "ATI IXP AC97");1571 if (err < 0) {1572 pci_disable_device(pci);1573 kfree(chip);1574 return err;1575 }1576 #endif1577 1567 chip->addr = pci_resource_start(pci, 0); 1578 #ifndef TARGET_OS21579 1568 chip->remap_addr = pcim_iomap_table(pci)[0]; 1580 #else 1581 chip->remap_addr = pci_ioremap_bar(pci, 0); 1582 #endif 1569 1583 1570 if (devm_request_irq(&pci->dev, pci->irq, snd_atiixp_interrupt, 1584 1571 IRQF_SHARED, KBUILD_MODNAME, chip)) { -
GPL/branches/uniaud32-next/alsa-kernel/pci/bt87x.c
r711 r745 706 706 spin_lock_init(&chip->reg_lock); 707 707 708 #ifndef TARGET_OS2709 708 err = pcim_iomap_regions(pci, 1 << 0, "Bt87x audio"); 710 709 if (err < 0) 711 710 return err; 712 711 chip->mmio = pcim_iomap_table(pci)[0]; 713 #else 714 err = pci_request_regions(pci, "Bt87x audio"); 715 if (err < 0) { 716 kfree(chip); 717 pci_disable_device(pci); 718 return err; 719 } 720 chip->mmio = pci_ioremap_bar(pci, 0); 721 #endif 712 722 713 chip->reg_control = CTL_A_PWRDN | CTL_DA_ES2 | 723 714 CTL_PKTP_16 | (15 << CTL_DA_SDR_SHIFT); -
GPL/branches/uniaud32-next/alsa-kernel/pci/cs4281.c
r715 r745 1309 1309 chip->dual_codec = dual_codec; 1310 1310 1311 #ifndef TARGET_OS21312 1311 err = pcim_iomap_regions(pci, 0x03, "CS4281"); /* 2 BARs */ 1313 1312 if (err < 0) 1314 1313 return err; 1315 #else1316 err = pci_request_regions(pci, "CS4281");1317 if (err < 0) {1318 kfree(chip);1319 pci_disable_device(pci);1320 return err;1321 }1322 #endif1323 1314 chip->ba0_addr = pci_resource_start(pci, 0); 1324 1315 chip->ba1_addr = pci_resource_start(pci, 1); 1325 1316 1326 #ifndef TARGET_OS21327 1317 chip->ba0 = pcim_iomap_table(pci)[0]; 1328 1318 chip->ba1 = pcim_iomap_table(pci)[1]; 1329 #else 1330 chip->ba0 = pci_ioremap_bar(pci, 0); 1331 chip->ba1 = pci_ioremap_bar(pci, 1); 1332 #endif 1319 1333 1320 if (devm_request_irq(&pci->dev, pci->irq, snd_cs4281_interrupt, 1334 1321 IRQF_SHARED, KBUILD_MODNAME, chip)) { -
GPL/branches/uniaud32-next/alsa-kernel/pci/cs5530.c
r710 r745 100 100 return err; 101 101 chip->pci_base = pci_resource_start(pci, 0); 102 #ifndef TARGET_OS2103 102 mem = pcim_iomap_table(pci)[0]; 104 #else105 mem = pci_ioremap_bar(pci, 0);106 #endif107 103 map = readw(mem + 0x18); 108 104 -
GPL/branches/uniaud32-next/alsa-kernel/pci/fm801.c
r711 r745 1186 1186 } 1187 1187 1188 1189 1188 static int snd_fm801_create(struct snd_card *card, 1190 1189 struct pci_dev *pci, … … 1195 1194 int err; 1196 1195 1197 #ifndef TARGET_OS21198 1196 err = pcim_enable_device(pci); 1199 1197 if (err < 0) 1200 1198 return err; 1201 #else1202 if ((err = pci_enable_device(pci)) < 0)1203 return err;1204 #endif1205 1199 spin_lock_init(&chip->reg_lock); 1206 1200 chip->card = card; … … 1231 1225 1232 1226 if ((chip->tea575x_tuner & TUNER_ONLY) == 0) { 1233 #ifndef TARGET_OS21234 1227 if (devm_request_irq(&pci->dev, pci->irq, snd_fm801_interrupt, 1235 1228 IRQF_SHARED, KBUILD_MODNAME, chip)) { 1236 #else1237 if (request_irq(pci->irq, snd_fm801_interrupt, IRQF_SHARED,1238 KBUILD_MODNAME, chip)) {1239 #endif1240 1229 dev_err(card->dev, "unable to grab IRQ %d\n", pci->irq); 1241 1230 return -EBUSY; -
GPL/branches/uniaud32-next/alsa-kernel/pci/hda/hda_intel.c
r732 r745 1891 1891 #endif 1892 1892 1893 #ifndef TARGET_OS21894 1893 err = pcim_iomap_regions(pci, 1 << 0, "ICH HD audio"); 1895 #else1896 err = pci_request_regions(pci, "ICH HD audio");1897 #endif1898 1894 if (err < 0) 1899 1895 return err; 1900 1896 1901 1897 bus->addr = pci_resource_start(pci, 0); 1902 #ifndef TARGET_OS21903 1898 bus->remap_addr = pcim_iomap_table(pci)[0]; 1904 #else 1905 bus->remap_addr = pci_ioremap_bar(pci, 0); 1906 #endif 1899 1907 1900 if (chip->driver_type == AZX_DRIVER_SKL) 1908 1901 snd_hdac_bus_parse_capabilities(bus); -
GPL/branches/uniaud32-next/include/linux/pci.h
r732 r745 781 781 #define dev_is_pci(d) (true) 782 782 int pcim_enable_device(struct pci_dev *pdev); 783 #define pcim_iomap pci_iomap784 783 int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name); 785 784 … … 789 788 } 790 789 void pci_intx(struct pci_dev *pdev, int enable); 790 #define PCI_STD_NUM_BARS 6 /* Number of standard BARs */ 791 int __must_check pci_request_region(struct pci_dev *, int, char *); 792 void pci_release_region(struct pci_dev *, int); 793 void __iomem * const *pcim_iomap_table(struct pci_dev *pdev); 791 794 792 795 #endif /* LINUX_PCI_H */ -
GPL/branches/uniaud32-next/include/linux/pgtable.h
r628 r745 2 2 #define _LINUX_PGTABLE_H 3 3 4 4 5 #endif /* _LINUX_PGTABLE_H */ -
GPL/branches/uniaud32-next/include/linux/vmalloc.h
r662 r745 8 8 #include <asm/page.h> 9 9 10 #define VM_MAP 0x00000004 /* vmap()ed pages */ 10 11 11 12 struct vm_struct { -
GPL/branches/uniaud32-next/lib32/devres.c
r720 r745 9 9 10 10 #include <linux/device.h> 11 #include <linux/pci.h> 11 12 #include <linux/module.h> 12 13 #include <linux/slab.h> … … 310 311 return NULL; 311 312 } 313 314 /** 315 * devres_get - Find devres, if non-existent, add one atomically 316 * @dev: Device to lookup or add devres for 317 * @new_res: Pointer to new initialized devres to add if not found 318 * @match: Match function (optional) 319 * @match_data: Data for the match function 320 * 321 * Find the latest devres of @dev which has the same release function 322 * as @new_res and for which @match return 1. If found, @new_res is 323 * freed; otherwise, @new_res is added atomically. 324 * 325 * RETURNS: 326 * Pointer to found or added devres. 327 */ 328 void * devres_get(struct device *dev, void *new_res, 329 dr_match_t match, void *match_data) 330 { 331 struct devres *new_dr = container_of(new_res, struct devres, data); 332 struct devres *dr; 333 unsigned long flags; 334 335 spin_lock_irqsave(&dev->devres_lock, flags); 336 dr = find_dr(dev, new_dr->node.release, match, match_data); 337 if (!dr) { 338 add_dr(dev, &new_dr->node); 339 dr = new_dr; 340 new_res = NULL; 341 } 342 spin_unlock_irqrestore(&dev->devres_lock, flags); 343 devres_free(new_res); 344 345 return dr->data; 346 } 347 EXPORT_SYMBOL_GPL(devres_get); 312 348 313 349 /* … … 472 508 } 473 509 EXPORT_SYMBOL(devm_ioremap); 510 511 /** 512 * devm_kvasprintf - Allocate resource managed space and format a string 513 * into that. 514 * @dev: Device to allocate memory for 515 * @gfp: the GFP mask used in the devm_kmalloc() call when 516 * allocating memory 517 * @fmt: The printf()-style format string 518 * @ap: Arguments for the format string 519 * RETURNS: 520 * Pointer to allocated string on success, NULL on failure. 521 */ 522 char *devm_kvasprintf(struct device *dev, gfp_t gfp, const char *fmt, 523 va_list ap) 524 { 525 unsigned int len; 526 char *p; 527 va_list aq; 528 529 va_copy(aq, ap); 530 len = vsnprintf(NULL, 0, fmt, aq); 531 va_end(aq); 532 533 p = devm_kmalloc(dev, len+1, gfp); 534 if (!p) 535 return NULL; 536 537 vsnprintf(p, len+1, fmt, ap); 538 539 return p; 540 } 541 EXPORT_SYMBOL(devm_kvasprintf); 542 /** 543 * devm_kasprintf - Allocate resource managed space and format a string 544 * into that. 545 * @dev: Device to allocate memory for 546 * @gfp: the GFP mask used in the devm_kmalloc() call when 547 * allocating memory 548 * @fmt: The printf()-style format string 549 * @...: Arguments for the format string 550 * RETURNS: 551 * Pointer to allocated string on success, NULL on failure. 552 */ 553 char *devm_kasprintf(struct device *dev, gfp_t gfp, const char *fmt, ...) 554 { 555 va_list ap; 556 char *p; 557 558 va_start(ap, fmt); 559 p = devm_kvasprintf(dev, gfp, fmt, ap); 560 va_end(ap); 561 562 return p; 563 } 564 EXPORT_SYMBOL_GPL(devm_kasprintf); 565 566 /* 567 * PCI iomap devres 568 */ 569 #define PCIM_IOMAP_MAX PCI_STD_NUM_BARS 570 571 struct pcim_iomap_devres { 572 void __iomem *table[PCIM_IOMAP_MAX]; 573 }; 574 575 static void pcim_iomap_release(struct device *gendev, void *res) 576 { 577 struct pci_dev *dev = to_pci_dev(gendev); 578 struct pcim_iomap_devres *this = res; 579 int i; 580 581 for (i = 0; i < PCIM_IOMAP_MAX; i++) 582 if (this->table[i]) 583 pci_iounmap(dev, this->table[i]); 584 } 585 586 /** 587 * pcim_iomap_table - access iomap allocation table 588 * @pdev: PCI device to access iomap table for 589 * 590 * Access iomap allocation table for @dev. If iomap table doesn't 591 * exist and @pdev is managed, it will be allocated. All iomaps 592 * recorded in the iomap table are automatically unmapped on driver 593 * detach. 594 * 595 * This function might sleep when the table is first allocated but can 596 * be safely called without context and guaranteed to succeed once 597 * allocated. 598 */ 599 void __iomem * const *pcim_iomap_table(struct pci_dev *pdev) 600 { 601 struct pcim_iomap_devres *dr, *new_dr; 602 603 dr = devres_find(&pdev->dev, pcim_iomap_release, NULL, NULL); 604 if (dr) 605 return dr->table; 606 607 new_dr = devres_alloc(pcim_iomap_release, sizeof(*new_dr), GFP_KERNEL); 608 if (!new_dr) 609 return NULL; 610 dr = devres_get(&pdev->dev, new_dr, NULL, NULL); 611 return dr->table; 612 } 613 EXPORT_SYMBOL(pcim_iomap_table); 614 615 /** 616 * pcim_iomap - Managed pcim_iomap() 617 * @pdev: PCI device to iomap for 618 * @bar: BAR to iomap 619 * @maxlen: Maximum length of iomap 620 * 621 * Managed pci_iomap(). Map is automatically unmapped on driver 622 * detach. 623 */ 624 void __iomem *pcim_iomap(struct pci_dev *pdev, int bar, unsigned long maxlen) 625 { 626 void __iomem **tbl; 627 628 BUG_ON(bar >= PCIM_IOMAP_MAX); 629 630 tbl = (void __iomem **)pcim_iomap_table(pdev); 631 if (!tbl || tbl[bar]) /* duplicate mappings not allowed */ 632 return NULL; 633 634 tbl[bar] = pci_iomap(pdev, bar, maxlen); 635 return tbl[bar]; 636 } 637 EXPORT_SYMBOL(pcim_iomap); 638 639 /** 640 * pcim_iounmap - Managed pci_iounmap() 641 * @pdev: PCI device to iounmap for 642 * @addr: Address to unmap 643 * 644 * Managed pci_iounmap(). @addr must have been mapped using pcim_iomap(). 645 */ 646 void pcim_iounmap(struct pci_dev *pdev, void __iomem *addr) 647 { 648 void __iomem **tbl; 649 int i; 650 651 pci_iounmap(pdev, addr); 652 653 tbl = (void __iomem **)pcim_iomap_table(pdev); 654 BUG_ON(!tbl); 655 656 for (i = 0; i < PCIM_IOMAP_MAX; i++) 657 if (tbl[i] == addr) { 658 tbl[i] = NULL; 659 return; 660 } 661 WARN_ON(1); 662 } 663 EXPORT_SYMBOL(pcim_iounmap); 664 665 /** 666 * pcim_iomap_regions - Request and iomap PCI BARs 667 * @pdev: PCI device to map IO resources for 668 * @mask: Mask of BARs to request and iomap 669 * @name: Name used when requesting regions 670 * 671 * Request and iomap regions specified by @mask. 672 */ 673 int pcim_iomap_regions(struct pci_dev *pdev, int mask, const char *name) 674 { 675 void __iomem * const *iomap; 676 int i, rc; 677 678 iomap = pcim_iomap_table(pdev); 679 if (!iomap) 680 return -ENOMEM; 681 682 for (i = 0; i < DEVICE_COUNT_RESOURCE; i++) { 683 unsigned long len; 684 685 if (!(mask & (1 << i))) 686 continue; 687 688 rc = -EINVAL; 689 len = pci_resource_len(pdev, i); 690 if (!len) 691 goto err_inval; 692 693 rc = pci_request_region(pdev, i, name); 694 if (rc) 695 goto err_inval; 696 697 rc = -ENOMEM; 698 if (!pcim_iomap(pdev, i, 0)) 699 goto err_region; 700 } 701 702 return 0; 703 704 err_region: 705 pci_release_region(pdev, i); 706 err_inval: 707 while (--i >= 0) { 708 if (!(mask & (1 << i))) 709 continue; 710 pcim_iounmap(pdev, iomap[i]); 711 pci_release_region(pdev, i); 712 } 713 714 return rc; 715 } 716 EXPORT_SYMBOL(pcim_iomap_regions);
Note:
See TracChangeset
for help on using the changeset viewer.