video: fbdev: vesafb: add missing mtrr_del() for added MTRR
The MTRR added was never being deleted, in order to store the MTRR cookie we need to make use of the private info->par so we create a struct for this. This driver was already using the extra space typically used for info->par for the info->pseudo_palette which typically used stuffed on driver's own private structs (the respective info->par), so we just move the pseudo_palette into the private struct as well. Cc: Toshi Kani <toshi.kani@hp.com> Cc: Suresh Siddha <sbsiddha@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Cc: Juergen Gross <jgross@suse.com> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Andy Lutomirski <luto@amacapital.net> Cc: Dave Airlie <airlied@redhat.com> Cc: Antonino Daplas <adaplas@gmail.com> Cc: Rob Clark <robdclark@gmail.com> Cc: Jingoo Han <jg1.han@samsung.com> Cc: Wolfram Sang <wsa@the-dreams.de> Cc: Jean-Christophe Plagniol-Villard <plagnioj@jcrosoft.com> Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: linux-fbdev@vger.kernel.org Cc: linux-kernel@vger.kernel.org Signed-off-by: Luis R. Rodriguez <mcgrof@suse.com> Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
This commit is contained in:
parent
87b81762a8
commit
6b41f27dce
|
@ -29,6 +29,11 @@
|
||||||
|
|
||||||
/* --------------------------------------------------------------------- */
|
/* --------------------------------------------------------------------- */
|
||||||
|
|
||||||
|
struct vesafb_par {
|
||||||
|
u32 pseudo_palette[256];
|
||||||
|
int wc_cookie;
|
||||||
|
};
|
||||||
|
|
||||||
static struct fb_var_screeninfo vesafb_defined = {
|
static struct fb_var_screeninfo vesafb_defined = {
|
||||||
.activate = FB_ACTIVATE_NOW,
|
.activate = FB_ACTIVATE_NOW,
|
||||||
.height = -1,
|
.height = -1,
|
||||||
|
@ -175,7 +180,16 @@ static int vesafb_setcolreg(unsigned regno, unsigned red, unsigned green,
|
||||||
|
|
||||||
static void vesafb_destroy(struct fb_info *info)
|
static void vesafb_destroy(struct fb_info *info)
|
||||||
{
|
{
|
||||||
|
#ifdef CONFIG_MTRR
|
||||||
|
struct vesafb_par *par = info->par;
|
||||||
|
#endif
|
||||||
|
|
||||||
fb_dealloc_cmap(&info->cmap);
|
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)
|
if (info->screen_base)
|
||||||
iounmap(info->screen_base);
|
iounmap(info->screen_base);
|
||||||
release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
|
release_mem_region(info->apertures->ranges[0].base, info->apertures->ranges[0].size);
|
||||||
|
@ -228,6 +242,7 @@ static int vesafb_setup(char *options)
|
||||||
static int vesafb_probe(struct platform_device *dev)
|
static int vesafb_probe(struct platform_device *dev)
|
||||||
{
|
{
|
||||||
struct fb_info *info;
|
struct fb_info *info;
|
||||||
|
struct vesafb_par *par;
|
||||||
int i, err;
|
int i, err;
|
||||||
unsigned int size_vmode;
|
unsigned int size_vmode;
|
||||||
unsigned int size_remap;
|
unsigned int size_remap;
|
||||||
|
@ -291,14 +306,14 @@ static int vesafb_probe(struct platform_device *dev)
|
||||||
spaces our resource handlers simply don't know about */
|
spaces our resource handlers simply don't know about */
|
||||||
}
|
}
|
||||||
|
|
||||||
info = framebuffer_alloc(sizeof(u32) * 256, &dev->dev);
|
info = framebuffer_alloc(sizeof(struct vesafb_par), &dev->dev);
|
||||||
if (!info) {
|
if (!info) {
|
||||||
release_mem_region(vesafb_fix.smem_start, size_total);
|
release_mem_region(vesafb_fix.smem_start, size_total);
|
||||||
return -ENOMEM;
|
return -ENOMEM;
|
||||||
}
|
}
|
||||||
platform_set_drvdata(dev, info);
|
platform_set_drvdata(dev, info);
|
||||||
info->pseudo_palette = info->par;
|
par = info->par;
|
||||||
info->par = NULL;
|
info->pseudo_palette = par->pseudo_palette;
|
||||||
|
|
||||||
/* set vesafb aperture size for generic probing */
|
/* set vesafb aperture size for generic probing */
|
||||||
info->apertures = alloc_apertures(1);
|
info->apertures = alloc_apertures(1);
|
||||||
|
@ -407,17 +422,17 @@ static int vesafb_probe(struct platform_device *dev)
|
||||||
if (mtrr == 3) {
|
if (mtrr == 3) {
|
||||||
#ifdef CONFIG_MTRR
|
#ifdef CONFIG_MTRR
|
||||||
unsigned int temp_size = size_total;
|
unsigned int temp_size = size_total;
|
||||||
int rc;
|
|
||||||
|
|
||||||
/* Find the largest power-of-two */
|
/* Find the largest power-of-two */
|
||||||
temp_size = roundup_pow_of_two(temp_size);
|
temp_size = roundup_pow_of_two(temp_size);
|
||||||
|
|
||||||
/* Try and find a power of two to add */
|
/* Try and find a power of two to add */
|
||||||
do {
|
do {
|
||||||
rc = mtrr_add(vesafb_fix.smem_start, temp_size,
|
par->wc_cookie = mtrr_add(vesafb_fix.smem_start,
|
||||||
MTRR_TYPE_WRCOMB, 1);
|
temp_size,
|
||||||
|
MTRR_TYPE_WRCOMB, 1);
|
||||||
temp_size >>= 1;
|
temp_size >>= 1;
|
||||||
} while (temp_size >= PAGE_SIZE && rc == -EINVAL);
|
} while (temp_size >= PAGE_SIZE && par->wc_cookie == -EINVAL);
|
||||||
#endif
|
#endif
|
||||||
info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len);
|
info->screen_base = ioremap_wc(vesafb_fix.smem_start, vesafb_fix.smem_len);
|
||||||
} else {
|
} else {
|
||||||
|
@ -462,6 +477,10 @@ static int vesafb_probe(struct platform_device *dev)
|
||||||
fb_info(info, "%s frame buffer device\n", info->fix.id);
|
fb_info(info, "%s frame buffer device\n", info->fix.id);
|
||||||
return 0;
|
return 0;
|
||||||
err:
|
err:
|
||||||
|
#ifdef CONFIG_MTRR
|
||||||
|
if (par->wc_cookie >= 0)
|
||||||
|
mtrr_del(par->wc_cookie, 0, 0);
|
||||||
|
#endif
|
||||||
if (info->screen_base)
|
if (info->screen_base)
|
||||||
iounmap(info->screen_base);
|
iounmap(info->screen_base);
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
|
|
Loading…
Reference in a new issue