fbdev/vesafb: Do not use struct fb_info.apertures
Acquire ownership of the firmware scanout buffer by calling Linux' aperture helpers. Remove the use of struct fb_info.apertures and do not set FBINFO_MISC_FIRMWARE; both of which previously configured buffer ownership. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Reviewed-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20221219160516.23436-17-tzimmermann@suse.de
This commit is contained in:
parent
4ef614be65
commit
678573b8ee
|
@ -9,6 +9,7 @@
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
#include <linux/aperture.h>
|
||||||
#include <linux/module.h>
|
#include <linux/module.h>
|
||||||
#include <linux/kernel.h>
|
#include <linux/kernel.h>
|
||||||
#include <linux/errno.h>
|
#include <linux/errno.h>
|
||||||
|
@ -31,6 +32,8 @@
|
||||||
|
|
||||||
struct vesafb_par {
|
struct vesafb_par {
|
||||||
u32 pseudo_palette[256];
|
u32 pseudo_palette[256];
|
||||||
|
resource_size_t base;
|
||||||
|
resource_size_t size;
|
||||||
int wc_cookie;
|
int wc_cookie;
|
||||||
struct resource *region;
|
struct resource *region;
|
||||||
};
|
};
|
||||||
|
@ -191,7 +194,7 @@ static void vesafb_destroy(struct fb_info *info)
|
||||||
arch_phys_wc_del(par->wc_cookie);
|
arch_phys_wc_del(par->wc_cookie);
|
||||||
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(par->base, par->size);
|
||||||
|
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
}
|
}
|
||||||
|
@ -316,14 +319,8 @@ static int vesafb_probe(struct platform_device *dev)
|
||||||
par = info->par;
|
par = info->par;
|
||||||
info->pseudo_palette = par->pseudo_palette;
|
info->pseudo_palette = par->pseudo_palette;
|
||||||
|
|
||||||
/* set vesafb aperture size for generic probing */
|
par->base = screen_info.lfb_base;
|
||||||
info->apertures = alloc_apertures(1);
|
par->size = size_total;
|
||||||
if (!info->apertures) {
|
|
||||||
err = -ENOMEM;
|
|
||||||
goto err;
|
|
||||||
}
|
|
||||||
info->apertures->ranges[0].base = screen_info.lfb_base;
|
|
||||||
info->apertures->ranges[0].size = size_total;
|
|
||||||
|
|
||||||
printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
|
printk(KERN_INFO "vesafb: mode is %dx%dx%d, linelength=%d, pages=%d\n",
|
||||||
vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, vesafb_fix.line_length, screen_info.pages);
|
vesafb_defined.xres, vesafb_defined.yres, vesafb_defined.bits_per_pixel, vesafb_fix.line_length, screen_info.pages);
|
||||||
|
@ -460,27 +457,29 @@ static int vesafb_probe(struct platform_device *dev)
|
||||||
info->fbops = &vesafb_ops;
|
info->fbops = &vesafb_ops;
|
||||||
info->var = vesafb_defined;
|
info->var = vesafb_defined;
|
||||||
info->fix = vesafb_fix;
|
info->fix = vesafb_fix;
|
||||||
info->flags = FBINFO_FLAG_DEFAULT | FBINFO_MISC_FIRMWARE |
|
info->flags = FBINFO_FLAG_DEFAULT | (ypan ? FBINFO_HWACCEL_YPAN : 0);
|
||||||
(ypan ? FBINFO_HWACCEL_YPAN : 0);
|
|
||||||
|
|
||||||
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
if (fb_alloc_cmap(&info->cmap, 256, 0) < 0) {
|
||||||
err = -ENOMEM;
|
err = -ENOMEM;
|
||||||
goto err_release_region;
|
goto err_release_region;
|
||||||
}
|
}
|
||||||
|
err = devm_aperture_acquire_for_platform_device(dev, par->base, par->size);
|
||||||
|
if (err)
|
||||||
|
goto err_fb_dealloc_cmap;
|
||||||
if (register_framebuffer(info)<0) {
|
if (register_framebuffer(info)<0) {
|
||||||
err = -EINVAL;
|
err = -EINVAL;
|
||||||
fb_dealloc_cmap(&info->cmap);
|
goto err_fb_dealloc_cmap;
|
||||||
goto err_release_region;
|
|
||||||
}
|
}
|
||||||
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_fb_dealloc_cmap:
|
||||||
|
fb_dealloc_cmap(&info->cmap);
|
||||||
err_release_region:
|
err_release_region:
|
||||||
arch_phys_wc_del(par->wc_cookie);
|
arch_phys_wc_del(par->wc_cookie);
|
||||||
if (info->screen_base)
|
if (info->screen_base)
|
||||||
iounmap(info->screen_base);
|
iounmap(info->screen_base);
|
||||||
if (par->region)
|
if (par->region)
|
||||||
release_region(0x3c0, 32);
|
release_region(0x3c0, 32);
|
||||||
err:
|
|
||||||
framebuffer_release(info);
|
framebuffer_release(info);
|
||||||
release_mem_region(vesafb_fix.smem_start, size_total);
|
release_mem_region(vesafb_fix.smem_start, size_total);
|
||||||
return err;
|
return err;
|
||||||
|
|
Loading…
Reference in New Issue