From patchwork Fri May 27 14:00:44 2016 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Chris Wilson X-Patchwork-Id: 9138439 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 7CD5C6075C for ; Fri, 27 May 2016 14:01:15 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 6F180280A3 for ; Fri, 27 May 2016 14:01:15 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 637C8281AA; Fri, 27 May 2016 14:01:15 +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 0E910280A3 for ; Fri, 27 May 2016 14:01:15 +0000 (UTC) Received: from gabe.freedesktop.org (localhost [127.0.0.1]) by gabe.freedesktop.org (Postfix) with ESMTP id 6EB186E210; Fri, 27 May 2016 14:01:09 +0000 (UTC) X-Original-To: intel-gfx@lists.freedesktop.org Delivered-To: intel-gfx@lists.freedesktop.org Received: from mail-wm0-x244.google.com (mail-wm0-x244.google.com [IPv6:2a00:1450:400c:c09::244]) by gabe.freedesktop.org (Postfix) with ESMTPS id 063016E1E3 for ; Fri, 27 May 2016 14:01:04 +0000 (UTC) Received: by mail-wm0-x244.google.com with SMTP id a136so15220183wme.0 for ; Fri, 27 May 2016 07:01:03 -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=UBNl+VFOPr7AaPCn0E9nutC/Aj3ARidJgFPZo79wfto=; b=EHXLCLc0bztCjVpYfxTF/S9b3VeYYhHMIv2i4vUQCQmTPzvwO5XiPyTXpZn0pd7Ntx r+41fLLECk+Q0q88WAWHUp7HNHkWN4tDDzVvUiSg0lt/mUaM2nkHcai2w0zMfzZndbV2 4+eMnqpNEwghzt9CP7RTzBBs3nOpY7Sec03iza0LGmN3JWRWDE3jIBzN9OchfnO6fsKD 8mhG1JDNKPCbEWLAXNkokt5MxR4Eu2JJ/s55jzgFezoZo0meYTGHEQY8QzekneRUEVpt bpQZm/pmAUiazo24dkI6FLQyqBMy0h8dV7CJbVGOoyTniEYwV/Xht6KSc+obePzUIc8J 0pBw== 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=UBNl+VFOPr7AaPCn0E9nutC/Aj3ARidJgFPZo79wfto=; b=HeiTaITGfvCOp19KXctp7K7v65tBoURMblTg8tfnSpLOSPpgWyg90KJvdUYhzcI/Nl vJiqq9uH3Sev8acK1C1fbcnU7H+zdOqWSIAqB1mgSLh4/tLgeTGUgt/RlWeKxQCuF2/J rIXI9Tl1sdIypNhc2snH8tpqRFHXDol+mzuNwCEFQSnnwoaSkbtvAP2GG8C58A+AK4Z1 Rr/jJJd5wa7GxWTYS5qjdXhGtFjHUCi4Bh5NKyp+P5aLNs4c+F0mUc1C9bZtvr+U17Wm 1HqqakSHazMaEBwyBTtaLKrXXkcAsjKphGqAcURQ9qsE52JZErqiZNkIReP5hMrbAC81 JC1w== X-Gm-Message-State: ALyK8tI+rV0BmEHq+oLMQvG8vJvYYQYJvW0vwa/cYZ9+/E/lPs1R6hgVUVAJrSBihkrKAw== X-Received: by 10.194.94.165 with SMTP id dd5mr14999423wjb.31.1464357662143; Fri, 27 May 2016 07:01:02 -0700 (PDT) Received: from haswell.alporthouse.com ([78.156.65.138]) by smtp.gmail.com with ESMTPSA id e8sm19607200wjm.23.2016.05.27.07.01.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 27 May 2016 07:01:01 -0700 (PDT) From: Chris Wilson To: intel-gfx@lists.freedesktop.org Date: Fri, 27 May 2016 15:00:44 +0100 Message-Id: <1464357644-16775-12-git-send-email-chris@chris-wilson.co.uk> X-Mailer: git-send-email 2.8.1 In-Reply-To: <1464357644-16775-1-git-send-email-chris@chris-wilson.co.uk> References: <1464357644-16775-1-git-send-email-chris@chris-wilson.co.uk> Cc: Daniel Vetter Subject: [Intel-gfx] [PATCH 11/11] 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. 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 79b6834bc6b2..bf607ca8ddb4 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; @@ -2988,50 +2990,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");