From mboxrd@z Thu Jan 1 00:00:00 1970 From: Inki Dae Subject: Re: [PATCH 14/25] drm/exynos: Use new drm_fb_helper functions Date: Tue, 11 Aug 2015 18:11:18 +0900 Message-ID: <55C9BC36.2020502@samsung.com> References: <1436769501-4105-1-git-send-email-architt@codeaurora.org> <1436769501-4105-15-git-send-email-architt@codeaurora.org> <55C9BAAF.4040907@samsung.com> Mime-Version: 1.0 Content-Type: text/plain; charset=utf-8 Content-Transfer-Encoding: QUOTED-PRINTABLE Return-path: Received: from mailout1.samsung.com ([203.254.224.24]:41172 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933715AbbHKJLU (ORCPT ); Tue, 11 Aug 2015 05:11:20 -0400 Received: from epcpsbgr4.samsung.com (u144.gpu120.samsung.co.kr [203.254.230.144]) by mailout1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NSW01LJDUUU7FC0@mailout1.samsung.com> for linux-arm-msm@vger.kernel.org; Tue, 11 Aug 2015 18:11:18 +0900 (KST) In-reply-to: <55C9BAAF.4040907@samsung.com> Sender: linux-arm-msm-owner@vger.kernel.org List-Id: linux-arm-msm@vger.kernel.org To: Archit Taneja , dri-devel@lists.freedesktop.org, daniel@ffwll.ch Cc: linux-arm-msm@vger.kernel.org, airlied@linux.ie, Joonyoung Shim , Seung-Woo Kim On 2015=EB=85=84 08=EC=9B=94 11=EC=9D=BC 18:04, Inki Dae wrote: > On 2015=EB=85=84 07=EC=9B=94 13=EC=9D=BC 15:38, Archit Taneja wrote: >> Use the newly created wrapper drm_fb_helper functions instead of cal= ling >> core fbdev functions directly. They also simplify the fb_info creati= on. >> >> COMPILE TESTED ONLY. >> >> Cc: Inki Dae >> Cc: Joonyoung Shim >> Cc: Seung-Woo Kim >> >> Signed-off-by: Archit Taneja >> --- >> drivers/gpu/drm/exynos/exynos_drm_fbdev.c | 45 +++++++++-----------= ----------- >> 1 file changed, 12 insertions(+), 33 deletions(-) >> >> diff --git a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c b/drivers/gpu= /drm/exynos/exynos_drm_fbdev.c >> index e0b085b..6975b70 100644 >> --- a/drivers/gpu/drm/exynos/exynos_drm_fbdev.c >> +++ b/drivers/gpu/drm/exynos/exynos_drm_fbdev.c >> @@ -65,9 +65,9 @@ static int exynos_drm_fb_mmap(struct fb_info *info= , >> static struct fb_ops exynos_drm_fb_ops =3D { >> .owner =3D THIS_MODULE, >> .fb_mmap =3D exynos_drm_fb_mmap, >> - .fb_fillrect =3D cfb_fillrect, >> - .fb_copyarea =3D cfb_copyarea, >> - .fb_imageblit =3D cfb_imageblit, >> + .fb_fillrect =3D drm_fb_helper_cfb_fillrect, >> + .fb_copyarea =3D drm_fb_helper_cfb_copyarea, >> + .fb_imageblit =3D drm_fb_helper_cfb_imageblit, >> .fb_check_var =3D drm_fb_helper_check_var, >> .fb_set_par =3D drm_fb_helper_set_par, >> .fb_blank =3D drm_fb_helper_blank, >> @@ -142,10 +142,10 @@ static int exynos_drm_fbdev_create(struct drm_= fb_helper *helper, >> =20 >> mutex_lock(&dev->struct_mutex); >> =20 >> - fbi =3D framebuffer_alloc(0, &pdev->dev); >> - if (!fbi) { >> + fbi =3D drm_fb_helper_alloc_fbi(helper); >> + if (IS_ERR(fbi)) { >> DRM_ERROR("failed to allocate fb info.\n"); >> - ret =3D -ENOMEM; >> + ret =3D PTR_ERR(fbi); >> goto out; >> } >> =20 >> @@ -165,7 +165,7 @@ static int exynos_drm_fbdev_create(struct drm_fb= _helper *helper, >> =20 >> if (IS_ERR(exynos_gem_obj)) { >> ret =3D PTR_ERR(exynos_gem_obj); >> - goto err_release_framebuffer; >> + goto err_release_fbi; >> } >> =20 >> exynos_fbdev->exynos_gem_obj =3D exynos_gem_obj; >> @@ -178,21 +178,13 @@ static int exynos_drm_fbdev_create(struct drm_= fb_helper *helper, >> goto err_destroy_gem; >> } >> =20 >> - helper->fbdev =3D fbi; >> - >> fbi->par =3D helper; >> fbi->flags =3D FBINFO_FLAG_DEFAULT; >> fbi->fbops =3D &exynos_drm_fb_ops; >> =20 >> - ret =3D fb_alloc_cmap(&fbi->cmap, 256, 0); >> - if (ret) { >> - DRM_ERROR("failed to allocate cmap.\n"); >> - goto err_destroy_framebuffer; >> - } >> - >> ret =3D exynos_drm_fbdev_update(helper, sizes, helper->fb); >> if (ret < 0) >> - goto err_dealloc_cmap; >> + goto err_destroy_framebuffer; >=20 > With above change, err_dealloc_cmap label isn't used anymore so you n= eed > to remove below lines, >=20 > err_dealloc_cmap: > fb_dealloc_cmap(&fbi->cmap); Oops, Sorry. You already posted v2 and there is no warning. Please ignore it. Thanks, Inki Dae >=20 > Thanks, > Inki Dae >=20 >> =20 >> mutex_unlock(&dev->struct_mutex); >> return ret; >> @@ -203,8 +195,8 @@ err_destroy_framebuffer: >> drm_framebuffer_cleanup(helper->fb); >> err_destroy_gem: >> exynos_drm_gem_destroy(exynos_gem_obj); >> -err_release_framebuffer: >> - framebuffer_release(fbi); >> +err_release_fbi: >> + drm_fb_helper_release_fbi(helper); >> =20 >> /* >> * if failed, all resources allocated above would be released by >> @@ -312,21 +304,8 @@ static void exynos_drm_fbdev_destroy(struct drm= _device *dev, >> } >> } >> =20 >> - /* release linux framebuffer */ >> - if (fb_helper->fbdev) { >> - struct fb_info *info; >> - int ret; >> - >> - info =3D fb_helper->fbdev; >> - ret =3D unregister_framebuffer(info); >> - if (ret < 0) >> - DRM_DEBUG_KMS("failed unregister_framebuffer()\n"); >> - >> - if (info->cmap.len) >> - fb_dealloc_cmap(&info->cmap); >> - >> - framebuffer_release(info); >> - } >> + drm_fb_helper_unregister_fbi(fb_helper); >> + drm_fb_helper_release_fbi(fb_helper); >> =20 >> drm_fb_helper_fini(fb_helper); >> } >> >=20