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

drm/atmel-hlcdc: Use drm_fbdev_generic_setup()

The CMA helper is already using the drm_fb_helper_generic_probe part of
the generic fbdev emulation. This patch makes full use of the generic
fbdev emulation by using its drm_client callbacks. This means that
drm_mode_config_funcs->output_poll_changed and drm_driver->lastclose are
now handled by the emulation code. Additionally fbdev unregister happens
automatically on drm_dev_unregister().

The drm_fbdev_generic_setup() call is put after drm_dev_register() in the
driver. This is done to highlight the fact that fbdev emulation is an
internal client that makes use of the driver, it is not part of the
driver as such. If fbdev setup fails, an error is printed, but the driver
succeeds probing.

Cc: Boris Brezillon <boris.brezillon@bootlin.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Sam Ravnborg <sam@ravnborg.org>
Acked-by: Boris Brezillon <boris.brezillon@bootlin.com>
Link: https://patchwork.freedesktop.org/patch/msgid/20181025201340.34227-7-noralf@tronnes.org

+2 -5
+2 -5
drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
··· 556 556 557 557 static const struct drm_mode_config_funcs mode_config_funcs = { 558 558 .fb_create = atmel_hlcdc_fb_create, 559 - .output_poll_changed = drm_fb_helper_output_poll_changed, 560 559 .atomic_check = drm_atomic_helper_check, 561 560 .atomic_commit = atmel_hlcdc_dc_atomic_commit, 562 561 }; ··· 657 658 658 659 platform_set_drvdata(pdev, dev); 659 660 660 - drm_fb_cma_fbdev_init(dev, 24, 0); 661 - 662 661 drm_kms_helper_poll_init(dev); 663 662 664 663 return 0; ··· 675 678 { 676 679 struct atmel_hlcdc_dc *dc = dev->dev_private; 677 680 678 - drm_fb_cma_fbdev_fini(dev); 679 681 flush_workqueue(dc->wq); 680 682 drm_kms_helper_poll_fini(dev); 681 683 drm_atomic_helper_shutdown(dev); ··· 723 727 .driver_features = DRIVER_HAVE_IRQ | DRIVER_GEM | 724 728 DRIVER_MODESET | DRIVER_PRIME | 725 729 DRIVER_ATOMIC, 726 - .lastclose = drm_fb_helper_lastclose, 727 730 .irq_handler = atmel_hlcdc_dc_irq_handler, 728 731 .irq_preinstall = atmel_hlcdc_dc_irq_uninstall, 729 732 .irq_postinstall = atmel_hlcdc_dc_irq_postinstall, ··· 763 768 ret = drm_dev_register(ddev, 0); 764 769 if (ret) 765 770 goto err_unload; 771 + 772 + drm_fbdev_generic_setup(ddev, 24); 766 773 767 774 return 0; 768 775