提交 53889c92 编写于 作者: N Noralf Trønnes

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: NNoralf Trønnes <noralf@tronnes.org>
Acked-by: NBenjamin Gaignard <benjamin.gaignard@linaro.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20171115142001.45358-13-noralf@tronnes.org
上级 d18df744
...@@ -17,6 +17,7 @@ ...@@ -17,6 +17,7 @@
#include <drm/drm_crtc_helper.h> #include <drm/drm_crtc_helper.h>
#include <drm/drm_gem_cma_helper.h> #include <drm/drm_gem_cma_helper.h>
#include <drm/drm_gem_framebuffer_helper.h> #include <drm/drm_gem_framebuffer_helper.h>
#include <drm/drm_fb_helper.h>
#include <drm/drm_fb_cma_helper.h> #include <drm/drm_fb_cma_helper.h>
#include <drm/drm_of.h> #include <drm/drm_of.h>
...@@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev, ...@@ -138,16 +139,9 @@ static int sti_atomic_check(struct drm_device *dev,
return ret; return ret;
} }
static void sti_output_poll_changed(struct drm_device *ddev)
{
struct sti_private *private = ddev->dev_private;
drm_fbdev_cma_hotplug_event(private->fbdev);
}
static const struct drm_mode_config_funcs sti_mode_config_funcs = { static const struct drm_mode_config_funcs sti_mode_config_funcs = {
.fb_create = drm_gem_fb_create, .fb_create = drm_gem_fb_create,
.output_poll_changed = sti_output_poll_changed, .output_poll_changed = drm_fb_helper_output_poll_changed,
.atomic_check = sti_atomic_check, .atomic_check = sti_atomic_check,
.atomic_commit = drm_atomic_helper_commit, .atomic_commit = drm_atomic_helper_commit,
}; };
...@@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev) ...@@ -230,11 +224,7 @@ static void sti_cleanup(struct drm_device *ddev)
{ {
struct sti_private *private = ddev->dev_private; struct sti_private *private = ddev->dev_private;
if (private->fbdev) { drm_fb_cma_fbdev_fini(ddev);
drm_fbdev_cma_fini(private->fbdev);
private->fbdev = NULL;
}
drm_kms_helper_poll_fini(ddev); drm_kms_helper_poll_fini(ddev);
component_unbind_all(ddev->dev, ddev); component_unbind_all(ddev->dev, ddev);
kfree(private); kfree(private);
...@@ -244,8 +234,6 @@ static void sti_cleanup(struct drm_device *ddev) ...@@ -244,8 +234,6 @@ static void sti_cleanup(struct drm_device *ddev)
static int sti_bind(struct device *dev) static int sti_bind(struct device *dev)
{ {
struct drm_device *ddev; struct drm_device *ddev;
struct sti_private *private;
struct drm_fbdev_cma *fbdev;
int ret; int ret;
ddev = drm_dev_alloc(&sti_driver, dev); ddev = drm_dev_alloc(&sti_driver, dev);
...@@ -266,15 +254,10 @@ static int sti_bind(struct device *dev) ...@@ -266,15 +254,10 @@ static int sti_bind(struct device *dev)
drm_mode_config_reset(ddev); drm_mode_config_reset(ddev);
private = ddev->dev_private;
if (ddev->mode_config.num_connector) { if (ddev->mode_config.num_connector) {
fbdev = drm_fbdev_cma_init(ddev, 32, ret = drm_fb_cma_fbdev_init(ddev, 32, 0);
ddev->mode_config.num_connector); if (ret)
if (IS_ERR(fbdev)) {
DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n"); DRM_DEBUG_DRIVER("Warning: fails to create fbdev\n");
fbdev = NULL;
}
private->fbdev = fbdev;
} }
return 0; return 0;
......
...@@ -24,7 +24,6 @@ struct sti_private { ...@@ -24,7 +24,6 @@ struct sti_private {
struct sti_compositor *compo; struct sti_compositor *compo;
struct drm_property *plane_zorder_property; struct drm_property *plane_zorder_property;
struct drm_device *drm_dev; struct drm_device *drm_dev;
struct drm_fbdev_cma *fbdev;
}; };
extern struct platform_driver sti_tvout_driver; extern struct platform_driver sti_tvout_driver;
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册