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

drm/atmel-hlcdc: 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: Boris Brezillon <boris.brezillon@free-electrons.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Boris Brezillon <boris.brezillon@free-electrons.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-6-noralf@tronnes.org

+5 -23
+4 -22
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
··· 461 461 return drm_gem_fb_create(dev, file_priv, mode_cmd); 462 462 } 463 463 464 - static void atmel_hlcdc_fb_output_poll_changed(struct drm_device *dev) 465 - { 466 - struct atmel_hlcdc_dc *dc = dev->dev_private; 467 - 468 - drm_fbdev_cma_hotplug_event(dc->fbdev); 469 - } 470 - 471 464 struct atmel_hlcdc_dc_commit { 472 465 struct work_struct work; 473 466 struct drm_device *dev; ··· 556 563 557 564 static const struct drm_mode_config_funcs mode_config_funcs = { 558 565 .fb_create = atmel_hlcdc_fb_create, 559 - .output_poll_changed = atmel_hlcdc_fb_output_poll_changed, 566 + .output_poll_changed = drm_fb_helper_output_poll_changed, 560 567 .atomic_check = drm_atomic_helper_check, 561 568 .atomic_commit = atmel_hlcdc_dc_atomic_commit, 562 569 }; ··· 658 665 659 666 platform_set_drvdata(pdev, dev); 660 667 661 - dc->fbdev = drm_fbdev_cma_init(dev, 24, 662 - dev->mode_config.num_connector); 663 - if (IS_ERR(dc->fbdev)) 664 - dc->fbdev = NULL; 668 + drm_fb_cma_fbdev_init(dev, 24, 0); 665 669 666 670 drm_kms_helper_poll_init(dev); 667 671 ··· 678 688 { 679 689 struct atmel_hlcdc_dc *dc = dev->dev_private; 680 690 681 - if (dc->fbdev) 682 - drm_fbdev_cma_fini(dc->fbdev); 691 + drm_fb_cma_fbdev_fini(dev); 683 692 flush_workqueue(dc->wq); 684 693 drm_kms_helper_poll_fini(dev); 685 694 drm_mode_config_cleanup(dev); ··· 692 703 pm_runtime_disable(dev->dev); 693 704 clk_disable_unprepare(dc->hlcdc->periph_clk); 694 705 destroy_workqueue(dc->wq); 695 - } 696 - 697 - static void atmel_hlcdc_dc_lastclose(struct drm_device *dev) 698 - { 699 - struct atmel_hlcdc_dc *dc = dev->dev_private; 700 - 701 - drm_fbdev_cma_restore_mode(dc->fbdev); 702 706 } 703 707 704 708 static int atmel_hlcdc_dc_irq_postinstall(struct drm_device *dev) ··· 726 744 .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM | 727 745 DRIVER_MODESET | DRIVER_PRIME | 728 746 DRIVER_ATOMIC, 729 - .lastclose = atmel_hlcdc_dc_lastclose, 747 + .lastclose = drm_fb_helper_lastclose, 730 748 .irq_handler = atmel_hlcdc_dc_irq_handler, 731 749 .irq_preinstall = atmel_hlcdc_dc_irq_uninstall, 732 750 .irq_postinstall = atmel_hlcdc_dc_irq_postinstall,
+1 -1
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.h
··· 32 32 #include <drm/drm_atomic_helper.h> 33 33 #include <drm/drm_crtc.h> 34 34 #include <drm/drm_crtc_helper.h> 35 + #include <drm/drm_fb_helper.h> 35 36 #include <drm/drm_fb_cma_helper.h> 36 37 #include <drm/drm_gem_cma_helper.h> 37 38 #include <drm/drm_gem_framebuffer_helper.h> ··· 375 374 const struct atmel_hlcdc_dc_desc *desc; 376 375 struct dma_pool *dscrpool; 377 376 struct atmel_hlcdc *hlcdc; 378 - struct drm_fbdev_cma *fbdev; 379 377 struct drm_crtc *crtc; 380 378 struct atmel_hlcdc_layer *layers[ATMEL_HLCDC_MAX_LAYERS]; 381 379 struct workqueue_struct *wq;