@@ -18,6 +18,7 @@
#include "rockchip_drm_fb.h"
#include "rockchip_drm_gem.h"
+
static const struct drm_framebuffer_funcs rockchip_drm_fb_funcs = {
.destroy = drm_gem_fb_destroy,
.create_handle = drm_gem_fb_create_handle,
@@ -30,22 +31,14 @@ rockchip_fb_alloc(struct drm_device *dev, const struct drm_mode_fb_cmd2 *mode_cm
{
struct drm_framebuffer *fb;
int ret;
- int i;
fb = kzalloc(sizeof(*fb), GFP_KERNEL);
if (!fb)
return ERR_PTR(-ENOMEM);
- drm_helper_mode_fill_fb_struct(dev, fb, mode_cmd);
-
- for (i = 0; i < num_planes; i++)
- fb->obj[i] = obj[i];
-
- ret = drm_framebuffer_init(dev, fb, &rockchip_drm_fb_funcs);
+ ret = drm_gem_fb_init_with_funcs(fb, dev, mode_cmd, obj, num_planes,
+ &rockchip_drm_fb_funcs);
if (ret) {
- DRM_DEV_ERROR(dev->dev,
- "Failed to initialize framebuffer: %d\n",
- ret);
kfree(fb);
return ERR_PTR(ret);
}
Use generic helper code. Signed-off-by: Andrzej Pietrasiewicz <andrzej.p@collabora.com> --- drivers/gpu/drm/rockchip/rockchip_drm_fb.c | 13 +++---------- 1 file changed, 3 insertions(+), 10 deletions(-)