From: Mark Yao Date: Wed, 10 Aug 2016 02:24:42 +0000 (+0800) Subject: drm/rockchip: fix compile error when build as modules X-Git-Tag: firefly_0821_release~1953 X-Git-Url: http://demsky.eecs.uci.edu/git/?a=commitdiff_plain;h=42867049c4419b69ecec31be6639b7900e810eb7;p=firefly-linux-kernel-4.4.55.git drm/rockchip: fix compile error when build as modules Build fail with: ERROR: "memblock_free" [drivers/gpu/drm/rockchip/rockchipdrm.ko] undefined! memblok_free fuction not export symbol, and use the flag __init, so it can't be used on modules. the memblock_free function only used for loader memory manager, not use on modules context, so just use it when build-in drm/rockchip. Change-Id: Ib88b6ca6c61f7ef85b4126d705a4911e207b57e5 Signed-off-by: Mark Yao --- diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c index 11df99a47079..afe6f6ccffd4 100644 --- a/drivers/gpu/drm/rockchip/rockchip_drm_fb.c +++ b/drivers/gpu/drm/rockchip/rockchip_drm_fb.c @@ -58,6 +58,7 @@ static void rockchip_drm_fb_destroy(struct drm_framebuffer *fb) drm_gem_object_unreference_unlocked(obj); } +#ifndef MODULE if (rockchip_fb->sgt) { void *start = phys_to_virt(rockchip_fb->start); void *end = phys_to_virt(rockchip_fb->size); @@ -68,6 +69,9 @@ static void rockchip_drm_fb_destroy(struct drm_framebuffer *fb) memblock_free(rockchip_fb->start, rockchip_fb->size); free_reserved_area(start, end, -1, "drm_fb"); } +#else + WARN_ON(rockchip_fb->sgt); +#endif drm_framebuffer_cleanup(fb); kfree(rockchip_fb); @@ -120,6 +124,7 @@ rockchip_fb_alloc(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd, rk_obj = to_rockchip_obj(obj[i]); rockchip_fb->dma_addr[i] = rk_obj->dma_addr; } +#ifndef MODULE } else if (res) { unsigned long nr_pages; struct page **pages; @@ -155,6 +160,7 @@ rockchip_fb_alloc(struct drm_device *dev, struct drm_mode_fb_cmd2 *mode_cmd, rockchip_fb->sgt = sgt; rockchip_fb->start = res->start; rockchip_fb->size = size; +#endif } else { ret = -EINVAL; dev_err(dev->dev, "Failed to find available buffer\n");