From patchwork Fri Jun 24 07:00:45 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9196809 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 8256C60871 for ; Fri, 24 Jun 2016 07:04:00 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7237C28495 for ; Fri, 24 Jun 2016 07:04:00 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6482328498; Fri, 24 Jun 2016 07:04:00 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-4.1 required=2.0 tests=BAYES_00,DKIM_SIGNED, RCVD_IN_DNSWL_MED,T_DKIM_INVALID autolearn=ham version=3.3.1 Received: from gabe.freedesktop.org (gabe.freedesktop.org [131.252.210.177]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E521E28495 for ; Fri, 24 Jun 2016 07:03:59 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 1A8ED6E26F; Fri, 24 Jun 2016 07:03:59 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x243.google.com (mail-wm0-x243.google.com [IPv6:2a00:1450:400c:c09::243]) by gabe.freedesktop.org (Postfix) with ESMTPS id A20606EA46 for ; Fri, 24 Jun 2016 07:01:07 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id a66so2572240wme.2 for ; Fri, 24 Jun 2016 00:01:07 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:subject:date:message-id:in-reply-to:references; bh=52vk6AJvBpBNdelJNl4pcJU6u52nz5lEZgVTE6cfHIo=; b=MpA6yeId2CpQjxHH36wMWd6wLr7CCmwZYDjg0EMBnD7j+i0taAUJlnzNnC2BuWs/5E tvlxDFkOUN2G5PpMG09ZY/yg44zo+ZEPhNCP4LSJE/F+G2l9SbAotBhpZadWWXcqLybe PzoR1ZRjw0Y1Sbhhz9js+kxZZ224Mw42msyCCZnpD3VynB4tyXZn9FGZbAlI0FGuB4Am 8NmZPtCoo6+07LBE9fM9hV4m36LulOG/MmljxNmURQWaQtAQ6xFAAzxrVLkk3CNgZWDg rlMVvd6ML+gnPl5szyaPEXYUrOGjjv4TYnhEXg+Go+cH+SBe6yLaj/CoPlcuyruHb1tj IMew== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:sender:from:to:subject:date:message-id :in-reply-to:references; bh=52vk6AJvBpBNdelJNl4pcJU6u52nz5lEZgVTE6cfHIo=; b=LrYfZ1hne1e2dUVD+coaStNA0ajVjMofoNlTb8RKt85ed5m/i86LCVujf8ax77gXRj qo3Stv9I2iOnOKgCGWru5vS869YUZscwgszcq2f5J6gPCuRiwxxri94w2SpzcLnpx2t4 fDnpLwQD08hvTvwzvMSvBQIKGpS9sQOGmAmNN+qJqHrBtS9cEAKUrPCfKlFKGcSOh+OZ nyT0HHD0eT4c/bNn0FrgKKiQoeVBL03H6+SDyPUmb++48YzMrnTq5uPCKxAJmAbVvet1 A0hrTUemlG2qzsSNyja7I21IYgFl3+h1AXMHFgbm9Cc2CTtNfXPvP8y6cXHzTYbxRc2l gClw== X-Gm-Message-State: ALyK8tJZFLVRug2qMVg41Hb+vPUTT0FiuN5DDtMYYBUSM4NL0DrBUHpRifx4pWHpmfgUsA== X-Received: by 10.28.142.194 with SMTP id q185mr17262157wmd.6.1466751665913; Fri, 24 Jun 2016 00:01:05 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id t188sm1621708wma.8.2016.06.24.00.01.05 for (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 24 Jun 2016 00:01:05 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 24 Jun 2016 08:00:45 +0100 Message-Id: <1466751645-6529-14-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1466751645-6529-1-git-send-email-chris@chris-wilson.co.uk> References: <1466751645-6529-1-git-send-email-chris@chris-wilson.co.uk> Subject: [Intel-gfx] [CI 14/14] drm/i915: Move module init/exit to i915_pci.c X-BeenThere: intel-gfx@lists.freedesktop.org X-Mailman-Version: 2.1.18 Precedence: list List-Id: Intel graphics driver community testing & development List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , MIME-Version: 1.0 Errors-To: intel-gfx-bounces@lists.freedesktop.org Sender: "Intel-gfx" X-Virus-Scanned: ClamAV using ClamSMTP 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 Cc: Daniel Vetter Cc: Joonas Lahtinen Reviewed-by: Joonas Lahtinen --- drivers/gpu/drm/i915/i915_drv.c | 51 +++-------------------------------------- drivers/gpu/drm/i915/i915_pci.c | 45 +++++++++++++++++++++++++++++++++++- 2 files changed, 47 insertions(+), 49 deletions(-) diff --git a/drivers/gpu/drm/i915/i915_drv.c b/drivers/gpu/drm/i915/i915_drv.c index 5f8742283e59..b98afbd33235 100644 --- a/drivers/gpu/drm/i915/i915_drv.c +++ b/drivers/gpu/drm/i915/i915_drv.c @@ -28,7 +28,6 @@ */ #include -#include #include #include #include @@ -1592,6 +1591,9 @@ int i915_driver_load(struct pci_dev *pdev, const struct pci_device_id *ent) struct drm_i915_private *dev_priv; int ret; + if (i915.nuclear_pageflip) + driver.driver_features |= DRIVER_ATOMIC; + ret = -ENOMEM; dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); if (dev_priv) @@ -3018,50 +3020,3 @@ static struct drm_driver driver = { .minor = DRIVER_MINOR, .patchlevel = DRIVER_PATCHLEVEL, }; - -static int __init i915_init(void) -{ - extern struct pci_driver i915_pci_driver; - - /* - * 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) - driver.driver_features &= ~DRIVER_MODESET; - - if (vgacon_text_force() && i915.modeset == -1) - driver.driver_features &= ~DRIVER_MODESET; - - if (!(driver.driver_features & DRIVER_MODESET)) { - /* Silently fail loading to not upset userspace. */ - DRM_DEBUG_DRIVER("KMS and UMS disabled.\n"); - return 0; - } - - if (i915.nuclear_pageflip) - driver.driver_features |= DRIVER_ATOMIC; - - return drm_pci_init(&driver, &i915_pci_driver); -} - -static void __exit i915_exit(void) -{ - extern struct pci_driver i915_pci_driver; - - if (!(driver.driver_features & DRIVER_MODESET)) - return; /* Never loaded a driver. */ - - drm_pci_exit(&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"); diff --git a/drivers/gpu/drm/i915/i915_pci.c b/drivers/gpu/drm/i915/i915_pci.c index 9aa07f38caea..14fc456bc637 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -22,6 +22,7 @@ * */ +#include #include #include @@ -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 and UMS 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");