[09/26] drm/ast: Use drm_fb_helper_fill_info
diff mbox series

Message ID 20190124165831.16427-10-daniel.vetter@ffwll.ch
State New
Headers show
Series
  • some cleanups, mostly around fbdev emulation
Related show

Commit Message

Daniel Vetter Jan. 24, 2019, 4:58 p.m. UTC
Should not result in any changes.

Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Junwei Zhang <Jerry.Zhang@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: "Christian König" <christian.koenig@amd.com>
Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Sean Paul <sean@poorly.run>
Cc: YueHaibing <yuehaibing@huawei.com>
Cc: Sam Bobroff <sbobroff@linux.ibm.com>
---
 drivers/gpu/drm/ast/ast_drv.h | 2 +-
 drivers/gpu/drm/ast/ast_fb.c  | 7 +------
 2 files changed, 2 insertions(+), 7 deletions(-)

Comments

Sam Ravnborg Jan. 24, 2019, 6 p.m. UTC | #1
Hi Daniel.

On Thu, Jan 24, 2019 at 05:58:14PM +0100, Daniel Vetter wrote:
> Should not result in any changes.
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Junwei Zhang <Jerry.Zhang@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: "Christian König" <christian.koenig@amd.com>
> Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Sean Paul <sean@poorly.run>
> Cc: YueHaibing <yuehaibing@huawei.com>
> Cc: Sam Bobroff <sbobroff@linux.ibm.com>
> ---
>  drivers/gpu/drm/ast/ast_drv.h | 2 +-
>  drivers/gpu/drm/ast/ast_fb.c  | 7 +------
>  2 files changed, 2 insertions(+), 7 deletions(-)
> 
> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> index bfc65040dfcb..ffce4608e0c5 100644
> --- a/drivers/gpu/drm/ast/ast_drv.h
> +++ b/drivers/gpu/drm/ast/ast_drv.h
> @@ -259,7 +259,7 @@ struct ast_framebuffer {
>  };
>  
>  struct ast_fbdev {
> -	struct drm_fb_helper helper;
> +	struct drm_fb_helper helper; /* must be first */

Again in the category "I do not know the code",
but I failed to see whay "struct drm_fb_helper" have to be first.

I saw no ugly cast or similar when browsign the code, but I
must have missed something?

	Sam
Daniel Vetter Jan. 25, 2019, 8:51 a.m. UTC | #2
On Thu, Jan 24, 2019 at 07:00:11PM +0100, Sam Ravnborg wrote:
> Hi Daniel.
> 
> On Thu, Jan 24, 2019 at 05:58:14PM +0100, Daniel Vetter wrote:
> > Should not result in any changes.
> > 
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > Cc: Dave Airlie <airlied@redhat.com>
> > Cc: Junwei Zhang <Jerry.Zhang@amd.com>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: "Christian König" <christian.koenig@amd.com>
> > Cc: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Sean Paul <sean@poorly.run>
> > Cc: YueHaibing <yuehaibing@huawei.com>
> > Cc: Sam Bobroff <sbobroff@linux.ibm.com>
> > ---
> >  drivers/gpu/drm/ast/ast_drv.h | 2 +-
> >  drivers/gpu/drm/ast/ast_fb.c  | 7 +------
> >  2 files changed, 2 insertions(+), 7 deletions(-)
> > 
> > diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> > index bfc65040dfcb..ffce4608e0c5 100644
> > --- a/drivers/gpu/drm/ast/ast_drv.h
> > +++ b/drivers/gpu/drm/ast/ast_drv.h
> > @@ -259,7 +259,7 @@ struct ast_framebuffer {
> >  };
> >  
> >  struct ast_fbdev {
> > -	struct drm_fb_helper helper;
> > +	struct drm_fb_helper helper; /* must be first */
> 
> Again in the category "I do not know the code",
> but I failed to see whay "struct drm_fb_helper" have to be first.
> 
> I saw no ugly cast or similar when browsign the code, but I
> must have missed something?

It's casting the void *info->par to either struct ast_fbdev *(in ast code)
or struct drm_fb_helper * (in fb helper code).
-Daniel

Patch
diff mbox series

diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index bfc65040dfcb..ffce4608e0c5 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -259,7 +259,7 @@  struct ast_framebuffer {
 };
 
 struct ast_fbdev {
-	struct drm_fb_helper helper;
+	struct drm_fb_helper helper; /* must be first */
 	struct ast_framebuffer afb;
 	void *sysram;
 	int size;
diff --git a/drivers/gpu/drm/ast/ast_fb.c b/drivers/gpu/drm/ast/ast_fb.c
index 2c9f8dd9733a..c3d00be69749 100644
--- a/drivers/gpu/drm/ast/ast_fb.c
+++ b/drivers/gpu/drm/ast/ast_fb.c
@@ -217,8 +217,6 @@  static int astfb_create(struct drm_fb_helper *helper,
 		ret = PTR_ERR(info);
 		goto out;
 	}
-	info->par = afbdev;
-
 	ret = ast_framebuffer_init(dev, &afbdev->afb, &mode_cmd, gobj);
 	if (ret)
 		goto out;
@@ -229,15 +227,12 @@  static int astfb_create(struct drm_fb_helper *helper,
 	fb = &afbdev->afb.base;
 	afbdev->helper.fb = fb;
 
-	strcpy(info->fix.id, "astdrmfb");
-
 	info->fbops = &astfb_ops;
 
 	info->apertures->ranges[0].base = pci_resource_start(dev->pdev, 0);
 	info->apertures->ranges[0].size = pci_resource_len(dev->pdev, 0);
 
-	drm_fb_helper_fill_fix(info, fb->pitches[0], fb->format->depth);
-	drm_fb_helper_fill_var(info, &afbdev->helper, sizes->fb_width, sizes->fb_height);
+	drm_fb_helper_fill_info(info, &afbdev->helper);
 
 	info->screen_base = sysram;
 	info->screen_size = size;