[PATCH 5/5] drm: Use drm_drv_enabled() instead of drm_modeset_disabled()
From: Javier Martinez Canillas
Date: Wed Nov 03 2021 - 06:55:13 EST
Now that there is a helper function to check whether or not a DRM driver
should be enabled, use that instead of calling to drm_modeset_disabled().
Suggested-by: Thomas Zimmermann <tzimmermann@xxxxxxx>
Signed-off-by: Javier Martinez Canillas <javierm@xxxxxxxxxx>
---
drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 +-
drivers/gpu/drm/ast/ast_drv.c | 2 +-
drivers/gpu/drm/i915/i915_module.c | 4 +++-
drivers/gpu/drm/mgag200/mgag200_drv.c | 2 +-
drivers/gpu/drm/nouveau/nouveau_drm.c | 2 +-
drivers/gpu/drm/qxl/qxl_drv.c | 2 +-
drivers/gpu/drm/radeon/radeon_drv.c | 2 +-
drivers/gpu/drm/tiny/bochs.c | 2 +-
drivers/gpu/drm/tiny/cirrus.c | 2 +-
drivers/gpu/drm/vboxvideo/vbox_drv.c | 2 +-
drivers/gpu/drm/virtio/virtgpu_drv.c | 2 +-
drivers/gpu/drm/vmwgfx/vmwgfx_drv.c | 2 +-
12 files changed, 14 insertions(+), 12 deletions(-)
diff --git drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index f7bd2616cf23..47e0c21bb0e8 100644
--- drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -2513,7 +2513,7 @@ static int __init amdgpu_init(void)
{
int r;
- if (drm_modeset_disabled()) {
+ if (!drm_drv_enabled(&amdgpu_kms_driver)) {
DRM_ERROR("amdgpu kernel modesetting disabled.\n");
return -EINVAL;
}
diff --git drivers/gpu/drm/ast/ast_drv.c drivers/gpu/drm/ast/ast_drv.c
index 6706050414c3..177537647531 100644
--- drivers/gpu/drm/ast/ast_drv.c
+++ drivers/gpu/drm/ast/ast_drv.c
@@ -232,7 +232,7 @@ static struct pci_driver ast_pci_driver = {
static int __init ast_init(void)
{
- if (drm_modeset_disabled() && ast_modeset == -1)
+ if (!drm_drv_enabled(&ast_driver) && ast_modeset == -1)
return -EINVAL;
if (ast_modeset == 0)
diff --git drivers/gpu/drm/i915/i915_module.c drivers/gpu/drm/i915/i915_module.c
index 3e5531040e4d..6cba45bbcbc9 100644
--- drivers/gpu/drm/i915/i915_module.c
+++ drivers/gpu/drm/i915/i915_module.c
@@ -16,6 +16,8 @@
#include "i915_selftest.h"
#include "i915_vma.h"
+static const struct drm_driver driver;
+
static int i915_check_nomodeset(void)
{
bool use_kms = true;
@@ -29,7 +31,7 @@ static int i915_check_nomodeset(void)
if (i915_modparams.modeset == 0)
use_kms = false;
- if (drm_modeset_disabled() && i915_modparams.modeset == -1)
+ if (!drm_drv_enabled(&driver) && i915_modparams.modeset == -1)
use_kms = false;
if (!use_kms) {
diff --git drivers/gpu/drm/mgag200/mgag200_drv.c drivers/gpu/drm/mgag200/mgag200_drv.c
index 7ee87564bade..100c958e3c90 100644
--- drivers/gpu/drm/mgag200/mgag200_drv.c
+++ drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -377,7 +377,7 @@ static struct pci_driver mgag200_pci_driver = {
static int __init mgag200_init(void)
{
- if (drm_modeset_disabled() && mgag200_modeset == -1)
+ if (!drm_drv_enabled(&mgag200_driver) && mgag200_modeset == -1)
return -EINVAL;
if (mgag200_modeset == 0)
diff --git drivers/gpu/drm/nouveau/nouveau_drm.c drivers/gpu/drm/nouveau/nouveau_drm.c
index 903d0e626954..db7168a9d0f1 100644
--- drivers/gpu/drm/nouveau/nouveau_drm.c
+++ drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1321,7 +1321,7 @@ nouveau_drm_init(void)
nouveau_display_options();
if (nouveau_modeset == -1) {
- if (drm_modeset_disabled())
+ if (!drm_drv_enabled(&driver_stub))
nouveau_modeset = 0;
}
diff --git drivers/gpu/drm/qxl/qxl_drv.c drivers/gpu/drm/qxl/qxl_drv.c
index e4ab16837fad..f03000bf32be 100644
--- drivers/gpu/drm/qxl/qxl_drv.c
+++ drivers/gpu/drm/qxl/qxl_drv.c
@@ -294,7 +294,7 @@ static struct drm_driver qxl_driver = {
static int __init qxl_init(void)
{
- if (drm_modeset_disabled() && qxl_modeset == -1)
+ if (!drm_drv_enabled(&qxl_driver) && qxl_modeset == -1)
return -EINVAL;
if (qxl_modeset == 0)
diff --git drivers/gpu/drm/radeon/radeon_drv.c drivers/gpu/drm/radeon/radeon_drv.c
index 36c8dac68cca..e17a1cd23933 100644
--- drivers/gpu/drm/radeon/radeon_drv.c
+++ drivers/gpu/drm/radeon/radeon_drv.c
@@ -636,7 +636,7 @@ static struct pci_driver radeon_kms_pci_driver = {
static int __init radeon_module_init(void)
{
- if (drm_modeset_disabled() && radeon_modeset == -1) {
+ if (!drm_drv_enabled(&kms_driver) && radeon_modeset == -1) {
DRM_INFO("VGACON disable radeon kernel modesetting.\n");
radeon_modeset = 0;
}
diff --git drivers/gpu/drm/tiny/bochs.c drivers/gpu/drm/tiny/bochs.c
index 59189f7c1840..dab3ca37dddb 100644
--- drivers/gpu/drm/tiny/bochs.c
+++ drivers/gpu/drm/tiny/bochs.c
@@ -718,7 +718,7 @@ static struct pci_driver bochs_pci_driver = {
static int __init bochs_init(void)
{
- if (drm_modeset_disabled() && bochs_modeset == -1)
+ if (!drm_drv_enabled(&bochs_driver) && bochs_modeset == -1)
return -EINVAL;
if (bochs_modeset == 0)
diff --git drivers/gpu/drm/tiny/cirrus.c drivers/gpu/drm/tiny/cirrus.c
index fcf98379c641..48e2a9509722 100644
--- drivers/gpu/drm/tiny/cirrus.c
+++ drivers/gpu/drm/tiny/cirrus.c
@@ -635,7 +635,7 @@ static struct pci_driver cirrus_pci_driver = {
static int __init cirrus_init(void)
{
- if (drm_modeset_disabled())
+ if (!drm_drv_enabled(&cirrus_driver))
return -EINVAL;
return pci_register_driver(&cirrus_pci_driver);
}
diff --git drivers/gpu/drm/vboxvideo/vbox_drv.c drivers/gpu/drm/vboxvideo/vbox_drv.c
index 09356dbd69b2..daa53ec1b517 100644
--- drivers/gpu/drm/vboxvideo/vbox_drv.c
+++ drivers/gpu/drm/vboxvideo/vbox_drv.c
@@ -192,7 +192,7 @@ static const struct drm_driver driver = {
static int __init vbox_init(void)
{
- if (drm_modeset_disabled() && vbox_modeset == -1)
+ if (!drm_drv_enabled(&driver) && vbox_modeset == -1)
return -EINVAL;
if (vbox_modeset == 0)
diff --git drivers/gpu/drm/virtio/virtgpu_drv.c drivers/gpu/drm/virtio/virtgpu_drv.c
index d96797d70fae..2f3d4d010b16 100644
--- drivers/gpu/drm/virtio/virtgpu_drv.c
+++ drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -103,7 +103,7 @@ static int virtio_gpu_probe(struct virtio_device *vdev)
struct drm_device *dev;
int ret;
- if (drm_modeset_disabled() && virtio_gpu_modeset == -1)
+ if (!drm_drv_enabled(&driver) && virtio_gpu_modeset == -1)
return -EINVAL;
if (virtio_gpu_modeset == 0)
diff --git drivers/gpu/drm/vmwgfx/vmwgfx_drv.c drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 22dab9beea03..969c765ef146 100644
--- drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1650,7 +1650,7 @@ static int __init vmwgfx_init(void)
{
int ret;
- if (drm_modeset_disabled())
+ if (!drm_drv_enabled(&driver))
return -EINVAL;
ret = pci_register_driver(&vmw_pci_driver);
--
2.33.1