From b99a1ae5736853e19e0782ab8d80a43dab066c91 Mon Sep 17 00:00:00 2001 From: Terence Hampson Date: Fri, 26 Sep 2014 10:12:03 -0400 Subject: [PATCH] mdss: mdp: Free splash memory properly We were calling free_bootmem_late, which is a __init function, from a none __init context. We are moving to free_reserved_page. Change-Id: I53b3b781201d46a6894f8d9fdfab1c3c5f3802b8 Signed-off-by: Terence Hampson --- .../video/fbdev/msm/mdss_mdp_splash_logo.c | 26 ++++++++++++++++--- 1 file changed, 22 insertions(+), 4 deletions(-) diff --git a/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c b/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c index d648aca12c3b..c8f036211d3c 100644 --- a/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c +++ b/drivers/video/fbdev/msm/mdss_mdp_splash_logo.c @@ -22,6 +22,8 @@ #include #include #include +#include +#include #include "mdss_fb.h" #include "mdss_mdp.h" @@ -228,6 +230,22 @@ void mdss_mdp_release_splash_pipe(struct msm_fb_data_type *mfd) sinfo->splash_pipe_allocated = false; } +/* + * In order to free reseved memory from bootup we are not + * able to call the __init free functions, as we could be + * passed the init boot sequence. As a reult we need to + * free this memory ourselves using the + * free_reeserved_page() function. + */ +void mdss_free_bootmem(u32 mem_addr, u32 size) +{ + unsigned long pfn_start, pfn_end, pfn_idx; + pfn_start = mem_addr >> PAGE_SHIFT; + pfn_end = (mem_addr + size) >> PAGE_SHIFT; + for (pfn_idx = pfn_start; pfn_idx < pfn_end; pfn_idx++) + free_reserved_page(pfn_to_page(pfn_idx)); +} + int mdss_mdp_splash_cleanup(struct msm_fb_data_type *mfd, bool use_borderfill) { @@ -290,8 +308,8 @@ int mdss_mdp_splash_cleanup(struct msm_fb_data_type *mfd, /* Give back the reserved memory to the system */ memblock_free(mdp5_data->splash_mem_addr, mdp5_data->splash_mem_size); - free_bootmem_late(mdp5_data->splash_mem_addr, - mdp5_data->splash_mem_size); + mdss_free_bootmem(mdp5_data->splash_mem_addr, + mdp5_data->splash_mem_size); } mdss_mdp_footswitch_ctrl_splash(0); @@ -656,8 +674,8 @@ error: pr_debug("mem reservation not reqd if cont splash disabled\n"); memblock_free(mdp5_mdata->splash_mem_addr, mdp5_mdata->splash_mem_size); - free_bootmem_late(mdp5_mdata->splash_mem_addr, - mdp5_mdata->splash_mem_size); + mdss_free_bootmem(mdp5_mdata->splash_mem_addr, + mdp5_mdata->splash_mem_size); } else if (rc && mfd->panel_info->cont_splash_enabled) { pr_err("no rsvd mem found in DT for splash screen\n"); } else {