summaryrefslogtreecommitdiffstats
path: root/drivers/gpu/drm/i915/i915_pci.c
diff options
context:
space:
mode:
authorChris Wilson2016-06-24 15:00:27 +0200
committerChris Wilson2016-06-24 15:45:48 +0200
commita09d0ba1745b607070a937083ecf9ec616178768 (patch)
tree88677b0fe3e98fe9ca8f44518adb5194e27f7f23 /drivers/gpu/drm/i915/i915_pci.c
parentdrm/i915: Split out the PCI driver interface to i915_pci.c (diff)
downloadkernel-qcow2-linux-a09d0ba1745b607070a937083ecf9ec616178768.tar.gz
kernel-qcow2-linux-a09d0ba1745b607070a937083ecf9ec616178768.tar.xz
kernel-qcow2-linux-a09d0ba1745b607070a937083ecf9ec616178768.zip
drm/i915: Move module init/exit to i915_pci.c
The module init/exit routines are a wrapper around the PCI device init/exit, so move them across. Note that in order to avoid exporting the driver struct, instead of manipulating driver.features inside i915_init we instead opt to simply exit if i915.modeset is disabled. Signed-off-by: Chris Wilson <chris@chris-wilson.co.uk> Cc: Daniel Vetter <daniel.vetter@ffwll.ch> Cc: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Reviewed-by: Joonas Lahtinen <joonas.lahtinen@linux.intel.com> Link: http://patchwork.freedesktop.org/patch/msgid/1466773227-7994-15-git-send-email-chris@chris-wilson.co.uk
Diffstat (limited to 'drivers/gpu/drm/i915/i915_pci.c')
-rw-r--r--drivers/gpu/drm/i915/i915_pci.c45
1 files changed, 44 insertions, 1 deletions
diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c
index 9aa07f38caea..a7f8f4fb7e8d 100644
--- a/drivers/gpu/drm/i915/i915_pci.c
+++ b/drivers/gpu/drm/i915/i915_pci.c
@@ -22,6 +22,7 @@
*
*/
+#include <linux/console.h>
#include <linux/vgaarb.h>
#include <linux/vga_switcheroo.h>
@@ -452,10 +453,52 @@ static void i915_pci_remove(struct pci_dev *pdev)
extern const struct dev_pm_ops i915_pm_ops;
-struct pci_driver i915_pci_driver = {
+static struct pci_driver i915_pci_driver = {
.name = DRIVER_NAME,
.id_table = pciidlist,
.probe = i915_pci_probe,
.remove = i915_pci_remove,
.driver.pm = &i915_pm_ops,
};
+
+static int __init i915_init(void)
+{
+ bool use_kms = true;
+
+ /*
+ * Enable KMS by default, unless explicitly overriden by
+ * either the i915.modeset prarameter or by the
+ * vga_text_mode_force boot option.
+ */
+
+ if (i915.modeset == 0)
+ use_kms = false;
+
+ if (vgacon_text_force() && i915.modeset == -1)
+ use_kms = false;
+
+ if (!use_kms) {
+ /* Silently fail loading to not upset userspace. */
+ DRM_DEBUG_DRIVER("KMS disabled.\n");
+ return 0;
+ }
+
+ return pci_register_driver(&i915_pci_driver);
+}
+
+static void __exit i915_exit(void)
+{
+ if (!i915_pci_driver.driver.owner)
+ return;
+
+ pci_unregister_driver(&i915_pci_driver);
+}
+
+module_init(i915_init);
+module_exit(i915_exit);
+
+MODULE_AUTHOR("Tungsten Graphics, Inc.");
+MODULE_AUTHOR("Intel Corporation");
+
+MODULE_DESCRIPTION(DRIVER_DESC);
+MODULE_LICENSE("GPL and additional rights");