diff mbox

[10/24] drm/mtk: mtk_drm_fb -> drm_framebuffer

Message ID 20180330141138.28987-10-daniels@collabora.com (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Stone March 30, 2018, 2:11 p.m. UTC
Now that mtk_drm_fb is an empty wrapper around drm_framebuffer, we can
just delete it.

Signed-off-by: Daniel Stone <daniels@collabora.com>
Cc: CK Hu <ck.hu@mediatek.com>
Cc: Philipp Zabel <p.zabel@pengutronix.de>
---
 drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++-----------------------
 1 file changed, 14 insertions(+), 26 deletions(-)

Comments

Daniel Stone May 17, 2018, 1:13 p.m. UTC | #1
Hi CK, Philipp,

On 30 March 2018 at 15:11, Daniel Stone <daniels@collabora.com> wrote:
> Now that mtk_drm_fb is an empty wrapper around drm_framebuffer, we can
> just delete it.

Did you get a chance to look at these three patches for Mediatek?

Cheers,
Daniel
Sean Paul May 17, 2018, 1:59 p.m. UTC | #2
On Fri, Mar 30, 2018 at 03:11:24PM +0100, Daniel Stone wrote:
> Now that mtk_drm_fb is an empty wrapper around drm_framebuffer, we can
> just delete it.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>

Reviewed-by: Sean Paul <seanpaul@chromium.org>

> ---
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++-----------------------
>  1 file changed, 14 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> index f130e37123b5..be5f6f1daf55 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> @@ -23,49 +23,37 @@
>  #include "mtk_drm_fb.h"
>  #include "mtk_drm_gem.h"
>  
> -/*
> - * mtk specific framebuffer structure.
> - *
> - * @fb: drm framebuffer object.
> - * @gem_obj: array of gem objects.
> - */
> -struct mtk_drm_fb {
> -	struct drm_framebuffer	base;
> -};
> -
> -#define to_mtk_fb(x) container_of(x, struct mtk_drm_fb, base)
> -
>  static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = {
>  	.create_handle = drm_gem_fb_create_handle,
>  	.destroy = drm_gem_fb_destroy,
>  };
>  
> -static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,
> +static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev,
>  					const struct drm_mode_fb_cmd2 *mode,
>  					struct drm_gem_object *obj)
>  {
> -	struct mtk_drm_fb *mtk_fb;
> +	struct drm_framebuffer *fb;
>  	int ret;
>  
>  	if (drm_format_num_planes(mode->pixel_format) != 1)
>  		return ERR_PTR(-EINVAL);
>  
> -	mtk_fb = kzalloc(sizeof(*mtk_fb), GFP_KERNEL);
> -	if (!mtk_fb)
> +	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
> +	if (!fb)
>  		return ERR_PTR(-ENOMEM);
>  
> -	drm_helper_mode_fill_fb_struct(dev, &mtk_fb->base, mode);
> +	drm_helper_mode_fill_fb_struct(dev, fb, mode);
>  
> -	mtk_fb->base.obj[0] = obj;
> +	fb->obj[0] = obj;
>  
> -	ret = drm_framebuffer_init(dev, &mtk_fb->base, &mtk_drm_fb_funcs);
> +	ret = drm_framebuffer_init(dev, fb, &mtk_drm_fb_funcs);
>  	if (ret) {
>  		DRM_ERROR("failed to initialize framebuffer\n");
> -		kfree(mtk_fb);
> +		kfree(fb);
>  		return ERR_PTR(ret);
>  	}
>  
> -	return mtk_fb;
> +	return fb;
>  }
>  
>  /*
> @@ -100,7 +88,7 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
>  					       struct drm_file *file,
>  					       const struct drm_mode_fb_cmd2 *cmd)
>  {
> -	struct mtk_drm_fb *mtk_fb;
> +	struct drm_framebuffer *fb;
>  	struct drm_gem_object *gem;
>  	unsigned int width = cmd->width;
>  	unsigned int height = cmd->height;
> @@ -123,13 +111,13 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
>  		goto unreference;
>  	}
>  
> -	mtk_fb = mtk_drm_framebuffer_init(dev, cmd, gem);
> -	if (IS_ERR(mtk_fb)) {
> -		ret = PTR_ERR(mtk_fb);
> +	fb = mtk_drm_framebuffer_init(dev, cmd, gem);
> +	if (IS_ERR(fb)) {
> +		ret = PTR_ERR(fb);
>  		goto unreference;
>  	}
>  
> -	return &mtk_fb->base;
> +	return fb;
>  
>  unreference:
>  	drm_gem_object_put_unlocked(gem);
> -- 
> 2.16.2
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Thierry Reding May 17, 2018, 2:56 p.m. UTC | #3
On Fri, Mar 30, 2018 at 03:11:24PM +0100, Daniel Stone wrote:
> Now that mtk_drm_fb is an empty wrapper around drm_framebuffer, we can
> just delete it.
> 
> Signed-off-by: Daniel Stone <daniels@collabora.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++-----------------------
>  1 file changed, 14 insertions(+), 26 deletions(-)

Reviewed-by: Thierry Reding <treding@nvidia.com>
CK Hu (胡俊光) May 18, 2018, 8:37 a.m. UTC | #4
On Fri, 2018-03-30 at 22:11 +0800, Daniel Stone wrote:
> Now that mtk_drm_fb is an empty wrapper around drm_framebuffer, we can
> just delete it.
> 

Reviewed-by: CK Hu <ck.hu@mediatek.com>

> Signed-off-by: Daniel Stone <daniels@collabora.com>
> Cc: CK Hu <ck.hu@mediatek.com>
> Cc: Philipp Zabel <p.zabel@pengutronix.de>
> ---
>  drivers/gpu/drm/mediatek/mtk_drm_fb.c | 40 ++++++++++++-----------------------
>  1 file changed, 14 insertions(+), 26 deletions(-)
> 
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> index f130e37123b5..be5f6f1daf55 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
> @@ -23,49 +23,37 @@
>  #include "mtk_drm_fb.h"
>  #include "mtk_drm_gem.h"
>  
> -/*
> - * mtk specific framebuffer structure.
> - *
> - * @fb: drm framebuffer object.
> - * @gem_obj: array of gem objects.
> - */
> -struct mtk_drm_fb {
> -	struct drm_framebuffer	base;
> -};
> -
> -#define to_mtk_fb(x) container_of(x, struct mtk_drm_fb, base)
> -
>  static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = {
>  	.create_handle = drm_gem_fb_create_handle,
>  	.destroy = drm_gem_fb_destroy,
>  };
>  
> -static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,
> +static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev,
>  					const struct drm_mode_fb_cmd2 *mode,
>  					struct drm_gem_object *obj)
>  {
> -	struct mtk_drm_fb *mtk_fb;
> +	struct drm_framebuffer *fb;
>  	int ret;
>  
>  	if (drm_format_num_planes(mode->pixel_format) != 1)
>  		return ERR_PTR(-EINVAL);
>  
> -	mtk_fb = kzalloc(sizeof(*mtk_fb), GFP_KERNEL);
> -	if (!mtk_fb)
> +	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
> +	if (!fb)
>  		return ERR_PTR(-ENOMEM);
>  
> -	drm_helper_mode_fill_fb_struct(dev, &mtk_fb->base, mode);
> +	drm_helper_mode_fill_fb_struct(dev, fb, mode);
>  
> -	mtk_fb->base.obj[0] = obj;
> +	fb->obj[0] = obj;
>  
> -	ret = drm_framebuffer_init(dev, &mtk_fb->base, &mtk_drm_fb_funcs);
> +	ret = drm_framebuffer_init(dev, fb, &mtk_drm_fb_funcs);
>  	if (ret) {
>  		DRM_ERROR("failed to initialize framebuffer\n");
> -		kfree(mtk_fb);
> +		kfree(fb);
>  		return ERR_PTR(ret);
>  	}
>  
> -	return mtk_fb;
> +	return fb;
>  }
>  
>  /*
> @@ -100,7 +88,7 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
>  					       struct drm_file *file,
>  					       const struct drm_mode_fb_cmd2 *cmd)
>  {
> -	struct mtk_drm_fb *mtk_fb;
> +	struct drm_framebuffer *fb;
>  	struct drm_gem_object *gem;
>  	unsigned int width = cmd->width;
>  	unsigned int height = cmd->height;
> @@ -123,13 +111,13 @@ struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
>  		goto unreference;
>  	}
>  
> -	mtk_fb = mtk_drm_framebuffer_init(dev, cmd, gem);
> -	if (IS_ERR(mtk_fb)) {
> -		ret = PTR_ERR(mtk_fb);
> +	fb = mtk_drm_framebuffer_init(dev, cmd, gem);
> +	if (IS_ERR(fb)) {
> +		ret = PTR_ERR(fb);
>  		goto unreference;
>  	}
>  
> -	return &mtk_fb->base;
> +	return fb;
>  
>  unreference:
>  	drm_gem_object_put_unlocked(gem);
diff mbox

Patch

diff --git a/drivers/gpu/drm/mediatek/mtk_drm_fb.c b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
index f130e37123b5..be5f6f1daf55 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_fb.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_fb.c
@@ -23,49 +23,37 @@ 
 #include "mtk_drm_fb.h"
 #include "mtk_drm_gem.h"
 
-/*
- * mtk specific framebuffer structure.
- *
- * @fb: drm framebuffer object.
- * @gem_obj: array of gem objects.
- */
-struct mtk_drm_fb {
-	struct drm_framebuffer	base;
-};
-
-#define to_mtk_fb(x) container_of(x, struct mtk_drm_fb, base)
-
 static const struct drm_framebuffer_funcs mtk_drm_fb_funcs = {
 	.create_handle = drm_gem_fb_create_handle,
 	.destroy = drm_gem_fb_destroy,
 };
 
