diff options
author | Thomas Zimmermann <tzimmermann@suse.de> | 2020-06-05 15:57:54 +0200 |
---|---|---|
committer | Thomas Zimmermann <tzimmermann@suse.de> | 2020-06-11 10:05:41 +0200 |
commit | 0956c329a4ff517672fa484e1b2ad1b36826f3a3 (patch) | |
tree | 04795ef1adeb42ec4d75b0db9bf32793236f1141 /drivers/gpu/drm/mgag200/mgag200_mm.c | |
parent | drm/mgag200: Rename mgag200_ttm.c to mgag200_mm.c (diff) | |
download | linux-0956c329a4ff517672fa484e1b2ad1b36826f3a3.tar.xz linux-0956c329a4ff517672fa484e1b2ad1b36826f3a3.zip |
drm/mgag200: Lookup VRAM PCI BAR start and length only once
The MM setup code on mgag200 reads PCI BAR 0's start and length
several times. Reusing these values makes the code more readable.
Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20200605135803.19811-6-tzimmermann@suse.de
Diffstat (limited to '')
-rw-r--r-- | drivers/gpu/drm/mgag200/mgag200_mm.c | 17 |
1 files changed, 9 insertions, 8 deletions
diff --git a/drivers/gpu/drm/mgag200/mgag200_mm.c b/drivers/gpu/drm/mgag200/mgag200_mm.c index a683642fe468..73e30901e063 100644 --- a/drivers/gpu/drm/mgag200/mgag200_mm.c +++ b/drivers/gpu/drm/mgag200/mgag200_mm.c @@ -33,16 +33,18 @@ int mgag200_mm_init(struct mga_device *mdev) { struct drm_device *dev = mdev->dev; + resource_size_t start, len; int ret; - arch_io_reserve_memtype_wc(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); + /* BAR 0 is VRAM */ + start = pci_resource_start(dev->pdev, 0); + len = pci_resource_len(dev->pdev, 0); - mdev->fb_mtrr = arch_phys_wc_add(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); + arch_io_reserve_memtype_wc(start, len); - mdev->vram = ioremap(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); + mdev->fb_mtrr = arch_phys_wc_add(start, len); + + mdev->vram = ioremap(start, len); if (!mdev->vram) { ret = -ENOMEM; goto err_arch_phys_wc_del; @@ -54,8 +56,7 @@ int mgag200_mm_init(struct mga_device *mdev) err_arch_phys_wc_del: arch_phys_wc_del(mdev->fb_mtrr); - arch_io_free_memtype_wc(pci_resource_start(dev->pdev, 0), - pci_resource_len(dev->pdev, 0)); + arch_io_free_memtype_wc(start, len); return ret; } |