diff mbox series

[5/5] drm/<drivers>: Constify struct drm_driver

Message ID 20201023122811.2374118-5-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show
Series None | expand

Commit Message

Daniel Vetter Oct. 23, 2020, 12:28 p.m. UTC
Only the following drivers aren't converted:
- amdgpu, because of the driver_feature mangling due to virt support
- nouveau, because DRIVER_ATOMIC uapi is still not the default on the
  platforms where it's supported (i.e. again driver_feature mangling)
- vc4, again because of driver_feature mangling
- qxl, because the ioctl table is somewhere else and moving that is
  maybe a bit too much, hence the num_ioctls assignment prevents a
  const driver structure.

Note that for armada I also went ahead and made the ioctl array const.

Only cc'ing the driver people who've not been converted (everyone else
is way too much).

Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Cc: Dave Airlie <airlied@redhat.com>
Cc: Gerd Hoffmann <kraxel@redhat.com>
Cc: virtualization@lists.linux-foundation.org
Cc: Harry Wentland <harry.wentland@amd.com>
Cc: Leo Li <sunpeng.li@amd.com>
Cc: Alex Deucher <alexander.deucher@amd.com>
Cc: Christian König <christian.koenig@amd.com>
Cc: Eric Anholt <eric@anholt.net>
Cc: Maxime Ripard <mripard@kernel.org>
Cc: Ben Skeggs <bskeggs@redhat.com>
Cc: nouveau@lists.freedesktop.org
Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
---
 drivers/gpu/drm/arm/display/komeda/komeda_kms.c  | 2 +-
 drivers/gpu/drm/arm/hdlcd_drv.c                  | 2 +-
 drivers/gpu/drm/arm/malidp_drv.c                 | 2 +-
 drivers/gpu/drm/armada/armada_drv.c              | 7 +++----
 drivers/gpu/drm/aspeed/aspeed_gfx_drv.c          | 2 +-
 drivers/gpu/drm/ast/ast_drv.c                    | 2 +-
 drivers/gpu/drm/ast/ast_drv.h                    | 2 +-
 drivers/gpu/drm/ast/ast_main.c                   | 2 +-
 drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c     | 2 +-
 drivers/gpu/drm/bochs/bochs_drv.c                | 2 +-
 drivers/gpu/drm/etnaviv/etnaviv_drv.c            | 2 +-
 drivers/gpu/drm/exynos/exynos_drm_drv.c          | 2 +-
 drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c        | 5 ++---
 drivers/gpu/drm/gma500/psb_drv.c                 | 4 ++--
 drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c  | 2 +-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c  | 2 +-
 drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h  | 2 +-
 drivers/gpu/drm/i915/i915_drv.c                  | 4 ++--
 drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +-
 drivers/gpu/drm/imx/dcss/dcss-kms.c              | 2 +-
 drivers/gpu/drm/imx/imx-drm-core.c               | 2 +-
 drivers/gpu/drm/ingenic/ingenic-drm-drv.c        | 2 +-
 drivers/gpu/drm/lima/lima_drv.c                  | 2 +-
 drivers/gpu/drm/mcde/mcde_drv.c                  | 2 +-
 drivers/gpu/drm/mediatek/mtk_drm_drv.c           | 2 +-
 drivers/gpu/drm/meson/meson_drv.c                | 2 +-
 drivers/gpu/drm/mgag200/mgag200_drv.c            | 2 +-
 drivers/gpu/drm/msm/msm_drv.c                    | 4 ++--
 drivers/gpu/drm/mxsfb/mxsfb_drv.c                | 2 +-
 drivers/gpu/drm/omapdrm/omap_drv.c               | 2 +-
 drivers/gpu/drm/panfrost/panfrost_drv.c          | 2 +-
 drivers/gpu/drm/pl111/pl111_drv.c                | 2 +-
 drivers/gpu/drm/radeon/radeon_drv.c              | 4 ++--
 drivers/gpu/drm/rcar-du/rcar_du_drv.c            | 2 +-
 drivers/gpu/drm/rockchip/rockchip_drm_drv.c      | 4 ++--
 drivers/gpu/drm/shmobile/shmob_drm_drv.c         | 2 +-
 drivers/gpu/drm/sti/sti_drv.c                    | 2 +-
 drivers/gpu/drm/stm/drv.c                        | 2 +-
 drivers/gpu/drm/sun4i/sun4i_drv.c                | 2 +-
 drivers/gpu/drm/tegra/drm.c                      | 5 ++---
 drivers/gpu/drm/tidss/tidss_drv.c                | 2 +-
 drivers/gpu/drm/tilcdc/tilcdc_drv.c              | 4 ++--
 drivers/gpu/drm/tiny/cirrus.c                    | 2 +-
 drivers/gpu/drm/tiny/gm12u320.c                  | 2 +-
 drivers/gpu/drm/tiny/hx8357d.c                   | 2 +-
 drivers/gpu/drm/tiny/ili9225.c                   | 2 +-
 drivers/gpu/drm/tiny/ili9341.c                   | 2 +-
 drivers/gpu/drm/tiny/ili9486.c                   | 2 +-
 drivers/gpu/drm/tiny/mi0283qt.c                  | 2 +-
 drivers/gpu/drm/tiny/repaper.c                   | 2 +-
 drivers/gpu/drm/tiny/st7586.c                    | 2 +-
 drivers/gpu/drm/tiny/st7735r.c                   | 2 +-
 drivers/gpu/drm/tve200/tve200_drv.c              | 2 +-
 drivers/gpu/drm/udl/udl_drv.c                    | 2 +-
 drivers/gpu/drm/v3d/v3d_drv.c                    | 2 +-
 drivers/gpu/drm/vboxvideo/vbox_drv.c             | 4 ++--
 drivers/gpu/drm/vgem/vgem_drv.c                  | 2 +-
 drivers/gpu/drm/virtio/virtgpu_drv.c             | 4 ++--
 drivers/gpu/drm/vkms/vkms_drv.c                  | 2 +-
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              | 2 +-
 drivers/gpu/drm/xen/xen_drm_front.c              | 2 +-
 drivers/gpu/drm/xlnx/zynqmp_dpsub.c              | 2 +-
 drivers/gpu/drm/zte/zx_drm_drv.c                 | 2 +-
 63 files changed, 75 insertions(+), 78 deletions(-)

Comments

Maxime Ripard Oct. 23, 2020, 3:13 p.m. UTC | #1
On Fri, Oct 23, 2020 at 02:28:11PM +0200, Daniel Vetter wrote:
> Only the following drivers aren't converted:
> - amdgpu, because of the driver_feature mangling due to virt support
> - nouveau, because DRIVER_ATOMIC uapi is still not the default on the
>   platforms where it's supported (i.e. again driver_feature mangling)
> - vc4, again because of driver_feature mangling
> - qxl, because the ioctl table is somewhere else and moving that is
>   maybe a bit too much, hence the num_ioctls assignment prevents a
>   const driver structure.
> 
> Note that for armada I also went ahead and made the ioctl array const.
> 
> Only cc'ing the driver people who've not been converted (everyone else
> is way too much).
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>


Acked-by: Maxime Ripard <mripard@kernel.org>

Maxime
kernel test robot Oct. 23, 2020, 3:22 p.m. UTC | #2
Hi Daniel,

I love your patch! Perhaps something to improve:

