From patchwork Fri Mar 20 23:18:08 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Luis R. Rodriguez" X-Patchwork-Id: 6061961 Return-Path: X-Original-To: patchwork-linux-fbdev@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 3BFE6BF90F for ; Sat, 21 Mar 2015 00:00:38 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 40C4720522 for ; Sat, 21 Mar 2015 00:00:37 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 3B5A620483 for ; Sat, 21 Mar 2015 00:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751045AbbCUAAf (ORCPT ); Fri, 20 Mar 2015 20:00:35 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36796 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1750994AbbCUAAe (ORCPT ); Fri, 20 Mar 2015 20:00:34 -0400 Received: by padcy3 with SMTP id cy3so123546579pad.3; Fri, 20 Mar 2015 17:00:34 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=FwZaidV59YELjLndf9SdKyy7J0MkD8V+/B2qFAaC6w4=; b=T0ymbOOjqoVKJkq8kGQtErb92MT2vp/M7Oknf24vOYv+eK0yNeHom0fxBoLqis506R j8QbSFR2TsipvUXUXc5RdOmNDed1v6RTD+t06md+5ztTOstzfWK9rueYWAM/EUpBkINX ENuw1ItBHl/g3WcKugM7cmWPOQI5Orntkc2/XzzS46SsrQRzgSsiiS2bExD4ENhFemD8 FZhfmf7dSHvaOfCSUrtdvrxdvaHgv3y683lJUIHU0NPk/Z/SX7zFba8fwdtCkwLDgG/J +2zGKbbqtoJSIcIknx3sO/BxuR7AMlJkGjmi653IS3hEOKaN7btPFQx6400gYMyAqpcu Bn2Q== X-Received: by 10.66.231.204 with SMTP id ti12mr110713727pac.135.1426896034096; Fri, 20 Mar 2015 17:00:34 -0700 (PDT) Received: from mcgrof@gmail.com (c-98-234-145-61.hsd1.ca.comcast.net. [98.234.145.61]) by mx.google.com with ESMTPSA id vh2sm183628pbc.49.2015.03.20.17.00.30 (version=TLSv1 cipher=RC4-SHA bits=128/128); Fri, 20 Mar 2015 17:00:32 -0700 (PDT) Received: by mcgrof@gmail.com (sSMTP sendmail emulation); Fri, 20 Mar 2015 16:58:22 -0700 From: "Luis R. Rodriguez" To: luto@amacapital.net, mingo@redhat.com, tglx@linutronix.de, hpa@zytor.com, jgross@suse.com, JBeulich@suse.com, bp@suse.de, suresh.b.siddha@intel.com, venkatesh.pallipadi@intel.com, airlied@redhat.com Cc: linux-kernel@vger.kernel.org, linux-fbdev@vger.kernel.org, x86@kernel.org, xen-devel@lists.xenproject.org, "Luis R. Rodriguez" , Ingo Molnar , Daniel Vetter , Antonino Daplas , Jean-Christophe Plagniol-Villard , Tomi Valkeinen Subject: [PATCH v1 18/47] vidoe: fbdev: vesafb: add missing mtrr_del() for added MTRR Date: Fri, 20 Mar 2015 16:18:08 -0700 Message-Id: <1426893517-2511-19-git-send-email-mcgrof@do-not-panic.com> X-Mailer: git-send-email 2.1.0 In-Reply-To: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> References: <1426893517-2511-1-git-send-email-mcgrof@do-not-panic.com> Sender: linux-fbdev-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-fbdev@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD,UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP From: "Luis R. Rodriguez" The MTRR added was never being deleted. Cc: Suresh Siddha Cc: Venkatesh Pallipadi Cc: Ingo Molnar Cc: Thomas Gleixner Cc: Juergen Gross Cc: Daniel Vetter Cc: Andy Lutomirski Cc: Dave Airlie Cc: Antonino Daplas Cc: Jean-Christophe Plagniol-Villard Cc: Tomi Valkeinen Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez --- drivers/video/fbdev/vesafb.c | 30 ++++++++++++++++++++++++------ 1 file changed, 24 insertions(+), 6 deletions(-) diff --git a/drivers/video/fbdev/vesafb.c b/drivers/video/fbdev/vesafb.c index 191156b..a2261d0 100644 --- a/drivers/video/fbdev/vesafb.c +++ b/drivers/video/fbdev/vesafb.c @@ -29,6 +29,10 @@ /* --------------------------------------------------------------------- */ +struct vesafb_par { + int wc_cookie; +}; + static struct fb_var_screeninfo vesafb_defined = { .activate = FB_ACTIVATE_NOW, .height = -1, @@ -175,7 +179,16 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green, static void vesafb_destroy(struct fb_info *info) { +#ifdef CONFIG_MTRR + struct vesafb_par *par = info->par; +#endif + fb_dealloc_cmap(&info->cmap); + +#ifdef CONFIG_MTRR + if (par->wc_cookie >= 0) + mtrr_del(par->wc_cookie, 0, 0); +#endif if (info->screen_base) iounmap(info->screen_base); release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size); @@ -228,6 +241,7 @@ static int vesafb_setup(char *options) static int vesafb_probe(struct platform_device *dev) { struct fb_info *info; + struct vesafb_par *par; int i, err; unsigned int size_vmode; unsigned int size_remap; @@ -297,8 +311,8 @@ static int vesafb_probe(struct platform_device *dev) return -ENOMEM; } platform_set_drvdata(dev, info); - info->pseudo_palette = info->par; - info->par = NULL; + info->pseudo_palette = NULL; + par = info->par; /* set vesafb aperture size for generic probing */ info->apertures = alloc_apertures(1); @@ -407,17 +421,17 @@ static int vesafb_probe(struct platform_device *dev) if (mtrr == 3) { #ifdef CONFIG_MTRR unsigned int temp_size = size_total; - int rc; /* Find the largest power-of-two */ temp_size = roundup_pow_of_two(temp_size); /* Try and find a power of two to add */ do { - rc = mtrr_add(vesafb_fix.smem_start, temp_size, - MTRR_TYPE_WRCOMB, 1); + par->wc_cookie = mtrr_add(vesafb_fix.smem_start, + temp_size, + MTRR_TYPE_WRCOMB, 1); temp_size >>= 1; - } while (temp_size >= PAGE_SIZE && rc == -EINVAL); + } while (temp_size >= PAGE_SIZE && par->wc_cookie == -EINVAL); #endif info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len); } else { @@ -462,6 +476,10 @@ static int vesafb_probe(struct platform_device *dev) fb_info(info, "%s frame buffer device\n", info->fix.id); return 0; err: +#ifdef CONFIG_MTRR + if (par->wc_cookie >= 0) + mtrr_del(par->wc_cookie, 0, 0); +#endif if (info->screen_base) iounmap(info->screen_base); framebuffer_release(info);