Unverified Commit 6a2d2ddf authored by Javier Martinez Canillas's avatar Javier Martinez Canillas
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: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
Signed-off-by: default avatarJavier Martinez Canillas <javierm@redhat.com>
Acked-by: default avatarThomas Zimmermann <tzimmermann@suse.de>
Acked-by: default avatarJani Nikula <jani.nikula@intel.com>
Acked-by: default avatarPekka Paalanen <pekka.paalanen@collabora.com>
Acked-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Link: https://patchwork.freedesktop.org/patch/msgid/20211112133230.1595307-4-javierm@redhat.com
parent d76f25d6
Loading
Loading
Loading
Loading
+2 −0
Original line number Diff line number Diff line
@@ -33,6 +33,8 @@ drm-$(CONFIG_DRM_PRIVACY_SCREEN) += drm_privacy_screen.o drm_privacy_screen_x86.

obj-$(CONFIG_DRM_DP_AUX_BUS) += drm_dp_aux_bus.o

obj-$(CONFIG_VGA_CONSOLE) += drm_nomodeset.o

drm_cma_helper-y := drm_gem_cma_helper.o
obj-$(CONFIG_DRM_GEM_CMA_HELPER) += drm_cma_helper.o

+1 −2
Original line number Diff line number Diff line
@@ -31,7 +31,6 @@
#include "amdgpu_drv.h"

#include <drm/drm_pciids.h>
#include <linux/console.h>
#include <linux/module.h>
#include <linux/pm_runtime.h>
#include <linux/vga_switcheroo.h>
@@ -2516,7 +2515,7 @@ static int __init amdgpu_init(void)
{
	int r;

	if (vgacon_text_force())
	if (drm_firmware_drivers_only())
		return -EINVAL;

	r = amdgpu_sync_init();
+1 −2
Original line number Diff line number Diff line
@@ -26,7 +26,6 @@
 * Authors: Dave Airlie <airlied@redhat.com>
 */

#include <linux/console.h>
#include <linux/module.h>
#include <linux/pci.h>

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

static int __init ast_init(void)
{
	if (vgacon_text_force() && ast_modeset == -1)
	if (drm_firmware_drivers_only() && ast_modeset == -1)
		return -EINVAL;

	if (ast_modeset == 0)
+2 −2
Original line number Diff line number Diff line
@@ -4,7 +4,7 @@
 * Copyright © 2021 Intel Corporation
 */

#include <linux/console.h>
#include <drm/drm_drv.h>

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

	if (vgacon_text_force() && i915_modparams.modeset == -1)
	if (drm_firmware_drivers_only() && i915_modparams.modeset == -1)
		use_kms = false;

	if (!use_kms) {
+1 −2
Original line number Diff line number Diff line
@@ -6,7 +6,6 @@
 *          Dave Airlie
 */

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

static int __init mgag200_init(void)
{
	if (vgacon_text_force() && mgag200_modeset == -1)
	if (drm_firmware_drivers_only() && mgag200_modeset == -1)
		return -EINVAL;

	if (mgag200_modeset == 0)
Loading