Skip to content

Commit 6a2d2dd

Browse files
drm: Move nomodeset kernel parameter to the DRM subsystem
The "nomodeset" kernel cmdline parameter is handled by the vgacon driver but the exported vgacon_text_force() symbol is only used by DRM drivers. It makes much more sense for the parameter logic to be in the subsystem of the drivers that are making use of it. Let's move the vgacon_text_force() function and related logic to the DRM subsystem. While doing that, rename it to drm_firmware_drivers_only() and make it return true if "nomodeset" was used and false otherwise. This is a better description of the condition that the drivers are testing for. Suggested-by: Daniel Vetter <[email protected]> Signed-off-by: Javier Martinez Canillas <[email protected]> Acked-by: Thomas Zimmermann <[email protected]> Acked-by: Jani Nikula <[email protected]> Acked-by: Pekka Paalanen <[email protected]> Acked-by: Greg Kroah-Hartman <[email protected]> Link: https://patchwork.freedesktop.org/patch/msgid/[email protected]
1 parent d76f25d commit 6a2d2dd

File tree

17 files changed

+48
-51
lines changed

17 files changed

+48
-51
lines changed

drivers/gpu/drm/Makefile

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,8 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += drm_privacy_screen.o drm_privacy_screen_x86.
3333

3434
obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o
3535

36+
obj-$(CONFIG_VGA_CONSOLE) += drm_nomodeset.o
37+
3638
drm_cma_helper-y := drm_gem_cma_helper.o
3739
obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o
3840

drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
#include "amdgpu_drv.h"
3232

3333
#include <drm/drm_pciids.h>
34-
#include <linux/console.h>
3534
#include <linux/module.h>
3635
#include <linux/pm_runtime.h>
3736
#include <linux/vga_switcheroo.h>
@@ -2516,7 +2515,7 @@ static int __init amdgpu_init(void)
25162515
{
25172516
int r;
25182517

2519-
if (vgacon_text_force())
2518+
if (drm_firmware_drivers_only())
25202519
return -EINVAL;
25212520

25222521
r = amdgpu_sync_init();

drivers/gpu/drm/ast/ast_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,6 @@
2626
* Authors: Dave Airlie <[email protected]>
2727
*/
2828

29-
#include <linux/console.h>
3029
#include <linux/module.h>
3130
#include <linux/pci.h>
3231

@@ -233,7 +232,7 @@ static struct pci_driver ast_pci_driver = {
233232

234233
static int __init ast_init(void)
235234
{
236-
if (vgacon_text_force() && ast_modeset == -1)
235+
if (drm_firmware_drivers_only() && ast_modeset == -1)
237236
return -EINVAL;
238237

239238
if (ast_modeset == 0)

drivers/gpu/drm/i915/i915_module.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* Copyright © 2021 Intel Corporation
55
*/
66

7-
#include <linux/console.h>
7+
#include <drm/drm_drv.h>
88

99
#include "gem/i915_gem_context.h"
1010
#include "gem/i915_gem_object.h"
@@ -31,7 +31,7 @@ static int i915_check_nomodeset(void)
3131
if (i915_modparams.modeset == 0)
3232
use_kms = false;
3333

34-
if (vgacon_text_force() && i915_modparams.modeset == -1)
34+
if (drm_firmware_drivers_only() && i915_modparams.modeset == -1)
3535
use_kms = false;
3636

3737
if (!use_kms) {

drivers/gpu/drm/mgag200/mgag200_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66
* Dave Airlie
77
*/
88

9-
#include <linux/console.h>
109
#include <linux/module.h>
1110
#include <linux/pci.h>
1211
#include <linux/vmalloc.h>
@@ -378,7 +377,7 @@ static struct pci_driver mgag200_pci_driver = {
378377

379378
static int __init mgag200_init(void)
380379
{
381-
if (vgacon_text_force() && mgag200_modeset == -1)
380+
if (drm_firmware_drivers_only() && mgag200_modeset == -1)
382381
return -EINVAL;
383382

384383
if (mgag200_modeset == 0)

drivers/gpu/drm/nouveau/nouveau_drm.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@
2222
* Authors: Ben Skeggs
2323
*/
2424

25-
#include <linux/console.h>
2625
#include <linux/delay.h>
2726
#include <linux/module.h>
2827
#include <linux/pci.h>
@@ -32,6 +31,7 @@
3231

3332
#include <drm/drm_aperture.h>
3433
#include <drm/drm_crtc_helper.h>
34+
#include <drm/drm_drv.h>
3535
#include <drm/drm_gem_ttm_helper.h>
3636
#include <drm/drm_ioctl.h>
3737
#include <drm/drm_vblank.h>
@@ -1358,7 +1358,7 @@ nouveau_drm_init(void)
13581358
nouveau_display_options();
13591359

13601360
if (nouveau_modeset == -1) {
1361-
if (vgacon_text_force())
1361+
if (drm_firmware_drivers_only())
13621362
nouveau_modeset = 0;
13631363
}
13641364

drivers/gpu/drm/qxl/qxl_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,6 @@
2929

3030
#include "qxl_drv.h"
3131

32-
#include <linux/console.h>
3332
#include <linux/module.h>
3433
#include <linux/pci.h>
3534
#include <linux/vgaarb.h>
@@ -295,7 +294,7 @@ static struct drm_driver qxl_driver = {
295294

296295
static int __init qxl_init(void)
297296
{
298-
if (vgacon_text_force() && qxl_modeset == -1)
297+
if (drm_firmware_drivers_only() && qxl_modeset == -1)
299298
return -EINVAL;
300299

301300
if (qxl_modeset == 0)

drivers/gpu/drm/radeon/radeon_drv.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131

3232

3333
#include <linux/compat.h>
34-
#include <linux/console.h>
3534
#include <linux/module.h>
3635
#include <linux/pm_runtime.h>
3736
#include <linux/vga_switcheroo.h>
@@ -637,7 +636,7 @@ static struct pci_driver radeon_kms_pci_driver = {
637636

638637
static int __init radeon_module_init(void)
639638
{
640-
if (vgacon_text_force() && radeon_modeset == -1)
639+
if (drm_firmware_drivers_only() && radeon_modeset == -1)
641640
radeon_modeset = 0;
642641

643642
if (radeon_modeset == 0)

drivers/gpu/drm/tiny/bochs.c

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,5 @@
11
// SPDX-License-Identifier: GPL-2.0-or-later
22

3-
#include <linux/console.h>
43
#include <linux/pci.h>
54

65
#include <drm/drm_aperture.h>
@@ -719,7 +718,7 @@ static struct pci_driver bochs_pci_driver = {
719718

720719
static int __init bochs_init(void)
721720
{
722-
if (vgacon_text_force() && bochs_modeset == -1)
721+
if (drm_firmware_drivers_only() && bochs_modeset == -1)
723722
return -EINVAL;
724723

725724
if (bochs_modeset == 0)

drivers/gpu/drm/tiny/cirrus.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
* Copyright 1999-2001 Jeff Garzik <[email protected]>
1717
*/
1818

19-
#include <linux/console.h>
2019
#include <linux/dma-buf-map.h>
2120
#include <linux/module.h>
2221
#include <linux/pci.h>
@@ -636,8 +635,9 @@ static struct pci_driver cirrus_pci_driver = {
636635

637636
static int __init cirrus_init(void)
638637
{
639-
if (vgacon_text_force())
638+
if (drm_firmware_drivers_only())
640639
return -EINVAL;
640+
641641
return pci_register_driver(&cirrus_pci_driver);
642642
}
643643

0 commit comments

Comments
 (0)