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

drm/sti: 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: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Cc: Vincent Abriou <vincent.abriou@st.com>
Signed-off-by: Noralf Trønnes <noralf@tronnes.org>
Acked-by: Benjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-13-noralf@tronnes.org

+5 -23
+5 -22
drivers/gpu/drm/sti/sti_drv.c
··· 17 17 #include <drm/drm_crtc_helper.h> 18 18 #include <drm/drm_gem_cma_helper.h> 19 19 #include <drm/drm_gem_framebuffer_helper.h> 20 + #include <drm/drm_fb_helper.h> 20 21 #include <drm/drm_fb_cma_helper.h> 21 22 #include <drm/drm_of.h> 22 23 ··· 139 138 return ret; 140 139 } 141 140 142 - static void sti_output_poll_changed(struct drm_device *ddev) 143 - { 144 - struct sti_private *private = ddev->dev_private; 145 - 146 - drm_fbdev_cma_hotplug_event(private->fbdev); 147 - } 148 - 149 141 static const struct drm_mode_config_funcs sti_mode_config_funcs = { 150 142 .fb_create = drm_gem_fb_create, 151 - .output_poll_changed = sti_output_poll_changed, 143 + .output_poll_changed = drm_fb_helper_output_poll_changed, 152 144 .atomic_check = sti_atomic_check, 153 145 .atomic_commit = drm_atomic_helper_commit, 154 146 }; ··· 224 230 { 225 231 struct sti_private *private = ddev->dev_private; 226 232 227 - if (private->fbdev) { 228 - drm_fbdev_cma_fini(private->fbdev); 229 - private->fbdev = NULL; 230 - } 231 - 233 + drm_fb_cma_fbdev_fini(ddev); 232 234 drm_kms_helper_poll_fini(ddev); 233 235 component_unbind_all(ddev->dev, ddev); 234 236 kfree(private); ··· 234 244 static int sti_bind(struct device *dev) 235 245 { 236 246 struct drm_device *ddev; 237 - struct sti_private *private; 238 - struct drm_fbdev_cma *fbdev; 239 247 int ret; 240 248 241 249 ddev = drm_dev_alloc(&sti_driver, dev); ··· 254 266 255 267 drm_mode_config_reset(ddev); 256 268 257 - private = ddev->dev_private; 258 269 if (ddev->mode_config.num_connector) { 259 - fbdev = drm_fbdev_cma_init(ddev, 32, 260 - ddev->mode_config.num_connector); 261 - if (IS_ERR(fbdev)) { 270 + ret = drm_fb_cma_fbdev_init(ddev, 32, 0); 271 + if (ret) 262 272 DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n"); 263 - fbdev = NULL; 264 - } 265 - private->fbdev = fbdev; 266 273 } 267 274 268 275 return 0;
-1
drivers/gpu/drm/sti/sti_drv.h
··· 24 24 struct sti_compositor *compo; 25 25 struct drm_property *plane_zorder_property; 26 26 struct drm_device *drm_dev; 27 - struct drm_fbdev_cma *fbdev; 28 27 }; 29 28 30 29 extern struct platform_driver sti_tvout_driver;