diff options
author | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-02-09 02:36:23 -0500 |
---|---|---|
committer | Tomi Valkeinen <tomi.valkeinen@ti.com> | 2018-03-01 02:18:18 -0500 |
commit | efd1f06be004a6a384f0482ef76c12bc202e1b8e (patch) | |
tree | 9c63f8ac2d2bd50f16def64569e48b47333c28c8 | |
parent | e6204a58b9e9ad01ab9c6d4b8b2b8b9c4e38bbba (diff) |
drm/omap: cleanup fbdev init/free
omap_fbdev_init() and omap_fbdev_free() use priv->fbdev directly.
However, omap_fbdev_init() returns the fbdev, and omap_drv.c also
assigns the return value to priv->fbdev. This is slightly confusing.
Clean this up by removing the omap_fbdev_init() return value, as we
don't care whether fbdev init succeeded or not. Also change omap_drv.c
to call omap_fbdev_free() always, and omap_fbdev_free() does the check
if fbdev was initialized.
While at it, rename omap_fbdev_free() to omap_fbdev_fini() to better
match the "init" counterpart.
Signed-off-by: Tomi Valkeinen <tomi.valkeinen@ti.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_drv.c | 9 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_fbdev.c | 18 | ||||
-rw-r--r-- | drivers/gpu/drm/omapdrm/omap_fbdev.h | 9 |
3 files changed, 16 insertions, 20 deletions
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c index 65a567dcf3ab..4f48b908bdc6 100644 --- a/drivers/gpu/drm/omapdrm/omap_drv.c +++ b/drivers/gpu/drm/omapdrm/omap_drv.c | |||
@@ -570,7 +570,7 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) | |||
570 | for (i = 0; i < priv->num_crtcs; i++) | 570 | for (i = 0; i < priv->num_crtcs; i++) |
571 | drm_crtc_vblank_off(priv->crtcs[i]); | 571 | drm_crtc_vblank_off(priv->crtcs[i]); |
572 | 572 | ||
573 | priv->fbdev = omap_fbdev_init(ddev); | 573 | omap_fbdev_init(ddev); |
574 | 574 | ||
575 | drm_kms_helper_poll_init(ddev); | 575 | drm_kms_helper_poll_init(ddev); |
576 | omap_modeset_enable_external_hpd(); | 576 | omap_modeset_enable_external_hpd(); |
@@ -588,8 +588,8 @@ static int omapdrm_init(struct omap_drm_private *priv, struct device *dev) | |||
588 | err_cleanup_helpers: | 588 | err_cleanup_helpers: |
589 | omap_modeset_disable_external_hpd(); | 589 | omap_modeset_disable_external_hpd(); |
590 | drm_kms_helper_poll_fini(ddev); | 590 | drm_kms_helper_poll_fini(ddev); |
591 | if (priv->fbdev) | 591 | |
592 | omap_fbdev_free(ddev); | 592 | omap_fbdev_fini(ddev); |
593 | err_cleanup_modeset: | 593 | err_cleanup_modeset: |
594 | drm_mode_config_cleanup(ddev); | 594 | drm_mode_config_cleanup(ddev); |
595 | omap_drm_irq_uninstall(ddev); | 595 | omap_drm_irq_uninstall(ddev); |
@@ -615,8 +615,7 @@ static void omapdrm_cleanup(struct omap_drm_private *priv) | |||
615 | omap_modeset_disable_external_hpd(); | 615 | omap_modeset_disable_external_hpd(); |
616 | drm_kms_helper_poll_fini(ddev); | 616 | drm_kms_helper_poll_fini(ddev); |
617 | 617 | ||
618 | if (priv->fbdev) | 618 | omap_fbdev_fini(ddev); |
619 | omap_fbdev_free(ddev); | ||
620 | 619 | ||
621 | drm_atomic_helper_shutdown(ddev); | 620 | drm_atomic_helper_shutdown(ddev); |
622 | 621 | ||
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 632ebcf2165f..be94480326d7 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c | |||
@@ -242,7 +242,7 @@ static struct drm_fb_helper *get_fb(struct fb_info *fbi) | |||
242 | } | 242 | } |
243 | 243 | ||
244 | /* initialize fbdev helper */ | 244 | /* initialize fbdev helper */ |
245 | struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) | 245 | void omap_fbdev_init(struct drm_device *dev) |
246 | { | 246 | { |
247 | struct omap_drm_private *priv = dev->dev_private; | 247 | struct omap_drm_private *priv = dev->dev_private; |
248 | struct omap_fbdev *fbdev = NULL; | 248 | struct omap_fbdev *fbdev = NULL; |
@@ -260,10 +260,8 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) | |||
260 | drm_fb_helper_prepare(dev, helper, &omap_fb_helper_funcs); | 260 | drm_fb_helper_prepare(dev, helper, &omap_fb_helper_funcs); |
261 | 261 | ||
262 | ret = drm_fb_helper_init(dev, helper, priv->num_connectors); | 262 | ret = drm_fb_helper_init(dev, helper, priv->num_connectors); |
263 | if (ret) { | 263 | if (ret) |
264 | dev_err(dev->dev, "could not init fbdev: ret=%d\n", ret); | ||
265 | goto fail; | 264 | goto fail; |
266 | } | ||
267 | 265 | ||
268 | ret = drm_fb_helper_single_add_all_connectors(helper); | 266 | ret = drm_fb_helper_single_add_all_connectors(helper); |
269 | if (ret) | 267 | if (ret) |
@@ -275,7 +273,7 @@ struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) | |||
275 | 273 | ||
276 | priv->fbdev = helper; | 274 | priv->fbdev = helper; |
277 | 275 | ||
278 | return helper; | 276 | return; |
279 | 277 | ||
280 | fini: | 278 | fini: |
281 | drm_fb_helper_fini(helper); | 279 | drm_fb_helper_fini(helper); |
@@ -283,12 +281,9 @@ fail: | |||
283 | kfree(fbdev); | 281 | kfree(fbdev); |
284 | 282 | ||
285 | dev_warn(dev->dev, "omap_fbdev_init failed\n"); | 283 | dev_warn(dev->dev, "omap_fbdev_init failed\n"); |
286 | /* well, limp along without an fbdev.. maybe X11 will work? */ | ||
287 | |||
288 | return NULL; | ||
289 | } | 284 | } |
290 | 285 | ||
291 | void omap_fbdev_free(struct drm_device *dev) | 286 | void omap_fbdev_fini(struct drm_device *dev) |
292 | { | 287 | { |
293 | struct omap_drm_private *priv = dev->dev_private; | 288 | struct omap_drm_private *priv = dev->dev_private; |
294 | struct drm_fb_helper *helper = priv->fbdev; | 289 | struct drm_fb_helper *helper = priv->fbdev; |
@@ -296,11 +291,14 @@ void omap_fbdev_free(struct drm_device *dev) | |||
296 | 291 | ||
297 | DBG(); | 292 | DBG(); |
298 | 293 | ||
294 | if (!helper) | ||
295 | return; | ||
296 | |||
299 | drm_fb_helper_unregister_fbi(helper); | 297 | drm_fb_helper_unregister_fbi(helper); |
300 | 298 | ||
301 | drm_fb_helper_fini(helper); | 299 | drm_fb_helper_fini(helper); |
302 | 300 | ||
303 | fbdev = to_omap_fbdev(priv->fbdev); | 301 | fbdev = to_omap_fbdev(helper); |
304 | 302 | ||
305 | /* unpin the GEM object pinned in omap_fbdev_create() */ | 303 | /* unpin the GEM object pinned in omap_fbdev_create() */ |
306 | if (fbdev->bo) | 304 | if (fbdev->bo) |
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.h b/drivers/gpu/drm/omapdrm/omap_fbdev.h index 1f5ba0996a1a..7dfd843f73f1 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.h +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.h | |||
@@ -24,14 +24,13 @@ struct drm_device; | |||
24 | struct drm_fb_helper; | 24 | struct drm_fb_helper; |
25 | 25 | ||
26 | #ifdef CONFIG_DRM_FBDEV_EMULATION | 26 | #ifdef CONFIG_DRM_FBDEV_EMULATION |
27 | struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev); | 27 | void omap_fbdev_init(struct drm_device *dev); |
28 | void omap_fbdev_free(struct drm_device *dev); | 28 | void omap_fbdev_fini(struct drm_device *dev); |
29 | #else | 29 | #else |
30 | static inline struct drm_fb_helper *omap_fbdev_init(struct drm_device *dev) | 30 | static inline void omap_fbdev_init(struct drm_device *dev) |
31 | { | 31 | { |
32 | return NULL; | ||
33 | } | 32 | } |
34 | static inline void omap_fbdev_free(struct drm_device *dev) | 33 | static inline void omap_fbdev_fini(struct drm_device *dev) |
35 | { | 34 | { |
36 | } | 35 | } |
37 | #endif | 36 | #endif |