linux-fbdev.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Daniel Vetter <daniel@ffwll.ch>
To: Jani Nikula <jani.nikula@intel.com>
Cc: linux-fbdev@vger.kernel.org, intel-gfx@lists.freedesktop.org,
	dri-devel@lists.freedesktop.org
Subject: Re: [PATCH v3 02/12] video: fbdev: mb862xx: modify the static fb_ops directly
Date: Tue, 03 Dec 2019 16:50:52 +0000	[thread overview]
Message-ID: <20191203165052.GF624164@phenom.ffwll.local> (raw)
In-Reply-To: <51f55c02ea4057cc46335ca5c447b92a55383f77.1575390740.git.jani.nikula@intel.com>

On Tue, Dec 03, 2019 at 06:38:44PM +0200, Jani Nikula wrote:
> Avoid modifying the fb_ops via info->fbops to let us make the pointer
> const in the future. Drop the unnecessary EXPORT_SYMBOL() while at it.
> 
> Cc: linux-fbdev@vger.kernel.org
> Signed-off-by: Jani Nikula <jani.nikula@intel.com>
> ---
>  drivers/video/fbdev/mb862xx/mb862xxfb.h       |  2 +-
>  drivers/video/fbdev/mb862xx/mb862xxfb_accel.c | 15 +++++++--------
>  drivers/video/fbdev/mb862xx/mb862xxfbdrv.c    |  4 +++-
>  3 files changed, 11 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/video/fbdev/mb862xx/mb862xxfb.h b/drivers/video/fbdev/mb862xx/mb862xxfb.h
> index 50bc9b584ca1..52a77ea4e849 100644
> --- a/drivers/video/fbdev/mb862xx/mb862xxfb.h
> +++ b/drivers/video/fbdev/mb862xx/mb862xxfb.h
> @@ -89,7 +89,7 @@ struct mb862xxfb_par {
>  	u32			pseudo_palette[16];
>  };
>  
> -extern void mb862xxfb_init_accel(struct fb_info *info, int xres);
> +extern void mb862xxfb_init_accel(struct fb_info *info, struct fb_ops *fbops, int xres);
>  #ifdef CONFIG_FB_MB862XX_I2C
>  extern int mb862xx_i2c_init(struct mb862xxfb_par *par);
>  extern void mb862xx_i2c_exit(struct mb862xxfb_par *par);
> diff --git a/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c b/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c
> index f58ff900e82a..42569264801f 100644
> --- a/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c
> +++ b/drivers/video/fbdev/mb862xx/mb862xxfb_accel.c

/me cries in fbdev

> @@ -303,19 +303,19 @@ static void mb86290fb_fillrect(struct fb_info *info,
>  	mb862xxfb_write_fifo(7, cmd, info);
>  }
>  
> -void mb862xxfb_init_accel(struct fb_info *info, int xres)
> +void mb862xxfb_init_accel(struct fb_info *info, struct fb_ops *fbops, int xres)
>  {
>  	struct mb862xxfb_par *par = info->par;
>  
>  	if (info->var.bits_per_pixel = 32) {
> -		info->fbops->fb_fillrect = cfb_fillrect;
> -		info->fbops->fb_copyarea = cfb_copyarea;
> -		info->fbops->fb_imageblit = cfb_imageblit;
> +		fbops->fb_fillrect = cfb_fillrect;
> +		fbops->fb_copyarea = cfb_copyarea;
> +		fbops->fb_imageblit = cfb_imageblit;

Ok, so this just resets to the same values as mb862xxfb_ops.

>  	} else {
>  		outreg(disp, GC_L0EM, 3);
> -		info->fbops->fb_fillrect = mb86290fb_fillrect;
> -		info->fbops->fb_copyarea = mb86290fb_copyarea;
> -		info->fbops->fb_imageblit = mb86290fb_imageblit;
> +		fbops->fb_fillrect = mb86290fb_fillrect;
> +		fbops->fb_copyarea = mb86290fb_copyarea;
> +		fbops->fb_imageblit = mb86290fb_imageblit;

Which means if we'd copypaste that into an mb862xxfb_accel_ops we could do
this a bit cleaner, and leave the ops structs const.

>  	}
>  	outreg(draw, GDC_REG_DRAW_BASE, 0);
>  	outreg(draw, GDC_REG_MODE_MISC, 0x8000);
> @@ -326,6 +326,5 @@ void mb862xxfb_init_accel(struct fb_info *info, int xres)
>  	    FBINFO_HWACCEL_IMAGEBLIT;
>  	info->fix.accel = 0xff;	/*FIXME: add right define */
>  }
> -EXPORT_SYMBOL(mb862xxfb_init_accel);
>  
>  MODULE_LICENSE("GPL v2");
> diff --git a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
> index 962c0171d271..52755b591c14 100644
> --- a/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
> +++ b/drivers/video/fbdev/mb862xx/mb862xxfbdrv.c
> @@ -194,6 +194,8 @@ static int mb862xxfb_check_var(struct fb_var_screeninfo *var,
>  	return 0;
>  }
>  
> +static struct fb_ops mb862xxfb_ops;
> +
>  /*
>   * set display parameters
>   */
> @@ -204,7 +206,7 @@ static int mb862xxfb_set_par(struct fb_info *fbi)

