drm/i915: simplify ppgtt setup
authorDaniel Vetter <daniel.vetter@ffwll.ch>
Tue, 10 Apr 2012 15:29:17 +0000 (17:29 +0200)
committerDaniel Vetter <daniel.vetter@ffwll.ch>
Thu, 12 Apr 2012 19:14:10 +0000 (21:14 +0200)
We don't need the pt_addr for the !dmar case, so drop the else and
move the if (dmar) condition out of the loop.

v2: Fixup whitespace damage noticed by Chris Wilson.

v3: Collapse the two identical if blocks. Chris Wilson makes me look
like a moron right now ...

Noticed-by: Konstantin Belousov <kostikbel@gmail.com>
Reviewed-by: Chris Wilson <chris@chris-wislon.co.uk>
Signed-Off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
drivers/gpu/drm/i915/i915_gem_gtt.c

index 4fb875de32e642744770ced22e6bb0a73f342819..25c8bf9d1d4e8526b81d8e22d244a1629bb65752 100644 (file)
@@ -96,11 +96,10 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
                                             GFP_KERNEL);
                if (!ppgtt->pt_dma_addr)
                        goto err_pt_alloc;
-       }
 
-       for (i = 0; i < ppgtt->num_pd_entries; i++) {
-               dma_addr_t pt_addr;
-               if (dev_priv->mm.gtt->needs_dmar) {
+               for (i = 0; i < ppgtt->num_pd_entries; i++) {
+                       dma_addr_t pt_addr;
+
                        pt_addr = pci_map_page(dev->pdev, ppgtt->pt_pages[i],
                                               0, 4096,
                                               PCI_DMA_BIDIRECTIONAL);
@@ -112,8 +111,7 @@ int i915_gem_init_aliasing_ppgtt(struct drm_device *dev)
 
                        }
                        ppgtt->pt_dma_addr[i] = pt_addr;
-               } else
-                       pt_addr = page_to_phys(ppgtt->pt_pages[i]);
+               }
        }
 
        ppgtt->scratch_page_dma_addr = dev_priv->mm.gtt->scratch_page_dma;