Commit 3c36aa5ccdf516255ef2eac90dd948da891aa4bd
Committed by
Linus Torvalds
1 parent
ab5dc37202
Exists in
master
and in
7 other branches
pci: use pci_ioremap_bar() in drivers/video
Use the newly introduced pci_ioremap_bar() function in drivers/video. 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> Cc: Krzysztof Helt <krzysztof.h1@poczta.fm> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Showing 6 changed files with 11 additions and 18 deletions Side-by-side Diff
drivers/video/aty/aty128fb.c
... | ... | @@ -2051,7 +2051,7 @@ |
2051 | 2051 | |
2052 | 2052 | /* Virtualize mmio region */ |
2053 | 2053 | info->fix.mmio_start = reg_addr; |
2054 | - par->regbase = ioremap(reg_addr, pci_resource_len(pdev, 2)); | |
2054 | + par->regbase = pci_ioremap_bar(pdev, 2); | |
2055 | 2055 | if (!par->regbase) |
2056 | 2056 | goto err_free_info; |
2057 | 2057 |
drivers/video/cyber2000fb.c
... | ... | @@ -1583,8 +1583,7 @@ |
1583 | 1583 | goto failed_release; |
1584 | 1584 | |
1585 | 1585 | cfb->dev = dev; |
1586 | - cfb->region = ioremap(pci_resource_start(dev, 0), | |
1587 | - pci_resource_len(dev, 0)); | |
1586 | + cfb->region = pci_ioremap_bar(dev, 0); | |
1588 | 1587 | if (!cfb->region) |
1589 | 1588 | goto failed_ioremap; |
1590 | 1589 |
drivers/video/geode/gx1fb_core.c
... | ... | @@ -217,8 +217,7 @@ |
217 | 217 | ret = pci_request_region(dev, 0, "gx1fb (video)"); |
218 | 218 | if (ret < 0) |
219 | 219 | return ret; |
220 | - par->vid_regs = ioremap(pci_resource_start(dev, 0), | |
221 | - pci_resource_len(dev, 0)); | |
220 | + par->vid_regs = pci_ioremap_bar(dev, 0); | |
222 | 221 | if (!par->vid_regs) |
223 | 222 | return -ENOMEM; |
224 | 223 |
drivers/video/geode/gxfb_core.c
... | ... | @@ -242,23 +242,21 @@ |
242 | 242 | ret = pci_request_region(dev, 3, "gxfb (video processor)"); |
243 | 243 | if (ret < 0) |
244 | 244 | return ret; |
245 | - par->vid_regs = ioremap(pci_resource_start(dev, 3), | |
246 | - pci_resource_len(dev, 3)); | |
245 | + par->vid_regs = pci_ioremap_bar(dev, 3); | |
247 | 246 | if (!par->vid_regs) |
248 | 247 | return -ENOMEM; |
249 | 248 | |
250 | 249 | ret = pci_request_region(dev, 2, "gxfb (display controller)"); |
251 | 250 | if (ret < 0) |
252 | 251 | return ret; |
253 | - par->dc_regs = ioremap(pci_resource_start(dev, 2), pci_resource_len(dev, 2)); | |
252 | + par->dc_regs = pci_ioremap_bar(dev, 2); | |
254 | 253 | if (!par->dc_regs) |
255 | 254 | return -ENOMEM; |
256 | 255 | |
257 | 256 | ret = pci_request_region(dev, 1, "gxfb (graphics processor)"); |
258 | 257 | if (ret < 0) |
259 | 258 | return ret; |
260 | - par->gp_regs = ioremap(pci_resource_start(dev, 1), | |
261 | - pci_resource_len(dev, 1)); | |
259 | + par->gp_regs = pci_ioremap_bar(dev, 1); | |
262 | 260 | |
263 | 261 | if (!par->gp_regs) |
264 | 262 | return -ENOMEM; |
drivers/video/geode/lxfb_core.c
... | ... | @@ -379,20 +379,17 @@ |
379 | 379 | if (info->screen_base == NULL) |
380 | 380 | return ret; |
381 | 381 | |
382 | - par->gp_regs = ioremap(pci_resource_start(dev, 1), | |
383 | - pci_resource_len(dev, 1)); | |
382 | + par->gp_regs = pci_ioremap_bar(dev, 1); | |
384 | 383 | |
385 | 384 | if (par->gp_regs == NULL) |
386 | 385 | return ret; |
387 | 386 | |
388 | - par->dc_regs = ioremap(pci_resource_start(dev, 2), | |
389 | - pci_resource_len(dev, 2)); | |
387 | + par->dc_regs = pci_ioremap_bar(dev, 2); | |
390 | 388 | |
391 | 389 | if (par->dc_regs == NULL) |
392 | 390 | return ret; |
393 | 391 | |
394 | - par->vp_regs = ioremap(pci_resource_start(dev, 3), | |
395 | - pci_resource_len(dev, 3)); | |
392 | + par->vp_regs = pci_ioremap_bar(dev, 3); | |
396 | 393 | |
397 | 394 | if (par->vp_regs == NULL) |
398 | 395 | return ret; |
drivers/video/gxt4500.c
... | ... | @@ -648,7 +648,7 @@ |
648 | 648 | info->pseudo_palette = par->pseudo_palette; |
649 | 649 | |
650 | 650 | info->fix.mmio_start = reg_phys; |
651 | - par->regs = ioremap(reg_phys, pci_resource_len(pdev, 0)); | |
651 | + par->regs = pci_ioremap_bar(pdev, 0); | |
652 | 652 | if (!par->regs) { |
653 | 653 | dev_err(&pdev->dev, "gxt4500: cannot map registers\n"); |
654 | 654 | goto err_free_all; |
... | ... | @@ -656,7 +656,7 @@ |
656 | 656 | |
657 | 657 | info->fix.smem_start = fb_phys; |
658 | 658 | info->fix.smem_len = pci_resource_len(pdev, 1); |
659 | - info->screen_base = ioremap(fb_phys, pci_resource_len(pdev, 1)); | |
659 | + info->screen_base = pci_ioremap_bar(pdev, 1); | |
660 | 660 | if (!info->screen_base) { |
661 | 661 | dev_err(&pdev->dev, "gxt4500: cannot map framebuffer\n"); |
662 | 662 | goto err_unmap_regs; |