From patchwork Mon May 30 08:38:39 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9140473 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 1F7AD60759 for ; Mon, 30 May 2016 08:39:34 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0C9FC27D17 for ; Mon, 30 May 2016 08:39:34 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 01AD62821D; Mon, 30 May 2016 08:39:33 +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 9C84E27D17 for ; Mon, 30 May 2016 08:39:33 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 111A86E6C3; Mon, 30 May 2016 08:39:15 +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 C6D9F6E6EB for ; Mon, 30 May 2016 08:39:12 +0000 (UTC) Received: by mail-wm0-x243.google.com with SMTP id q62so20330096wmg.3 for ; Mon, 30 May 2016 01:39:12 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=sender:from:to:cc:subject:date:message-id:in-reply-to:references; bh=ZfaylK90T/qOfJxXfkudioe3qf1/Gq1Qe981HBQyE9A=; b=iuzoPT/UtCWFi2PxHmfdUbx/KGcueUIW4IteyjbsRmJb5wgsP1LBHyAKalb/TAX7gh iDDphyx4hCWnmScoy0s8ZtLkdWZqkRYms+DH4MpbZOBLV5uXJ/GFmhlBI4dShg6HkGNV 3ApWtJOXkBh8Wmp3X9709Bt5QkUU0S57Wlb8Wi6TokH+ZZt+jxbp3uaB/1jFQgsQDGmU Em3lMTzb233sp1RuBvlTsgA3HU9fiOixScRVSEaId4QZ9LougDGEB7DQvFRMpdzt+yAR R4i1pdzQH2rNxy7VqI4G25D7A/GaGXLlVtRFYGRWbGSc4w1uPgTShYM9LVB/75Sw9+ZM dAvA== 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:cc:subject:date:message-id :in-reply-to:references; bh=ZfaylK90T/qOfJxXfkudioe3qf1/Gq1Qe981HBQyE9A=; b=l7c8Yra+6bOLferNDiClKea2iuvBifjHipU1Px3RHynIKK8AfgNMrbtVwo8Lisdpqm vgNFjhuDr6hiyy/cgn4YV7+Gkxxt/I2z6XK9a84oOUzEx7lsfJ276q01Z7s/xKQVZJcA ChJn7xlY2iKfbU/jl0gq+kmUzCOElkp0EAYzW3nJ1ZneEVRaZ1SUtEW1fj19qzLdp18o 8vZc7CwwqiiQXLjzcBjF2vARdCnmhbtVmGSGP9aewF3xMf/ptym7wYKVei0l6QO7bQ7q 2+jYy77Uf5bv6G+vX+Ggm0f553Ln+93TA0TUSB0LPkGllGrUa0MPjjnx578tTAeEu6sE wcqA== X-Gm-Message-State: ALyK8tLpvW6BK3rHSoGVYatPuAMjEtstso4ahLud5xI04h+IpVYjs/DTJOVmCO8xvdFHVw== X-Received: by 10.194.173.42 with SMTP id bh10mr29011669wjc.150.1464597550724; Mon, 30 May 2016 01:39:10 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id l9sm6945376wjm.0.2016.05.30.01.39.09 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Mon, 30 May 2016 01:39:09 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Mon, 30 May 2016 09:38:39 +0100 Message-Id: <1464597519-16659-22-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464597519-16659-1-git-send-email-chris@chris-wilson.co.uk> References: <1464597519-16659-1-git-send-email-chris@chris-wilson.co.uk> Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH v2 21/21] 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 --- 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 dfc038000e21..e371d4e75878 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 @@ -1563,6 +1562,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; + dev_priv = kzalloc(sizeof(*dev_priv), GFP_KERNEL); if (dev_priv == NULL) return -ENOMEM; @@ -2989,50 +2991,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 514d8b784319..3cb3a900b969 100644 --- a/drivers/gpu/drm/i915/i915_pci.c +++ b/drivers/gpu/drm/i915/i915_pci.c @@ -22,6 +22,7 @@ * */ +#include #include #include #include @@ -454,10 +455,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");