mirror of
https://github.com/edk2-porting/linux-next.git
synced 2024-12-27 06:34:11 +08:00
drm: Protect fb_defio in drivers with CONFIG_KMS_FBDEV_EMULATION
For reasons that entirely elude me fb.h exposes all the structures, even when it is not enabled. Except for special stuff like fb_defio. Which means all the drivers which haven't yet switched over to the defio support in the helpers and still roll their own, will fail to compile when fbdev emulation is disabled. Protect just those bits, as a gnarly reminder that conversion to the core defio helpers would be good. Cc: Dave Airlie <airlied@redhat.com> Reviewed-by: Alex Deucher <alexander.deucher@amd.com> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch> Link: http://patchwork.freedesktop.org/patch/msgid/1470847958-28465-6-git-send-email-daniel.vetter@ffwll.ch
This commit is contained in:
parent
9db7d2b20c
commit
0c756134cf
@ -72,10 +72,12 @@ static void qxl_fb_image_init(struct qxl_fb_image *qxl_fb_image,
|
||||
}
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
static struct fb_deferred_io qxl_defio = {
|
||||
.delay = QXL_DIRTY_DELAY,
|
||||
.deferred_io = drm_fb_helper_deferred_io,
|
||||
};
|
||||
#endif
|
||||
|
||||
static struct fb_ops qxlfb_ops = {
|
||||
.owner = THIS_MODULE,
|
||||
@ -312,8 +314,10 @@ static int qxlfb_create(struct qxl_fbdev *qfbdev,
|
||||
goto out_destroy_fbi;
|
||||
}
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
info->fbdefio = &qxl_defio;
|
||||
fb_deferred_io_init(info);
|
||||
#endif
|
||||
|
||||
qdev->fbdev_info = info;
|
||||
qdev->fbdev_qfb = &qfbdev->qfb;
|
||||
|
@ -203,6 +203,7 @@ static int udl_fb_open(struct fb_info *info, int user)
|
||||
|
||||
ufbdev->fb_count++;
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
if (fb_defio && (info->fbdefio == NULL)) {
|
||||
/* enable defio at last moment if not disabled by client */
|
||||
|
||||
@ -218,6 +219,7 @@ static int udl_fb_open(struct fb_info *info, int user)
|
||||
info->fbdefio = fbdefio;
|
||||
fb_deferred_io_init(info);
|
||||
}
|
||||
#endif
|
||||
|
||||
pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n",
|
||||
info->node, user, info, ufbdev->fb_count);
|
||||
@ -235,12 +237,14 @@ static int udl_fb_release(struct fb_info *info, int user)
|
||||
|
||||
ufbdev->fb_count--;
|
||||
|
||||
#ifdef CONFIG_DRM_FBDEV_EMULATION
|
||||
if ((ufbdev->fb_count == 0) && (info->fbdefio)) {
|
||||
fb_deferred_io_cleanup(info);
|
||||
kfree(info->fbdefio);
|
||||
info->fbdefio = NULL;
|
||||
info->fbops->fb_mmap = udl_fb_mmap;
|
||||
}
|
||||
#endif
|
||||
|
||||
pr_warn("released /dev/fb%d user=%d count=%d\n",
|
||||
info->node, user, ufbdev->fb_count);
|
||||
|
Loading…
Reference in New Issue
Block a user