From mboxrd@z Thu Jan 1 00:00:00 1970 From: Archit Taneja Subject: [PATCH 21/25] drm/udl: Use new drm_fb_helper functions Date: Mon, 13 Jul 2015 12:08:17 +0530 Message-ID: <1436769501-4105-22-git-send-email-architt@codeaurora.org> References: <1436769501-4105-1-git-send-email-architt@codeaurora.org> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from smtp.codeaurora.org ([198.145.29.96]:55522 "EHLO smtp.codeaurora.org" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751171AbbGMGjy (ORCPT ); Mon, 13 Jul 2015 02:39:54 -0400 In-Reply-To: <1436769501-4105-1-git-send-email-architt@codeaurora.org> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: dri-devel@lists.freedesktop.org, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, airlied@linux.ie, Archit Taneja , Haixia Shi , =?UTF-8?q?St=C3=A9phane=20Marchesin?= Use the newly created wrapper drm_fb_helper functions instead of callin= g core fbdev functions directly. They also simplify the fb_info creation. COMPILE TESTED ONLY. Cc: David Airlie Cc: Haixia Shi Cc: "St=C3=A9phane Marchesin" Signed-off-by: Archit Taneja --- drivers/gpu/drm/udl/udl_fb.c | 40 ++++++++++++------------------------= ---- 1 file changed, 12 insertions(+), 28 deletions(-) diff --git a/drivers/gpu/drm/udl/udl_fb.c b/drivers/gpu/drm/udl/udl_fb.= c index 5fc16ce..9fd6e83 100644 --- a/drivers/gpu/drm/udl/udl_fb.c +++ b/drivers/gpu/drm/udl/udl_fb.c @@ -288,7 +288,7 @@ static void udl_fb_fillrect(struct fb_info *info, c= onst struct fb_fillrect *rect { struct udl_fbdev *ufbdev =3D info->par; =20 - sys_fillrect(info, rect); + drm_fb_helper_sys_fillrect(info, rect); =20 udl_handle_damage(&ufbdev->ufb, rect->dx, rect->dy, rect->width, rect->height); @@ -298,7 +298,7 @@ static void udl_fb_copyarea(struct fb_info *info, c= onst struct fb_copyarea *regi { struct udl_fbdev *ufbdev =3D info->par; =20 - sys_copyarea(info, region); + drm_fb_helper_sys_copyarea(info, region); =20 udl_handle_damage(&ufbdev->ufb, region->dx, region->dy, region->width= , region->height); @@ -308,7 +308,7 @@ static void udl_fb_imageblit(struct fb_info *info, = const struct fb_image *image) { struct udl_fbdev *ufbdev =3D info->par; =20 - sys_imageblit(info, image); + drm_fb_helper_sys_imageblit(info, image); =20 udl_handle_damage(&ufbdev->ufb, image->dx, image->dy, image->width, image->height); @@ -506,21 +506,20 @@ static int udlfb_create(struct drm_fb_helper *hel= per, goto out_gfree; } =20 - info =3D framebuffer_alloc(0, device); - if (!info) { - ret =3D -ENOMEM; + info =3D drm_fb_helper_alloc_fbi(helper); + if (IS_ERR(info)) { + ret =3D PTR_ERR(info); goto out_gfree; } info->par =3D ufbdev; =20 ret =3D udl_framebuffer_init(dev, &ufbdev->ufb, &mode_cmd, obj); if (ret) - goto out_gfree; + goto out_destroy_fbi; =20 fb =3D &ufbdev->ufb.base; =20 ufbdev->helper.fb =3D fb; - ufbdev->helper.fbdev =3D info; =20 strcpy(info->fix.id, "udldrmfb"); =20 @@ -533,18 +532,13 @@ static int udlfb_create(struct drm_fb_helper *hel= per, drm_fb_helper_fill_fix(info, fb->pitches[0], fb->depth); drm_fb_helper_fill_var(info, &ufbdev->helper, sizes->fb_width, sizes-= >fb_height); =20 - ret =3D fb_alloc_cmap(&info->cmap, 256, 0); - if (ret) { - ret =3D -ENOMEM; - goto out_gfree; - } - - DRM_DEBUG_KMS("allocated %dx%d vmal %p\n", fb->width, fb->height, ufbdev->ufb.obj->vmapping); =20 return ret; +out_destroy_fbi: + drm_fb_helper_release_fbi(helper); out_gfree: drm_gem_object_unreference(&ufbdev->ufb.obj->base); out: @@ -558,14 +552,8 @@ static const struct drm_fb_helper_funcs udl_fb_hel= per_funcs =3D { static void udl_fbdev_destroy(struct drm_device *dev, struct udl_fbdev *ufbdev) { - struct fb_info *info; - if (ufbdev->helper.fbdev) { - info =3D ufbdev->helper.fbdev; - unregister_framebuffer(info); - if (info->cmap.len) - fb_dealloc_cmap(&info->cmap); - framebuffer_release(info); - } + drm_fb_helper_unregister_fbi(&ufbdev->helper); + drm_fb_helper_release_fbi(&ufbdev->helper); drm_fb_helper_fini(&ufbdev->helper); drm_framebuffer_unregister_private(&ufbdev->ufb.base); drm_framebuffer_cleanup(&ufbdev->ufb.base); @@ -631,11 +619,7 @@ void udl_fbdev_unplug(struct drm_device *dev) return; =20 ufbdev =3D udl->fbdev; - if (ufbdev->helper.fbdev) { - struct fb_info *info; - info =3D ufbdev->helper.fbdev; - unlink_framebuffer(info); - } + drm_fb_helper_unlink_fbi(&ufbdev->helper); } =20 struct drm_framebuffer * --=20 The Qualcomm Innovation Center, Inc. is a member of the Code Aurora For= um, hosted by The Linux Foundation