-static struct mtk_drm_fb *mtk_drm_framebuffer_init(struct drm_device *dev,
+static struct drm_framebuffer *mtk_drm_framebuffer_init(struct drm_device *dev,
 					const struct drm_mode_fb_cmd2 *mode,
 					struct drm_gem_object *obj)
 {
-	struct mtk_drm_fb *mtk_fb;
+	struct drm_framebuffer *fb;
 	int ret;
 
 	if (drm_format_num_planes(mode->pixel_format) != 1)
 		return ERR_PTR(-EINVAL);
 
-	mtk_fb = kzalloc(sizeof(*mtk_fb), GFP_KERNEL);
-	if (!mtk_fb)
+	fb = kzalloc(sizeof(*fb), GFP_KERNEL);
+	if (!fb)
 		return ERR_PTR(-ENOMEM);
 
-	drm_helper_mode_fill_fb_struct(dev, &mtk_fb->base, mode);
+	drm_helper_mode_fill_fb_struct(dev, fb, mode);
 
-	mtk_fb->base.obj[0] = obj;
+	fb->obj[0] = obj;
 
-	ret = drm_framebuffer_init(dev, &mtk_fb->base, &mtk_drm_fb_funcs);
+	ret = drm_framebuffer_init(dev, fb, &mtk_drm_fb_funcs);
 	if (ret) {
 		DRM_ERROR("failed to initialize framebuffer\n");
-		kfree(mtk_fb);
+		kfree(fb);
 		return ERR_PTR(ret);
 	}
 
-	return mtk_fb;
+	return fb;
 }
 
 /*
@@ -100,7 +88,7 @@  struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
 					       struct drm_file *file,
 					       const struct drm_mode_fb_cmd2 *cmd)
 {
-	struct mtk_drm_fb *mtk_fb;
+	struct drm_framebuffer *fb;
 	struct drm_gem_object *gem;
 	unsigned int width = cmd->width;
 	unsigned int height = cmd->height;
@@ -123,13 +111,13 @@  struct drm_framebuffer *mtk_drm_mode_fb_create(struct drm_device *dev,
 		goto unreference;
 	}
 
-	mtk_fb = mtk_drm_framebuffer_init(dev, cmd, gem);
-	if (IS_ERR(mtk_fb)) {
-		ret = PTR_ERR(mtk_fb);
+	fb = mtk_drm_framebuffer_init(dev, cmd, gem);
+	if (IS_ERR(fb)) {
+		ret = PTR_ERR(fb);
 		goto unreference;
 	}
 
-	return &mtk_fb->base;
+	return fb;
 
 unreference:
 	drm_gem_object_put_unlocked(gem);