[auto build test WARNING on drm-tip/drm-tip]
[cannot apply to drm-intel/for-linux-next drm-exynos/exynos-drm-next linus/master v5.9 next-20201023]
[If your patch is applied to the wrong git tree, kindly drop us a note.
And when submitting patch, we suggest to use '--base' as documented in
https://git-scm.com/docs/git-format-patch]

url:    https://github.com/0day-ci/linux/commits/Daniel-Vetter/drm-radeon-Stop-changing-the-drm_driver-struct/20201023-203020
base:   git://anongit.freedesktop.org/drm/drm-tip drm-tip
config: arm64-randconfig-r011-20201022 (attached as .config)
compiler: aarch64-linux-gcc (GCC) 9.3.0
reproduce (this is a W=1 build):
        wget https://raw.githubusercontent.com/intel/lkp-tests/master/sbin/make.cross -O ~/bin/make.cross
        chmod +x ~/bin/make.cross
        # https://github.com/0day-ci/linux/commit/9e2fdb03c9047a5d4b24b3e95f0370bcc59eec5e
        git remote add linux-review https://github.com/0day-ci/linux
        git fetch --no-tags linux-review Daniel-Vetter/drm-radeon-Stop-changing-the-drm_driver-struct/20201023-203020
        git checkout 9e2fdb03c9047a5d4b24b3e95f0370bcc59eec5e
        # save the attached .config to linux build tree
        COMPILER_INSTALL_PATH=$HOME/0day COMPILER=gcc-9.3.0 make.cross ARCH=arm64 

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

All warnings (new ones prefixed by >>):

>> drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c:921:1: warning: 'static' is not at beginning of declaration [-Wold-style-declaration]
     921 | const static struct drm_driver ade_driver = {
         | ^~~~~

vim +/static +921 drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c

   920	
 > 921	const static struct drm_driver ade_driver = {
   922		.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
   923		.fops = &ade_fops,
   924		DRM_GEM_CMA_DRIVER_OPS,
   925		.name = "kirin",
   926		.desc = "Hisilicon Kirin620 SoC DRM Driver",
   927		.date = "20150718",
   928		.major = 1,
   929		.minor = 0,
   930	};
   931	

---
0-DAY CI Kernel Test Service, Intel Corporation
https://lists.01.org/hyperkitty/list/kbuild-all@lists.01.org
Thomas Zimmermann Oct. 26, 2020, 8:43 a.m. UTC | #3
Hi

Am 23.10.20 um 14:28 schrieb Daniel Vetter:
> Only the following drivers aren't converted:
> - amdgpu, because of the driver_feature mangling due to virt support
> - nouveau, because DRIVER_ATOMIC uapi is still not the default on the
>   platforms where it's supported (i.e. again driver_feature mangling)
> - vc4, again because of driver_feature mangling
> - qxl, because the ioctl table is somewhere else and moving that is
>   maybe a bit too much, hence the num_ioctls assignment prevents a
>   const driver structure.
> 
> Note that for armada I also went ahead and made the ioctl array const.
> 
> Only cc'ing the driver people who've not been converted (everyone else
> is way too much).
> 
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> Cc: Dave Airlie <airlied@redhat.com>
> Cc: Gerd Hoffmann <kraxel@redhat.com>
> Cc: virtualization@lists.linux-foundation.org
> Cc: Harry Wentland <harry.wentland@amd.com>
> Cc: Leo Li <sunpeng.li@amd.com>
> Cc: Alex Deucher <alexander.deucher@amd.com>
> Cc: Christian König <christian.koenig@amd.com>
> Cc: Eric Anholt <eric@anholt.net>
> Cc: Maxime Ripard <mripard@kernel.org>
> Cc: Ben Skeggs <bskeggs@redhat.com>
> Cc: nouveau@lists.freedesktop.org
> Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> ---
>  drivers/gpu/drm/arm/display/komeda/komeda_kms.c  | 2 +-
>  drivers/gpu/drm/arm/hdlcd_drv.c                  | 2 +-
>  drivers/gpu/drm/arm/malidp_drv.c                 | 2 +-
>  drivers/gpu/drm/armada/armada_drv.c              | 7 +++----
>  drivers/gpu/drm/aspeed/aspeed_gfx_drv.c          | 2 +-
>  drivers/gpu/drm/ast/ast_drv.c                    | 2 +-
>  drivers/gpu/drm/ast/ast_drv.h                    | 2 +-
>  drivers/gpu/drm/ast/ast_main.c                   | 2 +-
>  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c     | 2 +-
>  drivers/gpu/drm/bochs/bochs_drv.c                | 2 +-
>  drivers/gpu/drm/etnaviv/etnaviv_drv.c            | 2 +-
>  drivers/gpu/drm/exynos/exynos_drm_drv.c          | 2 +-
>  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c        | 5 ++---
>  drivers/gpu/drm/gma500/psb_drv.c                 | 4 ++--
>  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c  | 2 +-
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c  | 2 +-
>  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h  | 2 +-
>  drivers/gpu/drm/i915/i915_drv.c                  | 4 ++--
>  drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +-
>  drivers/gpu/drm/imx/dcss/dcss-kms.c              | 2 +-
>  drivers/gpu/drm/imx/imx-drm-core.c               | 2 +-
>  drivers/gpu/drm/ingenic/ingenic-drm-drv.c        | 2 +-
>  drivers/gpu/drm/lima/lima_drv.c                  | 2 +-
>  drivers/gpu/drm/mcde/mcde_drv.c                  | 2 +-
>  drivers/gpu/drm/mediatek/mtk_drm_drv.c           | 2 +-
>  drivers/gpu/drm/meson/meson_drv.c                | 2 +-
>  drivers/gpu/drm/mgag200/mgag200_drv.c            | 2 +-
>  drivers/gpu/drm/msm/msm_drv.c                    | 4 ++--
>  drivers/gpu/drm/mxsfb/mxsfb_drv.c                | 2 +-
>  drivers/gpu/drm/omapdrm/omap_drv.c               | 2 +-
>  drivers/gpu/drm/panfrost/panfrost_drv.c          | 2 +-
>  drivers/gpu/drm/pl111/pl111_drv.c                | 2 +-
>  drivers/gpu/drm/radeon/radeon_drv.c              | 4 ++--
>  drivers/gpu/drm/rcar-du/rcar_du_drv.c            | 2 +-
>  drivers/gpu/drm/rockchip/rockchip_drm_drv.c      | 4 ++--
>  drivers/gpu/drm/shmobile/shmob_drm_drv.c         | 2 +-
>  drivers/gpu/drm/sti/sti_drv.c                    | 2 +-
>  drivers/gpu/drm/stm/drv.c                        | 2 +-
>  drivers/gpu/drm/sun4i/sun4i_drv.c                | 2 +-
>  drivers/gpu/drm/tegra/drm.c                      | 5 ++---
>  drivers/gpu/drm/tidss/tidss_drv.c                | 2 +-
>  drivers/gpu/drm/tilcdc/tilcdc_drv.c              | 4 ++--
>  drivers/gpu/drm/tiny/cirrus.c                    | 2 +-
>  drivers/gpu/drm/tiny/gm12u320.c                  | 2 +-
>  drivers/gpu/drm/tiny/hx8357d.c                   | 2 +-
>  drivers/gpu/drm/tiny/ili9225.c                   | 2 +-
>  drivers/gpu/drm/tiny/ili9341.c                   | 2 +-
>  drivers/gpu/drm/tiny/ili9486.c                   | 2 +-
>  drivers/gpu/drm/tiny/mi0283qt.c                  | 2 +-
>  drivers/gpu/drm/tiny/repaper.c                   | 2 +-
>  drivers/gpu/drm/tiny/st7586.c                    | 2 +-
>  drivers/gpu/drm/tiny/st7735r.c                   | 2 +-
>  drivers/gpu/drm/tve200/tve200_drv.c              | 2 +-
>  drivers/gpu/drm/udl/udl_drv.c                    | 2 +-
>  drivers/gpu/drm/v3d/v3d_drv.c                    | 2 +-
>  drivers/gpu/drm/vboxvideo/vbox_drv.c             | 4 ++--
>  drivers/gpu/drm/vgem/vgem_drv.c                  | 2 +-
>  drivers/gpu/drm/virtio/virtgpu_drv.c             | 4 ++--
>  drivers/gpu/drm/vkms/vkms_drv.c                  | 2 +-
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              | 2 +-
>  drivers/gpu/drm/xen/xen_drm_front.c              | 2 +-
>  drivers/gpu/drm/xlnx/zynqmp_dpsub.c              | 2 +-
>  drivers/gpu/drm/zte/zx_drm_drv.c                 | 2 +-
>  63 files changed, 75 insertions(+), 78 deletions(-)

Oh please no. That's a huge patch for no apparent reason. Can you break
this up?

Best regards
Thomas

> 
> diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> index cc5b5915bc5e..d04008f3e31a 100644
> --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> @@ -58,7 +58,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
>  	return status;
>  }
>  
> -static struct drm_driver komeda_kms_driver = {
> +static const struct drm_driver komeda_kms_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.lastclose			= drm_fb_helper_lastclose,
>  	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(komeda_gem_cma_dumb_create),
> diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> index faa8a5a752da..81ae92390736 100644
> --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> @@ -234,7 +234,7 @@ static void hdlcd_debugfs_init(struct drm_minor *minor)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver hdlcd_driver = {
> +static const struct drm_driver hdlcd_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.irq_handler = hdlcd_irq,
>  	.irq_preinstall = hdlcd_irq_preinstall,
> diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> index 26e60401a8e1..d83c7366b348 100644
> --- a/drivers/gpu/drm/arm/malidp_drv.c
> +++ b/drivers/gpu/drm/arm/malidp_drv.c
> @@ -564,7 +564,7 @@ static void malidp_debugfs_init(struct drm_minor *minor)
>  
>  #endif //CONFIG_DEBUG_FS
>  
> -static struct drm_driver malidp_driver = {
> +static const struct drm_driver malidp_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(malidp_dumb_create),
>  #ifdef CONFIG_DEBUG_FS
> diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> index 22247cfce80b..44fe9f994fc5 100644
> --- a/drivers/gpu/drm/armada/armada_drv.c
> +++ b/drivers/gpu/drm/armada/armada_drv.c
> @@ -27,7 +27,7 @@
>  #include <drm/armada_drm.h>
>  #include "armada_ioctlP.h"
>  
> -static struct drm_ioctl_desc armada_ioctls[] = {
> +static const struct drm_ioctl_desc armada_ioctls[] = {
>  	DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0),
>  	DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0),
>  	DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pwrite_ioctl, 0),
> @@ -35,7 +35,7 @@ static struct drm_ioctl_desc armada_ioctls[] = {
>  
>  DEFINE_DRM_GEM_FOPS(armada_drm_fops);
>  
> -static struct drm_driver armada_drm_driver = {
> +static const struct drm_driver armada_drm_driver = {
>  	.lastclose		= drm_fb_helper_lastclose,
>  	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
>  	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
> @@ -48,6 +48,7 @@ static struct drm_driver armada_drm_driver = {
>  	.date			= "20120730",
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.ioctls			= armada_ioctls,
> +	.num_ioctls = ARRAY_SIZE(armada_ioctls),
>  	.fops			= &armada_drm_fops,
>  };
>  
> @@ -275,8 +276,6 @@ static int __init armada_drm_init(void)
>  {
>  	int ret;
>  
> -	armada_drm_driver.num_ioctls = ARRAY_SIZE(armada_ioctls);
> -
>  	ret = platform_driver_register(&armada_lcd_platform_driver);
>  	if (ret)
>  		return ret;
> diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> index 771ad71cd340..457ec04950f7 100644
> --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> @@ -191,7 +191,7 @@ static void aspeed_gfx_unload(struct drm_device *drm)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver aspeed_gfx_driver = {
> +static const struct drm_driver aspeed_gfx_driver = {
>  	.driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &fops,
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index f0b4af1c390a..667b450606ef 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -49,7 +49,7 @@ module_param_named(modeset, ast_modeset, int, 0400);
>  
>  DEFINE_DRM_GEM_FOPS(ast_fops);
>  
> -static struct drm_driver ast_driver = {
> +static const struct drm_driver ast_driver = {
>  	.driver_features = DRIVER_ATOMIC |
>  			   DRIVER_GEM |
>  			   DRIVER_MODESET,
> diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> index 467049ca8430..33e596a4f042 100644
> --- a/drivers/gpu/drm/ast/ast_drv.h
> +++ b/drivers/gpu/drm/ast/ast_drv.h
> @@ -159,7 +159,7 @@ static inline struct ast_private *to_ast_private(struct drm_device *dev)
>  	return container_of(dev, struct ast_private, base);
>  }
>  
> -struct ast_private *ast_device_create(struct drm_driver *drv,
> +struct ast_private *ast_device_create(const struct drm_driver *drv,
>  				      struct pci_dev *pdev,
>  				      unsigned long flags);
>  
> diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> index 77066bca8793..45dd8185a488 100644
> --- a/drivers/gpu/drm/ast/ast_main.c
> +++ b/drivers/gpu/drm/ast/ast_main.c
> @@ -392,7 +392,7 @@ static void ast_device_release(void *data)
>  	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
>  }
>  
> -struct ast_private *ast_device_create(struct drm_driver *drv,
> +struct ast_private *ast_device_create(const struct drm_driver *drv,
>  				      struct pci_dev *pdev,
>  				      unsigned long flags)
>  {
> diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> index 03984932d174..65af56e47129 100644
> --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> @@ -712,7 +712,7 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver atmel_hlcdc_dc_driver = {
> +static const struct drm_driver atmel_hlcdc_dc_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.irq_handler = atmel_hlcdc_dc_irq_handler,
>  	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
> diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> index e18c51de1196..fd454225fd19 100644
> --- a/drivers/gpu/drm/bochs/bochs_drv.c
> +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> @@ -57,7 +57,7 @@ static int bochs_load(struct drm_device *dev)
>  
>  DEFINE_DRM_GEM_FOPS(bochs_fops);
>  
> -static struct drm_driver bochs_driver = {
> +static const struct drm_driver bochs_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &bochs_fops,
>  	.name			= "bochs-drm",
> diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> index aa270b79e585..7604e3c07973 100644
> --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> @@ -480,7 +480,7 @@ static const struct file_operations fops = {
>  	.mmap               = etnaviv_gem_mmap,
>  };
>  
> -static struct drm_driver etnaviv_drm_driver = {
> +static const struct drm_driver etnaviv_drm_driver = {
>  	.driver_features    = DRIVER_GEM | DRIVER_RENDER,
>  	.open               = etnaviv_open,
>  	.postclose           = etnaviv_postclose,
> diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> index fe46680ca208..e60257f1f24b 100644
> --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> @@ -113,7 +113,7 @@ static const struct file_operations exynos_drm_driver_fops = {
>  	.release	= drm_release,
>  };
>  
> -static struct drm_driver exynos_drm_driver = {
> +static const struct drm_driver exynos_drm_driver = {
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM
>  				  | DRIVER_ATOMIC | DRIVER_RENDER,
>  	.open			= exynos_drm_open,
> diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> index ae584f62aa19..75b58d55a940 100644
> --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> @@ -124,7 +124,7 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
>  
> -static struct drm_driver fsl_dcu_drm_driver = {
> +static const struct drm_driver fsl_dcu_drm_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.load			= fsl_dcu_load,
>  	.unload			= fsl_dcu_unload,
> @@ -224,7 +224,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
>  	struct device *dev = &pdev->dev;
>  	struct resource *res;
>  	void __iomem *base;
> -	struct drm_driver *driver = &fsl_dcu_drm_driver;
>  	struct clk *pix_clk_in;
>  	char pix_clk_name[32];
>  	const char *pix_clk_in_name;
> @@ -294,7 +293,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
>  
>  	fsl_dev->tcon = fsl_tcon_init(dev);
>  
> -	drm = drm_dev_alloc(driver, dev);
> +	drm = drm_dev_alloc(&fsl_dcu_drm_driver, dev);
>  	if (IS_ERR(drm)) {
>  		ret = PTR_ERR(drm);
>  		goto unregister_pix_clk;
> diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
> index b13376a6fb91..6e7197d89463 100644
> --- a/drivers/gpu/drm/gma500/psb_drv.c
> +++ b/drivers/gpu/drm/gma500/psb_drv.c
> @@ -34,7 +34,7 @@
>  #include "psb_intel_reg.h"
>  #include "psb_reg.h"
>  
> -static struct drm_driver driver;
> +static const struct drm_driver driver;
>  static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
>  
>  /*
> @@ -491,7 +491,7 @@ static const struct file_operations psb_gem_fops = {
>  	.read = drm_read,
>  };
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM,
>  	.lastclose = drm_fb_helper_lastclose,
>  
> diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> index a684814927cd..27205aa907f4 100644
> --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> @@ -43,7 +43,7 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
>  	return IRQ_HANDLED;
>  }
>  
> -static struct drm_driver hibmc_driver = {
> +static const struct drm_driver hibmc_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &hibmc_fops,
>  	.name			= "hibmc",
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> index cfe8ff596d55..8928550072df 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> @@ -918,7 +918,7 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
>  
> -static struct drm_driver ade_driver = {
> +const static struct drm_driver ade_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops = &ade_fops,
>  	DRM_GEM_CMA_DRIVER_OPS,
> diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> index dee8ec2f7f2e..386d137f29e5 100644
> --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> @@ -40,7 +40,7 @@ struct kirin_drm_data {
>  	u32 num_planes;
>  	u32 prim_plane;
>  
> -	struct drm_driver *driver;
> +	const struct drm_driver *driver;
>  	const struct drm_crtc_helper_funcs *crtc_helper_funcs;
>  	const struct drm_crtc_funcs *crtc_funcs;
>  	const struct drm_plane_helper_funcs *plane_helper_funcs;
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index d3237b0d821d..27249b5e2729 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -87,7 +87,7 @@
>  #include "intel_sideband.h"
>  #include "vlv_suspend.h"
>  
> -static struct drm_driver driver;
> +static const struct drm_driver driver;
>  
>  static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
>  {
> @@ -1758,7 +1758,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {
>  	DRM_IOCTL_DEF_DRV(I915_GEM_VM_DESTROY, i915_gem_vm_destroy_ioctl, DRM_RENDER_ALLOW),
>  };
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	/* Don't use MTRRs here; the Xserver or userspace app should
>  	 * deal with them for Intel hardware.
>  	 */
> diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> index 9220c9d1a4b7..e946bd2087d8 100644
> --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> @@ -81,7 +81,7 @@ static void mock_device_release(struct drm_device *dev)
>  	i915_params_free(&i915->params);
>  }
>  
> -static struct drm_driver mock_driver = {
> +static const struct drm_driver mock_driver = {
>  	.name = "mock",
>  	.driver_features = DRIVER_GEM,
>  	.release = mock_device_release,
> diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> index b72e5cef7e40..b549ce5e7607 100644
> --- a/drivers/gpu/drm/imx/dcss/dcss-kms.c
> +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> @@ -26,7 +26,7 @@ static const struct drm_mode_config_funcs dcss_drm_mode_config_funcs = {
>  	.atomic_commit = drm_atomic_helper_commit,
>  };
>  
> -static struct drm_driver dcss_kms_driver = {
> +static const struct drm_driver dcss_kms_driver = {
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops			= &dcss_cma_fops,
> diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> index 183f2e91881d..7090b82e7ea2 100644
> --- a/drivers/gpu/drm/imx/imx-drm-core.c
> +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> @@ -143,7 +143,7 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = {
>  	/* none so far */
>  };
>  
> -static struct drm_driver imx_drm_driver = {
> +static const struct drm_driver imx_drm_driver = {
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.ioctls			= imx_drm_ioctls,
> diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> index 2329754af116..082cb9e45908 100644
> --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> @@ -710,7 +710,7 @@ static void ingenic_drm_disable_vblank(struct drm_crtc *crtc)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(ingenic_drm_fops);
>  
> -static struct drm_driver ingenic_drm_driver_data = {
> +static const struct drm_driver ingenic_drm_driver_data = {
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.name			= "ingenic-drm",
>  	.desc			= "DRM module for Ingenic SoCs",
> diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c
> index ab460121fd52..d497af91d850 100644
> --- a/drivers/gpu/drm/lima/lima_drv.c
> +++ b/drivers/gpu/drm/lima/lima_drv.c
> @@ -261,7 +261,7 @@ DEFINE_DRM_GEM_FOPS(lima_drm_driver_fops);
>   * - 1.1.0 - add heap buffer support
>   */
>  
> -static struct drm_driver lima_drm_driver = {
> +static const struct drm_driver lima_drm_driver = {
>  	.driver_features    = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ,
>  	.open               = lima_drm_driver_open,
>  	.postclose          = lima_drm_driver_postclose,
> diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
> index f9b5f450a9cb..870626e04ec0 100644
> --- a/drivers/gpu/drm/mcde/mcde_drv.c
> +++ b/drivers/gpu/drm/mcde/mcde_drv.c
> @@ -178,7 +178,7 @@ static int mcde_modeset_init(struct drm_device *drm)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
>  
> -static struct drm_driver mcde_drm_driver = {
> +static const struct drm_driver mcde_drm_driver = {
>  	.driver_features =
>  		DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.lastclose = drm_fb_helper_lastclose,
> diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> index 7f3398a7c2b0..2e8065b1e2bb 100644
> --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> @@ -321,7 +321,7 @@ struct drm_gem_object *mtk_drm_gem_prime_import(struct drm_device *dev,
>  	return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev);
>  }
>  
> -static struct drm_driver mtk_drm_driver = {
> +static const struct drm_driver mtk_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  
>  	.dumb_create = mtk_drm_gem_dumb_create,
> diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> index 8b9c8dd788c4..dc8509ceb787 100644
> --- a/drivers/gpu/drm/meson/meson_drv.c
> +++ b/drivers/gpu/drm/meson/meson_drv.c
> @@ -90,7 +90,7 @@ static int meson_dumb_create(struct drm_file *file, struct drm_device *dev,
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver meson_driver = {
> +static const struct drm_driver meson_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  
>  	/* IRQ */
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index 771b26aeee19..0f07f259503d 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -28,7 +28,7 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
>  
>  DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
>  
> -static struct drm_driver mgag200_driver = {
> +static const struct drm_driver mgag200_driver = {
>  	.driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
>  	.fops = &mgag200_driver_fops,
>  	.name = DRIVER_NAME,
> diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> index aa4509766d64..f8fd31e709bb 100644
> --- a/drivers/gpu/drm/msm/msm_drv.c
> +++ b/drivers/gpu/drm/msm/msm_drv.c
> @@ -393,7 +393,7 @@ static int msm_init_vram(struct drm_device *dev)
>  	return ret;
>  }
>  
> -static int msm_drm_init(struct device *dev, struct drm_driver *drv)
> +static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
>  {
>  	struct platform_device *pdev = to_platform_device(dev);
>  	struct drm_device *ddev;
> @@ -984,7 +984,7 @@ static const struct file_operations fops = {
>  	.mmap               = msm_gem_mmap,
>  };
>  
> -static struct drm_driver msm_driver = {
> +static const struct drm_driver msm_driver = {
>  	.driver_features    = DRIVER_GEM |
>  				DRIVER_RENDER |
>  				DRIVER_ATOMIC |
> diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> index 35122aef037b..6faf17b6408d 100644
> --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> @@ -289,7 +289,7 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver mxsfb_driver = {
> +static const struct drm_driver mxsfb_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.irq_handler		= mxsfb_irq_handler,
>  	.irq_preinstall		= mxsfb_irq_disable,
> diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> index 2b82a708eca6..21a6cd3f5473 100644
> --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> @@ -534,7 +534,7 @@ static const struct file_operations omapdriver_fops = {
>  	.llseek = noop_llseek,
>  };
>  
> -static struct drm_driver omap_drm_driver = {
> +static const struct drm_driver omap_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM  |
>  		DRIVER_ATOMIC | DRIVER_RENDER,
>  	.open = dev_open,
> diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> index 37d4cb7a5491..ed116bd3d6d6 100644
> --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> @@ -548,7 +548,7 @@ DEFINE_DRM_GEM_FOPS(panfrost_drm_driver_fops);
>   * - 1.0 - initial interface
>   * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO
>   */
> -static struct drm_driver panfrost_drm_driver = {
> +static const struct drm_driver panfrost_drm_driver = {
>  	.driver_features	= DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ,
>  	.open			= panfrost_open,
>  	.postclose		= panfrost_postclose,
> diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
> index 3899c28f428d..10d9a12be672 100644
> --- a/drivers/gpu/drm/pl111/pl111_drv.c
> +++ b/drivers/gpu/drm/pl111/pl111_drv.c
> @@ -213,7 +213,7 @@ pl111_gem_import_sg_table(struct drm_device *dev,
>  
>  DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
>  
> -static struct drm_driver pl111_drm_driver = {
> +static const struct drm_driver pl111_drm_driver = {
>  	.driver_features =
>  		DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.ioctls = NULL,
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index 9c11e36ad33a..bfadb799d6a3 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -297,7 +297,7 @@ static struct pci_device_id pciidlist[] = {
>  
>  MODULE_DEVICE_TABLE(pci, pciidlist);
>  
> -static struct drm_driver kms_driver;
> +static const struct drm_driver kms_driver;
>  
>  bool radeon_device_is_virtual(void);
>  
> @@ -629,7 +629,7 @@ static const struct drm_ioctl_desc radeon_ioctls_kms[] = {
>  	DRM_IOCTL_DEF_DRV(RADEON_GEM_USERPTR, radeon_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
>  };
>  
> -static struct drm_driver kms_driver = {
> +static const struct drm_driver kms_driver = {
>  	.driver_features =
>  	    DRIVER_GEM | DRIVER_RENDER | DRIVER_MODESET,
>  	.load = radeon_driver_load_kms,
> diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> index 447be991fa25..600056dff374 100644
> --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> @@ -507,7 +507,7 @@ MODULE_DEVICE_TABLE(of, rcar_du_of_table);
>  
>  DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
>  
> -static struct drm_driver rcar_du_driver = {
> +static const struct drm_driver rcar_du_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(rcar_du_dumb_create),
>  	.fops			= &rcar_du_fops,
> diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> index b7654f5e4225..212bd87c0c4a 100644
> --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> @@ -35,7 +35,7 @@
>  #define DRIVER_MINOR	0
>  
>  static bool is_support_iommu = true;
> -static struct drm_driver rockchip_drm_driver;
> +static const struct drm_driver rockchip_drm_driver;
>  
>  /*
>   * Attach a (component) device to the shared drm dma mapping from master drm
> @@ -209,7 +209,7 @@ static const struct file_operations rockchip_drm_driver_fops = {
>  	.release = drm_release,
>  };
>  
> -static struct drm_driver rockchip_drm_driver = {
> +static const struct drm_driver rockchip_drm_driver = {
>  	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.lastclose		= drm_fb_helper_lastclose,
>  	.dumb_create		= rockchip_gem_dumb_create,
> diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> index 26a15c214bd3..0a02b7092c04 100644
> --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> @@ -128,7 +128,7 @@ static irqreturn_t shmob_drm_irq(int irq, void *arg)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
>  
> -static struct drm_driver shmob_drm_driver = {
> +static const struct drm_driver shmob_drm_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
>  	.irq_handler		= shmob_drm_irq,
>  	DRM_GEM_CMA_DRIVER_OPS,
> diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> index 3f54efa36098..c7efb43b83ee 100644
> --- a/drivers/gpu/drm/sti/sti_drv.c
> +++ b/drivers/gpu/drm/sti/sti_drv.c
> @@ -130,7 +130,7 @@ static void sti_mode_config_init(struct drm_device *dev)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops);
>  
> -static struct drm_driver sti_driver = {
> +static const struct drm_driver sti_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.fops = &sti_driver_fops,
>  	DRM_GEM_CMA_DRIVER_OPS,
> diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> index 411103f013e2..222869b232ae 100644
> --- a/drivers/gpu/drm/stm/drv.c
> +++ b/drivers/gpu/drm/stm/drv.c
> @@ -53,7 +53,7 @@ static int stm_gem_cma_dumb_create(struct drm_file *file,
>  
>  DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
>  
> -static struct drm_driver drv_driver = {
> +static const struct drm_driver drv_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.name = "stm",
>  	.desc = "STMicroelectronics SoC DRM",
> diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> index 29861fc81b35..91502937f26d 100644
> --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> @@ -40,7 +40,7 @@ static int drm_sun4i_gem_dumb_create(struct drm_file *file_priv,
>  
>  DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
>  
> -static struct drm_driver sun4i_drv_driver = {
> +static const struct drm_driver sun4i_drv_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  
>  	/* Generic Operations */
> diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> index 24f353c1cee8..ae13a3ff8a87 100644
> --- a/drivers/gpu/drm/tegra/drm.c
> +++ b/drivers/gpu/drm/tegra/drm.c
> @@ -850,7 +850,7 @@ static void tegra_debugfs_init(struct drm_minor *minor)
>  }
>  #endif
>  
> -static struct drm_driver tegra_drm_driver = {
> +static const struct drm_driver tegra_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM |
>  			   DRIVER_ATOMIC | DRIVER_RENDER,
>  	.open = tegra_drm_open,
> @@ -1084,12 +1084,11 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
>  
>  static int host1x_drm_probe(struct host1x_device *dev)
>  {
> -	struct drm_driver *driver = &tegra_drm_driver;
>  	struct tegra_drm *tegra;
>  	struct drm_device *drm;
>  	int err;
>  
> -	drm = drm_dev_alloc(driver, &dev->dev);
> +	drm = drm_dev_alloc(&tegra_drm_driver, &dev->dev);
>  	if (IS_ERR(drm))
>  		return PTR_ERR(drm);
>  
> diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> index 9179ea18f625..66e3c86eb5c7 100644
> --- a/drivers/gpu/drm/tidss/tidss_drv.c
> +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> @@ -108,7 +108,7 @@ static void tidss_release(struct drm_device *ddev)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(tidss_fops);
>  
> -static struct drm_driver tidss_driver = {
> +static const struct drm_driver tidss_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &tidss_fops,
>  	.release		= tidss_release,
> diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> index c5f82e693f1a..137f74f613ab 100644
> --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> @@ -166,7 +166,7 @@ static void tilcdc_fini(struct drm_device *dev)
>  	drm_dev_put(dev);
>  }
>  
> -static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
> +static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
>  {
>  	struct drm_device *ddev;
>  	struct platform_device *pdev = to_platform_device(dev);
> @@ -452,7 +452,7 @@ static void tilcdc_debugfs_init(struct drm_minor *minor)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(fops);
>  
> -static struct drm_driver tilcdc_driver = {
> +static const struct drm_driver tilcdc_driver = {
>  	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.irq_handler        = tilcdc_irq,
>  	DRM_GEM_CMA_DRIVER_OPS,
> diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
> index 759a5a66dd0b..e5641969c181 100644
> --- a/drivers/gpu/drm/tiny/cirrus.c
> +++ b/drivers/gpu/drm/tiny/cirrus.c
> @@ -536,7 +536,7 @@ static int cirrus_mode_config_init(struct cirrus_device *cirrus)
>  
>  DEFINE_DRM_GEM_FOPS(cirrus_fops);
>  
> -static struct drm_driver cirrus_driver = {
> +static const struct drm_driver cirrus_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  
>  	.name		 = DRIVER_NAME,
> diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
> index cc397671f689..5a953c4ce265 100644
> --- a/drivers/gpu/drm/tiny/gm12u320.c
> +++ b/drivers/gpu/drm/tiny/gm12u320.c
> @@ -600,7 +600,7 @@ static const uint64_t gm12u320_pipe_modifiers[] = {
>  
>  DEFINE_DRM_GEM_FOPS(gm12u320_fops);
>  
> -static struct drm_driver gm12u320_drm_driver = {
> +static const struct drm_driver gm12u320_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  
>  	.name		 = DRIVER_NAME,
> diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
> index 0998309b0d95..c6525cd02bc2 100644
> --- a/drivers/gpu/drm/tiny/hx8357d.c
> +++ b/drivers/gpu/drm/tiny/hx8357d.c
> @@ -193,7 +193,7 @@ static const struct drm_display_mode yx350hv15_mode = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
>  
> -static struct drm_driver hx8357d_driver = {
> +static const struct drm_driver hx8357d_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &hx8357d_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
> index 97a77262d791..8e98962db5a2 100644
> --- a/drivers/gpu/drm/tiny/ili9225.c
> +++ b/drivers/gpu/drm/tiny/ili9225.c
> @@ -337,7 +337,7 @@ static const struct drm_display_mode ili9225_mode = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
>  
> -static struct drm_driver ili9225_driver = {
> +static const struct drm_driver ili9225_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &ili9225_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
> index d39c39df56ad..6ce97f0698eb 100644
> --- a/drivers/gpu/drm/tiny/ili9341.c
> +++ b/drivers/gpu/drm/tiny/ili9341.c
> @@ -149,7 +149,7 @@ static const struct drm_display_mode yx240qv29_mode = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
>  
> -static struct drm_driver ili9341_driver = {
> +static const struct drm_driver ili9341_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &ili9341_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
> index 403af68fa440..d7ce40eb166a 100644
> --- a/drivers/gpu/drm/tiny/ili9486.c
> +++ b/drivers/gpu/drm/tiny/ili9486.c
> @@ -162,7 +162,7 @@ static const struct drm_display_mode waveshare_mode = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
>  
> -static struct drm_driver ili9486_driver = {
> +static const struct drm_driver ili9486_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &ili9486_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
> index 2131b4268c00..ff77f983f803 100644
> --- a/drivers/gpu/drm/tiny/mi0283qt.c
> +++ b/drivers/gpu/drm/tiny/mi0283qt.c
> @@ -153,7 +153,7 @@ static const struct drm_display_mode mi0283qt_mode = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
>  
> -static struct drm_driver mi0283qt_driver = {
> +static const struct drm_driver mi0283qt_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &mi0283qt_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
> index 2e01cf0a9876..11c602fc9897 100644
> --- a/drivers/gpu/drm/tiny/repaper.c
> +++ b/drivers/gpu/drm/tiny/repaper.c
> @@ -936,7 +936,7 @@ static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,
>  
>  DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
>  
> -static struct drm_driver repaper_driver = {
> +static const struct drm_driver repaper_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &repaper_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
> index d05de03891f8..ff5cf60f4bd7 100644
> --- a/drivers/gpu/drm/tiny/st7586.c
> +++ b/drivers/gpu/drm/tiny/st7586.c
> @@ -277,7 +277,7 @@ static const struct drm_display_mode st7586_mode = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
>  
> -static struct drm_driver st7586_driver = {
> +static const struct drm_driver st7586_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &st7586_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
> index a0f688f0d050..2c77d9ab7e8d 100644
> --- a/drivers/gpu/drm/tiny/st7735r.c
> +++ b/drivers/gpu/drm/tiny/st7735r.c
> @@ -154,7 +154,7 @@ static const struct st7735r_cfg rh128128t_cfg = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
>  
> -static struct drm_driver st7735r_driver = {
> +static const struct drm_driver st7735r_driver = {
>  	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.fops			= &st7735r_fops,
>  	DRM_GEM_CMA_DRIVER_OPS_VMAP,
> diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
> index b5259cb1383f..07140e0b90a3 100644
> --- a/drivers/gpu/drm/tve200/tve200_drv.c
> +++ b/drivers/gpu/drm/tve200/tve200_drv.c
> @@ -137,7 +137,7 @@ static int tve200_modeset_init(struct drm_device *dev)
>  
>  DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
>  
> -static struct drm_driver tve200_drm_driver = {
> +static const struct drm_driver tve200_drm_driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  	.ioctls = NULL,
>  	.fops = &drm_fops,
> diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> index 96d4317a2c1b..46df4d07bd7b 100644
> --- a/drivers/gpu/drm/udl/udl_drv.c
> +++ b/drivers/gpu/drm/udl/udl_drv.c
> @@ -34,7 +34,7 @@ static int udl_usb_resume(struct usb_interface *interface)
>  
>  DEFINE_DRM_GEM_FOPS(udl_driver_fops);
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	.driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
>  
>  	/* GEM hooks */
> diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> index 9f7c26193831..2da0c1180bc6 100644
> --- a/drivers/gpu/drm/v3d/v3d_drv.c
> +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> @@ -194,7 +194,7 @@ static const struct drm_ioctl_desc v3d_drm_ioctls[] = {
>  	DRM_IOCTL_DEF_DRV(V3D_SUBMIT_CSD, v3d_submit_csd_ioctl, DRM_RENDER_ALLOW | DRM_AUTH),
>  };
>  
> -static struct drm_driver v3d_drm_driver = {
> +static const struct drm_driver v3d_drm_driver = {
>  	.driver_features = (DRIVER_GEM |
>  			    DRIVER_RENDER |
>  			    DRIVER_SYNCOBJ),
> diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> index cf2e3e6a2388..f3eac72cb46e 100644
> --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
> +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> @@ -26,7 +26,7 @@ static int vbox_modeset = -1;
>  MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
>  module_param_named(modeset, vbox_modeset, int, 0400);
>  
> -static struct drm_driver driver;
> +static const struct drm_driver driver;
>  
>  static const struct pci_device_id pciidlist[] = {
>  	{ PCI_DEVICE(0x80ee, 0xbeef) },
> @@ -175,7 +175,7 @@ static struct pci_driver vbox_pci_driver = {
>  
>  DEFINE_DRM_GEM_FOPS(vbox_fops);
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	.driver_features =
>  	    DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
>  
> diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> index fa54a6d1403d..3e9b7a4c30ce 100644
> --- a/drivers/gpu/drm/vgem/vgem_drv.c
> +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> @@ -415,7 +415,7 @@ static const struct drm_gem_object_funcs vgem_gem_object_funcs = {
>  	.vm_ops = &vgem_gem_vm_ops,
>  };
>  
> -static struct drm_driver vgem_driver = {
> +static const struct drm_driver vgem_driver = {
>  	.driver_features		= DRIVER_GEM | DRIVER_RENDER,
>  	.open				= vgem_open,
>  	.postclose			= vgem_postclose,
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> index 86330f1ade72..27f13bd29c13 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> @@ -37,7 +37,7 @@
>  
>  #include "virtgpu_drv.h"
>  
> -static struct drm_driver driver;
> +static const struct drm_driver driver;
>  
>  static int virtio_gpu_modeset = -1;
>  
> @@ -190,7 +190,7 @@ MODULE_AUTHOR("Alon Levy");
>  
>  DEFINE_DRM_GEM_FOPS(virtio_gpu_driver_fops);
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_RENDER | DRIVER_ATOMIC,
>  	.open = virtio_gpu_driver_open,
>  	.postclose = virtio_gpu_driver_postclose,
> diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> index 98ba844ae77d..8056b3d1ff6a 100644
> --- a/drivers/gpu/drm/vkms/vkms_drv.c
> +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> @@ -78,7 +78,7 @@ static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
>  	drm_atomic_helper_cleanup_planes(dev, old_state);
>  }
>  
> -static struct drm_driver vkms_driver = {
> +static const struct drm_driver vkms_driver = {
>  	.driver_features	= DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
>  	.release		= vkms_release,
>  	.fops			= &vkms_driver_fops,
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index 68206d0a1237..e66b252e3923 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1465,7 +1465,7 @@ static const struct file_operations vmwgfx_driver_fops = {
>  	.get_unmapped_area = vmw_get_unmapped_area,
>  };
>  
> -static struct drm_driver driver = {
> +static const struct drm_driver driver = {
>  	.driver_features =
>  	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
>  	.ioctls = vmw_ioctls,
> diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
> index 98b6d2ba088a..30d9adf31c84 100644
> --- a/drivers/gpu/drm/xen/xen_drm_front.c
> +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> @@ -483,7 +483,7 @@ static const struct file_operations xen_drm_dev_fops = {
>  	.mmap           = xen_drm_front_gem_mmap,
>  };
>  
> -static struct drm_driver xen_drm_driver = {
> +static const struct drm_driver xen_drm_driver = {
>  	.driver_features           = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	.release                   = xen_drm_drv_release,
>  	.prime_handle_to_fd        = drm_gem_prime_handle_to_fd,
> diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> index f3ffc3703a0e..0c1c50271a88 100644
> --- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> @@ -76,7 +76,7 @@ static const struct drm_mode_config_funcs zynqmp_dpsub_mode_config_funcs = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(zynqmp_dpsub_drm_fops);
>  
> -static struct drm_driver zynqmp_dpsub_drm_driver = {
> +static const struct drm_driver zynqmp_dpsub_drm_driver = {
>  	.driver_features		= DRIVER_MODESET | DRIVER_GEM |
>  					  DRIVER_ATOMIC,
>  
> diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> index 31014a451f8b..5506336594e2 100644
> --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> @@ -34,7 +34,7 @@ static const struct drm_mode_config_funcs zx_drm_mode_config_funcs = {
>  
>  DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops);
>  
> -static struct drm_driver zx_drm_driver = {
> +static const struct drm_driver zx_drm_driver = {
>  	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
>  	DRM_GEM_CMA_DRIVER_OPS,
>  	.fops = &zx_drm_fops,
>
Daniel Vetter Oct. 26, 2020, 9:14 a.m. UTC | #4
On Mon, Oct 26, 2020 at 9:43 AM Thomas Zimmermann <tzimmermann@suse.de> wrote:
>
> Hi
>
> Am 23.10.20 um 14:28 schrieb Daniel Vetter:
> > Only the following drivers aren't converted:
> > - amdgpu, because of the driver_feature mangling due to virt support
> > - nouveau, because DRIVER_ATOMIC uapi is still not the default on the
> >   platforms where it's supported (i.e. again driver_feature mangling)
> > - vc4, again because of driver_feature mangling
> > - qxl, because the ioctl table is somewhere else and moving that is
> >   maybe a bit too much, hence the num_ioctls assignment prevents a
> >   const driver structure.
> >
> > Note that for armada I also went ahead and made the ioctl array const.
> >
> > Only cc'ing the driver people who've not been converted (everyone else
> > is way too much).
> >
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> > Cc: Dave Airlie <airlied@redhat.com>
> > Cc: Gerd Hoffmann <kraxel@redhat.com>
> > Cc: virtualization@lists.linux-foundation.org
> > Cc: Harry Wentland <harry.wentland@amd.com>
> > Cc: Leo Li <sunpeng.li@amd.com>
> > Cc: Alex Deucher <alexander.deucher@amd.com>
> > Cc: Christian König <christian.koenig@amd.com>
> > Cc: Eric Anholt <eric@anholt.net>
> > Cc: Maxime Ripard <mripard@kernel.org>
> > Cc: Ben Skeggs <bskeggs@redhat.com>
> > Cc: nouveau@lists.freedesktop.org
> > Signed-off-by: Daniel Vetter <daniel.vetter@intel.com>
> > ---
> >  drivers/gpu/drm/arm/display/komeda/komeda_kms.c  | 2 +-
> >  drivers/gpu/drm/arm/hdlcd_drv.c                  | 2 +-
> >  drivers/gpu/drm/arm/malidp_drv.c                 | 2 +-
> >  drivers/gpu/drm/armada/armada_drv.c              | 7 +++----
> >  drivers/gpu/drm/aspeed/aspeed_gfx_drv.c          | 2 +-
> >  drivers/gpu/drm/ast/ast_drv.c                    | 2 +-
> >  drivers/gpu/drm/ast/ast_drv.h                    | 2 +-
> >  drivers/gpu/drm/ast/ast_main.c                   | 2 +-
> >  drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c     | 2 +-
> >  drivers/gpu/drm/bochs/bochs_drv.c                | 2 +-
> >  drivers/gpu/drm/etnaviv/etnaviv_drv.c            | 2 +-
> >  drivers/gpu/drm/exynos/exynos_drm_drv.c          | 2 +-
> >  drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c        | 5 ++---
> >  drivers/gpu/drm/gma500/psb_drv.c                 | 4 ++--
> >  drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c  | 2 +-
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c  | 2 +-
> >  drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h  | 2 +-
> >  drivers/gpu/drm/i915/i915_drv.c                  | 4 ++--
> >  drivers/gpu/drm/i915/selftests/mock_gem_device.c | 2 +-
> >  drivers/gpu/drm/imx/dcss/dcss-kms.c              | 2 +-
> >  drivers/gpu/drm/imx/imx-drm-core.c               | 2 +-
> >  drivers/gpu/drm/ingenic/ingenic-drm-drv.c        | 2 +-
> >  drivers/gpu/drm/lima/lima_drv.c                  | 2 +-
> >  drivers/gpu/drm/mcde/mcde_drv.c                  | 2 +-
> >  drivers/gpu/drm/mediatek/mtk_drm_drv.c           | 2 +-
> >  drivers/gpu/drm/meson/meson_drv.c                | 2 +-
> >  drivers/gpu/drm/mgag200/mgag200_drv.c            | 2 +-
> >  drivers/gpu/drm/msm/msm_drv.c                    | 4 ++--
> >  drivers/gpu/drm/mxsfb/mxsfb_drv.c                | 2 +-
> >  drivers/gpu/drm/omapdrm/omap_drv.c               | 2 +-
> >  drivers/gpu/drm/panfrost/panfrost_drv.c          | 2 +-
> >  drivers/gpu/drm/pl111/pl111_drv.c                | 2 +-
> >  drivers/gpu/drm/radeon/radeon_drv.c              | 4 ++--
> >  drivers/gpu/drm/rcar-du/rcar_du_drv.c            | 2 +-
> >  drivers/gpu/drm/rockchip/rockchip_drm_drv.c      | 4 ++--
> >  drivers/gpu/drm/shmobile/shmob_drm_drv.c         | 2 +-
> >  drivers/gpu/drm/sti/sti_drv.c                    | 2 +-
> >  drivers/gpu/drm/stm/drv.c                        | 2 +-
> >  drivers/gpu/drm/sun4i/sun4i_drv.c                | 2 +-
> >  drivers/gpu/drm/tegra/drm.c                      | 5 ++---
> >  drivers/gpu/drm/tidss/tidss_drv.c                | 2 +-
> >  drivers/gpu/drm/tilcdc/tilcdc_drv.c              | 4 ++--
> >  drivers/gpu/drm/tiny/cirrus.c                    | 2 +-
> >  drivers/gpu/drm/tiny/gm12u320.c                  | 2 +-
> >  drivers/gpu/drm/tiny/hx8357d.c                   | 2 +-
> >  drivers/gpu/drm/tiny/ili9225.c                   | 2 +-
> >  drivers/gpu/drm/tiny/ili9341.c                   | 2 +-
> >  drivers/gpu/drm/tiny/ili9486.c                   | 2 +-
> >  drivers/gpu/drm/tiny/mi0283qt.c                  | 2 +-
> >  drivers/gpu/drm/tiny/repaper.c                   | 2 +-
> >  drivers/gpu/drm/tiny/st7586.c                    | 2 +-
> >  drivers/gpu/drm/tiny/st7735r.c                   | 2 +-
> >  drivers/gpu/drm/tve200/tve200_drv.c              | 2 +-
> >  drivers/gpu/drm/udl/udl_drv.c                    | 2 +-
> >  drivers/gpu/drm/v3d/v3d_drv.c                    | 2 +-
> >  drivers/gpu/drm/vboxvideo/vbox_drv.c             | 4 ++--
> >  drivers/gpu/drm/vgem/vgem_drv.c                  | 2 +-
> >  drivers/gpu/drm/virtio/virtgpu_drv.c             | 4 ++--
> >  drivers/gpu/drm/vkms/vkms_drv.c                  | 2 +-
> >  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c              | 2 +-
> >  drivers/gpu/drm/xen/xen_drm_front.c              | 2 +-
> >  drivers/gpu/drm/xlnx/zynqmp_dpsub.c              | 2 +-
> >  drivers/gpu/drm/zte/zx_drm_drv.c                 | 2 +-
> >  63 files changed, 75 insertions(+), 78 deletions(-)
>
> Oh please no. That's a huge patch for no apparent reason. Can you break
> this up?

Function pointer tables are high value targets, making them const
allows the compiler to move them into the read-only section and the
kernel to protect them from stray writes. That helps against exploits,
especially for a function table which userspace pretty much directly
calls. So that's why making stuff const is important in the kernel.

Now I didn't feel like splitting this up per-driver because it's a bit
too much trivial change, plus it' would take weeks to get all the acks
for every piece. But if you promise you'll go and ack them all I can
inflate this up to 11 and dump a 60+ patch set on dri-devel :-)

Cheers, Daniel

>
> Best regards
> Thomas
>
> >
> > diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > index cc5b5915bc5e..d04008f3e31a 100644
> > --- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > +++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
> > @@ -58,7 +58,7 @@ static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
> >       return status;
> >  }
> >
> > -static struct drm_driver komeda_kms_driver = {
> > +static const struct drm_driver komeda_kms_driver = {
> >       .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .lastclose                      = drm_fb_helper_lastclose,
> >       DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(komeda_gem_cma_dumb_create),
> > diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
> > index faa8a5a752da..81ae92390736 100644
> > --- a/drivers/gpu/drm/arm/hdlcd_drv.c
> > +++ b/drivers/gpu/drm/arm/hdlcd_drv.c
> > @@ -234,7 +234,7 @@ static void hdlcd_debugfs_init(struct drm_minor *minor)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fops);
> >
> > -static struct drm_driver hdlcd_driver = {
> > +static const struct drm_driver hdlcd_driver = {
> >       .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .irq_handler = hdlcd_irq,
> >       .irq_preinstall = hdlcd_irq_preinstall,
> > diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
> > index 26e60401a8e1..d83c7366b348 100644
> > --- a/drivers/gpu/drm/arm/malidp_drv.c
> > +++ b/drivers/gpu/drm/arm/malidp_drv.c
> > @@ -564,7 +564,7 @@ static void malidp_debugfs_init(struct drm_minor *minor)
> >
> >  #endif //CONFIG_DEBUG_FS
> >
> > -static struct drm_driver malidp_driver = {
> > +static const struct drm_driver malidp_driver = {
> >       .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(malidp_dumb_create),
> >  #ifdef CONFIG_DEBUG_FS
> > diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
> > index 22247cfce80b..44fe9f994fc5 100644
> > --- a/drivers/gpu/drm/armada/armada_drv.c
> > +++ b/drivers/gpu/drm/armada/armada_drv.c
> > @@ -27,7 +27,7 @@
> >  #include <drm/armada_drm.h>
> >  #include "armada_ioctlP.h"
> >
> > -static struct drm_ioctl_desc armada_ioctls[] = {
> > +static const struct drm_ioctl_desc armada_ioctls[] = {
> >       DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0),
> >       DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0),
> >       DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pwrite_ioctl, 0),
> > @@ -35,7 +35,7 @@ static struct drm_ioctl_desc armada_ioctls[] = {
> >
> >  DEFINE_DRM_GEM_FOPS(armada_drm_fops);
> >
> > -static struct drm_driver armada_drm_driver = {
> > +static const struct drm_driver armada_drm_driver = {
> >       .lastclose              = drm_fb_helper_lastclose,
> >       .prime_handle_to_fd     = drm_gem_prime_handle_to_fd,
> >       .prime_fd_to_handle     = drm_gem_prime_fd_to_handle,
> > @@ -48,6 +48,7 @@ static struct drm_driver armada_drm_driver = {
> >       .date                   = "20120730",
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .ioctls                 = armada_ioctls,
> > +     .num_ioctls = ARRAY_SIZE(armada_ioctls),
> >       .fops                   = &armada_drm_fops,
> >  };
> >
> > @@ -275,8 +276,6 @@ static int __init armada_drm_init(void)
> >  {
> >       int ret;
> >
> > -     armada_drm_driver.num_ioctls = ARRAY_SIZE(armada_ioctls);
> > -
> >       ret = platform_driver_register(&armada_lcd_platform_driver);
> >       if (ret)
> >               return ret;
> > diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> > index 771ad71cd340..457ec04950f7 100644
> > --- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> > +++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
> > @@ -191,7 +191,7 @@ static void aspeed_gfx_unload(struct drm_device *drm)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fops);
> >
> > -static struct drm_driver aspeed_gfx_driver = {
> > +static const struct drm_driver aspeed_gfx_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       DRM_GEM_CMA_DRIVER_OPS,
> >       .fops = &fops,
> > diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> > index f0b4af1c390a..667b450606ef 100644
> > --- a/drivers/gpu/drm/ast/ast_drv.c
> > +++ b/drivers/gpu/drm/ast/ast_drv.c
> > @@ -49,7 +49,7 @@ module_param_named(modeset, ast_modeset, int, 0400);
> >
> >  DEFINE_DRM_GEM_FOPS(ast_fops);
> >
> > -static struct drm_driver ast_driver = {
> > +static const struct drm_driver ast_driver = {
> >       .driver_features = DRIVER_ATOMIC |
> >                          DRIVER_GEM |
> >                          DRIVER_MODESET,
> > diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
> > index 467049ca8430..33e596a4f042 100644
> > --- a/drivers/gpu/drm/ast/ast_drv.h
> > +++ b/drivers/gpu/drm/ast/ast_drv.h
> > @@ -159,7 +159,7 @@ static inline struct ast_private *to_ast_private(struct drm_device *dev)
> >       return container_of(dev, struct ast_private, base);
> >  }
> >
> > -struct ast_private *ast_device_create(struct drm_driver *drv,
> > +struct ast_private *ast_device_create(const struct drm_driver *drv,
> >                                     struct pci_dev *pdev,
> >                                     unsigned long flags);
> >
> > diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
> > index 77066bca8793..45dd8185a488 100644
> > --- a/drivers/gpu/drm/ast/ast_main.c
> > +++ b/drivers/gpu/drm/ast/ast_main.c
> > @@ -392,7 +392,7 @@ static void ast_device_release(void *data)
> >       ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
> >  }
> >
> > -struct ast_private *ast_device_create(struct drm_driver *drv,
> > +struct ast_private *ast_device_create(const struct drm_driver *drv,
> >                                     struct pci_dev *pdev,
> >                                     unsigned long flags)
> >  {
> > diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > index 03984932d174..65af56e47129 100644
> > --- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > +++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
> > @@ -712,7 +712,7 @@ static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fops);
> >
> > -static struct drm_driver atmel_hlcdc_dc_driver = {
> > +static const struct drm_driver atmel_hlcdc_dc_driver = {
> >       .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .irq_handler = atmel_hlcdc_dc_irq_handler,
> >       .irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
> > diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
> > index e18c51de1196..fd454225fd19 100644
> > --- a/drivers/gpu/drm/bochs/bochs_drv.c
> > +++ b/drivers/gpu/drm/bochs/bochs_drv.c
> > @@ -57,7 +57,7 @@ static int bochs_load(struct drm_device *dev)
> >
> >  DEFINE_DRM_GEM_FOPS(bochs_fops);
> >
> > -static struct drm_driver bochs_driver = {
> > +static const struct drm_driver bochs_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &bochs_fops,
> >       .name                   = "bochs-drm",
> > diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > index aa270b79e585..7604e3c07973 100644
> > --- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > +++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
> > @@ -480,7 +480,7 @@ static const struct file_operations fops = {
> >       .mmap               = etnaviv_gem_mmap,
> >  };
> >
> > -static struct drm_driver etnaviv_drm_driver = {
> > +static const struct drm_driver etnaviv_drm_driver = {
> >       .driver_features    = DRIVER_GEM | DRIVER_RENDER,
> >       .open               = etnaviv_open,
> >       .postclose           = etnaviv_postclose,
> > diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > index fe46680ca208..e60257f1f24b 100644
> > --- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > +++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
> > @@ -113,7 +113,7 @@ static const struct file_operations exynos_drm_driver_fops = {
> >       .release        = drm_release,
> >  };
> >
> > -static struct drm_driver exynos_drm_driver = {
> > +static const struct drm_driver exynos_drm_driver = {
> >       .driver_features        = DRIVER_MODESET | DRIVER_GEM
> >                                 | DRIVER_ATOMIC | DRIVER_RENDER,
> >       .open                   = exynos_drm_open,
> > diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > index ae584f62aa19..75b58d55a940 100644
> > --- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > +++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
> > @@ -124,7 +124,7 @@ static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
> >
> > -static struct drm_driver fsl_dcu_drm_driver = {
> > +static const struct drm_driver fsl_dcu_drm_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .load                   = fsl_dcu_load,
> >       .unload                 = fsl_dcu_unload,
> > @@ -224,7 +224,6 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
> >       struct device *dev = &pdev->dev;
> >       struct resource *res;
> >       void __iomem *base;
> > -     struct drm_driver *driver = &fsl_dcu_drm_driver;
> >       struct clk *pix_clk_in;
> >       char pix_clk_name[32];
> >       const char *pix_clk_in_name;
> > @@ -294,7 +293,7 @@ static int fsl_dcu_drm_probe(struct platform_device *pdev)
> >
> >       fsl_dev->tcon = fsl_tcon_init(dev);
> >
> > -     drm = drm_dev_alloc(driver, dev);
> > +     drm = drm_dev_alloc(&fsl_dcu_drm_driver, dev);
> >       if (IS_ERR(drm)) {
> >               ret = PTR_ERR(drm);
> >               goto unregister_pix_clk;
> > diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
> > index b13376a6fb91..6e7197d89463 100644
> > --- a/drivers/gpu/drm/gma500/psb_drv.c
> > +++ b/drivers/gpu/drm/gma500/psb_drv.c
> > @@ -34,7 +34,7 @@
> >  #include "psb_intel_reg.h"
> >  #include "psb_reg.h"
> >
> > -static struct drm_driver driver;
> > +static const struct drm_driver driver;
> >  static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
> >
> >  /*
> > @@ -491,7 +491,7 @@ static const struct file_operations psb_gem_fops = {
> >       .read = drm_read,
> >  };
> >
> > -static struct drm_driver driver = {
> > +static const struct drm_driver driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM,
> >       .lastclose = drm_fb_helper_lastclose,
> >
> > diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > index a684814927cd..27205aa907f4 100644
> > --- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > +++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
> > @@ -43,7 +43,7 @@ static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
> >       return IRQ_HANDLED;
> >  }
> >
> > -static struct drm_driver hibmc_driver = {
> > +static const struct drm_driver hibmc_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &hibmc_fops,
> >       .name                   = "hibmc",
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > index cfe8ff596d55..8928550072df 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
> > @@ -918,7 +918,7 @@ static const struct drm_mode_config_funcs ade_mode_config_funcs = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
> >
> > -static struct drm_driver ade_driver = {
> > +const static struct drm_driver ade_driver = {
> >       .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops = &ade_fops,
> >       DRM_GEM_CMA_DRIVER_OPS,
> > diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> > index dee8ec2f7f2e..386d137f29e5 100644
> > --- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> > +++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
> > @@ -40,7 +40,7 @@ struct kirin_drm_data {
> >       u32 num_planes;
> >       u32 prim_plane;
> >
> > -     struct drm_driver *driver;
> > +     const struct drm_driver *driver;
> >       const struct drm_crtc_helper_funcs *crtc_helper_funcs;
> >       const struct drm_crtc_funcs *crtc_funcs;
> >       const struct drm_plane_helper_funcs *plane_helper_funcs;
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index d3237b0d821d..27249b5e2729 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -87,7 +87,7 @@
> >  #include "intel_sideband.h"
> >  #include "vlv_suspend.h"
> >
> > -static struct drm_driver driver;
> > +static const struct drm_driver driver;
> >
> >  static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
> >  {
> > @@ -1758,7 +1758,7 @@ static const struct drm_ioctl_desc i915_ioctls[] = {
> >       DRM_IOCTL_DEF_DRV(I915_GEM_VM_DESTROY, i915_gem_vm_destroy_ioctl, DRM_RENDER_ALLOW),
> >  };
> >
> > -static struct drm_driver driver = {
> > +static const struct drm_driver driver = {
> >       /* Don't use MTRRs here; the Xserver or userspace app should
> >        * deal with them for Intel hardware.
> >        */
> > diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > index 9220c9d1a4b7..e946bd2087d8 100644
> > --- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > +++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
> > @@ -81,7 +81,7 @@ static void mock_device_release(struct drm_device *dev)
> >       i915_params_free(&i915->params);
> >  }
> >
> > -static struct drm_driver mock_driver = {
> > +static const struct drm_driver mock_driver = {
> >       .name = "mock",
> >       .driver_features = DRIVER_GEM,
> >       .release = mock_device_release,
> > diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> > index b72e5cef7e40..b549ce5e7607 100644
> > --- a/drivers/gpu/drm/imx/dcss/dcss-kms.c
> > +++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c
> > @@ -26,7 +26,7 @@ static const struct drm_mode_config_funcs dcss_drm_mode_config_funcs = {
> >       .atomic_commit = drm_atomic_helper_commit,
> >  };
> >
> > -static struct drm_driver dcss_kms_driver = {
> > +static const struct drm_driver dcss_kms_driver = {
> >       .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       DRM_GEM_CMA_DRIVER_OPS,
> >       .fops                   = &dcss_cma_fops,
> > diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
> > index 183f2e91881d..7090b82e7ea2 100644
> > --- a/drivers/gpu/drm/imx/imx-drm-core.c
> > +++ b/drivers/gpu/drm/imx/imx-drm-core.c
> > @@ -143,7 +143,7 @@ static const struct drm_ioctl_desc imx_drm_ioctls[] = {
> >       /* none so far */
> >  };
> >
> > -static struct drm_driver imx_drm_driver = {
> > +static const struct drm_driver imx_drm_driver = {
> >       .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       DRM_GEM_CMA_DRIVER_OPS,
> >       .ioctls                 = imx_drm_ioctls,
> > diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > index 2329754af116..082cb9e45908 100644
> > --- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > +++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
> > @@ -710,7 +710,7 @@ static void ingenic_drm_disable_vblank(struct drm_crtc *crtc)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(ingenic_drm_fops);
> >
> > -static struct drm_driver ingenic_drm_driver_data = {
> > +static const struct drm_driver ingenic_drm_driver_data = {
> >       .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .name                   = "ingenic-drm",
> >       .desc                   = "DRM module for Ingenic SoCs",
> > diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c
> > index ab460121fd52..d497af91d850 100644
> > --- a/drivers/gpu/drm/lima/lima_drv.c
> > +++ b/drivers/gpu/drm/lima/lima_drv.c
> > @@ -261,7 +261,7 @@ DEFINE_DRM_GEM_FOPS(lima_drm_driver_fops);
> >   * - 1.1.0 - add heap buffer support
> >   */
> >
> > -static struct drm_driver lima_drm_driver = {
> > +static const struct drm_driver lima_drm_driver = {
> >       .driver_features    = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ,
> >       .open               = lima_drm_driver_open,
> >       .postclose          = lima_drm_driver_postclose,
> > diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
> > index f9b5f450a9cb..870626e04ec0 100644
> > --- a/drivers/gpu/drm/mcde/mcde_drv.c
> > +++ b/drivers/gpu/drm/mcde/mcde_drv.c
> > @@ -178,7 +178,7 @@ static int mcde_modeset_init(struct drm_device *drm)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
> >
> > -static struct drm_driver mcde_drm_driver = {
> > +static const struct drm_driver mcde_drm_driver = {
> >       .driver_features =
> >               DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .lastclose = drm_fb_helper_lastclose,
> > diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > index 7f3398a7c2b0..2e8065b1e2bb 100644
> > --- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > +++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
> > @@ -321,7 +321,7 @@ struct drm_gem_object *mtk_drm_gem_prime_import(struct drm_device *dev,
> >       return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev);
> >  }
> >
> > -static struct drm_driver mtk_drm_driver = {
> > +static const struct drm_driver mtk_drm_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >
> >       .dumb_create = mtk_drm_gem_dumb_create,
> > diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
> > index 8b9c8dd788c4..dc8509ceb787 100644
> > --- a/drivers/gpu/drm/meson/meson_drv.c
> > +++ b/drivers/gpu/drm/meson/meson_drv.c
> > @@ -90,7 +90,7 @@ static int meson_dumb_create(struct drm_file *file, struct drm_device *dev,
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fops);
> >
> > -static struct drm_driver meson_driver = {
> > +static const struct drm_driver meson_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >
> >       /* IRQ */
> > diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> > index 771b26aeee19..0f07f259503d 100644
> > --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> > +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> > @@ -28,7 +28,7 @@ module_param_named(modeset, mgag200_modeset, int, 0400);
> >
> >  DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
> >
> > -static struct drm_driver mgag200_driver = {
> > +static const struct drm_driver mgag200_driver = {
> >       .driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
> >       .fops = &mgag200_driver_fops,
> >       .name = DRIVER_NAME,
> > diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
> > index aa4509766d64..f8fd31e709bb 100644
> > --- a/drivers/gpu/drm/msm/msm_drv.c
> > +++ b/drivers/gpu/drm/msm/msm_drv.c
> > @@ -393,7 +393,7 @@ static int msm_init_vram(struct drm_device *dev)
> >       return ret;
> >  }
> >
> > -static int msm_drm_init(struct device *dev, struct drm_driver *drv)
> > +static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
> >  {
> >       struct platform_device *pdev = to_platform_device(dev);
> >       struct drm_device *ddev;
> > @@ -984,7 +984,7 @@ static const struct file_operations fops = {
> >       .mmap               = msm_gem_mmap,
> >  };
> >
> > -static struct drm_driver msm_driver = {
> > +static const struct drm_driver msm_driver = {
> >       .driver_features    = DRIVER_GEM |
> >                               DRIVER_RENDER |
> >                               DRIVER_ATOMIC |
> > diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > index 35122aef037b..6faf17b6408d 100644
> > --- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > +++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
> > @@ -289,7 +289,7 @@ static irqreturn_t mxsfb_irq_handler(int irq, void *data)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fops);
> >
> > -static struct drm_driver mxsfb_driver = {
> > +static const struct drm_driver mxsfb_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .irq_handler            = mxsfb_irq_handler,
> >       .irq_preinstall         = mxsfb_irq_disable,
> > diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
> > index 2b82a708eca6..21a6cd3f5473 100644
> > --- a/drivers/gpu/drm/omapdrm/omap_drv.c
> > +++ b/drivers/gpu/drm/omapdrm/omap_drv.c
> > @@ -534,7 +534,7 @@ static const struct file_operations omapdriver_fops = {
> >       .llseek = noop_llseek,
> >  };
> >
> > -static struct drm_driver omap_drm_driver = {
> > +static const struct drm_driver omap_drm_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM  |
> >               DRIVER_ATOMIC | DRIVER_RENDER,
> >       .open = dev_open,
> > diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
> > index 37d4cb7a5491..ed116bd3d6d6 100644
> > --- a/drivers/gpu/drm/panfrost/panfrost_drv.c
> > +++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
> > @@ -548,7 +548,7 @@ DEFINE_DRM_GEM_FOPS(panfrost_drm_driver_fops);
> >   * - 1.0 - initial interface
> >   * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO
> >   */
> > -static struct drm_driver panfrost_drm_driver = {
> > +static const struct drm_driver panfrost_drm_driver = {
> >       .driver_features        = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ,
> >       .open                   = panfrost_open,
> >       .postclose              = panfrost_postclose,
> > diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
> > index 3899c28f428d..10d9a12be672 100644
> > --- a/drivers/gpu/drm/pl111/pl111_drv.c
> > +++ b/drivers/gpu/drm/pl111/pl111_drv.c
> > @@ -213,7 +213,7 @@ pl111_gem_import_sg_table(struct drm_device *dev,
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
> >
> > -static struct drm_driver pl111_drm_driver = {
> > +static const struct drm_driver pl111_drm_driver = {
> >       .driver_features =
> >               DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .ioctls = NULL,
> > diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> > index 9c11e36ad33a..bfadb799d6a3 100644
> > --- a/drivers/gpu/drm/radeon/radeon_drv.c
> > +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> > @@ -297,7 +297,7 @@ static struct pci_device_id pciidlist[] = {
> >
> >  MODULE_DEVICE_TABLE(pci, pciidlist);
> >
> > -static struct drm_driver kms_driver;
> > +static const struct drm_driver kms_driver;
> >
> >  bool radeon_device_is_virtual(void);
> >
> > @@ -629,7 +629,7 @@ static const struct drm_ioctl_desc radeon_ioctls_kms[] = {
> >       DRM_IOCTL_DEF_DRV(RADEON_GEM_USERPTR, radeon_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
> >  };
> >
> > -static struct drm_driver kms_driver = {
> > +static const struct drm_driver kms_driver = {
> >       .driver_features =
> >           DRIVER_GEM | DRIVER_RENDER | DRIVER_MODESET,
> >       .load = radeon_driver_load_kms,
> > diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > index 447be991fa25..600056dff374 100644
> > --- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > +++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
> > @@ -507,7 +507,7 @@ MODULE_DEVICE_TABLE(of, rcar_du_of_table);
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
> >
> > -static struct drm_driver rcar_du_driver = {
> > +static const struct drm_driver rcar_du_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(rcar_du_dumb_create),
> >       .fops                   = &rcar_du_fops,
> > diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> > index b7654f5e4225..212bd87c0c4a 100644
> > --- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> > +++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
> > @@ -35,7 +35,7 @@
> >  #define DRIVER_MINOR 0
> >
> >  static bool is_support_iommu = true;
> > -static struct drm_driver rockchip_drm_driver;
> > +static const struct drm_driver rockchip_drm_driver;
> >
> >  /*
> >   * Attach a (component) device to the shared drm dma mapping from master drm
> > @@ -209,7 +209,7 @@ static const struct file_operations rockchip_drm_driver_fops = {
> >       .release = drm_release,
> >  };
> >
> > -static struct drm_driver rockchip_drm_driver = {
> > +static const struct drm_driver rockchip_drm_driver = {
> >       .driver_features        = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .lastclose              = drm_fb_helper_lastclose,
> >       .dumb_create            = rockchip_gem_dumb_create,
> > diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> > index 26a15c214bd3..0a02b7092c04 100644
> > --- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> > +++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
> > @@ -128,7 +128,7 @@ static irqreturn_t shmob_drm_irq(int irq, void *arg)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
> >
> > -static struct drm_driver shmob_drm_driver = {
> > +static const struct drm_driver shmob_drm_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET,
> >       .irq_handler            = shmob_drm_irq,
> >       DRM_GEM_CMA_DRIVER_OPS,
> > diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
> > index 3f54efa36098..c7efb43b83ee 100644
> > --- a/drivers/gpu/drm/sti/sti_drv.c
> > +++ b/drivers/gpu/drm/sti/sti_drv.c
> > @@ -130,7 +130,7 @@ static void sti_mode_config_init(struct drm_device *dev)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops);
> >
> > -static struct drm_driver sti_driver = {
> > +static const struct drm_driver sti_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .fops = &sti_driver_fops,
> >       DRM_GEM_CMA_DRIVER_OPS,
> > diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
> > index 411103f013e2..222869b232ae 100644
> > --- a/drivers/gpu/drm/stm/drv.c
> > +++ b/drivers/gpu/drm/stm/drv.c
> > @@ -53,7 +53,7 @@ static int stm_gem_cma_dumb_create(struct drm_file *file,
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
> >
> > -static struct drm_driver drv_driver = {
> > +static const struct drm_driver drv_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .name = "stm",
> >       .desc = "STMicroelectronics SoC DRM",
> > diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > index 29861fc81b35..91502937f26d 100644
> > --- a/drivers/gpu/drm/sun4i/sun4i_drv.c
> > +++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
> > @@ -40,7 +40,7 @@ static int drm_sun4i_gem_dumb_create(struct drm_file *file_priv,
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
> >
> > -static struct drm_driver sun4i_drv_driver = {
> > +static const struct drm_driver sun4i_drv_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >
> >       /* Generic Operations */
> > diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
> > index 24f353c1cee8..ae13a3ff8a87 100644
> > --- a/drivers/gpu/drm/tegra/drm.c
> > +++ b/drivers/gpu/drm/tegra/drm.c
> > @@ -850,7 +850,7 @@ static void tegra_debugfs_init(struct drm_minor *minor)
> >  }
> >  #endif
> >
> > -static struct drm_driver tegra_drm_driver = {
> > +static const struct drm_driver tegra_drm_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM |
> >                          DRIVER_ATOMIC | DRIVER_RENDER,
> >       .open = tegra_drm_open,
> > @@ -1084,12 +1084,11 @@ static bool host1x_drm_wants_iommu(struct host1x_device *dev)
> >
> >  static int host1x_drm_probe(struct host1x_device *dev)
> >  {
> > -     struct drm_driver *driver = &tegra_drm_driver;
> >       struct tegra_drm *tegra;
> >       struct drm_device *drm;
> >       int err;
> >
> > -     drm = drm_dev_alloc(driver, &dev->dev);
> > +     drm = drm_dev_alloc(&tegra_drm_driver, &dev->dev);
> >       if (IS_ERR(drm))
> >               return PTR_ERR(drm);
> >
> > diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
> > index 9179ea18f625..66e3c86eb5c7 100644
> > --- a/drivers/gpu/drm/tidss/tidss_drv.c
> > +++ b/drivers/gpu/drm/tidss/tidss_drv.c
> > @@ -108,7 +108,7 @@ static void tidss_release(struct drm_device *ddev)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(tidss_fops);
> >
> > -static struct drm_driver tidss_driver = {
> > +static const struct drm_driver tidss_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &tidss_fops,
> >       .release                = tidss_release,
> > diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > index c5f82e693f1a..137f74f613ab 100644
> > --- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > +++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
> > @@ -166,7 +166,7 @@ static void tilcdc_fini(struct drm_device *dev)
> >       drm_dev_put(dev);
> >  }
> >
> > -static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
> > +static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
> >  {
> >       struct drm_device *ddev;
> >       struct platform_device *pdev = to_platform_device(dev);
> > @@ -452,7 +452,7 @@ static void tilcdc_debugfs_init(struct drm_minor *minor)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(fops);
> >
> > -static struct drm_driver tilcdc_driver = {
> > +static const struct drm_driver tilcdc_driver = {
> >       .driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .irq_handler        = tilcdc_irq,
> >       DRM_GEM_CMA_DRIVER_OPS,
> > diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
> > index 759a5a66dd0b..e5641969c181 100644
> > --- a/drivers/gpu/drm/tiny/cirrus.c
> > +++ b/drivers/gpu/drm/tiny/cirrus.c
> > @@ -536,7 +536,7 @@ static int cirrus_mode_config_init(struct cirrus_device *cirrus)
> >
> >  DEFINE_DRM_GEM_FOPS(cirrus_fops);
> >
> > -static struct drm_driver cirrus_driver = {
> > +static const struct drm_driver cirrus_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >
> >       .name            = DRIVER_NAME,
> > diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
> > index cc397671f689..5a953c4ce265 100644
> > --- a/drivers/gpu/drm/tiny/gm12u320.c
> > +++ b/drivers/gpu/drm/tiny/gm12u320.c
> > @@ -600,7 +600,7 @@ static const uint64_t gm12u320_pipe_modifiers[] = {
> >
> >  DEFINE_DRM_GEM_FOPS(gm12u320_fops);
> >
> > -static struct drm_driver gm12u320_drm_driver = {
> > +static const struct drm_driver gm12u320_drm_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >
> >       .name            = DRIVER_NAME,
> > diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
> > index 0998309b0d95..c6525cd02bc2 100644
> > --- a/drivers/gpu/drm/tiny/hx8357d.c
> > +++ b/drivers/gpu/drm/tiny/hx8357d.c
> > @@ -193,7 +193,7 @@ static const struct drm_display_mode yx350hv15_mode = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
> >
> > -static struct drm_driver hx8357d_driver = {
> > +static const struct drm_driver hx8357d_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &hx8357d_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
> > index 97a77262d791..8e98962db5a2 100644
> > --- a/drivers/gpu/drm/tiny/ili9225.c
> > +++ b/drivers/gpu/drm/tiny/ili9225.c
> > @@ -337,7 +337,7 @@ static const struct drm_display_mode ili9225_mode = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
> >
> > -static struct drm_driver ili9225_driver = {
> > +static const struct drm_driver ili9225_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &ili9225_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
> > index d39c39df56ad..6ce97f0698eb 100644
> > --- a/drivers/gpu/drm/tiny/ili9341.c
> > +++ b/drivers/gpu/drm/tiny/ili9341.c
> > @@ -149,7 +149,7 @@ static const struct drm_display_mode yx240qv29_mode = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
> >
> > -static struct drm_driver ili9341_driver = {
> > +static const struct drm_driver ili9341_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &ili9341_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
> > index 403af68fa440..d7ce40eb166a 100644
> > --- a/drivers/gpu/drm/tiny/ili9486.c
> > +++ b/drivers/gpu/drm/tiny/ili9486.c
> > @@ -162,7 +162,7 @@ static const struct drm_display_mode waveshare_mode = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
> >
> > -static struct drm_driver ili9486_driver = {
> > +static const struct drm_driver ili9486_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &ili9486_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
> > index 2131b4268c00..ff77f983f803 100644
> > --- a/drivers/gpu/drm/tiny/mi0283qt.c
> > +++ b/drivers/gpu/drm/tiny/mi0283qt.c
> > @@ -153,7 +153,7 @@ static const struct drm_display_mode mi0283qt_mode = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
> >
> > -static struct drm_driver mi0283qt_driver = {
> > +static const struct drm_driver mi0283qt_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &mi0283qt_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
> > index 2e01cf0a9876..11c602fc9897 100644
> > --- a/drivers/gpu/drm/tiny/repaper.c
> > +++ b/drivers/gpu/drm/tiny/repaper.c
> > @@ -936,7 +936,7 @@ static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
> >
> > -static struct drm_driver repaper_driver = {
> > +static const struct drm_driver repaper_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &repaper_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
> > index d05de03891f8..ff5cf60f4bd7 100644
> > --- a/drivers/gpu/drm/tiny/st7586.c
> > +++ b/drivers/gpu/drm/tiny/st7586.c
> > @@ -277,7 +277,7 @@ static const struct drm_display_mode st7586_mode = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
> >
> > -static struct drm_driver st7586_driver = {
> > +static const struct drm_driver st7586_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &st7586_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
> > index a0f688f0d050..2c77d9ab7e8d 100644
> > --- a/drivers/gpu/drm/tiny/st7735r.c
> > +++ b/drivers/gpu/drm/tiny/st7735r.c
> > @@ -154,7 +154,7 @@ static const struct st7735r_cfg rh128128t_cfg = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
> >
> > -static struct drm_driver st7735r_driver = {
> > +static const struct drm_driver st7735r_driver = {
> >       .driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .fops                   = &st7735r_fops,
> >       DRM_GEM_CMA_DRIVER_OPS_VMAP,
> > diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
> > index b5259cb1383f..07140e0b90a3 100644
> > --- a/drivers/gpu/drm/tve200/tve200_drv.c
> > +++ b/drivers/gpu/drm/tve200/tve200_drv.c
> > @@ -137,7 +137,7 @@ static int tve200_modeset_init(struct drm_device *dev)
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
> >
> > -static struct drm_driver tve200_drm_driver = {
> > +static const struct drm_driver tve200_drm_driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >       .ioctls = NULL,
> >       .fops = &drm_fops,
> > diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
> > index 96d4317a2c1b..46df4d07bd7b 100644
> > --- a/drivers/gpu/drm/udl/udl_drv.c
> > +++ b/drivers/gpu/drm/udl/udl_drv.c
> > @@ -34,7 +34,7 @@ static int udl_usb_resume(struct usb_interface *interface)
> >
> >  DEFINE_DRM_GEM_FOPS(udl_driver_fops);
> >
> > -static struct drm_driver driver = {
> > +static const struct drm_driver driver = {
> >       .driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
> >
> >       /* GEM hooks */
> > diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
> > index 9f7c26193831..2da0c1180bc6 100644
> > --- a/drivers/gpu/drm/v3d/v3d_drv.c
> > +++ b/drivers/gpu/drm/v3d/v3d_drv.c
> > @@ -194,7 +194,7 @@ static const struct drm_ioctl_desc v3d_drm_ioctls[] = {
> >       DRM_IOCTL_DEF_DRV(V3D_SUBMIT_CSD, v3d_submit_csd_ioctl, DRM_RENDER_ALLOW | DRM_AUTH),
> >  };
> >
> > -static struct drm_driver v3d_drm_driver = {
> > +static const struct drm_driver v3d_drm_driver = {
> >       .driver_features = (DRIVER_GEM |
> >                           DRIVER_RENDER |
> >                           DRIVER_SYNCOBJ),
> > diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> > index cf2e3e6a2388..f3eac72cb46e 100644
> > --- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
> > +++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
> > @@ -26,7 +26,7 @@ static int vbox_modeset = -1;
> >  MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
> >  module_param_named(modeset, vbox_modeset, int, 0400);
> >
> > -static struct drm_driver driver;
> > +static const struct drm_driver driver;
> >
> >  static const struct pci_device_id pciidlist[] = {
> >       { PCI_DEVICE(0x80ee, 0xbeef) },
> > @@ -175,7 +175,7 @@ static struct pci_driver vbox_pci_driver = {
> >
> >  DEFINE_DRM_GEM_FOPS(vbox_fops);
> >
> > -static struct drm_driver driver = {
> > +static const struct drm_driver driver = {
> >       .driver_features =
> >           DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
> >
> > diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
> > index fa54a6d1403d..3e9b7a4c30ce 100644
> > --- a/drivers/gpu/drm/vgem/vgem_drv.c
> > +++ b/drivers/gpu/drm/vgem/vgem_drv.c
> > @@ -415,7 +415,7 @@ static const struct drm_gem_object_funcs vgem_gem_object_funcs = {
> >       .vm_ops = &vgem_gem_vm_ops,
> >  };
> >
> > -static struct drm_driver vgem_driver = {
> > +static const struct drm_driver vgem_driver = {
> >       .driver_features                = DRIVER_GEM | DRIVER_RENDER,
> >       .open                           = vgem_open,
> >       .postclose                      = vgem_postclose,
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> > index 86330f1ade72..27f13bd29c13 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> > @@ -37,7 +37,7 @@
> >
> >  #include "virtgpu_drv.h"
> >
> > -static struct drm_driver driver;
> > +static const struct drm_driver driver;
> >
> >  static int virtio_gpu_modeset = -1;
> >
> > @@ -190,7 +190,7 @@ MODULE_AUTHOR("Alon Levy");
> >
> >  DEFINE_DRM_GEM_FOPS(virtio_gpu_driver_fops);
> >
> > -static struct drm_driver driver = {
> > +static const struct drm_driver driver = {
> >       .driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_RENDER | DRIVER_ATOMIC,
> >       .open = virtio_gpu_driver_open,
> >       .postclose = virtio_gpu_driver_postclose,
> > diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
> > index 98ba844ae77d..8056b3d1ff6a 100644
> > --- a/drivers/gpu/drm/vkms/vkms_drv.c
> > +++ b/drivers/gpu/drm/vkms/vkms_drv.c
> > @@ -78,7 +78,7 @@ static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
> >       drm_atomic_helper_cleanup_planes(dev, old_state);
> >  }
> >
> > -static struct drm_driver vkms_driver = {
> > +static const struct drm_driver vkms_driver = {
> >       .driver_features        = DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
> >       .release                = vkms_release,
> >       .fops                   = &vkms_driver_fops,
> > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > index 68206d0a1237..e66b252e3923 100644
> > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > @@ -1465,7 +1465,7 @@ static const struct file_operations vmwgfx_driver_fops = {
> >       .get_unmapped_area = vmw_get_unmapped_area,
> >  };
> >
> > -static struct drm_driver driver = {
> > +static const struct drm_driver driver = {
> >       .driver_features =
> >       DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
> >       .ioctls = vmw_ioctls,
> > diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
> > index 98b6d2ba088a..30d9adf31c84 100644
> > --- a/drivers/gpu/drm/xen/xen_drm_front.c
> > +++ b/drivers/gpu/drm/xen/xen_drm_front.c
> > @@ -483,7 +483,7 @@ static const struct file_operations xen_drm_dev_fops = {
> >       .mmap           = xen_drm_front_gem_mmap,
> >  };
> >
> > -static struct drm_driver xen_drm_driver = {
> > +static const struct drm_driver xen_drm_driver = {
> >       .driver_features           = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       .release                   = xen_drm_drv_release,
> >       .prime_handle_to_fd        = drm_gem_prime_handle_to_fd,
> > diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > index f3ffc3703a0e..0c1c50271a88 100644
> > --- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > +++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
> > @@ -76,7 +76,7 @@ static const struct drm_mode_config_funcs zynqmp_dpsub_mode_config_funcs = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(zynqmp_dpsub_drm_fops);
> >
> > -static struct drm_driver zynqmp_dpsub_drm_driver = {
> > +static const struct drm_driver zynqmp_dpsub_drm_driver = {
> >       .driver_features                = DRIVER_MODESET | DRIVER_GEM |
> >                                         DRIVER_ATOMIC,
> >
> > diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
> > index 31014a451f8b..5506336594e2 100644
> > --- a/drivers/gpu/drm/zte/zx_drm_drv.c
> > +++ b/drivers/gpu/drm/zte/zx_drm_drv.c
> > @@ -34,7 +34,7 @@ static const struct drm_mode_config_funcs zx_drm_mode_config_funcs = {
> >
> >  DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops);
> >
> > -static struct drm_driver zx_drm_driver = {
> > +static const struct drm_driver zx_drm_driver = {
> >       .driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
> >       DRM_GEM_CMA_DRIVER_OPS,
> >       .fops = &zx_drm_fops,
> >
>
> --
> Thomas Zimmermann
> Graphics Driver Developer
> SUSE Software Solutions Germany GmbH
> Maxfeldstr. 5, 90409 Nürnberg, Germany
> (HRB 36809, AG Nürnberg)
> Geschäftsführer: Felix Imendörffer
diff mbox series

Patch

diff --git a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
index cc5b5915bc5e..d04008f3e31a 100644
--- a/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
+++ b/drivers/gpu/drm/arm/display/komeda/komeda_kms.c
@@ -58,7 +58,7 @@  static irqreturn_t komeda_kms_irq_handler(int irq, void *data)
 	return status;
 }
 
-static struct drm_driver komeda_kms_driver = {
+static const struct drm_driver komeda_kms_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.lastclose			= drm_fb_helper_lastclose,
 	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(komeda_gem_cma_dumb_create),
diff --git a/drivers/gpu/drm/arm/hdlcd_drv.c b/drivers/gpu/drm/arm/hdlcd_drv.c
index faa8a5a752da..81ae92390736 100644
--- a/drivers/gpu/drm/arm/hdlcd_drv.c
+++ b/drivers/gpu/drm/arm/hdlcd_drv.c
@@ -234,7 +234,7 @@  static void hdlcd_debugfs_init(struct drm_minor *minor)
 
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
-static struct drm_driver hdlcd_driver = {
+static const struct drm_driver hdlcd_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.irq_handler = hdlcd_irq,
 	.irq_preinstall = hdlcd_irq_preinstall,
diff --git a/drivers/gpu/drm/arm/malidp_drv.c b/drivers/gpu/drm/arm/malidp_drv.c
index 26e60401a8e1..d83c7366b348 100644
--- a/drivers/gpu/drm/arm/malidp_drv.c
+++ b/drivers/gpu/drm/arm/malidp_drv.c
@@ -564,7 +564,7 @@  static void malidp_debugfs_init(struct drm_minor *minor)
 
 #endif //CONFIG_DEBUG_FS
 
-static struct drm_driver malidp_driver = {
+static const struct drm_driver malidp_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(malidp_dumb_create),
 #ifdef CONFIG_DEBUG_FS
diff --git a/drivers/gpu/drm/armada/armada_drv.c b/drivers/gpu/drm/armada/armada_drv.c
index 22247cfce80b..44fe9f994fc5 100644
--- a/drivers/gpu/drm/armada/armada_drv.c
+++ b/drivers/gpu/drm/armada/armada_drv.c
@@ -27,7 +27,7 @@ 
 #include <drm/armada_drm.h>
 #include "armada_ioctlP.h"
 
-static struct drm_ioctl_desc armada_ioctls[] = {
+static const struct drm_ioctl_desc armada_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(ARMADA_GEM_CREATE, armada_gem_create_ioctl,0),
 	DRM_IOCTL_DEF_DRV(ARMADA_GEM_MMAP, armada_gem_mmap_ioctl, 0),
 	DRM_IOCTL_DEF_DRV(ARMADA_GEM_PWRITE, armada_gem_pwrite_ioctl, 0),
@@ -35,7 +35,7 @@  static struct drm_ioctl_desc armada_ioctls[] = {
 
 DEFINE_DRM_GEM_FOPS(armada_drm_fops);
 
-static struct drm_driver armada_drm_driver = {
+static const struct drm_driver armada_drm_driver = {
 	.lastclose		= drm_fb_helper_lastclose,
 	.prime_handle_to_fd	= drm_gem_prime_handle_to_fd,
 	.prime_fd_to_handle	= drm_gem_prime_fd_to_handle,
@@ -48,6 +48,7 @@  static struct drm_driver armada_drm_driver = {
 	.date			= "20120730",
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.ioctls			= armada_ioctls,
+	.num_ioctls = ARRAY_SIZE(armada_ioctls),
 	.fops			= &armada_drm_fops,
 };
 
@@ -275,8 +276,6 @@  static int __init armada_drm_init(void)
 {
 	int ret;
 
-	armada_drm_driver.num_ioctls = ARRAY_SIZE(armada_ioctls);
-
 	ret = platform_driver_register(&armada_lcd_platform_driver);
 	if (ret)
 		return ret;
diff --git a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
index 771ad71cd340..457ec04950f7 100644
--- a/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
+++ b/drivers/gpu/drm/aspeed/aspeed_gfx_drv.c
@@ -191,7 +191,7 @@  static void aspeed_gfx_unload(struct drm_device *drm)
 
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
-static struct drm_driver aspeed_gfx_driver = {
+static const struct drm_driver aspeed_gfx_driver = {
 	.driver_features        = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &fops,
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index f0b4af1c390a..667b450606ef 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -49,7 +49,7 @@  module_param_named(modeset, ast_modeset, int, 0400);
 
 DEFINE_DRM_GEM_FOPS(ast_fops);
 
-static struct drm_driver ast_driver = {
+static const struct drm_driver ast_driver = {
 	.driver_features = DRIVER_ATOMIC |
 			   DRIVER_GEM |
 			   DRIVER_MODESET,
diff --git a/drivers/gpu/drm/ast/ast_drv.h b/drivers/gpu/drm/ast/ast_drv.h
index 467049ca8430..33e596a4f042 100644
--- a/drivers/gpu/drm/ast/ast_drv.h
+++ b/drivers/gpu/drm/ast/ast_drv.h
@@ -159,7 +159,7 @@  static inline struct ast_private *to_ast_private(struct drm_device *dev)
 	return container_of(dev, struct ast_private, base);
 }
 
-struct ast_private *ast_device_create(struct drm_driver *drv,
+struct ast_private *ast_device_create(const struct drm_driver *drv,
 				      struct pci_dev *pdev,
 				      unsigned long flags);
 
diff --git a/drivers/gpu/drm/ast/ast_main.c b/drivers/gpu/drm/ast/ast_main.c
index 77066bca8793..45dd8185a488 100644
--- a/drivers/gpu/drm/ast/ast_main.c
+++ b/drivers/gpu/drm/ast/ast_main.c
@@ -392,7 +392,7 @@  static void ast_device_release(void *data)
 	ast_set_index_reg(ast, AST_IO_CRTC_PORT, 0xa1, 0x04);
 }
 
-struct ast_private *ast_device_create(struct drm_driver *drv,
+struct ast_private *ast_device_create(const struct drm_driver *drv,
 				      struct pci_dev *pdev,
 				      unsigned long flags)
 {
diff --git a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
index 03984932d174..65af56e47129 100644
--- a/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
+++ b/drivers/gpu/drm/atmel-hlcdc/atmel_hlcdc_dc.c
@@ -712,7 +712,7 @@  static void atmel_hlcdc_dc_irq_uninstall(struct drm_device *dev)
 
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
-static struct drm_driver atmel_hlcdc_dc_driver = {
+static const struct drm_driver atmel_hlcdc_dc_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.irq_handler = atmel_hlcdc_dc_irq_handler,
 	.irq_preinstall = atmel_hlcdc_dc_irq_uninstall,
diff --git a/drivers/gpu/drm/bochs/bochs_drv.c b/drivers/gpu/drm/bochs/bochs_drv.c
index e18c51de1196..fd454225fd19 100644
--- a/drivers/gpu/drm/bochs/bochs_drv.c
+++ b/drivers/gpu/drm/bochs/bochs_drv.c
@@ -57,7 +57,7 @@  static int bochs_load(struct drm_device *dev)
 
 DEFINE_DRM_GEM_FOPS(bochs_fops);
 
-static struct drm_driver bochs_driver = {
+static const struct drm_driver bochs_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &bochs_fops,
 	.name			= "bochs-drm",
diff --git a/drivers/gpu/drm/etnaviv/etnaviv_drv.c b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
index aa270b79e585..7604e3c07973 100644
--- a/drivers/gpu/drm/etnaviv/etnaviv_drv.c
+++ b/drivers/gpu/drm/etnaviv/etnaviv_drv.c
@@ -480,7 +480,7 @@  static const struct file_operations fops = {
 	.mmap               = etnaviv_gem_mmap,
 };
 
-static struct drm_driver etnaviv_drm_driver = {
+static const struct drm_driver etnaviv_drm_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_RENDER,
 	.open               = etnaviv_open,
 	.postclose           = etnaviv_postclose,
diff --git a/drivers/gpu/drm/exynos/exynos_drm_drv.c b/drivers/gpu/drm/exynos/exynos_drm_drv.c
index fe46680ca208..e60257f1f24b 100644
--- a/drivers/gpu/drm/exynos/exynos_drm_drv.c
+++ b/drivers/gpu/drm/exynos/exynos_drm_drv.c
@@ -113,7 +113,7 @@  static const struct file_operations exynos_drm_driver_fops = {
 	.release	= drm_release,
 };
 
-static struct drm_driver exynos_drm_driver = {
+static const struct drm_driver exynos_drm_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM
 				  | DRIVER_ATOMIC | DRIVER_RENDER,
 	.open			= exynos_drm_open,
diff --git a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
index ae584f62aa19..75b58d55a940 100644
--- a/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
+++ b/drivers/gpu/drm/fsl-dcu/fsl_dcu_drm_drv.c
@@ -124,7 +124,7 @@  static irqreturn_t fsl_dcu_drm_irq(int irq, void *arg)
 
 DEFINE_DRM_GEM_CMA_FOPS(fsl_dcu_drm_fops);
 
-static struct drm_driver fsl_dcu_drm_driver = {
+static const struct drm_driver fsl_dcu_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.load			= fsl_dcu_load,
 	.unload			= fsl_dcu_unload,
@@ -224,7 +224,6 @@  static int fsl_dcu_drm_probe(struct platform_device *pdev)
 	struct device *dev = &pdev->dev;
 	struct resource *res;
 	void __iomem *base;
-	struct drm_driver *driver = &fsl_dcu_drm_driver;
 	struct clk *pix_clk_in;
 	char pix_clk_name[32];
 	const char *pix_clk_in_name;
@@ -294,7 +293,7 @@  static int fsl_dcu_drm_probe(struct platform_device *pdev)
 
 	fsl_dev->tcon = fsl_tcon_init(dev);
 
-	drm = drm_dev_alloc(driver, dev);
+	drm = drm_dev_alloc(&fsl_dcu_drm_driver, dev);
 	if (IS_ERR(drm)) {
 		ret = PTR_ERR(drm);
 		goto unregister_pix_clk;
diff --git a/drivers/gpu/drm/gma500/psb_drv.c b/drivers/gpu/drm/gma500/psb_drv.c
index b13376a6fb91..6e7197d89463 100644
--- a/drivers/gpu/drm/gma500/psb_drv.c
+++ b/drivers/gpu/drm/gma500/psb_drv.c
@@ -34,7 +34,7 @@ 
 #include "psb_intel_reg.h"
 #include "psb_reg.h"
 
-static struct drm_driver driver;
+static const struct drm_driver driver;
 static int psb_pci_probe(struct pci_dev *pdev, const struct pci_device_id *ent);
 
 /*
@@ -491,7 +491,7 @@  static const struct file_operations psb_gem_fops = {
 	.read = drm_read,
 };
 
-static struct drm_driver driver = {
+static const struct drm_driver driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM,
 	.lastclose = drm_fb_helper_lastclose,
 
diff --git a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
index a684814927cd..27205aa907f4 100644
--- a/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
+++ b/drivers/gpu/drm/hisilicon/hibmc/hibmc_drm_drv.c
@@ -43,7 +43,7 @@  static irqreturn_t hibmc_drm_interrupt(int irq, void *arg)
 	return IRQ_HANDLED;
 }
 
-static struct drm_driver hibmc_driver = {
+static const struct drm_driver hibmc_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &hibmc_fops,
 	.name			= "hibmc",
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
index cfe8ff596d55..8928550072df 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_ade.c
@@ -918,7 +918,7 @@  static const struct drm_mode_config_funcs ade_mode_config_funcs = {
 
 DEFINE_DRM_GEM_CMA_FOPS(ade_fops);
 
-static struct drm_driver ade_driver = {
+const static struct drm_driver ade_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops = &ade_fops,
 	DRM_GEM_CMA_DRIVER_OPS,
diff --git a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
index dee8ec2f7f2e..386d137f29e5 100644
--- a/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
+++ b/drivers/gpu/drm/hisilicon/kirin/kirin_drm_drv.h
@@ -40,7 +40,7 @@  struct kirin_drm_data {
 	u32 num_planes;
 	u32 prim_plane;
 
-	struct drm_driver *driver;
+	const struct drm_driver *driver;
 	const struct drm_crtc_helper_funcs *crtc_helper_funcs;
 	const struct drm_crtc_funcs *crtc_funcs;
 	const struct drm_plane_helper_funcs *plane_helper_funcs;
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index d3237b0d821d..27249b5e2729 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -87,7 +87,7 @@ 
 #include "intel_sideband.h"
 #include "vlv_suspend.h"
 
-static struct drm_driver driver;
+static const struct drm_driver driver;
 
 static int i915_get_bridge_dev(struct drm_i915_private *dev_priv)
 {
@@ -1758,7 +1758,7 @@  static const struct drm_ioctl_desc i915_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(I915_GEM_VM_DESTROY, i915_gem_vm_destroy_ioctl, DRM_RENDER_ALLOW),
 };
 
-static struct drm_driver driver = {
+static const struct drm_driver driver = {
 	/* Don't use MTRRs here; the Xserver or userspace app should
 	 * deal with them for Intel hardware.
 	 */
diff --git a/drivers/gpu/drm/i915/selftests/mock_gem_device.c b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
index 9220c9d1a4b7..e946bd2087d8 100644
--- a/drivers/gpu/drm/i915/selftests/mock_gem_device.c
+++ b/drivers/gpu/drm/i915/selftests/mock_gem_device.c
@@ -81,7 +81,7 @@  static void mock_device_release(struct drm_device *dev)
 	i915_params_free(&i915->params);
 }
 
-static struct drm_driver mock_driver = {
+static const struct drm_driver mock_driver = {
 	.name = "mock",
 	.driver_features = DRIVER_GEM,
 	.release = mock_device_release,
diff --git a/drivers/gpu/drm/imx/dcss/dcss-kms.c b/drivers/gpu/drm/imx/dcss/dcss-kms.c
index b72e5cef7e40..b549ce5e7607 100644
--- a/drivers/gpu/drm/imx/dcss/dcss-kms.c
+++ b/drivers/gpu/drm/imx/dcss/dcss-kms.c
@@ -26,7 +26,7 @@  static const struct drm_mode_config_funcs dcss_drm_mode_config_funcs = {
 	.atomic_commit = drm_atomic_helper_commit,
 };
 
-static struct drm_driver dcss_kms_driver = {
+static const struct drm_driver dcss_kms_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops			= &dcss_cma_fops,
diff --git a/drivers/gpu/drm/imx/imx-drm-core.c b/drivers/gpu/drm/imx/imx-drm-core.c
index 183f2e91881d..7090b82e7ea2 100644
--- a/drivers/gpu/drm/imx/imx-drm-core.c
+++ b/drivers/gpu/drm/imx/imx-drm-core.c
@@ -143,7 +143,7 @@  static const struct drm_ioctl_desc imx_drm_ioctls[] = {
 	/* none so far */
 };
 
-static struct drm_driver imx_drm_driver = {
+static const struct drm_driver imx_drm_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.ioctls			= imx_drm_ioctls,
diff --git a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
index 2329754af116..082cb9e45908 100644
--- a/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
+++ b/drivers/gpu/drm/ingenic/ingenic-drm-drv.c
@@ -710,7 +710,7 @@  static void ingenic_drm_disable_vblank(struct drm_crtc *crtc)
 
 DEFINE_DRM_GEM_CMA_FOPS(ingenic_drm_fops);
 
-static struct drm_driver ingenic_drm_driver_data = {
+static const struct drm_driver ingenic_drm_driver_data = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.name			= "ingenic-drm",
 	.desc			= "DRM module for Ingenic SoCs",
diff --git a/drivers/gpu/drm/lima/lima_drv.c b/drivers/gpu/drm/lima/lima_drv.c
index ab460121fd52..d497af91d850 100644
--- a/drivers/gpu/drm/lima/lima_drv.c
+++ b/drivers/gpu/drm/lima/lima_drv.c
@@ -261,7 +261,7 @@  DEFINE_DRM_GEM_FOPS(lima_drm_driver_fops);
  * - 1.1.0 - add heap buffer support
  */
 
-static struct drm_driver lima_drm_driver = {
+static const struct drm_driver lima_drm_driver = {
 	.driver_features    = DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ,
 	.open               = lima_drm_driver_open,
 	.postclose          = lima_drm_driver_postclose,
diff --git a/drivers/gpu/drm/mcde/mcde_drv.c b/drivers/gpu/drm/mcde/mcde_drv.c
index f9b5f450a9cb..870626e04ec0 100644
--- a/drivers/gpu/drm/mcde/mcde_drv.c
+++ b/drivers/gpu/drm/mcde/mcde_drv.c
@@ -178,7 +178,7 @@  static int mcde_modeset_init(struct drm_device *drm)
 
 DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
 
-static struct drm_driver mcde_drm_driver = {
+static const struct drm_driver mcde_drm_driver = {
 	.driver_features =
 		DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.lastclose = drm_fb_helper_lastclose,
diff --git a/drivers/gpu/drm/mediatek/mtk_drm_drv.c b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
index 7f3398a7c2b0..2e8065b1e2bb 100644
--- a/drivers/gpu/drm/mediatek/mtk_drm_drv.c
+++ b/drivers/gpu/drm/mediatek/mtk_drm_drv.c
@@ -321,7 +321,7 @@  struct drm_gem_object *mtk_drm_gem_prime_import(struct drm_device *dev,
 	return drm_gem_prime_import_dev(dev, dma_buf, private->dma_dev);
 }
 
-static struct drm_driver mtk_drm_driver = {
+static const struct drm_driver mtk_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 
 	.dumb_create = mtk_drm_gem_dumb_create,
diff --git a/drivers/gpu/drm/meson/meson_drv.c b/drivers/gpu/drm/meson/meson_drv.c
index 8b9c8dd788c4..dc8509ceb787 100644
--- a/drivers/gpu/drm/meson/meson_drv.c
+++ b/drivers/gpu/drm/meson/meson_drv.c
@@ -90,7 +90,7 @@  static int meson_dumb_create(struct drm_file *file, struct drm_device *dev,
 
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
-static struct drm_driver meson_driver = {
+static const struct drm_driver meson_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 
 	/* IRQ */
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index 771b26aeee19..0f07f259503d 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -28,7 +28,7 @@  module_param_named(modeset, mgag200_modeset, int, 0400);
 
 DEFINE_DRM_GEM_FOPS(mgag200_driver_fops);
 
-static struct drm_driver mgag200_driver = {
+static const struct drm_driver mgag200_driver = {
 	.driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
 	.fops = &mgag200_driver_fops,
 	.name = DRIVER_NAME,
diff --git a/drivers/gpu/drm/msm/msm_drv.c b/drivers/gpu/drm/msm/msm_drv.c
index aa4509766d64..f8fd31e709bb 100644
--- a/drivers/gpu/drm/msm/msm_drv.c
+++ b/drivers/gpu/drm/msm/msm_drv.c
@@ -393,7 +393,7 @@  static int msm_init_vram(struct drm_device *dev)
 	return ret;
 }
 
-static int msm_drm_init(struct device *dev, struct drm_driver *drv)
+static int msm_drm_init(struct device *dev, const struct drm_driver *drv)
 {
 	struct platform_device *pdev = to_platform_device(dev);
 	struct drm_device *ddev;
@@ -984,7 +984,7 @@  static const struct file_operations fops = {
 	.mmap               = msm_gem_mmap,
 };
 
-static struct drm_driver msm_driver = {
+static const struct drm_driver msm_driver = {
 	.driver_features    = DRIVER_GEM |
 				DRIVER_RENDER |
 				DRIVER_ATOMIC |
diff --git a/drivers/gpu/drm/mxsfb/mxsfb_drv.c b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
index 35122aef037b..6faf17b6408d 100644
--- a/drivers/gpu/drm/mxsfb/mxsfb_drv.c
+++ b/drivers/gpu/drm/mxsfb/mxsfb_drv.c
@@ -289,7 +289,7 @@  static irqreturn_t mxsfb_irq_handler(int irq, void *data)
 
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
-static struct drm_driver mxsfb_driver = {
+static const struct drm_driver mxsfb_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.irq_handler		= mxsfb_irq_handler,
 	.irq_preinstall		= mxsfb_irq_disable,
diff --git a/drivers/gpu/drm/omapdrm/omap_drv.c b/drivers/gpu/drm/omapdrm/omap_drv.c
index 2b82a708eca6..21a6cd3f5473 100644
--- a/drivers/gpu/drm/omapdrm/omap_drv.c
+++ b/drivers/gpu/drm/omapdrm/omap_drv.c
@@ -534,7 +534,7 @@  static const struct file_operations omapdriver_fops = {
 	.llseek = noop_llseek,
 };
 
-static struct drm_driver omap_drm_driver = {
+static const struct drm_driver omap_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM  |
 		DRIVER_ATOMIC | DRIVER_RENDER,
 	.open = dev_open,
diff --git a/drivers/gpu/drm/panfrost/panfrost_drv.c b/drivers/gpu/drm/panfrost/panfrost_drv.c
index 37d4cb7a5491..ed116bd3d6d6 100644
--- a/drivers/gpu/drm/panfrost/panfrost_drv.c
+++ b/drivers/gpu/drm/panfrost/panfrost_drv.c
@@ -548,7 +548,7 @@  DEFINE_DRM_GEM_FOPS(panfrost_drm_driver_fops);
  * - 1.0 - initial interface
  * - 1.1 - adds HEAP and NOEXEC flags for CREATE_BO
  */
-static struct drm_driver panfrost_drm_driver = {
+static const struct drm_driver panfrost_drm_driver = {
 	.driver_features	= DRIVER_RENDER | DRIVER_GEM | DRIVER_SYNCOBJ,
 	.open			= panfrost_open,
 	.postclose		= panfrost_postclose,
diff --git a/drivers/gpu/drm/pl111/pl111_drv.c b/drivers/gpu/drm/pl111/pl111_drv.c
index 3899c28f428d..10d9a12be672 100644
--- a/drivers/gpu/drm/pl111/pl111_drv.c
+++ b/drivers/gpu/drm/pl111/pl111_drv.c
@@ -213,7 +213,7 @@  pl111_gem_import_sg_table(struct drm_device *dev,
 
 DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
 
-static struct drm_driver pl111_drm_driver = {
+static const struct drm_driver pl111_drm_driver = {
 	.driver_features =
 		DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.ioctls = NULL,
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index 9c11e36ad33a..bfadb799d6a3 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -297,7 +297,7 @@  static struct pci_device_id pciidlist[] = {
 
 MODULE_DEVICE_TABLE(pci, pciidlist);
 
-static struct drm_driver kms_driver;
+static const struct drm_driver kms_driver;
 
 bool radeon_device_is_virtual(void);
 
@@ -629,7 +629,7 @@  static const struct drm_ioctl_desc radeon_ioctls_kms[] = {
 	DRM_IOCTL_DEF_DRV(RADEON_GEM_USERPTR, radeon_gem_userptr_ioctl, DRM_AUTH|DRM_RENDER_ALLOW),
 };
 
-static struct drm_driver kms_driver = {
+static const struct drm_driver kms_driver = {
 	.driver_features =
 	    DRIVER_GEM | DRIVER_RENDER | DRIVER_MODESET,
 	.load = radeon_driver_load_kms,
diff --git a/drivers/gpu/drm/rcar-du/rcar_du_drv.c b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
index 447be991fa25..600056dff374 100644
--- a/drivers/gpu/drm/rcar-du/rcar_du_drv.c
+++ b/drivers/gpu/drm/rcar-du/rcar_du_drv.c
@@ -507,7 +507,7 @@  MODULE_DEVICE_TABLE(of, rcar_du_of_table);
 
 DEFINE_DRM_GEM_CMA_FOPS(rcar_du_fops);
 
-static struct drm_driver rcar_du_driver = {
+static const struct drm_driver rcar_du_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	DRM_GEM_CMA_DRIVER_OPS_WITH_DUMB_CREATE(rcar_du_dumb_create),
 	.fops			= &rcar_du_fops,
diff --git a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
index b7654f5e4225..212bd87c0c4a 100644
--- a/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
+++ b/drivers/gpu/drm/rockchip/rockchip_drm_drv.c
@@ -35,7 +35,7 @@ 
 #define DRIVER_MINOR	0
 
 static bool is_support_iommu = true;
-static struct drm_driver rockchip_drm_driver;
+static const struct drm_driver rockchip_drm_driver;
 
 /*
  * Attach a (component) device to the shared drm dma mapping from master drm
@@ -209,7 +209,7 @@  static const struct file_operations rockchip_drm_driver_fops = {
 	.release = drm_release,
 };
 
-static struct drm_driver rockchip_drm_driver = {
+static const struct drm_driver rockchip_drm_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.lastclose		= drm_fb_helper_lastclose,
 	.dumb_create		= rockchip_gem_dumb_create,
diff --git a/drivers/gpu/drm/shmobile/shmob_drm_drv.c b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
index 26a15c214bd3..0a02b7092c04 100644
--- a/drivers/gpu/drm/shmobile/shmob_drm_drv.c
+++ b/drivers/gpu/drm/shmobile/shmob_drm_drv.c
@@ -128,7 +128,7 @@  static irqreturn_t shmob_drm_irq(int irq, void *arg)
 
 DEFINE_DRM_GEM_CMA_FOPS(shmob_drm_fops);
 
-static struct drm_driver shmob_drm_driver = {
+static const struct drm_driver shmob_drm_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET,
 	.irq_handler		= shmob_drm_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
diff --git a/drivers/gpu/drm/sti/sti_drv.c b/drivers/gpu/drm/sti/sti_drv.c
index 3f54efa36098..c7efb43b83ee 100644
--- a/drivers/gpu/drm/sti/sti_drv.c
+++ b/drivers/gpu/drm/sti/sti_drv.c
@@ -130,7 +130,7 @@  static void sti_mode_config_init(struct drm_device *dev)
 
 DEFINE_DRM_GEM_CMA_FOPS(sti_driver_fops);
 
-static struct drm_driver sti_driver = {
+static const struct drm_driver sti_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.fops = &sti_driver_fops,
 	DRM_GEM_CMA_DRIVER_OPS,
diff --git a/drivers/gpu/drm/stm/drv.c b/drivers/gpu/drm/stm/drv.c
index 411103f013e2..222869b232ae 100644
--- a/drivers/gpu/drm/stm/drv.c
+++ b/drivers/gpu/drm/stm/drv.c
@@ -53,7 +53,7 @@  static int stm_gem_cma_dumb_create(struct drm_file *file,
 
 DEFINE_DRM_GEM_CMA_FOPS(drv_driver_fops);
 
-static struct drm_driver drv_driver = {
+static const struct drm_driver drv_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.name = "stm",
 	.desc = "STMicroelectronics SoC DRM",
diff --git a/drivers/gpu/drm/sun4i/sun4i_drv.c b/drivers/gpu/drm/sun4i/sun4i_drv.c
index 29861fc81b35..91502937f26d 100644
--- a/drivers/gpu/drm/sun4i/sun4i_drv.c
+++ b/drivers/gpu/drm/sun4i/sun4i_drv.c
@@ -40,7 +40,7 @@  static int drm_sun4i_gem_dumb_create(struct drm_file *file_priv,
 
 DEFINE_DRM_GEM_CMA_FOPS(sun4i_drv_fops);
 
-static struct drm_driver sun4i_drv_driver = {
+static const struct drm_driver sun4i_drv_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 
 	/* Generic Operations */
diff --git a/drivers/gpu/drm/tegra/drm.c b/drivers/gpu/drm/tegra/drm.c
index 24f353c1cee8..ae13a3ff8a87 100644
--- a/drivers/gpu/drm/tegra/drm.c
+++ b/drivers/gpu/drm/tegra/drm.c
@@ -850,7 +850,7 @@  static void tegra_debugfs_init(struct drm_minor *minor)
 }
 #endif
 
-static struct drm_driver tegra_drm_driver = {
+static const struct drm_driver tegra_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM |
 			   DRIVER_ATOMIC | DRIVER_RENDER,
 	.open = tegra_drm_open,
@@ -1084,12 +1084,11 @@  static bool host1x_drm_wants_iommu(struct host1x_device *dev)
 
 static int host1x_drm_probe(struct host1x_device *dev)
 {
-	struct drm_driver *driver = &tegra_drm_driver;
 	struct tegra_drm *tegra;
 	struct drm_device *drm;
 	int err;
 
-	drm = drm_dev_alloc(driver, &dev->dev);
+	drm = drm_dev_alloc(&tegra_drm_driver, &dev->dev);
 	if (IS_ERR(drm))
 		return PTR_ERR(drm);
 
diff --git a/drivers/gpu/drm/tidss/tidss_drv.c b/drivers/gpu/drm/tidss/tidss_drv.c
index 9179ea18f625..66e3c86eb5c7 100644
--- a/drivers/gpu/drm/tidss/tidss_drv.c
+++ b/drivers/gpu/drm/tidss/tidss_drv.c
@@ -108,7 +108,7 @@  static void tidss_release(struct drm_device *ddev)
 
 DEFINE_DRM_GEM_CMA_FOPS(tidss_fops);
 
-static struct drm_driver tidss_driver = {
+static const struct drm_driver tidss_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &tidss_fops,
 	.release		= tidss_release,
diff --git a/drivers/gpu/drm/tilcdc/tilcdc_drv.c b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
index c5f82e693f1a..137f74f613ab 100644
--- a/drivers/gpu/drm/tilcdc/tilcdc_drv.c
+++ b/drivers/gpu/drm/tilcdc/tilcdc_drv.c
@@ -166,7 +166,7 @@  static void tilcdc_fini(struct drm_device *dev)
 	drm_dev_put(dev);
 }
 
-static int tilcdc_init(struct drm_driver *ddrv, struct device *dev)
+static int tilcdc_init(const struct drm_driver *ddrv, struct device *dev)
 {
 	struct drm_device *ddev;
 	struct platform_device *pdev = to_platform_device(dev);
@@ -452,7 +452,7 @@  static void tilcdc_debugfs_init(struct drm_minor *minor)
 
 DEFINE_DRM_GEM_CMA_FOPS(fops);
 
-static struct drm_driver tilcdc_driver = {
+static const struct drm_driver tilcdc_driver = {
 	.driver_features    = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.irq_handler        = tilcdc_irq,
 	DRM_GEM_CMA_DRIVER_OPS,
diff --git a/drivers/gpu/drm/tiny/cirrus.c b/drivers/gpu/drm/tiny/cirrus.c
index 759a5a66dd0b..e5641969c181 100644
--- a/drivers/gpu/drm/tiny/cirrus.c
+++ b/drivers/gpu/drm/tiny/cirrus.c
@@ -536,7 +536,7 @@  static int cirrus_mode_config_init(struct cirrus_device *cirrus)
 
 DEFINE_DRM_GEM_FOPS(cirrus_fops);
 
-static struct drm_driver cirrus_driver = {
+static const struct drm_driver cirrus_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 
 	.name		 = DRIVER_NAME,
diff --git a/drivers/gpu/drm/tiny/gm12u320.c b/drivers/gpu/drm/tiny/gm12u320.c
index cc397671f689..5a953c4ce265 100644
--- a/drivers/gpu/drm/tiny/gm12u320.c
+++ b/drivers/gpu/drm/tiny/gm12u320.c
@@ -600,7 +600,7 @@  static const uint64_t gm12u320_pipe_modifiers[] = {
 
 DEFINE_DRM_GEM_FOPS(gm12u320_fops);
 
-static struct drm_driver gm12u320_drm_driver = {
+static const struct drm_driver gm12u320_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 
 	.name		 = DRIVER_NAME,
diff --git a/drivers/gpu/drm/tiny/hx8357d.c b/drivers/gpu/drm/tiny/hx8357d.c
index 0998309b0d95..c6525cd02bc2 100644
--- a/drivers/gpu/drm/tiny/hx8357d.c
+++ b/drivers/gpu/drm/tiny/hx8357d.c
@@ -193,7 +193,7 @@  static const struct drm_display_mode yx350hv15_mode = {
 
 DEFINE_DRM_GEM_CMA_FOPS(hx8357d_fops);
 
-static struct drm_driver hx8357d_driver = {
+static const struct drm_driver hx8357d_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &hx8357d_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/ili9225.c b/drivers/gpu/drm/tiny/ili9225.c
index 97a77262d791..8e98962db5a2 100644
--- a/drivers/gpu/drm/tiny/ili9225.c
+++ b/drivers/gpu/drm/tiny/ili9225.c
@@ -337,7 +337,7 @@  static const struct drm_display_mode ili9225_mode = {
 
 DEFINE_DRM_GEM_CMA_FOPS(ili9225_fops);
 
-static struct drm_driver ili9225_driver = {
+static const struct drm_driver ili9225_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &ili9225_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/ili9341.c b/drivers/gpu/drm/tiny/ili9341.c
index d39c39df56ad..6ce97f0698eb 100644
--- a/drivers/gpu/drm/tiny/ili9341.c
+++ b/drivers/gpu/drm/tiny/ili9341.c
@@ -149,7 +149,7 @@  static const struct drm_display_mode yx240qv29_mode = {
 
 DEFINE_DRM_GEM_CMA_FOPS(ili9341_fops);
 
-static struct drm_driver ili9341_driver = {
+static const struct drm_driver ili9341_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &ili9341_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/ili9486.c b/drivers/gpu/drm/tiny/ili9486.c
index 403af68fa440..d7ce40eb166a 100644
--- a/drivers/gpu/drm/tiny/ili9486.c
+++ b/drivers/gpu/drm/tiny/ili9486.c
@@ -162,7 +162,7 @@  static const struct drm_display_mode waveshare_mode = {
 
 DEFINE_DRM_GEM_CMA_FOPS(ili9486_fops);
 
-static struct drm_driver ili9486_driver = {
+static const struct drm_driver ili9486_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &ili9486_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/mi0283qt.c b/drivers/gpu/drm/tiny/mi0283qt.c
index 2131b4268c00..ff77f983f803 100644
--- a/drivers/gpu/drm/tiny/mi0283qt.c
+++ b/drivers/gpu/drm/tiny/mi0283qt.c
@@ -153,7 +153,7 @@  static const struct drm_display_mode mi0283qt_mode = {
 
 DEFINE_DRM_GEM_CMA_FOPS(mi0283qt_fops);
 
-static struct drm_driver mi0283qt_driver = {
+static const struct drm_driver mi0283qt_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &mi0283qt_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/repaper.c b/drivers/gpu/drm/tiny/repaper.c
index 2e01cf0a9876..11c602fc9897 100644
--- a/drivers/gpu/drm/tiny/repaper.c
+++ b/drivers/gpu/drm/tiny/repaper.c
@@ -936,7 +936,7 @@  static const u8 repaper_e2271cs021_cs[] = { 0x00, 0x00, 0x00, 0x7f,
 
 DEFINE_DRM_GEM_CMA_FOPS(repaper_fops);
 
-static struct drm_driver repaper_driver = {
+static const struct drm_driver repaper_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &repaper_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/st7586.c b/drivers/gpu/drm/tiny/st7586.c
index d05de03891f8..ff5cf60f4bd7 100644
--- a/drivers/gpu/drm/tiny/st7586.c
+++ b/drivers/gpu/drm/tiny/st7586.c
@@ -277,7 +277,7 @@  static const struct drm_display_mode st7586_mode = {
 
 DEFINE_DRM_GEM_CMA_FOPS(st7586_fops);
 
-static struct drm_driver st7586_driver = {
+static const struct drm_driver st7586_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &st7586_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tiny/st7735r.c b/drivers/gpu/drm/tiny/st7735r.c
index a0f688f0d050..2c77d9ab7e8d 100644
--- a/drivers/gpu/drm/tiny/st7735r.c
+++ b/drivers/gpu/drm/tiny/st7735r.c
@@ -154,7 +154,7 @@  static const struct st7735r_cfg rh128128t_cfg = {
 
 DEFINE_DRM_GEM_CMA_FOPS(st7735r_fops);
 
-static struct drm_driver st7735r_driver = {
+static const struct drm_driver st7735r_driver = {
 	.driver_features	= DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.fops			= &st7735r_fops,
 	DRM_GEM_CMA_DRIVER_OPS_VMAP,
diff --git a/drivers/gpu/drm/tve200/tve200_drv.c b/drivers/gpu/drm/tve200/tve200_drv.c
index b5259cb1383f..07140e0b90a3 100644
--- a/drivers/gpu/drm/tve200/tve200_drv.c
+++ b/drivers/gpu/drm/tve200/tve200_drv.c
@@ -137,7 +137,7 @@  static int tve200_modeset_init(struct drm_device *dev)
 
 DEFINE_DRM_GEM_CMA_FOPS(drm_fops);
 
-static struct drm_driver tve200_drm_driver = {
+static const struct drm_driver tve200_drm_driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 	.ioctls = NULL,
 	.fops = &drm_fops,
diff --git a/drivers/gpu/drm/udl/udl_drv.c b/drivers/gpu/drm/udl/udl_drv.c
index 96d4317a2c1b..46df4d07bd7b 100644
--- a/drivers/gpu/drm/udl/udl_drv.c
+++ b/drivers/gpu/drm/udl/udl_drv.c
@@ -34,7 +34,7 @@  static int udl_usb_resume(struct usb_interface *interface)
 
 DEFINE_DRM_GEM_FOPS(udl_driver_fops);
 
-static struct drm_driver driver = {
+static const struct drm_driver driver = {
 	.driver_features = DRIVER_ATOMIC | DRIVER_GEM | DRIVER_MODESET,
 
 	/* GEM hooks */
diff --git a/drivers/gpu/drm/v3d/v3d_drv.c b/drivers/gpu/drm/v3d/v3d_drv.c
index 9f7c26193831..2da0c1180bc6 100644
--- a/drivers/gpu/drm/v3d/v3d_drv.c
+++ b/drivers/gpu/drm/v3d/v3d_drv.c
@@ -194,7 +194,7 @@  static const struct drm_ioctl_desc v3d_drm_ioctls[] = {
 	DRM_IOCTL_DEF_DRV(V3D_SUBMIT_CSD, v3d_submit_csd_ioctl, DRM_RENDER_ALLOW | DRM_AUTH),
 };
 
-static struct drm_driver v3d_drm_driver = {
+static const struct drm_driver v3d_drm_driver = {
 	.driver_features = (DRIVER_GEM |
 			    DRIVER_RENDER |
 			    DRIVER_SYNCOBJ),
diff --git a/drivers/gpu/drm/vboxvideo/vbox_drv.c b/drivers/gpu/drm/vboxvideo/vbox_drv.c
index cf2e3e6a2388..f3eac72cb46e 100644
--- a/drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ b/drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -26,7 +26,7 @@  static int vbox_modeset = -1;
 MODULE_PARM_DESC(modeset, "Disable/Enable modesetting");
 module_param_named(modeset, vbox_modeset, int, 0400);
 
-static struct drm_driver driver;
+static const struct drm_driver driver;
 
 static const struct pci_device_id pciidlist[] = {
 	{ PCI_DEVICE(0x80ee, 0xbeef) },
@@ -175,7 +175,7 @@  static struct pci_driver vbox_pci_driver = {
 
 DEFINE_DRM_GEM_FOPS(vbox_fops);
 
-static struct drm_driver driver = {
+static const struct drm_driver driver = {
 	.driver_features =
 	    DRIVER_MODESET | DRIVER_GEM | DRIVER_ATOMIC,
 
diff --git a/drivers/gpu/drm/vgem/vgem_drv.c b/drivers/gpu/drm/vgem/vgem_drv.c
index fa54a6d1403d..3e9b7a4c30ce 100644
--- a/drivers/gpu/drm/vgem/vgem_drv.c
+++ b/drivers/gpu/drm/vgem/vgem_drv.c
@@ -415,7 +415,7 @@  static const struct drm_gem_object_funcs vgem_gem_object_funcs = {
 	.vm_ops = &vgem_gem_vm_ops,
 };
 
-static struct drm_driver vgem_driver = {
+static const struct drm_driver vgem_driver = {
 	.driver_features		= DRIVER_GEM | DRIVER_RENDER,
 	.open				= vgem_open,
 	.postclose			= vgem_postclose,
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 86330f1ade72..27f13bd29c13 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -37,7 +37,7 @@ 
 
 #include "virtgpu_drv.h"
 
-static struct drm_driver driver;
+static const struct drm_driver driver;
 
 static int virtio_gpu_modeset = -1;
 
@@ -190,7 +190,7 @@  MODULE_AUTHOR("Alon Levy");
 
 DEFINE_DRM_GEM_FOPS(virtio_gpu_driver_fops);
 
-static struct drm_driver driver = {
+static const struct drm_driver driver = {
 	.driver_features = DRIVER_MODESET | DRIVER_GEM | DRIVER_RENDER | DRIVER_ATOMIC,
 	.open = virtio_gpu_driver_open,
 	.postclose = virtio_gpu_driver_postclose,
diff --git a/drivers/gpu/drm/vkms/vkms_drv.c b/drivers/gpu/drm/vkms/vkms_drv.c
index 98ba844ae77d..8056b3d1ff6a 100644
--- a/drivers/gpu/drm/vkms/vkms_drv.c
+++ b/drivers/gpu/drm/vkms/vkms_drv.c
@@ -78,7 +78,7 @@  static void vkms_atomic_commit_tail(struct drm_atomic_state *old_state)
 	drm_atomic_helper_cleanup_planes(dev, old_state);
 }
 
-static struct drm_driver vkms_driver = {
+static const struct drm_driver vkms_driver = {
 	.driver_features	= DRIVER_MODESET | DRIVER_ATOMIC | DRIVER_GEM,
 	.release		= vkms_release,
 	.fops			= &vkms_driver_fops,
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 68206d0a1237..e66b252e3923 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1465,7 +1465,7 @@  static const struct file_operations vmwgfx_driver_fops = {
 	.get_unmapped_area = vmw_get_unmapped_area,
 };
 
-static struct drm_driver driver = {
+static const struct drm_driver driver = {
 	.driver_features =
 	DRIVER_MODESET | DRIVER_RENDER | DRIVER_ATOMIC,
 	.ioctls = vmw_ioctls,
diff --git a/drivers/gpu/drm/xen/xen_drm_front.c b/drivers/gpu/drm/xen/xen_drm_front.c
index 98b6d2ba088a..30d9adf31c84 100644
--- a/drivers/gpu/drm/xen/xen_drm_front.c
+++ b/drivers/gpu/drm/xen/xen_drm_front.c
@@ -483,7 +483,7 @@  static const struct file_operations xen_drm_dev_fops = {
 	.mmap           = xen_drm_front_gem_mmap,
 };
 
-static struct drm_driver xen_drm_driver = {
+static const struct drm_driver xen_drm_driver = {
 	.driver_features           = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	.release                   = xen_drm_drv_release,
 	.prime_handle_to_fd        = drm_gem_prime_handle_to_fd,
diff --git a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
index f3ffc3703a0e..0c1c50271a88 100644
--- a/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
+++ b/drivers/gpu/drm/xlnx/zynqmp_dpsub.c
@@ -76,7 +76,7 @@  static const struct drm_mode_config_funcs zynqmp_dpsub_mode_config_funcs = {
 
 DEFINE_DRM_GEM_CMA_FOPS(zynqmp_dpsub_drm_fops);
 
-static struct drm_driver zynqmp_dpsub_drm_driver = {
+static const struct drm_driver zynqmp_dpsub_drm_driver = {
 	.driver_features		= DRIVER_MODESET | DRIVER_GEM |
 					  DRIVER_ATOMIC,
 
diff --git a/drivers/gpu/drm/zte/zx_drm_drv.c b/drivers/gpu/drm/zte/zx_drm_drv.c
index 31014a451f8b..5506336594e2 100644
--- a/drivers/gpu/drm/zte/zx_drm_drv.c
+++ b/drivers/gpu/drm/zte/zx_drm_drv.c
@@ -34,7 +34,7 @@  static const struct drm_mode_config_funcs zx_drm_mode_config_funcs = {
 
 DEFINE_DRM_GEM_CMA_FOPS(zx_drm_fops);
 
-static struct drm_driver zx_drm_driver = {
+static const struct drm_driver zx_drm_driver = {
 	.driver_features = DRIVER_GEM | DRIVER_MODESET | DRIVER_ATOMIC,
 	DRM_GEM_CMA_DRIVER_OPS,
 	.fops = &zx_drm_fops,