Message ID | 20230330074150.7637-4-tzimmermann@suse.de (mailing list archive) |
---|---|
State | Superseded |
Headers | show |
Series | drm/msm: Convert fbdev to DRM client | expand |
On Thu, 30 Mar 2023 at 10:41, Thomas Zimmermann <tzimmermann@suse.de> wrote: > > Remove struct msm_fbdev, which is an empty wrapper around struct > drm_fb_helper. Use the latter directly. No functional changes. > > Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> > --- > drivers/gpu/drm/msm/msm_fbdev.c | 19 +++---------------- > 1 file changed, 3 insertions(+), 16 deletions(-) > > diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c > index 323a79d9ef83..0985486d194b 100644 > --- a/drivers/gpu/drm/msm/msm_fbdev.c > +++ b/drivers/gpu/drm/msm/msm_fbdev.c > @@ -18,12 +18,6 @@ > * fbdev funcs, to implement legacy fbdev interface on top of drm driver > */ > > -#define to_msm_fbdev(x) container_of(x, struct msm_fbdev, base) > - > -struct msm_fbdev { > - struct drm_fb_helper base; > -}; > - > static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) > { > struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par; > @@ -129,16 +123,13 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { > struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) > { > struct msm_drm_private *priv = dev->dev_private; > - struct msm_fbdev *fbdev; > struct drm_fb_helper *helper; > int ret; > > - fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); > - if (!fbdev) > + helper = kzalloc(sizeof(*helper), GFP_KERNEL); > + if (!helper) > return NULL; > > - helper = &fbdev->base; > - > drm_fb_helper_prepare(dev, helper, 32, &msm_fb_helper_funcs); > > ret = drm_fb_helper_init(dev, helper); > @@ -159,7 +150,6 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) > drm_fb_helper_fini(helper); > fail: > drm_fb_helper_unprepare(helper); > - kfree(fbdev); I think this will leak the newly created helper instance. > return NULL; > } > > @@ -168,7 +158,6 @@ void msm_fbdev_free(struct drm_device *dev) > struct msm_drm_private *priv = dev->dev_private; > struct drm_fb_helper *helper = priv->fbdev; > struct drm_framebuffer *fb = helper->fb; > - struct msm_fbdev *fbdev; > > DBG(); > > @@ -176,8 +165,6 @@ void msm_fbdev_free(struct drm_device *dev) > > drm_fb_helper_fini(helper); > > - fbdev = to_msm_fbdev(priv->fbdev); > - > /* this will free the backing object */ > if (fb) { > struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0); > @@ -186,7 +173,7 @@ void msm_fbdev_free(struct drm_device *dev) > } > > drm_fb_helper_unprepare(helper); > - kfree(fbdev); > + kfree(helper); > > priv->fbdev = NULL; > } > -- > 2.40.0 >
diff --git a/drivers/gpu/drm/msm/msm_fbdev.c b/drivers/gpu/drm/msm/msm_fbdev.c index 323a79d9ef83..0985486d194b 100644 --- a/drivers/gpu/drm/msm/msm_fbdev.c +++ b/drivers/gpu/drm/msm/msm_fbdev.c @@ -18,12 +18,6 @@ * fbdev funcs, to implement legacy fbdev interface on top of drm driver */ -#define to_msm_fbdev(x) container_of(x, struct msm_fbdev, base) - -struct msm_fbdev { - struct drm_fb_helper base; -}; - static int msm_fbdev_mmap(struct fb_info *info, struct vm_area_struct *vma) { struct drm_fb_helper *helper = (struct drm_fb_helper *)info->par; @@ -129,16 +123,13 @@ static const struct drm_fb_helper_funcs msm_fb_helper_funcs = { struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) { struct msm_drm_private *priv = dev->dev_private; - struct msm_fbdev *fbdev; struct drm_fb_helper *helper; int ret; - fbdev = kzalloc(sizeof(*fbdev), GFP_KERNEL); - if (!fbdev) + helper = kzalloc(sizeof(*helper), GFP_KERNEL); + if (!helper) return NULL; - helper = &fbdev->base; - drm_fb_helper_prepare(dev, helper, 32, &msm_fb_helper_funcs); ret = drm_fb_helper_init(dev, helper); @@ -159,7 +150,6 @@ struct drm_fb_helper *msm_fbdev_init(struct drm_device *dev) drm_fb_helper_fini(helper); fail: drm_fb_helper_unprepare(helper); - kfree(fbdev); return NULL; } @@ -168,7 +158,6 @@ void msm_fbdev_free(struct drm_device *dev) struct msm_drm_private *priv = dev->dev_private; struct drm_fb_helper *helper = priv->fbdev; struct drm_framebuffer *fb = helper->fb; - struct msm_fbdev *fbdev; DBG(); @@ -176,8 +165,6 @@ void msm_fbdev_free(struct drm_device *dev) drm_fb_helper_fini(helper); - fbdev = to_msm_fbdev(priv->fbdev); - /* this will free the backing object */ if (fb) { struct drm_gem_object *bo = msm_framebuffer_bo(fb, 0); @@ -186,7 +173,7 @@ void msm_fbdev_free(struct drm_device *dev) } drm_fb_helper_unprepare(helper); - kfree(fbdev); + kfree(helper); priv->fbdev = NULL; }
Remove struct msm_fbdev, which is an empty wrapper around struct drm_fb_helper. Use the latter directly. No functional changes. Signed-off-by: Thomas Zimmermann <tzimmermann@suse.de> --- drivers/gpu/drm/msm/msm_fbdev.c | 19 +++---------------- 1 file changed, 3 insertions(+), 16 deletions(-)