mirror of https://gitee.com/openkylin/linux.git
pci: use pci_ioremap_bar() in sound/
Use the newly introduced pci_ioremap_bar() function in sound/. pci_ioremap_bar() just takes a pci device and a bar number, with the goal of making it really hard to get wrong, while also having a central place to stick sanity checks. Signed-off-by: Arjan van de Ven <arjan@linux.intel.com> Signed-off-by: Takashi Iwai <tiwai@suse.de>
This commit is contained in:
parent
2515ddc6db
commit
2f5ad54ea6
|
@ -932,7 +932,7 @@ snd_ad1889_create(struct snd_card *card,
|
|||
goto free_and_ret;
|
||||
|
||||
chip->bar = pci_resource_start(pci, 0);
|
||||
chip->iobase = ioremap_nocache(chip->bar, pci_resource_len(pci, 0));
|
||||
chip->iobase = pci_ioremap_bar(pci, 0);
|
||||
if (chip->iobase == NULL) {
|
||||
printk(KERN_ERR PFX "unable to reserve region.\n");
|
||||
err = -EBUSY;
|
||||
|
|
|
@ -1609,7 +1609,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
|
|||
return err;
|
||||
}
|
||||
chip->addr = pci_resource_start(pci, 0);
|
||||
chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0));
|
||||
chip->remap_addr = pci_ioremap_bar(pci, 0);
|
||||
if (chip->remap_addr == NULL) {
|
||||
snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
|
||||
snd_atiixp_free(chip);
|
||||
|
|
|
@ -1252,7 +1252,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
|
|||
return err;
|
||||
}
|
||||
chip->addr = pci_resource_start(pci, 0);
|
||||
chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci, 0));
|
||||
chip->remap_addr = pci_ioremap_bar(pci, 0);
|
||||
if (chip->remap_addr == NULL) {
|
||||
snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
|
||||
snd_atiixp_free(chip);
|
||||
|
|
|
@ -180,8 +180,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip)
|
|||
if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0)
|
||||
goto regions_out;
|
||||
|
||||
chip->mmio = ioremap_nocache(pci_resource_start(pci, 0),
|
||||
pci_resource_len(pci, 0));
|
||||
chip->mmio = pci_ioremap_bar(pci, 0);
|
||||
if (!chip->mmio) {
|
||||
printk(KERN_ERR "MMIO area remap failed.\n");
|
||||
err = -ENOMEM;
|
||||
|
|
|
@ -749,8 +749,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card,
|
|||
pci_disable_device(pci);
|
||||
return err;
|
||||
}
|
||||
chip->mmio = ioremap_nocache(pci_resource_start(pci, 0),
|
||||
pci_resource_len(pci, 0));
|
||||
chip->mmio = pci_ioremap_bar(pci, 0);
|
||||
if (!chip->mmio) {
|
||||
snd_printk(KERN_ERR "cannot remap io memory\n");
|
||||
err = -ENOMEM;
|
||||
|
|
|
@ -1382,8 +1382,8 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
|
|||
chip->ba0_addr = pci_resource_start(pci, 0);
|
||||
chip->ba1_addr = pci_resource_start(pci, 1);
|
||||
|
||||
chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0));
|
||||
chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1));
|
||||
chip->ba0 = pci_ioremap_bar(pci, 0);
|
||||
chip->ba1 = pci_ioremap_bar(pci, 1);
|
||||
if (!chip->ba0 || !chip->ba1) {
|
||||
snd_cs4281_free(chip);
|
||||
return -ENOMEM;
|
||||
|
|
|
@ -132,7 +132,7 @@ static int __devinit snd_cs5530_create(struct snd_card *card,
|
|||
}
|
||||
chip->pci_base = pci_resource_start(pci, 0);
|
||||
|
||||
mem = ioremap_nocache(chip->pci_base, pci_resource_len(pci, 0));
|
||||
mem = pci_ioremap_bar(pci, 0);
|
||||
if (mem == NULL) {
|
||||
kfree(chip);
|
||||
pci_disable_device(pci);
|
||||
|
|
|
@ -2158,7 +2158,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *pci,
|
|||
}
|
||||
|
||||
chip->addr = pci_resource_start(pci, 0);
|
||||
chip->remap_addr = ioremap_nocache(chip->addr, pci_resource_len(pci,0));
|
||||
chip->remap_addr = pci_ioremap_bar(pci, 0);
|
||||
if (chip->remap_addr == NULL) {
|
||||
snd_printk(KERN_ERR SFX "ioremap error\n");
|
||||
err = -ENXIO;
|
||||
|
|
|
@ -1314,8 +1314,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
|
|||
}
|
||||
for (i = 0; i < 2; i++) {
|
||||
mgr->mem[i].phys = pci_resource_start(pci, i);
|
||||
mgr->mem[i].virt = ioremap_nocache(mgr->mem[i].phys,
|
||||
pci_resource_len(pci, i));
|
||||
mgr->mem[i].virt = pci_ioremap_bar(pci, i);
|
||||
if (!mgr->mem[i].virt) {
|
||||
printk(KERN_ERR "unable to remap resource 0x%lx\n",
|
||||
mgr->mem[i].phys);
|
||||
|
|
Loading…
Reference in New Issue