set_par. It's called from set_par.

Ok not going to think about this more.
-Daniel

>  
>  	dev_dbg(par->dev, "%s\n", __func__);
>  	if (par->type = BT_CORALP)
> -		mb862xxfb_init_accel(fbi, fbi->var.xres);
> +		mb862xxfb_init_accel(fbi, &mb862xxfb_ops, fbi->var.xres);
>  
>  	if (par->pre_init)
>  		return 0;
> -- 
> 2.20.1
> 
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel

-- 
Daniel Vetter
Software Engineer, Intel Corporation
http://blog.ffwll.ch

  reply	other threads:[~2019-12-03 16:50 UTC|newest]

Thread overview: 34+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-12-03 16:38 [PATCH v3 00/12] video, drm, etc: constify fbops in struct fb_info Jani Nikula
2019-12-03 16:38 ` [PATCH v3 01/12] video: fbdev: atyfb: modify the static fb_ops directly Jani Nikula
2019-12-03 16:46   ` Daniel Vetter
2019-12-03 16:38 ` [PATCH v3 02/12] video: fbdev: mb862xx: " Jani Nikula
2019-12-03 16:50   ` Daniel Vetter [this message]
2019-12-03 16:38 ` [PATCH v3 03/12] video: fbdev: nvidia: " Jani Nikula
2019-12-03 16:54   ` [Intel-gfx] " Daniel Vetter
2019-12-03 16:38 ` [PATCH v3 04/12] video: fbdev: uvesafb: " Jani Nikula
2019-12-03 17:03   ` [Intel-gfx] " Daniel Vetter
2019-12-04  6:31     ` Jani Nikula
2019-12-03 16:38 ` [PATCH v3 05/12] video: fbdev: make fbops member of struct fb_info a const pointer Jani Nikula
2019-12-05  0:12   ` kbuild test robot
2019-12-03 16:38 ` [PATCH v3 06/12] drm: constify fb ops across all drivers Jani Nikula
2019-12-03 16:38 ` [PATCH v3 07/12] video: fbdev: intelfb: use const pointer for fb_ops Jani Nikula
2019-12-03 17:09   ` Daniel Vetter
2019-12-03 16:38 ` [PATCH v3 08/12] video: constify fb ops across all drivers Jani Nikula
2019-12-05  9:37   ` [Intel-gfx] " Jani Nikula
2019-12-03 16:38 ` [PATCH v3 09/12] HID: picoLCD: constify fb ops Jani Nikula
2019-12-09 13:59   ` [Intel-gfx] " Jani Nikula
2019-12-03 16:38 ` [PATCH v3 10/12] media: constify fb ops across all drivers Jani Nikula
2019-12-04 11:33   ` Sakari Ailus
2019-12-05  9:40     ` Jani Nikula
2019-12-12  9:02   ` Hans Verkuil
2019-12-13 10:41     ` Jani Nikula
2019-12-03 16:38 ` [PATCH v3 11/12] samples: vfio-mdev: constify fb ops Jani Nikula
2019-12-09 14:01   ` Jani Nikula
2019-12-09 18:55     ` Kirti Wankhede
2019-12-10  6:53       ` Jani Nikula
2019-12-03 16:38 ` [PATCH v3 12/12] auxdisplay: " Jani Nikula
2019-12-09 14:03   ` Jani Nikula
2019-12-10 19:08     ` Miguel Ojeda
2019-12-11 11:11       ` Jani Nikula
2019-12-11  8:35     ` robin
2019-12-03 16:42 ` [Intel-gfx] [PATCH v3 00/12] video, drm, etc: constify fbops in struct fb_info Jani Nikula

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=20191203165052.GF624164@phenom.ffwll.local \
    --to=daniel@ffwll.ch \
    --cc=dri-devel@lists.freedesktop.org \
    --cc=intel-gfx@lists.freedesktop.org \
    --cc=jani.nikula@intel.com \
    --cc=linux-fbdev@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).