Commit 2f5ad54e authored by Arjan van de Ven's avatar Arjan van de Ven Committed by Takashi Iwai

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: default avatarArjan van de Ven <arjan@linux.intel.com>
Signed-off-by: default avatarTakashi Iwai <tiwai@suse.de>
parent 2515ddc6
...@@ -932,7 +932,7 @@ snd_ad1889_create(struct snd_card *card, ...@@ -932,7 +932,7 @@ snd_ad1889_create(struct snd_card *card,
goto free_and_ret; goto free_and_ret;
chip->bar = pci_resource_start(pci, 0); 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) { if (chip->iobase == NULL) {
printk(KERN_ERR PFX "unable to reserve region.\n"); printk(KERN_ERR PFX "unable to reserve region.\n");
err = -EBUSY; err = -EBUSY;
......
...@@ -1609,7 +1609,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, ...@@ -1609,7 +1609,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
return err; return err;
} }
chip->addr = pci_resource_start(pci, 0); 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) { if (chip->remap_addr == NULL) {
snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
snd_atiixp_free(chip); snd_atiixp_free(chip);
......
...@@ -1252,7 +1252,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card, ...@@ -1252,7 +1252,7 @@ static int __devinit snd_atiixp_create(struct snd_card *card,
return err; return err;
} }
chip->addr = pci_resource_start(pci, 0); 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) { if (chip->remap_addr == NULL) {
snd_printk(KERN_ERR "AC'97 space ioremap problem\n"); snd_printk(KERN_ERR "AC'97 space ioremap problem\n");
snd_atiixp_free(chip); snd_atiixp_free(chip);
......
...@@ -180,8 +180,7 @@ snd_vortex_create(struct snd_card *card, struct pci_dev *pci, vortex_t ** rchip) ...@@ -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) if ((err = pci_request_regions(pci, CARD_NAME_SHORT)) != 0)
goto regions_out; goto regions_out;
chip->mmio = ioremap_nocache(pci_resource_start(pci, 0), chip->mmio = pci_ioremap_bar(pci, 0);
pci_resource_len(pci, 0));
if (!chip->mmio) { if (!chip->mmio) {
printk(KERN_ERR "MMIO area remap failed.\n"); printk(KERN_ERR "MMIO area remap failed.\n");
err = -ENOMEM; err = -ENOMEM;
......
...@@ -749,8 +749,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card, ...@@ -749,8 +749,7 @@ static int __devinit snd_bt87x_create(struct snd_card *card,
pci_disable_device(pci); pci_disable_device(pci);
return err; return err;
} }
chip->mmio = ioremap_nocache(pci_resource_start(pci, 0), chip->mmio = pci_ioremap_bar(pci, 0);
pci_resource_len(pci, 0));
if (!chip->mmio) { if (!chip->mmio) {
snd_printk(KERN_ERR "cannot remap io memory\n"); snd_printk(KERN_ERR "cannot remap io memory\n");
err = -ENOMEM; err = -ENOMEM;
......
...@@ -1382,8 +1382,8 @@ static int __devinit snd_cs4281_create(struct snd_card *card, ...@@ -1382,8 +1382,8 @@ static int __devinit snd_cs4281_create(struct snd_card *card,
chip->ba0_addr = pci_resource_start(pci, 0); chip->ba0_addr = pci_resource_start(pci, 0);
chip->ba1_addr = pci_resource_start(pci, 1); chip->ba1_addr = pci_resource_start(pci, 1);
chip->ba0 = ioremap_nocache(chip->ba0_addr, pci_resource_len(pci, 0)); chip->ba0 = pci_ioremap_bar(pci, 0);
chip->ba1 = ioremap_nocache(chip->ba1_addr, pci_resource_len(pci, 1)); chip->ba1 = pci_ioremap_bar(pci, 1);
if (!chip->ba0 || !chip->ba1) { if (!chip->ba0 || !chip->ba1) {
snd_cs4281_free(chip); snd_cs4281_free(chip);
return -ENOMEM; return -ENOMEM;
......
...@@ -132,7 +132,7 @@ static int __devinit snd_cs5530_create(struct snd_card *card, ...@@ -132,7 +132,7 @@ static int __devinit snd_cs5530_create(struct snd_card *card,
} }
chip->pci_base = pci_resource_start(pci, 0); 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) { if (mem == NULL) {
kfree(chip); kfree(chip);
pci_disable_device(pci); pci_disable_device(pci);
......
...@@ -2158,7 +2158,7 @@ static int __devinit azx_create(struct snd_card *card, struct pci_dev *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->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) { if (chip->remap_addr == NULL) {
snd_printk(KERN_ERR SFX "ioremap error\n"); snd_printk(KERN_ERR SFX "ioremap error\n");
err = -ENXIO; err = -ENXIO;
......
...@@ -1314,8 +1314,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci, ...@@ -1314,8 +1314,7 @@ static int __devinit snd_mixart_probe(struct pci_dev *pci,
} }
for (i = 0; i < 2; i++) { for (i = 0; i < 2; i++) {
mgr->mem[i].phys = pci_resource_start(pci, i); mgr->mem[i].phys = pci_resource_start(pci, i);
mgr->mem[i].virt = ioremap_nocache(mgr->mem[i].phys, mgr->mem[i].virt = pci_ioremap_bar(pci, i);
pci_resource_len(pci, i));
if (!mgr->mem[i].virt) { if (!mgr->mem[i].virt) {
printk(KERN_ERR "unable to remap resource 0x%lx\n", printk(KERN_ERR "unable to remap resource 0x%lx\n",
mgr->mem[i].phys); mgr->mem[i].phys);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment