summaryrefslogtreecommitdiff
path: root/drivers/gpu/drm/omapdrm/omap_gem.c
diff options
context:
space:
mode:
authorLaurent Pinchart <laurent.pinchart@ideasonboard.com>2017-04-21 00:33:53 +0300
committerTomi Valkeinen <tomi.valkeinen@ti.com>2017-06-02 10:57:06 +0300
commit4fa6ce48a97d687fa733292cb7103a8971976280 (patch)
tree3980f66c178e489d3655d43970c3fa2c72eac475 /drivers/gpu/drm/omapdrm/omap_gem.c
parentbc20c85caba279b7c63146bab683ca1a81de9f79 (diff)
downloadlinux-4fa6ce48a97d687fa733292cb7103a8971976280.tar.gz
drm: omapdrm: Lower indentation level in omap_gem_dma_sync_buffer()
This makes the function more readable. Signed-off-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Diffstat (limited to 'drivers/gpu/drm/omapdrm/omap_gem.c')
-rw-r--r--drivers/gpu/drm/omapdrm/omap_gem.c43
1 files changed, 21 insertions, 22 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c
index c9ad18ea31c8..f4e0daede6e2 100644
--- a/drivers/gpu/drm/omapdrm/omap_gem.c
+++ b/drivers/gpu/drm/omapdrm/omap_gem.c
@@ -752,36 +752,35 @@ void omap_gem_dma_sync(struct drm_gem_object *obj,
{
struct drm_device *dev = obj->dev;
struct omap_gem_object *omap_obj = to_omap_bo(obj);
+ int i, npages = obj->size >> PAGE_SHIFT;
+ struct page **pages = omap_obj->pages;
+ bool dirty = false;
- if (is_cached_coherent(obj)) {
- int i, npages = obj->size >> PAGE_SHIFT;
- struct page **pages = omap_obj->pages;
- bool dirty = false;
-
- for (i = 0; i < npages; i++) {
- if (!omap_obj->addrs[i]) {
- dma_addr_t addr;
+ if (!is_cached_coherent(obj))
+ return;
- addr = dma_map_page(dev->dev, pages[i], 0,
- PAGE_SIZE, DMA_BIDIRECTIONAL);
+ for (i = 0; i < npages; i++) {
+ if (!omap_obj->addrs[i]) {
+ dma_addr_t addr;
- if (dma_mapping_error(dev->dev, addr)) {
- dev_warn(dev->dev,
- "%s: failed to map page\n",
- __func__);
- break;
- }
+ addr = dma_map_page(dev->dev, pages[i], 0,
+ PAGE_SIZE, DMA_BIDIRECTIONAL);
- dirty = true;
- omap_obj->addrs[i] = addr;
+ if (dma_mapping_error(dev->dev, addr)) {
+ dev_warn(dev->dev, "%s: failed to map page\n",
+ __func__);
+ break;
}
- }
- if (dirty) {
- unmap_mapping_range(obj->filp->f_mapping, 0,
- omap_gem_mmap_size(obj), 1);
+ dirty = true;
+ omap_obj->addrs[i] = addr;
}
}
+
+ if (dirty) {
+ unmap_mapping_range(obj->filp->f_mapping, 0,
+ omap_gem_mmap_size(obj), 1);
+ }
}
/**