Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753169AbbETJxG (ORCPT ); Wed, 20 May 2015 05:53:06 -0400 Received: from arroyo.ext.ti.com ([192.94.94.40]:47945 "EHLO arroyo.ext.ti.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752624AbbETJxA (ORCPT ); Wed, 20 May 2015 05:53:00 -0400 Message-ID: <555C594E.1010607@ti.com> Date: Wed, 20 May 2015 12:52:14 +0300 From: Tomi Valkeinen User-Agent: Mozilla/5.0 (X11; Linux x86_64; rv:31.0) Gecko/20100101 Thunderbird/31.7.0 MIME-Version: 1.0 To: "Luis R. Rodriguez" , , CC: , , , "Luis R. Rodriguez" , Toshi Kani , Suresh Siddha , Ingo Molnar , Thomas Gleixner , Juergen Gross , Daniel Vetter , Dave Airlie , Antonino Daplas , Rob Clark , Jingoo Han , Wolfram Sang , Subject: Re: [PATCH v3 2/3] video: fbdev: vesafb: add missing mtrr_del() for added MTRR References: <1429648850-17902-1-git-send-email-mcgrof@do-not-panic.com> <1429648850-17902-3-git-send-email-mcgrof@do-not-panic.com> In-Reply-To: <1429648850-17902-3-git-send-email-mcgrof@do-not-panic.com> Content-Type: multipart/signed; micalg=pgp-sha256; protocol="application/pgp-signature"; boundary="9mvovWKUSjlEIdRsOd5WBLtix8dEeGJDp" Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 5317 Lines: 161 --9mvovWKUSjlEIdRsOd5WBLtix8dEeGJDp Content-Type: text/plain; charset=windows-1252 Content-Transfer-Encoding: quoted-printable Hi Luis, On 21/04/15 23:40, Luis R. Rodriguez wrote: > From: "Luis R. Rodriguez" >=20 > The MTRR added was never being deleted. >=20 > Cc: Toshi Kani > Cc: Suresh Siddha > Cc: Ingo Molnar > Cc: Thomas Gleixner > Cc: Juergen Gross > Cc: Daniel Vetter > Cc: Andy Lutomirski > Cc: Dave Airlie > Cc: Antonino Daplas > Cc: Rob Clark > Cc: Jingoo Han > Cc: Wolfram Sang > 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(-) >=20 > 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 @@ > =20 > /* -------------------------------------------------------------------= -- */ > =20 > +struct vesafb_par { > + int wc_cookie; > +}; > + > static struct fb_var_screeninfo vesafb_defined =3D { > .activate =3D FB_ACTIVATE_NOW, > .height =3D -1, > @@ -175,7 +179,16 @@ static int vesafb_setcolreg(unsigned regno, unsign= ed red, unsigned green, > =20 > static void vesafb_destroy(struct fb_info *info) > { > +#ifdef CONFIG_MTRR > + struct vesafb_par *par =3D info->par; > +#endif > + > fb_dealloc_cmap(&info->cmap); > + > +#ifdef CONFIG_MTRR > + if (par->wc_cookie >=3D 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 =3D info->par; > - info->par =3D NULL; > + info->pseudo_palette =3D NULL; > + par =3D info->par; > =20 > /* set vesafb aperture size for generic probing */ > info->apertures =3D alloc_apertures(1); > @@ -407,17 +421,17 @@ static int vesafb_probe(struct platform_device *d= ev) > if (mtrr =3D=3D 3) { > #ifdef CONFIG_MTRR > unsigned int temp_size =3D size_total; > - int rc; > =20 > /* Find the largest power-of-two */ > temp_size =3D roundup_pow_of_two(temp_size); > =20 > /* Try and find a power of two to add */ > do { > - rc =3D mtrr_add(vesafb_fix.smem_start, temp_size, > - MTRR_TYPE_WRCOMB, 1); > + par->wc_cookie =3D mtrr_add(vesafb_fix.smem_start, > + temp_size, > + MTRR_TYPE_WRCOMB, 1); > temp_size >>=3D 1; > - } while (temp_size >=3D PAGE_SIZE && rc =3D=3D -EINVAL); > + } while (temp_size >=3D PAGE_SIZE && par->wc_cookie =3D=3D -EINVAL);= > #endif > info->screen_base =3D ioremap_wc(vesafb_fix.smem_start, vesafb_fix.s= mem_len); > } else { > @@ -462,6 +476,10 @@ static int vesafb_probe(struct platform_device *de= v) > fb_info(info, "%s frame buffer device\n", info->fix.id); > return 0; > err: > +#ifdef CONFIG_MTRR > + if (par->wc_cookie >=3D 0) > + mtrr_del(par->wc_cookie, 0, 0); > +#endif > if (info->screen_base) > iounmap(info->screen_base); > framebuffer_release(info); Hmm, this looks a bit odd... You're removing the pseudo_palette, and using its memory for mtrr cookie? Tomi --9mvovWKUSjlEIdRsOd5WBLtix8dEeGJDp Content-Type: application/pgp-signature; name="signature.asc" Content-Description: OpenPGP digital signature Content-Disposition: attachment; filename="signature.asc" -----BEGIN PGP SIGNATURE----- Version: GnuPG v2 iQIcBAEBCAAGBQJVXFlOAAoJEPo9qoy8lh71qYQP/3OEki6RrXsMgJ1gAOYvAvyE ClqyuMe7oPn2UjIHl/LdZiH8bimosVnyh60xi2bv/RrJvkt09mK06ItBrGAWQnBe +g3NCh+pL5gcjGfqeQFG2MuSfRrDYvKcrnDVxmBQdLD+1MS/MqeqOlMNTaUM7tC/ vnZuuO+Uk6ZPpCZagnVdHO+PSnjUMGcpqNYXcBibY2hRTIMsD3SDM0TIRS++4A6v LGjaSXeW6IAI6K5ko/9O9cjbvHAl5ipEq3ZQMgdURl+oAX+BJhcKpCP6aDeuEgPc sRY/a2aP5UpRkXIuqld8cYdUlP6aOS7uP/xUcCR+f99mbx2qAFk9rgZQFj2UWLBm J1g8raVTnaSDb07AKB1zLwDWYBdOPId2MKFqMKDObmu6f7ChDmY6tLi+LU11Nemn ix8cMdcSTGcovZ0hLZHzDX7q98wmyvKKznzwa4fbopaXrdCd06ij9R8CYuXMUrau KhYQsOjMh3RsV65bfCF1xUuwC/zwJ6jD+iRnAcopqPEuGbHTRI3NU09sZLkaT8t+ fUm9LEZ021NMgeojxPxDwCAGd7VRYA5yLjDQeyw86VJMNgN1rJhJ0gDrGR3464rG Pmr0TnEoIOeDQBuPMOzyhtOgF2/GCjiMWVp4a6kHUrBbHJ8GYmuUl0Rah1GaXzEh Id8fDMDmR1MXy7NCh1ql =eG8V -----END PGP SIGNATURE----- --9mvovWKUSjlEIdRsOd5WBLtix8dEeGJDp-- -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/