diff mbox series

[08/13] video: fbdev: make fbops member of struct fb_info a const pointer

Message ID b0ff7235e8c941d6b9fcc28d5e49ceeb92d56828.1574871797.git.jani.nikula@intel.com (mailing list archive)
State New, archived
Headers show
Series video, drm: constify fbops in struct fb_info | expand

Commit Message

Jani Nikula Nov. 27, 2019, 4:32 p.m. UTC
Now that we no longer modify the fbops, or hold non-const pointers to
it, we can make it const. With that, also deferred_io_private needs to
be const. After this, we can start making the fbops const all over the
place.

Cc: linux-fbdev@vger.kernel.org
Signed-off-by: Jani Nikula <jani.nikula@intel.com>
---
 include/linux/fb.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

kernel test robot Nov. 28, 2019, 9:36 a.m. UTC | #1
Hi Jani,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.4 next-20191127]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jani-Nikula/video-drm-constify-fbops-in-struct-fb_info/20191128-022047
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-randconfig-s1-20191128 (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/video/fbdev/uvesafb.c: In function 'uvesafb_init_info':
>> drivers/video/fbdev/uvesafb.c:1443:25: error: assignment of member 'fb_blank' in read-only object
      info->fbops->fb_blank = NULL;
                            ^
>> drivers/video/fbdev/uvesafb.c:1513:31: error: assignment of member 'fb_pan_display' in read-only object
      info->fbops->fb_pan_display = NULL;
                                  ^
--
   drivers/video/fbdev/mb862xx/mb862xxfb_accel.c: In function 'mb862xxfb_init_accel':
>> drivers/video/fbdev/mb862xx/mb862xxfb_accel.c:311:28: error: assignment of member 'fb_fillrect' in read-only object
      info->fbops->fb_fillrect = cfb_fillrect;
                               ^
>> drivers/video/fbdev/mb862xx/mb862xxfb_accel.c:312:28: error: assignment of member 'fb_copyarea' in read-only object
      info->fbops->fb_copyarea = cfb_copyarea;
                               ^
>> drivers/video/fbdev/mb862xx/mb862xxfb_accel.c:313:29: error: assignment of member 'fb_imageblit' in read-only object
      info->fbops->fb_imageblit = cfb_imageblit;
                                ^
   drivers/video/fbdev/mb862xx/mb862xxfb_accel.c:316:28: error: assignment of member 'fb_fillrect' in read-only object
      info->fbops->fb_fillrect = mb86290fb_fillrect;
                               ^
   drivers/video/fbdev/mb862xx/mb862xxfb_accel.c:317:28: error: assignment of member 'fb_copyarea' in read-only object
      info->fbops->fb_copyarea = mb86290fb_copyarea;
                               ^
   drivers/video/fbdev/mb862xx/mb862xxfb_accel.c:318:29: error: assignment of member 'fb_imageblit' in read-only object
      info->fbops->fb_imageblit = mb86290fb_imageblit;
                                ^
--
   drivers/video/fbdev/nvidia/nvidia.c: In function 'nvidiafb_set_par':
>> drivers/video/fbdev/nvidia/nvidia.c:663:29: error: assignment of member 'fb_imageblit' in read-only object
      info->fbops->fb_imageblit = nvidiafb_imageblit;
                                ^
>> drivers/video/fbdev/nvidia/nvidia.c:664:28: error: assignment of member 'fb_fillrect' in read-only object
      info->fbops->fb_fillrect = nvidiafb_fillrect;
                               ^
>> drivers/video/fbdev/nvidia/nvidia.c:665:28: error: assignment of member 'fb_copyarea' in read-only object
      info->fbops->fb_copyarea = nvidiafb_copyarea;
                               ^
>> drivers/video/fbdev/nvidia/nvidia.c:666:24: error: assignment of member 'fb_sync' in read-only object
      info->fbops->fb_sync = nvidiafb_sync;
                           ^
   drivers/video/fbdev/nvidia/nvidia.c:672:29: error: assignment of member 'fb_imageblit' in read-only object
      info->fbops->fb_imageblit = cfb_imageblit;
                                ^
   drivers/video/fbdev/nvidia/nvidia.c:673:28: error: assignment of member 'fb_fillrect' in read-only object
      info->fbops->fb_fillrect = cfb_fillrect;
                               ^
   drivers/video/fbdev/nvidia/nvidia.c:674:28: error: assignment of member 'fb_copyarea' in read-only object
      info->fbops->fb_copyarea = cfb_copyarea;
                               ^
   drivers/video/fbdev/nvidia/nvidia.c:675:24: error: assignment of member 'fb_sync' in read-only object
      info->fbops->fb_sync = NULL;
                           ^
   drivers/video/fbdev/nvidia/nvidia.c: In function 'nvidia_set_fbinfo':
>> drivers/video/fbdev/nvidia/nvidia.c:1168:29: error: assignment of member 'fb_cursor' in read-only object
         info->fbops->fb_cursor = NULL;
                                ^

vim +/fb_blank +1443 drivers/video/fbdev/uvesafb.c

8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1427  
48c68c4f1b5424 drivers/video/uvesafb.c       Greg Kroah-Hartman 2012-12-21  1428  static void uvesafb_init_info(struct fb_info *info, struct vbe_mode_ib *mode)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1429  {
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1430  	unsigned int size_vmode;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1431  	unsigned int size_remap;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1432  	unsigned int size_total;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1433  	struct uvesafb_par *par = info->par;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1434  	int i, h;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1435  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1436  	info->pseudo_palette = ((u8 *)info->par + sizeof(struct uvesafb_par));
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1437  	info->fix = uvesafb_fix;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1438  	info->fix.ypanstep = par->ypan ? 1 : 0;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1439  	info->fix.ywrapstep = (par->ypan > 1) ? 1 : 0;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1440  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1441  	/* Disable blanking if the user requested so. */
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1442  	if (!blank)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16 @1443  		info->fbops->fb_blank = NULL;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1444  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1445  	/*
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1446  	 * Find out how much IO memory is required for the mode with
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1447  	 * the highest resolution.
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1448  	 */
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1449  	size_remap = 0;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1450  	for (i = 0; i < par->vbe_modes_cnt; i++) {
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1451  		h = par->vbe_modes[i].bytes_per_scan_line *
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1452  					par->vbe_modes[i].y_res;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1453  		if (h > size_remap)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1454  			size_remap = h;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1455  	}
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1456  	size_remap *= 2;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1457  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1458  	/*
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1459  	 *   size_vmode -- that is the amount of memory needed for the
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1460  	 *                 used video mode, i.e. the minimum amount of
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1461  	 *                 memory we need.
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1462  	 */
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1463  	size_vmode = info->var.yres * mode->bytes_per_scan_line;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1464  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1465  	/*
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1466  	 *   size_total -- all video memory we have. Used for mtrr
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1467  	 *                 entries, resource allocation and bounds
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1468  	 *                 checking.
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1469  	 */
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1470  	size_total = par->vbe_ib.total_memory * 65536;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1471  	if (vram_total)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1472  		size_total = vram_total * 1024 * 1024;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1473  	if (size_total < size_vmode)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1474  		size_total = size_vmode;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1475  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1476  	/*
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1477  	 *   size_remap -- the amount of video memory we are going to
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1478  	 *                 use for vesafb.  With modern cards it is no
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1479  	 *                 option to simply use size_total as th
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1480  	 *                 wastes plenty of kernel address space.
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1481  	 */
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1482  	if (vram_remap)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1483  		size_remap = vram_remap * 1024 * 1024;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1484  	if (size_remap < size_vmode)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1485  		size_remap = size_vmode;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1486  	if (size_remap > size_total)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1487  		size_remap = size_total;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1488  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1489  	info->fix.smem_len = size_remap;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1490  	info->fix.smem_start = mode->phys_base_ptr;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1491  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1492  	/*
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1493  	 * We have to set yres_virtual here because when setup_var() was
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1494  	 * called, smem_len wasn't defined yet.
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1495  	 */
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1496  	info->var.yres_virtual = info->fix.smem_len /
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1497  				 mode->bytes_per_scan_line;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1498  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1499  	if (par->ypan && info->var.yres_virtual > info->var.yres) {
a8feae09110675 drivers/video/fbdev/uvesafb.c Joe Perches        2017-06-14  1500  		pr_info("scrolling: %s using protected mode interface, yres_virtual=%d\n",
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1501  			(par->ypan > 1) ? "ywrap" : "ypan",
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1502  			info->var.yres_virtual);
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1503  	} else {
a8feae09110675 drivers/video/fbdev/uvesafb.c Joe Perches        2017-06-14  1504  		pr_info("scrolling: redraw\n");
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1505  		info->var.yres_virtual = info->var.yres;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1506  		par->ypan = 0;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1507  	}
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1508  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1509  	info->flags = FBINFO_FLAG_DEFAULT |
1cc9fb6dbf915e drivers/video/uvesafb.c       Roel Kluin         2009-03-31  1510  			(par->ypan ? FBINFO_HWACCEL_YPAN : 0);
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1511  
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1512  	if (!par->ypan)
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16 @1513  		info->fbops->fb_pan_display = NULL;
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1514  }
8bdb3a2d7df48b drivers/video/uvesafb.c       Michal Januszewski 2007-10-16  1515  

:::::: The code at line 1443 was first introduced by commit
:::::: 8bdb3a2d7df48b861972c4bfb58490853a228f51 uvesafb: the driver core

:::::: TO: Michal Januszewski <spock@gentoo.org>
:::::: CC: Linus Torvalds <torvalds@woody.linux-foundation.org>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
kernel test robot Nov. 28, 2019, 10:46 a.m. UTC | #2
Hi Jani,

I love your patch! Yet something to improve:

[auto build test ERROR on drm-intel/for-linux-next]
[also build test ERROR on v5.4 next-20191127]
[if your patch is applied to the wrong git tree, please drop us a note to help
improve the system. BTW, we also suggest to use '--base' option to specify the
base tree in git format-patch, please see https://stackoverflow.com/a/37406982]

url:    https://github.com/0day-ci/linux/commits/Jani-Nikula/video-drm-constify-fbops-in-struct-fb_info/20191128-022047
base:   git://anongit.freedesktop.org/drm-intel for-linux-next
config: x86_64-allyesconfig (attached as .config)
compiler: gcc-7 (Debian 7.4.0-14) 7.4.0
reproduce:
        # save the attached .config to linux build tree
        make ARCH=x86_64 

If you fix the issue, kindly add following tag
Reported-by: kbuild test robot <lkp@intel.com>

All errors (new ones prefixed by >>):

   drivers/gpu/drm/udl/udl_fb.c: In function 'udl_fb_release':
>> drivers/gpu/drm/udl/udl_fb.c:256:24: error: assignment of member 'fb_mmap' in read-only object
      info->fbops->fb_mmap = udl_fb_mmap;
                           ^

vim +/fb_mmap +256 drivers/gpu/drm/udl/udl_fb.c

5320918b9a8786 Dave Airlie     2010-12-15  240  
5320918b9a8786 Dave Airlie     2010-12-15  241  
5320918b9a8786 Dave Airlie     2010-12-15  242  /*
5320918b9a8786 Dave Airlie     2010-12-15  243   * Assumes caller is holding info->lock mutex (for open and release at least)
5320918b9a8786 Dave Airlie     2010-12-15  244   */
5320918b9a8786 Dave Airlie     2010-12-15  245  static int udl_fb_release(struct fb_info *info, int user)
5320918b9a8786 Dave Airlie     2010-12-15  246  {
5320918b9a8786 Dave Airlie     2010-12-15  247  	struct udl_fbdev *ufbdev = info->par;
5320918b9a8786 Dave Airlie     2010-12-15  248  
5320918b9a8786 Dave Airlie     2010-12-15  249  	ufbdev->fb_count--;
5320918b9a8786 Dave Airlie     2010-12-15  250  
2b721f20770ccb Daniel Vetter   2016-08-10  251  #ifdef CONFIG_DRM_FBDEV_EMULATION
5320918b9a8786 Dave Airlie     2010-12-15  252  	if ((ufbdev->fb_count == 0) && (info->fbdefio)) {
5320918b9a8786 Dave Airlie     2010-12-15  253  		fb_deferred_io_cleanup(info);
5320918b9a8786 Dave Airlie     2010-12-15  254  		kfree(info->fbdefio);
5320918b9a8786 Dave Airlie     2010-12-15  255  		info->fbdefio = NULL;
5320918b9a8786 Dave Airlie     2010-12-15 @256  		info->fbops->fb_mmap = udl_fb_mmap;
5320918b9a8786 Dave Airlie     2010-12-15  257  	}
2b721f20770ccb Daniel Vetter   2016-08-10  258  #endif
5320918b9a8786 Dave Airlie     2010-12-15  259  
90991209837ab6 Mikulas Patocka 2018-06-03  260  	pr_debug("released /dev/fb%d user=%d count=%d\n",
5320918b9a8786 Dave Airlie     2010-12-15  261  		info->node, user, ufbdev->fb_count);
5320918b9a8786 Dave Airlie     2010-12-15  262  
5320918b9a8786 Dave Airlie     2010-12-15  263  	return 0;
5320918b9a8786 Dave Airlie     2010-12-15  264  }
5320918b9a8786 Dave Airlie     2010-12-15  265  

:::::: The code at line 256 was first introduced by commit
:::::: 5320918b9a87865223fd6b228e530bf30bc64d9d drm/udl: initial UDL driver (v4)

:::::: TO: Dave Airlie <airlied@gmail.com>
:::::: CC: Dave Airlie <airlied@redhat.com>

---
0-DAY kernel test infrastructure                 Open Source Technology Center
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org Intel Corporation
diff mbox series

Patch

diff --git a/include/linux/fb.h b/include/linux/fb.h
index 65f2abd47745..efc5376c243a 100644
--- a/include/linux/fb.h
+++ b/include/linux/fb.h
@@ -470,10 +470,10 @@  struct fb_info {
 #ifdef CONFIG_FB_DEFERRED_IO
 	struct delayed_work deferred_work;
 	struct fb_deferred_io *fbdefio;
-	void *deferred_io_private;
+	const void *deferred_io_private;
 #endif
 
-	struct fb_ops *fbops;
+	const struct fb_ops *fbops;
 	struct device *device;		/* This is the parent */
 	struct device *dev;		/* This is this fb device */
 	int class_flag;                    /* private sysfs flags */