Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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

+8
+4
drivers/gpu/drm/qxl/qxl_fb.c
··· 72 72 } 73 73 } 74 74 75 + #ifdef CONFIG_DRM_FBDEV_EMULATION 75 76 static struct fb_deferred_io qxl_defio = { 76 77 .delay = QXL_DIRTY_DELAY, 77 78 .deferred_io = drm_fb_helper_deferred_io, 78 79 }; 80 + #endif 79 81 80 82 static struct fb_ops qxlfb_ops = { 81 83 .owner = THIS_MODULE, ··· 314 312 goto out_destroy_fbi; 315 313 } 316 314 315 + #ifdef CONFIG_DRM_FBDEV_EMULATION 317 316 info->fbdefio = &qxl_defio; 318 317 fb_deferred_io_init(info); 318 + #endif 319 319 320 320 qdev->fbdev_info = info; 321 321 qdev->fbdev_qfb = &qfbdev->qfb;
+4
drivers/gpu/drm/udl/udl_fb.c
··· 203 203 204 204 ufbdev->fb_count++; 205 205 206 + #ifdef CONFIG_DRM_FBDEV_EMULATION 206 207 if (fb_defio && (info->fbdefio == NULL)) { 207 208 /* enable defio at last moment if not disabled by client */ 208 209 ··· 219 218 info->fbdefio = fbdefio; 220 219 fb_deferred_io_init(info); 221 220 } 221 + #endif 222 222 223 223 pr_notice("open /dev/fb%d user=%d fb_info=%p count=%d\n", 224 224 info->node, user, info, ufbdev->fb_count); ··· 237 235 238 236 ufbdev->fb_count--; 239 237 238 + #ifdef CONFIG_DRM_FBDEV_EMULATION 240 239 if ((ufbdev->fb_count == 0) && (info->fbdefio)) { 241 240 fb_deferred_io_cleanup(info); 242 241 kfree(info->fbdefio); 243 242 info->fbdefio = NULL; 244 243 info->fbops->fb_mmap = udl_fb_mmap; 245 244 } 245 + #endif 246 246 247 247 pr_warn("released /dev/fb%d user=%d count=%d\n", 248 248 info->node, user, ufbdev->fb_count);