diff mbox

vgacon: dummy implementation for vgacon_text_force

Message ID 1459329995-12300-1-git-send-email-daniel.vetter@ffwll.ch (mailing list archive)
State New, archived
Headers show

Commit Message

Daniel Vetter March 30, 2016, 9:26 a.m. UTC
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>
Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
---
 drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 --
 drivers/gpu/drm/ast/ast_drv.c           | 2 --
 drivers/gpu/drm/cirrus/cirrus_drv.c     | 2 --
 drivers/gpu/drm/i915/i915_drv.c         | 2 --
 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/virtio/virtgpu_drv.c    | 2 --
 drivers/gpu/drm/vmwgfx/vmwgfx_drv.c     | 2 --
 include/linux/console.h                 | 2 ++
 11 files changed, 2 insertions(+), 20 deletions(-)

Comments

Emil Velikov March 30, 2016, 10:18 a.m. UTC | #1
On 30 March 2016 at 10:26, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
Good bye #ifdef spaghetti :-)

Reviewed-by: Emil Velikov <emil.l.velikov@gmail.com>

-Emil
Alex Deucher March 30, 2016, 1:52 p.m. UTC | #2
On Wed, Mar 30, 2016 at 5:26 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> 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>
> Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>

Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

> ---
>  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 --
>  drivers/gpu/drm/ast/ast_drv.c           | 2 --
>  drivers/gpu/drm/cirrus/cirrus_drv.c     | 2 --
>  drivers/gpu/drm/i915/i915_drv.c         | 2 --
>  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/virtio/virtgpu_drv.c    | 2 --
>  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c     | 2 --
>  include/linux/console.h                 | 2 ++
>  11 files changed, 2 insertions(+), 20 deletions(-)
>
> diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> index f1e17d60055a..93462aea9faa 100644
> --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> @@ -556,12 +556,10 @@ static struct pci_driver amdgpu_kms_pci_driver = {
>  static int __init amdgpu_init(void)
>  {
>         amdgpu_sync_init();
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force()) {
>                 DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
>                 return -EINVAL;
>         }
> -#endif
>         DRM_INFO("amdgpu kernel modesetting enabled.\n");
>         driver = &kms_driver;
>         pdriver = &amdgpu_kms_pci_driver;
> diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> index 9a32d9dfdd26..fcd9c0714836 100644
> --- a/drivers/gpu/drm/ast/ast_drv.c
> +++ b/drivers/gpu/drm/ast/ast_drv.c
> @@ -218,10 +218,8 @@ static struct drm_driver driver = {
>
>  static int __init ast_init(void)
>  {
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && ast_modeset == -1)
>                 return -EINVAL;
> -#endif
>
>         if (ast_modeset == 0)
>                 return -EINVAL;
> diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
> index 7bc394ec9fb3..dc83f69da6f1 100644
> --- a/drivers/gpu/drm/cirrus/cirrus_drv.c
> +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
> @@ -163,10 +163,8 @@ static struct pci_driver cirrus_pci_driver = {
>
>  static int __init cirrus_init(void)
>  {
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && cirrus_modeset == -1)
>                 return -EINVAL;
> -#endif
>
>         if (cirrus_modeset == 0)
>                 return -EINVAL;
> diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> index f73b4f7b2d39..349e17cc8540 100644
> --- a/drivers/gpu/drm/i915/i915_drv.c
> +++ b/drivers/gpu/drm/i915/i915_drv.c
> @@ -1754,10 +1754,8 @@ static int __init i915_init(void)
>         if (i915.modeset == 0)
>                 driver.driver_features &= ~DRIVER_MODESET;
>
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && i915.modeset == -1)
>                 driver.driver_features &= ~DRIVER_MODESET;
> -#endif
>
>         if (!(driver.driver_features & DRIVER_MODESET)) {
>                 /* Silently fail loading to not upset userspace. */
> diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> index b0af77454d52..ebb470ff7200 100644
> --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> @@ -116,10 +116,8 @@ static struct pci_driver mgag200_pci_driver = {
>
>  static int __init mgag200_init(void)
>  {
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && mgag200_modeset == -1)
>                 return -EINVAL;
> -#endif
>
>         if (mgag200_modeset == 0)
>                 return -EINVAL;
> diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> index d06877d9c1ed..db5c7d0cc25c 100644
> --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> @@ -1083,10 +1083,8 @@ nouveau_drm_init(void)
>         nouveau_display_options();
>
>         if (nouveau_modeset == -1) {
> -#ifdef CONFIG_VGA_CONSOLE
>                 if (vgacon_text_force())
>                         nouveau_modeset = 0;
> -#endif
>         }
>
>         if (!nouveau_modeset)
> diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
> index 7307b07fe06b..dc9df5fe50ba 100644
> --- a/drivers/gpu/drm/qxl/qxl_drv.c
> +++ b/drivers/gpu/drm/qxl/qxl_drv.c
> @@ -272,10 +272,8 @@ static struct drm_driver qxl_driver = {
>
>  static int __init qxl_init(void)
>  {
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && qxl_modeset == -1)
>                 return -EINVAL;
> -#endif
>
>         if (qxl_modeset == 0)
>                 return -EINVAL;
> diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> index ccd4ad4ee592..5d44ed0d104a 100644
> --- a/drivers/gpu/drm/radeon/radeon_drv.c
> +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> @@ -566,12 +566,10 @@ static struct pci_driver radeon_kms_pci_driver = {
>
>  static int __init radeon_init(void)
>  {
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && radeon_modeset == -1) {
>                 DRM_INFO("VGACON disable radeon kernel modesetting.\n");
>                 radeon_modeset = 0;
>         }
> -#endif
>         /* set to modesetting by default if not nomodeset */
>         if (radeon_modeset == -1)
>                 radeon_modeset = 1;
> diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> index 7f898cfdc746..3cc7afa77a35 100644
> --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> @@ -42,10 +42,8 @@ module_param_named(modeset, virtio_gpu_modeset, int, 0400);
>
>  static int virtio_gpu_probe(struct virtio_device *vdev)
>  {
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force() && virtio_gpu_modeset == -1)
>                 return -EINVAL;
> -#endif
>
>         if (virtio_gpu_modeset == 0)
>                 return -EINVAL;
> diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> index 6cbb7d4bdd11..e7335a48ebf6 100644
> --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> @@ -1530,10 +1530,8 @@ static int __init vmwgfx_init(void)
>  {
>         int ret;
>
> -#ifdef CONFIG_VGA_CONSOLE
>         if (vgacon_text_force())
>                 return -EINVAL;
> -#endif
>
>         ret = drm_pci_init(&driver, &vmw_pci_driver);
>         if (ret)
> diff --git a/include/linux/console.h b/include/linux/console.h
> index ea731af2451e..e49cc1ef19be 100644
> --- a/include/linux/console.h
> +++ b/include/linux/console.h
> @@ -191,6 +191,8 @@ void vcs_remove_sysfs(int index);
>
>  #ifdef CONFIG_VGA_CONSOLE
>  extern bool vgacon_text_force(void);
> +#else
> +static inline bool vgacon_text_force(void) { return false; }
>  #endif
>
>  #endif /* _LINUX_CONSOLE_H */
> --
> 2.8.0.rc3
>
> _______________________________________________
> dri-devel mailing list
> dri-devel@lists.freedesktop.org
> https://lists.freedesktop.org/mailman/listinfo/dri-devel
Daniel Vetter March 30, 2016, 3:38 p.m. UTC | #3
On Wed, Mar 30, 2016 at 09:52:28AM -0400, Alex Deucher wrote:
> On Wed, Mar 30, 2016 at 5:26 AM, Daniel Vetter <daniel.vetter@ffwll.ch> wrote:
> > 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>
> > Signed-off-by: Daniel Vetter <daniel.vetter@ffwll.ch>
> 
> Reviewed-by: Alex Deucher <alexander.deucher@amd.com>

Applied to drm-misc, thanks for the review.
-Daniel

> 
> > ---
> >  drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c | 2 --
> >  drivers/gpu/drm/ast/ast_drv.c           | 2 --
> >  drivers/gpu/drm/cirrus/cirrus_drv.c     | 2 --
> >  drivers/gpu/drm/i915/i915_drv.c         | 2 --
> >  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/virtio/virtgpu_drv.c    | 2 --
> >  drivers/gpu/drm/vmwgfx/vmwgfx_drv.c     | 2 --
> >  include/linux/console.h                 | 2 ++
> >  11 files changed, 2 insertions(+), 20 deletions(-)
> >
> > diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > index f1e17d60055a..93462aea9faa 100644
> > --- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > +++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
> > @@ -556,12 +556,10 @@ static struct pci_driver amdgpu_kms_pci_driver = {
> >  static int __init amdgpu_init(void)
> >  {
> >         amdgpu_sync_init();
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force()) {
> >                 DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
> >                 return -EINVAL;
> >         }
> > -#endif
> >         DRM_INFO("amdgpu kernel modesetting enabled.\n");
> >         driver = &kms_driver;
> >         pdriver = &amdgpu_kms_pci_driver;
> > diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
> > index 9a32d9dfdd26..fcd9c0714836 100644
> > --- a/drivers/gpu/drm/ast/ast_drv.c
> > +++ b/drivers/gpu/drm/ast/ast_drv.c
> > @@ -218,10 +218,8 @@ static struct drm_driver driver = {
> >
> >  static int __init ast_init(void)
> >  {
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && ast_modeset == -1)
> >                 return -EINVAL;
> > -#endif
> >
> >         if (ast_modeset == 0)
> >                 return -EINVAL;
> > diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
> > index 7bc394ec9fb3..dc83f69da6f1 100644
> > --- a/drivers/gpu/drm/cirrus/cirrus_drv.c
> > +++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
> > @@ -163,10 +163,8 @@ static struct pci_driver cirrus_pci_driver = {
> >
> >  static int __init cirrus_init(void)
> >  {
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && cirrus_modeset == -1)
> >                 return -EINVAL;
> > -#endif
> >
> >         if (cirrus_modeset == 0)
> >                 return -EINVAL;
> > diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
> > index f73b4f7b2d39..349e17cc8540 100644
> > --- a/drivers/gpu/drm/i915/i915_drv.c
> > +++ b/drivers/gpu/drm/i915/i915_drv.c
> > @@ -1754,10 +1754,8 @@ static int __init i915_init(void)
> >         if (i915.modeset == 0)
> >                 driver.driver_features &= ~DRIVER_MODESET;
> >
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && i915.modeset == -1)
> >                 driver.driver_features &= ~DRIVER_MODESET;
> > -#endif
> >
> >         if (!(driver.driver_features & DRIVER_MODESET)) {
> >                 /* Silently fail loading to not upset userspace. */
> > diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
> > index b0af77454d52..ebb470ff7200 100644
> > --- a/drivers/gpu/drm/mgag200/mgag200_drv.c
> > +++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
> > @@ -116,10 +116,8 @@ static struct pci_driver mgag200_pci_driver = {
> >
> >  static int __init mgag200_init(void)
> >  {
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && mgag200_modeset == -1)
> >                 return -EINVAL;
> > -#endif
> >
> >         if (mgag200_modeset == 0)
> >                 return -EINVAL;
> > diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
> > index d06877d9c1ed..db5c7d0cc25c 100644
> > --- a/drivers/gpu/drm/nouveau/nouveau_drm.c
> > +++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
> > @@ -1083,10 +1083,8 @@ nouveau_drm_init(void)
> >         nouveau_display_options();
> >
> >         if (nouveau_modeset == -1) {
> > -#ifdef CONFIG_VGA_CONSOLE
> >                 if (vgacon_text_force())
> >                         nouveau_modeset = 0;
> > -#endif
> >         }
> >
> >         if (!nouveau_modeset)
> > diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
> > index 7307b07fe06b..dc9df5fe50ba 100644
> > --- a/drivers/gpu/drm/qxl/qxl_drv.c
> > +++ b/drivers/gpu/drm/qxl/qxl_drv.c
> > @@ -272,10 +272,8 @@ static struct drm_driver qxl_driver = {
> >
> >  static int __init qxl_init(void)
> >  {
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && qxl_modeset == -1)
> >                 return -EINVAL;
> > -#endif
> >
> >         if (qxl_modeset == 0)
> >                 return -EINVAL;
> > diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
> > index ccd4ad4ee592..5d44ed0d104a 100644
> > --- a/drivers/gpu/drm/radeon/radeon_drv.c
> > +++ b/drivers/gpu/drm/radeon/radeon_drv.c
> > @@ -566,12 +566,10 @@ static struct pci_driver radeon_kms_pci_driver = {
> >
> >  static int __init radeon_init(void)
> >  {
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && radeon_modeset == -1) {
> >                 DRM_INFO("VGACON disable radeon kernel modesetting.\n");
> >                 radeon_modeset = 0;
> >         }
> > -#endif
> >         /* set to modesetting by default if not nomodeset */
> >         if (radeon_modeset == -1)
> >                 radeon_modeset = 1;
> > diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
> > index 7f898cfdc746..3cc7afa77a35 100644
> > --- a/drivers/gpu/drm/virtio/virtgpu_drv.c
> > +++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
> > @@ -42,10 +42,8 @@ module_param_named(modeset, virtio_gpu_modeset, int, 0400);
> >
> >  static int virtio_gpu_probe(struct virtio_device *vdev)
> >  {
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force() && virtio_gpu_modeset == -1)
> >                 return -EINVAL;
> > -#endif
> >
> >         if (virtio_gpu_modeset == 0)
> >                 return -EINVAL;
> > diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > index 6cbb7d4bdd11..e7335a48ebf6 100644
> > --- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > +++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
> > @@ -1530,10 +1530,8 @@ static int __init vmwgfx_init(void)
> >  {
> >         int ret;
> >
> > -#ifdef CONFIG_VGA_CONSOLE
> >         if (vgacon_text_force())
> >                 return -EINVAL;
> > -#endif
> >
> >         ret = drm_pci_init(&driver, &vmw_pci_driver);
> >         if (ret)
> > diff --git a/include/linux/console.h b/include/linux/console.h
> > index ea731af2451e..e49cc1ef19be 100644
> > --- a/include/linux/console.h
> > +++ b/include/linux/console.h
> > @@ -191,6 +191,8 @@ void vcs_remove_sysfs(int index);
> >
> >  #ifdef CONFIG_VGA_CONSOLE
> >  extern bool vgacon_text_force(void);
> > +#else
> > +static inline bool vgacon_text_force(void) { return false; }
> >  #endif
> >
> >  #endif /* _LINUX_CONSOLE_H */
> > --
> > 2.8.0.rc3
> >
> > _______________________________________________
> > dri-devel mailing list
> > dri-devel@lists.freedesktop.org
> > https://lists.freedesktop.org/mailman/listinfo/dri-devel
diff mbox

Patch

diff --git a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
index f1e17d60055a..93462aea9faa 100644
--- a/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
+++ b/drivers/gpu/drm/amd/amdgpu/amdgpu_drv.c
@@ -556,12 +556,10 @@  static struct pci_driver amdgpu_kms_pci_driver = {
 static int __init amdgpu_init(void)
 {
 	amdgpu_sync_init();
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force()) {
 		DRM_ERROR("VGACON disables amdgpu kernel modesetting.\n");
 		return -EINVAL;
 	}
-#endif
 	DRM_INFO("amdgpu kernel modesetting enabled.\n");
 	driver = &kms_driver;
 	pdriver = &amdgpu_kms_pci_driver;
diff --git a/drivers/gpu/drm/ast/ast_drv.c b/drivers/gpu/drm/ast/ast_drv.c
index 9a32d9dfdd26..fcd9c0714836 100644
--- a/drivers/gpu/drm/ast/ast_drv.c
+++ b/drivers/gpu/drm/ast/ast_drv.c
@@ -218,10 +218,8 @@  static struct drm_driver driver = {
 
 static int __init ast_init(void)
 {
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && ast_modeset == -1)
 		return -EINVAL;
-#endif
 
 	if (ast_modeset == 0)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/cirrus/cirrus_drv.c b/drivers/gpu/drm/cirrus/cirrus_drv.c
index 7bc394ec9fb3..dc83f69da6f1 100644
--- a/drivers/gpu/drm/cirrus/cirrus_drv.c
+++ b/drivers/gpu/drm/cirrus/cirrus_drv.c
@@ -163,10 +163,8 @@  static struct pci_driver cirrus_pci_driver = {
 
 static int __init cirrus_init(void)
 {
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && cirrus_modeset == -1)
 		return -EINVAL;
-#endif
 
 	if (cirrus_modeset == 0)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c
index f73b4f7b2d39..349e17cc8540 100644
--- a/drivers/gpu/drm/i915/i915_drv.c
+++ b/drivers/gpu/drm/i915/i915_drv.c
@@ -1754,10 +1754,8 @@  static int __init i915_init(void)
 	if (i915.modeset == 0)
 		driver.driver_features &= ~DRIVER_MODESET;
 
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && i915.modeset == -1)
 		driver.driver_features &= ~DRIVER_MODESET;
-#endif
 
 	if (!(driver.driver_features & DRIVER_MODESET)) {
 		/* Silently fail loading to not upset userspace. */
diff --git a/drivers/gpu/drm/mgag200/mgag200_drv.c b/drivers/gpu/drm/mgag200/mgag200_drv.c
index b0af77454d52..ebb470ff7200 100644
--- a/drivers/gpu/drm/mgag200/mgag200_drv.c
+++ b/drivers/gpu/drm/mgag200/mgag200_drv.c
@@ -116,10 +116,8 @@  static struct pci_driver mgag200_pci_driver = {
 
 static int __init mgag200_init(void)
 {
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && mgag200_modeset == -1)
 		return -EINVAL;
-#endif
 
 	if (mgag200_modeset == 0)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/nouveau/nouveau_drm.c b/drivers/gpu/drm/nouveau/nouveau_drm.c
index d06877d9c1ed..db5c7d0cc25c 100644
--- a/drivers/gpu/drm/nouveau/nouveau_drm.c
+++ b/drivers/gpu/drm/nouveau/nouveau_drm.c
@@ -1083,10 +1083,8 @@  nouveau_drm_init(void)
 	nouveau_display_options();
 
 	if (nouveau_modeset == -1) {
-#ifdef CONFIG_VGA_CONSOLE
 		if (vgacon_text_force())
 			nouveau_modeset = 0;
-#endif
 	}
 
 	if (!nouveau_modeset)
diff --git a/drivers/gpu/drm/qxl/qxl_drv.c b/drivers/gpu/drm/qxl/qxl_drv.c
index 7307b07fe06b..dc9df5fe50ba 100644
--- a/drivers/gpu/drm/qxl/qxl_drv.c
+++ b/drivers/gpu/drm/qxl/qxl_drv.c
@@ -272,10 +272,8 @@  static struct drm_driver qxl_driver = {
 
 static int __init qxl_init(void)
 {
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && qxl_modeset == -1)
 		return -EINVAL;
-#endif
 
 	if (qxl_modeset == 0)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/radeon/radeon_drv.c b/drivers/gpu/drm/radeon/radeon_drv.c
index ccd4ad4ee592..5d44ed0d104a 100644
--- a/drivers/gpu/drm/radeon/radeon_drv.c
+++ b/drivers/gpu/drm/radeon/radeon_drv.c
@@ -566,12 +566,10 @@  static struct pci_driver radeon_kms_pci_driver = {
 
 static int __init radeon_init(void)
 {
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && radeon_modeset == -1) {
 		DRM_INFO("VGACON disable radeon kernel modesetting.\n");
 		radeon_modeset = 0;
 	}
-#endif
 	/* set to modesetting by default if not nomodeset */
 	if (radeon_modeset == -1)
 		radeon_modeset = 1;
diff --git a/drivers/gpu/drm/virtio/virtgpu_drv.c b/drivers/gpu/drm/virtio/virtgpu_drv.c
index 7f898cfdc746..3cc7afa77a35 100644
--- a/drivers/gpu/drm/virtio/virtgpu_drv.c
+++ b/drivers/gpu/drm/virtio/virtgpu_drv.c
@@ -42,10 +42,8 @@  module_param_named(modeset, virtio_gpu_modeset, int, 0400);
 
 static int virtio_gpu_probe(struct virtio_device *vdev)
 {
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force() && virtio_gpu_modeset == -1)
 		return -EINVAL;
-#endif
 
 	if (virtio_gpu_modeset == 0)
 		return -EINVAL;
diff --git a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
index 6cbb7d4bdd11..e7335a48ebf6 100644
--- a/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
+++ b/drivers/gpu/drm/vmwgfx/vmwgfx_drv.c
@@ -1530,10 +1530,8 @@  static int __init vmwgfx_init(void)
 {
 	int ret;
 
-#ifdef CONFIG_VGA_CONSOLE
 	if (vgacon_text_force())
 		return -EINVAL;
-#endif
 
 	ret = drm_pci_init(&driver, &vmw_pci_driver);
 	if (ret)
diff --git a/include/linux/console.h b/include/linux/console.h
index ea731af2451e..e49cc1ef19be 100644
--- a/include/linux/console.h
+++ b/include/linux/console.h
@@ -191,6 +191,8 @@  void vcs_remove_sysfs(int index);
 
 #ifdef CONFIG_VGA_CONSOLE
 extern bool vgacon_text_force(void);
+#else
+static inline bool vgacon_text_force(void) { return false; }
 #endif
 
 #endif /* _LINUX_CONSOLE_H */