pci: use pci_ioremap_bar() in drivers/video
authorArjan van de Ven <arjan@linux.intel.com>
Tue, 6 Jan 2009 22:42:28 +0000 (14:42 -0800)
committerLinus Torvalds <torvalds@linux-foundation.org>
Tue, 6 Jan 2009 23:59:26 +0000 (15:59 -0800)
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>
drivers/video/aty/aty128fb.c
drivers/video/cyber2000fb.c
drivers/video/geode/gx1fb_core.c
drivers/video/geode/gxfb_core.c
drivers/video/geode/lxfb_core.c
drivers/video/gxt4500.c

index 243ea4ab20c8b78e6a61bf5d1a949fdcf37013b8..db16112cf197c0199df67949f68b3ebf07e7107c 100644 (file)
@@ -2051,7 +2051,7 @@ static int __devinit aty128_probe(struct pci_dev *pdev, const struct pci_device_
 
        /* Virtualize mmio region */
        info->fix.mmio_start = reg_addr;
-       par->regbase = ioremap(reg_addr, pci_resource_len(pdev, 2));
+       par->regbase = pci_ioremap_bar(pdev, 2);
        if (!par->regbase)
                goto err_free_info;
 
index 39d5d643a50b9397d67a26f37d3f0572c5561b4c..7a9e42e3a9a961e9c1957a6c7c6c10b7608118cb 100644 (file)
@@ -1583,8 +1583,7 @@ cyberpro_pci_probe(struct pci_dev *dev, const struct pci_device_id *id)
                goto failed_release;
 
        cfb->dev = dev;
-       cfb->region = ioremap(pci_resource_start(dev, 0),
-                             pci_resource_len(dev, 0));
+       cfb->region = pci_ioremap_bar(dev, 0);
        if (!cfb->region)
                goto failed_ioremap;
 
index bb20a2289760bffea5e8064b65cd1ff709970f12..751e491ca8c8ee61cdc1211f7b3548783efe853a 100644 (file)
@@ -217,8 +217,7 @@ static int __init gx1fb_map_video_memory(struct fb_info *info, struct pci_dev *d
        ret = pci_request_region(dev, 0, "gx1fb (video)");
        if (ret < 0)
                return ret;
-       par->vid_regs = ioremap(pci_resource_start(dev, 0),
-                               pci_resource_len(dev, 0));
+       par->vid_regs = pci_ioremap_bar(dev, 0);
        if (!par->vid_regs)
                return -ENOMEM;
 
index de2b8f9876a5398b1534aa77ac9c269c38e67408..484118926318f40b7f97fcdda06336e1cae95334 100644 (file)
@@ -242,23 +242,21 @@ static int __init gxfb_map_video_memory(struct fb_info *info, struct pci_dev *de
        ret = pci_request_region(dev, 3, "gxfb (video processor)");
        if (ret < 0)
                return ret;
-       par->vid_regs = ioremap(pci_resource_start(dev, 3),
-                               pci_resource_len(dev, 3));
+       par->vid_regs = pci_ioremap_bar(dev, 3);
        if (!par->vid_regs)
                return -ENOMEM;
 
        ret = pci_request_region(dev, 2, "gxfb (display controller)");
        if (ret < 0)
                return ret;
-       par->dc_regs = ioremap(pci_resource_start(dev, 2), pci_resource_len(dev, 2));
+       par->dc_regs = pci_ioremap_bar(dev, 2);
        if (!par->dc_regs)
                return -ENOMEM;
 
        ret = pci_request_region(dev, 1, "gxfb (graphics processor)");
        if (ret < 0)
                return ret;
-       par->gp_regs = ioremap(pci_resource_start(dev, 1),
-       pci_resource_len(dev, 1));
+       par->gp_regs = pci_ioremap_bar(dev, 1);
 
        if (!par->gp_regs)
                return -ENOMEM;
index 2cd9b74d222545ea771d653cf1d558be43c2173b..b965ecdbc604695929f4a2fde6a6764027e1028c 100644 (file)
@@ -379,20 +379,17 @@ static int __init lxfb_map_video_memory(struct fb_info *info,
        if (info->screen_base == NULL)
                return ret;
 
-       par->gp_regs = ioremap(pci_resource_start(dev, 1),
-                               pci_resource_len(dev, 1));
+       par->gp_regs = pci_ioremap_bar(dev, 1);
 
        if (par->gp_regs == NULL)
                return ret;
 
-       par->dc_regs = ioremap(pci_resource_start(dev, 2),
-                              pci_resource_len(dev, 2));
+       par->dc_regs = pci_ioremap_bar(dev, 2);
 
        if (par->dc_regs == NULL)
                return ret;
 
-       par->vp_regs = ioremap(pci_resource_start(dev, 3),
-                              pci_resource_len(dev, 3));
+       par->vp_regs = pci_ioremap_bar(dev, 3);
 
        if (par->vp_regs == NULL)
                return ret;
index 564557792bed6e616d590b8c49a1d28f3719f442..896e53dea906178a30f951e4460b76b462c51b66 100644 (file)
@@ -648,7 +648,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev,
        info->pseudo_palette = par->pseudo_palette;
 
        info->fix.mmio_start = reg_phys;
-       par->regs = ioremap(reg_phys, pci_resource_len(pdev, 0));
+       par->regs = pci_ioremap_bar(pdev, 0);
        if (!par->regs) {
                dev_err(&pdev->dev, "gxt4500: cannot map registers\n");
                goto err_free_all;
@@ -656,7 +656,7 @@ static int __devinit gxt4500_probe(struct pci_dev *pdev,
 
        info->fix.smem_start = fb_phys;
        info->fix.smem_len = pci_resource_len(pdev, 1);
-       info->screen_base = ioremap(fb_phys, pci_resource_len(pdev, 1));
+       info->screen_base = pci_ioremap_bar(pdev, 1);
        if (!info->screen_base) {
                dev_err(&pdev->dev, "gxt4500: cannot map framebuffer\n");
                goto err_unmap_regs;