Commit 44debe7a authored by Daniel Vetter's avatar Daniel Vetter

vgacon: dummy implementation for vgacon_text_force

This allows us to ditch a ton of ugly #ifdefs from a bunch of drm modeset
drivers.

v2: Make the dummy function actually return a sane value, spotted by
Ville.

v3: Because the patch is still in limbo there's no more drivers to
convert, noticed by Emil.

v4: Rebase once more, because hooray. I'll just go ahead an apply this
one later on to drm-misc.

Cc: Emil Velikov <emil.l.velikov@gmail.com>
Cc: Ville Syrjälä <ville.syrjala@linux.intel.com>
Cc: Andrew Morton <akpm@linux-foundation.org>
Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Reviewed-by: default avatarEmil Velikov <emil.l.velikov@gmail.com>
Reviewed-by: default avatarAlex Deucher <alexander.deucher@amd.com>
Signed-off-by: default avatarDaniel Vetter <daniel.vetter@ffwll.ch>
parent aa2e2996
...@@ -539,12 +539,10 @@ static struct pci_driver amdgpu_kms_pci_driver = { ...@@ -539,12 +539,10 @@ static struct pci_driver amdgpu_kms_pci_driver = {
static int __init amdgpu_init(void) static int __init amdgpu_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force()) { if (vgacon_text_force()) {
DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n"); DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
return -EINVAL; return -EINVAL;
} }
#endif
DRM_INFO("amdgpu kernel modesetting enabled.\n"); DRM_INFO("amdgpu kernel modesetting enabled.\n");
driver = &kms_driver; driver = &kms_driver;
pdriver = &amdgpu_kms_pci_driver; pdriver = &amdgpu_kms_pci_driver;
......
...@@ -218,10 +218,8 @@ static struct drm_driver driver = { ...@@ -218,10 +218,8 @@ static struct drm_driver driver = {
static int __init ast_init(void) static int __init ast_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && ast_modeset == -1) if (vgacon_text_force() && ast_modeset == -1)
return -EINVAL; return -EINVAL;
#endif
if (ast_modeset == 0) if (ast_modeset == 0)
return -EINVAL; return -EINVAL;
......
...@@ -162,10 +162,8 @@ static struct pci_driver cirrus_pci_driver = { ...@@ -162,10 +162,8 @@ static struct pci_driver cirrus_pci_driver = {
static int __init cirrus_init(void) static int __init cirrus_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && cirrus_modeset == -1) if (vgacon_text_force() && cirrus_modeset == -1)
return -EINVAL; return -EINVAL;
#endif
if (cirrus_modeset == 0) if (cirrus_modeset == 0)
return -EINVAL; return -EINVAL;
......
...@@ -1750,10 +1750,8 @@ static int __init i915_init(void) ...@@ -1750,10 +1750,8 @@ static int __init i915_init(void)
if (i915.modeset == 0) if (i915.modeset == 0)
driver.driver_features &= ~DRIVER_MODESET; driver.driver_features &= ~DRIVER_MODESET;
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && i915.modeset == -1) if (vgacon_text_force() && i915.modeset == -1)
driver.driver_features &= ~DRIVER_MODESET; driver.driver_features &= ~DRIVER_MODESET;
#endif
if (!(driver.driver_features & DRIVER_MODESET)) { if (!(driver.driver_features & DRIVER_MODESET)) {
/* Silently fail loading to not upset userspace. */ /* Silently fail loading to not upset userspace. */
......
...@@ -116,10 +116,8 @@ static struct pci_driver mgag200_pci_driver = { ...@@ -116,10 +116,8 @@ static struct pci_driver mgag200_pci_driver = {
static int __init mgag200_init(void) static int __init mgag200_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && mgag200_modeset == -1) if (vgacon_text_force() && mgag200_modeset == -1)
return -EINVAL; return -EINVAL;
#endif
if (mgag200_modeset == 0) if (mgag200_modeset == 0)
return -EINVAL; return -EINVAL;
......
...@@ -1082,10 +1082,8 @@ nouveau_drm_init(void) ...@@ -1082,10 +1082,8 @@ nouveau_drm_init(void)
nouveau_display_options(); nouveau_display_options();
if (nouveau_modeset == -1) { if (nouveau_modeset == -1) {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force()) if (vgacon_text_force())
nouveau_modeset = 0; nouveau_modeset = 0;
#endif
} }
if (!nouveau_modeset) if (!nouveau_modeset)
......
...@@ -272,10 +272,8 @@ static struct drm_driver qxl_driver = { ...@@ -272,10 +272,8 @@ static struct drm_driver qxl_driver = {
static int __init qxl_init(void) static int __init qxl_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && qxl_modeset == -1) if (vgacon_text_force() && qxl_modeset == -1)
return -EINVAL; return -EINVAL;
#endif
if (qxl_modeset == 0) if (qxl_modeset == 0)
return -EINVAL; return -EINVAL;
......
...@@ -558,12 +558,10 @@ static struct pci_driver radeon_kms_pci_driver = { ...@@ -558,12 +558,10 @@ static struct pci_driver radeon_kms_pci_driver = {
static int __init radeon_init(void) static int __init radeon_init(void)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && radeon_modeset == -1) { if (vgacon_text_force() && radeon_modeset == -1) {
DRM_INFO("VGACON disable radeon kernel modesetting.\n"); DRM_INFO("VGACON disable radeon kernel modesetting.\n");
radeon_modeset = 0; radeon_modeset = 0;
} }
#endif
/* set to modesetting by default if not nomodeset */ /* set to modesetting by default if not nomodeset */
if (radeon_modeset == -1) if (radeon_modeset == -1)
radeon_modeset = 1; radeon_modeset = 1;
......
...@@ -42,10 +42,8 @@ module_param_named(modeset, virtio_gpu_modeset, int, 0400); ...@@ -42,10 +42,8 @@ module_param_named(modeset, virtio_gpu_modeset, int, 0400);
static int virtio_gpu_probe(struct virtio_device *vdev) static int virtio_gpu_probe(struct virtio_device *vdev)
{ {
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force() && virtio_gpu_modeset == -1) if (vgacon_text_force() && virtio_gpu_modeset == -1)
return -EINVAL; return -EINVAL;
#endif
if (virtio_gpu_modeset == 0) if (virtio_gpu_modeset == 0)
return -EINVAL; return -EINVAL;
......
...@@ -1529,10 +1529,8 @@ static int __init vmwgfx_init(void) ...@@ -1529,10 +1529,8 @@ static int __init vmwgfx_init(void)
{ {
int ret; int ret;
#ifdef CONFIG_VGA_CONSOLE
if (vgacon_text_force()) if (vgacon_text_force())
return -EINVAL; return -EINVAL;
#endif
ret = drm_pci_init(&driver, &vmw_pci_driver); ret = drm_pci_init(&driver, &vmw_pci_driver);
if (ret) if (ret)
......
...@@ -191,6 +191,8 @@ void vcs_remove_sysfs(int index); ...@@ -191,6 +191,8 @@ void vcs_remove_sysfs(int index);
#ifdef CONFIG_VGA_CONSOLE #ifdef CONFIG_VGA_CONSOLE
extern bool vgacon_text_force(void); extern bool vgacon_text_force(void);
#else
static inline bool vgacon_text_force(void) { return false; }
#endif #endif
#endif /* _LINUX_CONSOLE_H */ #endif /* _LINUX_CONSOLE_H */
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment