From: Laurent Pinchart Date: Mon, 14 Dec 2015 20:39:32 +0000 (+0200) Subject: drm: omapdrm: gem: Remove forward declarations X-Git-Url: https://git.stricted.de/?a=commitdiff_plain;h=b902f8f4d69094690accf4c483e9f176be525000;p=GitHub%2Fmoto-9609%2Fandroid_kernel_motorola_exynos9610.git drm: omapdrm: gem: Remove forward declarations Reorder functions to get rid of forward declarations Signed-off-by: Laurent Pinchart Signed-off-by: Tomi Valkeinen --- diff --git a/drivers/gpu/drm/omapdrm/omap_gem.c b/drivers/gpu/drm/omapdrm/omap_gem.c index 29a7ac6eb040..a953a967b7db 100644 --- a/drivers/gpu/drm/omapdrm/omap_gem.c +++ b/drivers/gpu/drm/omapdrm/omap_gem.c @@ -113,8 +113,6 @@ struct omap_gem_object { } *sync; }; -static int get_pages(struct drm_gem_object *obj, struct page ***pages); -static uint64_t mmap_offset(struct drm_gem_object *obj); /* To deal with userspace mmap'ings of 2d tiled buffers, which (a) are * not necessarily pinned in TILER all the time, and (b) when they are @@ -144,6 +142,30 @@ static struct { int last; /* index of last used entry */ } *usergart; +/* ----------------------------------------------------------------------------- + * Helpers + */ + +/** get mmap offset */ +static uint64_t mmap_offset(struct drm_gem_object *obj) +{ + struct drm_device *dev = obj->dev; + int ret; + size_t size; + + WARN_ON(!mutex_is_locked(&dev->struct_mutex)); + + /* Make it mmapable */ + size = omap_gem_mmap_size(obj); + ret = drm_gem_create_mmap_offset_size(obj, size); + if (ret) { + dev_err(dev->dev, "could not allocate mmap offset\n"); + return 0; + } + + return drm_vma_node_offset_addr(&obj->vma_node); +} + static void evict_entry(struct drm_gem_object *obj, enum tiler_fmt fmt, struct usergart_entry *entry) { @@ -266,6 +288,28 @@ free_pages: return ret; } +/* acquire pages when needed (for example, for DMA where physically + * contiguous buffer is not required + */ +static int get_pages(struct drm_gem_object *obj, struct page ***pages) +{ + struct omap_gem_object *omap_obj = to_omap_bo(obj); + int ret = 0; + + if (is_shmem(obj) && !omap_obj->pages) { + ret = omap_gem_attach_pages(obj); + if (ret) { + dev_err(obj->dev->dev, "could not attach pages\n"); + return ret; + } + } + + /* TODO: even phys-contig.. we should have a list of pages? */ + *pages = omap_obj->pages; + + return 0; +} + /** release backing pages */ static void omap_gem_detach_pages(struct drm_gem_object *obj) { @@ -295,26 +339,6 @@ uint32_t omap_gem_flags(struct drm_gem_object *obj) return to_omap_bo(obj)->flags; } -/** get mmap offset */ -static uint64_t mmap_offset(struct drm_gem_object *obj) -{ - struct drm_device *dev = obj->dev; - int ret; - size_t size; - - WARN_ON(!mutex_is_locked(&dev->struct_mutex)); - - /* Make it mmapable */ - size = omap_gem_mmap_size(obj); - ret = drm_gem_create_mmap_offset_size(obj, size); - if (ret) { - dev_err(dev->dev, "could not allocate mmap offset\n"); - return 0; - } - - return drm_vma_node_offset_addr(&obj->vma_node); -} - uint64_t omap_gem_mmap_offset(struct drm_gem_object *obj) { uint64_t offset; @@ -861,28 +885,6 @@ int omap_gem_tiled_stride(struct drm_gem_object *obj, uint32_t orient) return ret; } -/* acquire pages when needed (for example, for DMA where physically - * contiguous buffer is not required - */ -static int get_pages(struct drm_gem_object *obj, struct page ***pages) -{ - struct omap_gem_object *omap_obj = to_omap_bo(obj); - int ret = 0; - - if (is_shmem(obj) && !omap_obj->pages) { - ret = omap_gem_attach_pages(obj); - if (ret) { - dev_err(obj->dev->dev, "could not attach pages\n"); - return ret; - } - } - - /* TODO: even phys-contig.. we should have a list of pages? */ - *pages = omap_obj->pages; - - return 0; -} - /* if !remap, and we don't have pages backing, then fail, rather than * increasing the pin count (which we don't really do yet anyways, * because we don't support swapping pages back out). And 'remap'