Message ID | 1438339922-6805-12-git-send-email-architt@codeaurora.org (mailing list archive) |
---|---|
State | New, archived |
Headers | show |
Hi Archit, Thank you for the patch. On Friday 31 July 2015 16:21:48 Archit Taneja wrote: > Use the newly created wrapper drm_fb_helper functions instead of calling > core fbdev functions directly. They also simplify the fb_info creation. > > v3: > - Update error handling for new drm_fb_helper funcs. Check using IS_ERR() > instead of checking for NULL. > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > > v2: > - No changes > > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Signed-off-by: Archit Taneja <architt@codeaurora.org> Acked-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > --- > drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 +++++++++++--------------------- > 1 file changed, 13 insertions(+), 25 deletions(-) > > diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c > b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 23b5a84..4916543 100644 > --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c > +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c > @@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = { > /* Note: to properly handle manual update displays, we wrap the > * basic fbdev ops which write to the framebuffer > */ > - .fb_read = fb_sys_read, > - .fb_write = fb_sys_write, > - .fb_fillrect = sys_fillrect, > - .fb_copyarea = sys_copyarea, > - .fb_imageblit = sys_imageblit, > + .fb_read = drm_fb_helper_sys_read, > + .fb_write = drm_fb_helper_sys_write, > + .fb_fillrect = drm_fb_helper_sys_fillrect, > + .fb_copyarea = drm_fb_helper_sys_copyarea, > + .fb_imageblit = drm_fb_helper_sys_imageblit, > > .fb_check_var = drm_fb_helper_check_var, > .fb_set_par = drm_fb_helper_set_par, > @@ -179,10 +179,10 @@ static int omap_fbdev_create(struct drm_fb_helper > *helper, > > mutex_lock(&dev->struct_mutex); > > - fbi = framebuffer_alloc(0, dev->dev); > - if (!fbi) { > + fbi = drm_fb_helper_alloc_fbi(helper); > + if (IS_ERR(fbi)) { > dev_err(dev->dev, "failed to allocate fb info\n"); > - ret = -ENOMEM; > + ret = PTR_ERR(fbi); > goto fail_unlock; > } > > @@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper > *helper, > > fbdev->fb = fb; > helper->fb = fb; > - helper->fbdev = fbi; > > fbi->par = helper; > fbi->flags = FBINFO_DEFAULT; > @@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper > *helper, > > strcpy(fbi->fix.id, MODULE_NAME); > > - ret = fb_alloc_cmap(&fbi->cmap, 256, 0); > - if (ret) { > - ret = -ENOMEM; > - goto fail_unlock; > - } > - > drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); > drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height); > > @@ -236,8 +229,9 @@ fail_unlock: > fail: > > if (ret) { > - if (fbi) > - framebuffer_release(fbi); > + > + drm_fb_helper_release_fbi(helper); > + > if (fb) { > drm_framebuffer_unregister_private(fb); > drm_framebuffer_remove(fb); > @@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev) > struct omap_drm_private *priv = dev->dev_private; > struct drm_fb_helper *helper = priv->fbdev; > struct omap_fbdev *fbdev; > - struct fb_info *fbi; > > DBG(); > > - fbi = helper->fbdev; > - > - /* only cleanup framebuffer if it is present */ > - if (fbi) { > - unregister_framebuffer(fbi); > - framebuffer_release(fbi); > - } > + drm_fb_helper_unregister_fbi(helper); > + drm_fb_helper_release_fbi(helper); > > drm_fb_helper_fini(helper);
On 31/07/15 13:51, Archit Taneja wrote: > Use the newly created wrapper drm_fb_helper functions instead of calling > core fbdev functions directly. They also simplify the fb_info creation. > > v3: > - Update error handling for new drm_fb_helper funcs. Check using IS_ERR() > instead of checking for NULL. > > Reported-by: Dan Carpenter <dan.carpenter@oracle.com> > > v2: > - No changes > > Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> > Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> > > Signed-off-by: Archit Taneja <architt@codeaurora.org> > --- > drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 ++++++++++++------------------------ > 1 file changed, 13 insertions(+), 25 deletions(-) Acked-by: Tomi Valkeinen <tomi.valkeinen@ti.com> Tomi
diff --git a/drivers/gpu/drm/omapdrm/omap_fbdev.c b/drivers/gpu/drm/omapdrm/omap_fbdev.c index 23b5a84..4916543 100644 --- a/drivers/gpu/drm/omapdrm/omap_fbdev.c +++ b/drivers/gpu/drm/omapdrm/omap_fbdev.c @@ -86,11 +86,11 @@ static struct fb_ops omap_fb_ops = { /* Note: to properly handle manual update displays, we wrap the * basic fbdev ops which write to the framebuffer */ - .fb_read = fb_sys_read, - .fb_write = fb_sys_write, - .fb_fillrect = sys_fillrect, - .fb_copyarea = sys_copyarea, - .fb_imageblit = sys_imageblit, + .fb_read = drm_fb_helper_sys_read, + .fb_write = drm_fb_helper_sys_write, + .fb_fillrect = drm_fb_helper_sys_fillrect, + .fb_copyarea = drm_fb_helper_sys_copyarea, + .fb_imageblit = drm_fb_helper_sys_imageblit, .fb_check_var = drm_fb_helper_check_var, .fb_set_par = drm_fb_helper_set_par, @@ -179,10 +179,10 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, mutex_lock(&dev->struct_mutex); - fbi = framebuffer_alloc(0, dev->dev); - if (!fbi) { + fbi = drm_fb_helper_alloc_fbi(helper); + if (IS_ERR(fbi)) { dev_err(dev->dev, "failed to allocate fb info\n"); - ret = -ENOMEM; + ret = PTR_ERR(fbi); goto fail_unlock; } @@ -190,7 +190,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, fbdev->fb = fb; helper->fb = fb; - helper->fbdev = fbi; fbi->par = helper; fbi->flags = FBINFO_DEFAULT; @@ -198,12 +197,6 @@ static int omap_fbdev_create(struct drm_fb_helper *helper, strcpy(fbi->fix.id, MODULE_NAME); - ret = fb_alloc_cmap(&fbi->cmap, 256, 0); - if (ret) { - ret = -ENOMEM; - goto fail_unlock; - } - drm_fb_helper_fill_fix(fbi, fb->pitches[0], fb->depth); drm_fb_helper_fill_var(fbi, helper, sizes->fb_width, sizes->fb_height); @@ -236,8 +229,9 @@ fail_unlock: fail: if (ret) { - if (fbi) - framebuffer_release(fbi); + + drm_fb_helper_release_fbi(helper); + if (fb) { drm_framebuffer_unregister_private(fb); drm_framebuffer_remove(fb); @@ -312,17 +306,11 @@ void omap_fbdev_free(struct drm_device *dev) struct omap_drm_private *priv = dev->dev_private; struct drm_fb_helper *helper = priv->fbdev; struct omap_fbdev *fbdev; - struct fb_info *fbi; DBG(); - fbi = helper->fbdev; - - /* only cleanup framebuffer if it is present */ - if (fbi) { - unregister_framebuffer(fbi); - framebuffer_release(fbi); - } + drm_fb_helper_unregister_fbi(helper); + drm_fb_helper_release_fbi(helper); drm_fb_helper_fini(helper);
Use the newly created wrapper drm_fb_helper functions instead of calling core fbdev functions directly. They also simplify the fb_info creation. v3: - Update error handling for new drm_fb_helper funcs. Check using IS_ERR() instead of checking for NULL. Reported-by: Dan Carpenter <dan.carpenter@oracle.com> v2: - No changes Cc: Tomi Valkeinen <tomi.valkeinen@ti.com> Cc: Laurent Pinchart <laurent.pinchart@ideasonboard.com> Signed-off-by: Archit Taneja <architt@codeaurora.org> --- drivers/gpu/drm/omapdrm/omap_fbdev.c | 38 ++++++++++++------------------------ 1 file changed, 13 insertions(+), 25 deletions(-)