staging/fbtft: Initialize fb_op struct as static const
Replace dynamic allocation of the fb_ops instance with static allocation. Initialize the fields at module-load time. The owner field changes to THIS_MODULE, as in all other fbdev drivers. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> Acked-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org> Acked-by: Javier Martinez Canillas <javierm@redhat.com> Link: https://patchwork.freedesktop.org/patch/msgid/20230828132131.29295-8-tzimmermann@suse.de
This commit is contained in:
parent
a564708ec4
commit
b1adff68e3
@ -473,6 +473,18 @@ static int fbtft_fb_blank(int blank, struct fb_info *info)
|
||||
return ret;
|
||||
}
|
||||
|
||||
static const struct fb_ops fbtft_ops = {
|
||||
.owner = THIS_MODULE;
|
||||
.fb_read = fb_sys_read;
|
||||
.fb_write = fbtft_fb_write;
|
||||
.fb_fillrect = fbtft_fb_fillrect;
|
||||
.fb_copyarea = fbtft_fb_copyarea;
|
||||
.fb_imageblit = fbtft_fb_imageblit;
|
||||
.fb_setcolreg = fbtft_fb_setcolreg;
|
||||
.fb_blank = fbtft_fb_blank;
|
||||
.fb_mmap = fb_deferred_io_mmap;
|
||||
};
|
||||
|
||||
static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)
|
||||
{
|
||||
if (src->write)
|
||||
@ -521,7 +533,6 @@ static void fbtft_merge_fbtftops(struct fbtft_ops *dst, struct fbtft_ops *src)
|
||||
* Creates a new frame buffer info structure.
|
||||
*
|
||||
* Also creates and populates the following structures:
|
||||
* info->fbops
|
||||
* info->fbdefio
|
||||
* info->pseudo_palette
|
||||
* par->fbtftops
|
||||
@ -536,7 +547,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
|
||||
{
|
||||
struct fb_info *info;
|
||||
struct fbtft_par *par;
|
||||
struct fb_ops *fbops = NULL;
|
||||
struct fb_deferred_io *fbdefio = NULL;
|
||||
u8 *vmem = NULL;
|
||||
void *txbuf = NULL;
|
||||
@ -611,10 +621,6 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
|
||||
if (!vmem)
|
||||
goto alloc_fail;
|
||||
|
||||
fbops = devm_kzalloc(dev, sizeof(struct fb_ops), GFP_KERNEL);
|
||||
if (!fbops)
|
||||
goto alloc_fail;
|
||||
|
||||
fbdefio = devm_kzalloc(dev, sizeof(struct fb_deferred_io), GFP_KERNEL);
|
||||
if (!fbdefio)
|
||||
goto alloc_fail;
|
||||
@ -638,19 +644,9 @@ struct fb_info *fbtft_framebuffer_alloc(struct fbtft_display *display,
|
||||
goto alloc_fail;
|
||||
|
||||
info->screen_buffer = vmem;
|
||||
info->fbops = fbops;
|
||||
info->fbops = &fbtft_ops;
|
||||
info->fbdefio = fbdefio;
|
||||
|
||||
fbops->owner = dev->driver->owner;
|
||||
fbops->fb_read = fb_sys_read;
|
||||
fbops->fb_write = fbtft_fb_write;
|
||||
fbops->fb_fillrect = fbtft_fb_fillrect;
|
||||
fbops->fb_copyarea = fbtft_fb_copyarea;
|
||||
fbops->fb_imageblit = fbtft_fb_imageblit;
|
||||
fbops->fb_setcolreg = fbtft_fb_setcolreg;
|
||||
fbops->fb_blank = fbtft_fb_blank;
|
||||
fbops->fb_mmap = fb_deferred_io_mmap;
|
||||
|
||||
fbdefio->delay = HZ / fps;
|
||||
fbdefio->sort_pagereflist = true;
|
||||
fbdefio->deferred_io = fbtft_deferred_io;
|
||||
|
Loading…
x
Reference in New Issue
Block a user