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

drm/arm/mali: Use drm_fb_cma_fbdev_init/fini()

Use drm_fb_cma_fbdev_init() and drm_fb_cma_fbdev_fini() which relies on
the fact that drm_device holds a pointer to the drm_fb_helper structure.
This means that the driver doesn't have to keep track of that.
Also use the drm_fb_helper functions directly.

Cc: Liviu Dudau <liviu.dudau@arm.com>
Cc: Brian Starkey <brian.starkey@arm.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Liviu Dudau <liviu.dudau@arm.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-20-noralf@tronnes.org

+7 -33
+7 -32
drivers/gpu/drm/arm/malidp_drv.c
··· 13 13 #include <linux/module.h> 14 14 #include <linux/clk.h> 15 15 #include <linux/component.h> 16 - #include <linux/console.h> 17 16 #include <linux/of_device.h> 18 17 #include <linux/of_graph.h> 19 18 #include <linux/of_reserved_mem.h> ··· 23 24 #include <drm/drm_atomic_helper.h> 24 25 #include <drm/drm_crtc.h> 25 26 #include <drm/drm_crtc_helper.h> 27 + #include <drm/drm_fb_helper.h> 26 28 #include <drm/drm_fb_cma_helper.h> 27 29 #include <drm/drm_gem_cma_helper.h> 28 30 #include <drm/drm_gem_framebuffer_helper.h> ··· 183 183 return (ret > 0) ? 0 : -ETIMEDOUT; 184 184 } 185 185 186 - static void malidp_output_poll_changed(struct drm_device *drm) 187 - { 188 - struct malidp_drm *malidp = drm->dev_private; 189 - 190 - drm_fbdev_cma_hotplug_event(malidp->fbdev); 191 - } 192 - 193 186 static void malidp_atomic_commit_hw_done(struct drm_atomic_state *state) 194 187 { 195 188 struct drm_pending_vblank_event *event; ··· 245 252 246 253 static const struct drm_mode_config_funcs malidp_mode_config_funcs = { 247 254 .fb_create = drm_gem_fb_create, 248 - .output_poll_changed = malidp_output_poll_changed, 255 + .output_poll_changed = drm_fb_helper_output_poll_changed, 249 256 .atomic_check = drm_atomic_helper_check, 250 257 .atomic_commit = drm_atomic_helper_commit, 251 258 }; ··· 310 317 return 0; 311 318 } 312 319 313 - static void malidp_lastclose(struct drm_device *drm) 314 - { 315 - struct malidp_drm *malidp = drm->dev_private; 316 - 317 - drm_fbdev_cma_restore_mode(malidp->fbdev); 318 - } 319 - 320 320 DEFINE_DRM_GEM_CMA_FOPS(fops); 321 321 322 322 static struct drm_driver malidp_driver = { 323 323 .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC | 324 324 DRIVER_PRIME, 325 - .lastclose = malidp_lastclose, 325 + .lastclose = drm_fb_helper_lastclose, 326 326 .gem_free_object_unlocked = drm_gem_cma_free_object, 327 327 .gem_vm_ops = &drm_gem_cma_vm_ops, 328 328 .dumb_create = drm_gem_cma_dumb_create, ··· 609 623 610 624 drm_mode_config_reset(drm); 611 625 612 - malidp->fbdev = drm_fbdev_cma_init(drm, 32, 613 - drm->mode_config.num_connector); 614 - 615 - if (IS_ERR(malidp->fbdev)) { 616 - ret = PTR_ERR(malidp->fbdev); 617 - malidp->fbdev = NULL; 626 + ret = drm_fb_cma_fbdev_init(drm, 32, 0); 627 + if (ret) 618 628 goto fbdev_fail; 619 - } 620 629 621 630 drm_kms_helper_poll_init(drm); 622 631 ··· 622 641 return 0; 623 642 624 643 register_fail: 625 - if (malidp->fbdev) { 626 - drm_fbdev_cma_fini(malidp->fbdev); 627 - malidp->fbdev = NULL; 628 - } 644 + drm_fb_cma_fbdev_fini(drm); 629 645 drm_kms_helper_poll_fini(drm); 630 646 fbdev_fail: 631 647 pm_runtime_get_sync(dev); ··· 659 681 struct malidp_drm *malidp = drm->dev_private; 660 682 661 683 drm_dev_unregister(drm); 662 - if (malidp->fbdev) { 663 - drm_fbdev_cma_fini(malidp->fbdev); 664 - malidp->fbdev = NULL; 665 - } 684 + drm_fb_cma_fbdev_fini(drm); 666 685 drm_kms_helper_poll_fini(drm); 667 686 pm_runtime_get_sync(dev); 668 687 malidp_se_irq_fini(drm);
-1
drivers/gpu/drm/arm/malidp_drv.h
··· 20 20 21 21 struct malidp_drm { 22 22 struct malidp_hw_device *dev; 23 - struct drm_fbdev_cma *fbdev; 24 23 struct drm_crtc crtc; 25 24 wait_queue_head_t wq; 26 25 atomic_t config_valid;