get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

GET /api/patches/808542/?format=api
HTTP 200 OK
Allow: GET, PUT, PATCH, HEAD, OPTIONS
Content-Type: application/json
Vary: Accept

{
    "id": 808542,
    "url": "http://patchwork.ozlabs.org/api/patches/808542/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-pci/patch/20170901072744.2409-2-dja@axtens.net/",
    "project": {
        "id": 28,
        "url": "http://patchwork.ozlabs.org/api/projects/28/?format=api",
        "name": "Linux PCI development",
        "link_name": "linux-pci",
        "list_id": "linux-pci.vger.kernel.org",
        "list_email": "linux-pci@vger.kernel.org",
        "web_url": null,
        "scm_url": null,
        "webscm_url": null,
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20170901072744.2409-2-dja@axtens.net>",
    "list_archive_url": null,
    "date": "2017-09-01T07:27:42",
    "name": "[v3,1/3] drm: split default display handler out of VGA arbiter",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "a7227a70f8938bddffc7c393b5cea9a69b01f47f",
    "submitter": {
        "id": 65792,
        "url": "http://patchwork.ozlabs.org/api/people/65792/?format=api",
        "name": "Daniel Axtens",
        "email": "dja@axtens.net"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-pci/patch/20170901072744.2409-2-dja@axtens.net/mbox/",
    "series": [
        {
            "id": 959,
            "url": "http://patchwork.ozlabs.org/api/series/959/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-pci/list/?series=959",
            "date": "2017-09-01T07:27:41",
            "name": "Split default display handling out from VGA arbiter",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/959/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/808542/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/808542/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-pci-owner@vger.kernel.org>",
        "X-Original-To": "incoming@patchwork.ozlabs.org",
        "Delivered-To": "patchwork-incoming@bilbo.ozlabs.org",
        "Authentication-Results": [
            "ozlabs.org;\n\tspf=none (mailfrom) smtp.mailfrom=vger.kernel.org\n\t(client-ip=209.132.180.67; helo=vger.kernel.org;\n\tenvelope-from=linux-pci-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=axtens.net header.i=@axtens.net\n\theader.b=\"oobRnDLz\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xk9p45qbWz9s81\n\tfor <incoming@patchwork.ozlabs.org>;\n\tFri,  1 Sep 2017 17:28:28 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1751395AbdIAH22 (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tFri, 1 Sep 2017 03:28:28 -0400",
            "from mail-pf0-f195.google.com ([209.85.192.195]:38104 \"EHLO\n\tmail-pf0-f195.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1751354AbdIAH20 (ORCPT\n\t<rfc822;linux-pci@vger.kernel.org>); Fri, 1 Sep 2017 03:28:26 -0400",
            "by mail-pf0-f195.google.com with SMTP id r187so1170920pfr.5\n\tfor <linux-pci@vger.kernel.org>; Fri, 01 Sep 2017 00:28:26 -0700 (PDT)",
            "from localhost.localdomain (124-171-202-56.dyn.iinet.net.au.\n\t[124.171.202.56]) by smtp.gmail.com with ESMTPSA id\n\tl30sm2430300pgc.61.2017.09.01.00.28.18\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128);\n\tFri, 01 Sep 2017 00:28:25 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=axtens.net; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=s16eE/mwbtFYlScofYfNbHkqxIQUZFSoZB//zgZU0Og=;\n\tb=oobRnDLzxESD0mDZnN7G6iDy1Tt6HLfc9BoqnojyTYQkcs808BFSbv3Bosbk5e/Brz\n\toQDnwcqr+o3KEZupA0HhRrihg1sOUvU5ON9+wOaLLvgsDxZ5W31ct/f3jHTqD/U6PqGg\n\tXJBYSIYK0CpRURIQtXIVeG074aXlrqV3DuDZ0=",
        "X-Google-DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed;\n\td=1e100.net; s=20161025;\n\th=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to\n\t:references;\n\tbh=s16eE/mwbtFYlScofYfNbHkqxIQUZFSoZB//zgZU0Og=;\n\tb=o8m4c3ZzKSxqssER4dKV4Zx39w1qAxOKEi/24Uz3xg9eJOf67AFwht3HgYnDv2eFCe\n\tBvmb68NyNTakIUmOOejlnpvRURb3VQA1K4cKEWOAcsoq0pA555yw84HsLGcvT/48asUo\n\tGh88vF5Sx3O6Ki8GDxZ7VKjcTSh+m4yiKl2hHdxq9Ya9io2OmtjTnzZm4RzS4r4Raxy+\n\tcxcEzrn4wjXOReI4N1eEEjG4es9CkjvV0wM1z1U9K+lpTR7BELj1ME5c1kFcrsDf2Ypt\n\tN7jbLs5tj7TRrU/NCMZOZg1gUiu4qgX+I/GEWwZN4SHJ95VaU6FB0Q78QURR8w5k8zdj\n\t0OHA==",
        "X-Gm-Message-State": "AHPjjUjR+joliDY/DvjfN1XBIsZHiOiYSuBiOMsgcAC3v8xqe+ssmJ1P\n\tIg5o4zfu5E2DS+5IeB2FbA==",
        "X-Google-Smtp-Source": "ADKCNb7lmqmp8BrEAWFqdNDay9FbbfrWaucVo06afZg6vgsqba/xjTBSLeguEoQzJV42GwNCL+RdMg==",
        "X-Received": "by 10.98.77.70 with SMTP id a67mr1248916pfb.343.1504250905773;\n\tFri, 01 Sep 2017 00:28:25 -0700 (PDT)",
        "From": "Daniel Axtens <dja@axtens.net>",
        "To": "linux-pci@vger.kernel.org, linuxppc-dev@lists.ozlabs.org,\n\tlinux-arm-kernel@lists.infradead.org",
        "Cc": "benh@kernel.crashing.org, z.liuxinliang@hisilicon.com,\n\tzourongrong@gmail.com, catalin.marinas@arm.com,\n\twill.deacon@arm.com, gabriele.paoloni@huawei.com,\n\thelgaas@kernel.org, airlied@linux.ie, daniel.vetter@intel.com,\n\talex.williamson@redhat.com, dri-devel@lists.freedesktop.org,\n\tlukas@wunner.de, ard.biesheuvel@linaro.org,\n\tlorenzo.pieralisi@arm.com, Daniel Axtens <dja@axtens.net>",
        "Subject": "[PATCH v3 1/3] drm: split default display handler out of VGA arbiter",
        "Date": "Fri,  1 Sep 2017 17:27:42 +1000",
        "Message-Id": "<20170901072744.2409-2-dja@axtens.net>",
        "X-Mailer": "git-send-email 2.11.0",
        "In-Reply-To": "<20170901072744.2409-1-dja@axtens.net>",
        "References": "<20170901072744.2409-1-dja@axtens.net>",
        "Sender": "linux-pci-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-pci.vger.kernel.org>",
        "X-Mailing-List": "linux-pci@vger.kernel.org"
    },
    "content": "Split the small bit of code that does default VGA handling out from\nthe arbiter. Add a Kconfig option to allow the kernel to be built\nwith just the default handling, or the arbiter and default handling.\n\nWhile doing this, rename the functions from vga_(set_)default_device\nto pci_(set_)default_display. This makes it clear that these functions\ndo not rely on legacy VGA access: they're about the default PCI display.\n(The device still needs to be a member of PCI_CLASS_DISPLAY_VGA.)\n\nThis should not introduce any functional change.\n\nSigned-off-by: Daniel Axtens <dja@axtens.net>\n\n---\n\nI know this adds another config option and that's a bit sad, but\nwe can't include it unconditionally as it depends on PCI.\nSuggestions welcome.\n\nv3: split from the part where we add functionality\n    rename functions\n---\n arch/ia64/pci/fixup.c             |  6 +--\n arch/powerpc/kernel/pci-common.c  |  6 +--\n arch/x86/pci/fixup.c              |  6 +--\n arch/x86/video/fbdev.c            |  4 +-\n drivers/gpu/vga/Kconfig           | 12 ++++++\n drivers/gpu/vga/Makefile          |  1 +\n drivers/gpu/vga/default_display.c | 86 +++++++++++++++++++++++++++++++++++++++\n drivers/gpu/vga/vga_switcheroo.c  |  8 ++--\n drivers/gpu/vga/vgaarb.c          | 61 ++++++---------------------\n drivers/pci/pci-sysfs.c           |  4 +-\n include/linux/default_display.h   | 44 ++++++++++++++++++++\n include/linux/vgaarb.h            | 15 -------\n 12 files changed, 173 insertions(+), 80 deletions(-)\n create mode 100644 drivers/gpu/vga/default_display.c\n create mode 100644 include/linux/default_display.h",
    "diff": "diff --git a/arch/ia64/pci/fixup.c b/arch/ia64/pci/fixup.c\nindex 41caa99add51..a5f35e767c84 100644\n--- a/arch/ia64/pci/fixup.c\n+++ b/arch/ia64/pci/fixup.c\n@@ -5,7 +5,7 @@\n \n #include <linux/pci.h>\n #include <linux/init.h>\n-#include <linux/vgaarb.h>\n+#include <linux/default_display.h>\n #include <linux/screen_info.h>\n \n #include <asm/machvec.h>\n@@ -22,7 +22,7 @@\n  * card with this copy. On laptops this copy has to be used since\n  * the main ROM may be compressed or combined with another image.\n  * See pci_map_rom() for use of this flag. Before marking the device\n- * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set\n+ * with IORESOURCE_ROM_SHADOW check if a pci_default_display is already set\n  * by either arch code or vga-arbitration; if so only apply the fixup to this\n  * already-determined primary video card.\n  */\n@@ -59,7 +59,7 @@ static void pci_fixup_video(struct pci_dev *pdev)\n \t\t}\n \t\tbus = bus->parent;\n \t}\n-\tif (!vga_default_device() || pdev == vga_default_device()) {\n+\tif (!pci_default_display() || pdev == pci_default_display()) {\n \t\tpci_read_config_word(pdev, PCI_COMMAND, &config);\n \t\tif (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {\n \t\t\tres = &pdev->resource[PCI_ROM_RESOURCE];\ndiff --git a/arch/powerpc/kernel/pci-common.c b/arch/powerpc/kernel/pci-common.c\nindex 341a7469cab8..9f82f13ac531 100644\n--- a/arch/powerpc/kernel/pci-common.c\n+++ b/arch/powerpc/kernel/pci-common.c\n@@ -31,7 +31,7 @@\n #include <linux/irq.h>\n #include <linux/vmalloc.h>\n #include <linux/slab.h>\n-#include <linux/vgaarb.h>\n+#include <linux/default_display.h>\n \n #include <asm/processor.h>\n #include <asm/io.h>\n@@ -1747,8 +1747,8 @@ static void fixup_vga(struct pci_dev *pdev)\n \tu16 cmd;\n \n \tpci_read_config_word(pdev, PCI_COMMAND, &cmd);\n-\tif ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !vga_default_device())\n-\t\tvga_set_default_device(pdev);\n+\tif ((cmd & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) || !pci_default_display())\n+\t\tpci_set_default_display(pdev);\n \n }\n DECLARE_PCI_FIXUP_CLASS_FINAL(PCI_ANY_ID, PCI_ANY_ID,\ndiff --git a/arch/x86/pci/fixup.c b/arch/x86/pci/fixup.c\nindex 11e407489db0..7e32a2a80383 100644\n--- a/arch/x86/pci/fixup.c\n+++ b/arch/x86/pci/fixup.c\n@@ -5,7 +5,7 @@\n #include <linux/delay.h>\n #include <linux/dmi.h>\n #include <linux/pci.h>\n-#include <linux/vgaarb.h>\n+#include <linux/default_display.h>\n #include <asm/hpet.h>\n #include <asm/pci_x86.h>\n \n@@ -302,7 +302,7 @@ DECLARE_PCI_FIXUP_FINAL(PCI_VENDOR_ID_INTEL,\tPCI_DEVICE_ID_INTEL_MCH_PC1,\tpcie_r\n  * card with this copy. On laptops this copy has to be used since\n  * the main ROM may be compressed or combined with another image.\n  * See pci_map_rom() for use of this flag. Before marking the device\n- * with IORESOURCE_ROM_SHADOW check if a vga_default_device is already set\n+ * with IORESOURCE_ROM_SHADOW check if a pci_default_display is already set\n  * by either arch code or vga-arbitration; if so only apply the fixup to this\n  * already-determined primary video card.\n  */\n@@ -334,7 +334,7 @@ static void pci_fixup_video(struct pci_dev *pdev)\n \t\t}\n \t\tbus = bus->parent;\n \t}\n-\tif (!vga_default_device() || pdev == vga_default_device()) {\n+\tif (!pci_default_display() || pdev == pci_default_display()) {\n \t\tpci_read_config_word(pdev, PCI_COMMAND, &config);\n \t\tif (config & (PCI_COMMAND_IO | PCI_COMMAND_MEMORY)) {\n \t\t\tres = &pdev->resource[PCI_ROM_RESOURCE];\ndiff --git a/arch/x86/video/fbdev.c b/arch/x86/video/fbdev.c\nindex 9fd24846d094..114bd9ac95d0 100644\n--- a/arch/x86/video/fbdev.c\n+++ b/arch/x86/video/fbdev.c\n@@ -9,12 +9,12 @@\n #include <linux/fb.h>\n #include <linux/pci.h>\n #include <linux/module.h>\n-#include <linux/vgaarb.h>\n+#include <linux/default_display.h>\n \n int fb_is_primary_device(struct fb_info *info)\n {\n \tstruct device *device = info->device;\n-\tstruct pci_dev *default_device = vga_default_device();\n+\tstruct pci_dev *default_device = pci_default_display();\n \tstruct pci_dev *pci_dev;\n \tstruct resource *res;\n \ndiff --git a/drivers/gpu/vga/Kconfig b/drivers/gpu/vga/Kconfig\nindex 29437eabe095..8e6edfb6d160 100644\n--- a/drivers/gpu/vga/Kconfig\n+++ b/drivers/gpu/vga/Kconfig\n@@ -1,3 +1,14 @@\n+config DEFAULT_DISPLAY\n+\tbool \"Default Display Device Support\" if EXPERT\n+\tdefault y\n+\tdepends on PCI\n+\thelp\n+\t  Some programs find it helpful to know what PCI display device is the\n+\t  default. On platforms like x86 this means the device used by the BIOS\n+\t  to show early boot messages. On other platforms this may be an arbitrary\n+\t  PCI graphics card. Select this to have a default device recorded within\n+\t  the kernel and exposed to userspace through sysfs.\n+\n config VGA_ARB\n \tbool \"VGA Arbitration\" if EXPERT\n \tdefault y\n@@ -22,6 +33,7 @@ config VGA_SWITCHEROO\n \tdepends on X86\n \tdepends on ACPI\n \tselect VGA_ARB\n+\tselect DEFAULT_DISPLAY\n \thelp\n \t  Many laptops released in 2008/9/10 have two GPUs with a multiplexer\n \t  to switch between them. This adds support for dynamic switching when\ndiff --git a/drivers/gpu/vga/Makefile b/drivers/gpu/vga/Makefile\nindex 14ca30b75d0a..3abf32c26de5 100644\n--- a/drivers/gpu/vga/Makefile\n+++ b/drivers/gpu/vga/Makefile\n@@ -1,2 +1,3 @@\n obj-$(CONFIG_VGA_ARB)  += vgaarb.o\n+obj-$(CONFIG_DEFAULT_DISPLAY) += default_display.o\n obj-$(CONFIG_VGA_SWITCHEROO) += vga_switcheroo.o\ndiff --git a/drivers/gpu/vga/default_display.c b/drivers/gpu/vga/default_display.c\nnew file mode 100644\nindex 000000000000..99e4723360da\n--- /dev/null\n+++ b/drivers/gpu/vga/default_display.c\n@@ -0,0 +1,86 @@\n+/*\n+ * default_display.c: What is the default/boot PCI VGA device?\n+ *\n+ * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>\n+ * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>\n+ * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>\n+ * (C) Copyright 2017 Canonical Ltd. (Author: Daniel Axtens <dja@axtens.net>)\n+ *\n+ * (License from vgaarb.c)\n+ * Permission is hereby granted, free of charge, to any person obtaining a\n+ * copy of this software and associated documentation files (the \"Software\"),\n+ * to deal in the Software without restriction, including without limitation\n+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n+ * and/or sell copies of the Software, and to permit persons to whom the\n+ * Software is furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice (including the next\n+ * paragraph) shall be included in all copies or substantial portions of the\n+ * Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n+ * DEALINGS\n+ * IN THE SOFTWARE.\n+ */\n+\n+/**\n+ * DOC: overview\n+ *\n+ * What device should a graphics system draw to?\n+ *\n+ * It is helpful to have a concept of a default or boot device (for\n+ * example, for autoconfiguration where there is no device speficied\n+ * by the user). That should be:\n+ *\n+ *  1) If the platform has a concept of a boot device for early boot\n+ *     messages (think BIOS displays on x86), that device.\n+ *\n+ *  2) Anything specified by an arch hook,\n+ *     e.g. arch/powerpc/kernel/pci-common.c::fixup_vga()\n+ */\n+\n+#include <linux/module.h>\n+#include <linux/kernel.h>\n+#include <linux/pci.h>\n+#include <linux/init.h>\n+\n+#include <linux/default_display.h>\n+\n+static struct pci_dev *vga_default;\n+\n+/**\n+ * pci_default_display - return the default display device\n+ *\n+ * This represents the default or boot device.\n+ *\n+ * The default implementation is rather dumb and will probably only\n+ * work properly on single vga card setups and/or x86 platforms.\n+ */\n+struct pci_dev *pci_default_display(void)\n+{\n+\treturn vga_default;\n+}\n+EXPORT_SYMBOL_GPL(pci_default_display);\n+\n+/**\n+ * pci_set_default_display - set the default display device\n+ * @pdev: pci device to set as default\n+ *\n+ * Idempotent - safe to call with the same device repeatedly.\n+ *\n+ * Drops a reference to the old default, if applicable. Takes a\n+ * reference to the new device.\n+ */\n+void pci_set_default_display(struct pci_dev *pdev)\n+{\n+\tif (vga_default == pdev)\n+\t\treturn;\n+\n+\tpci_dev_put(vga_default);\n+\tvga_default = pci_dev_get(pdev);\n+}\ndiff --git a/drivers/gpu/vga/vga_switcheroo.c b/drivers/gpu/vga/vga_switcheroo.c\nindex 3cd153c6d271..beefefc288f9 100644\n--- a/drivers/gpu/vga/vga_switcheroo.c\n+++ b/drivers/gpu/vga/vga_switcheroo.c\n@@ -41,7 +41,7 @@\n #include <linux/pm_runtime.h>\n #include <linux/seq_file.h>\n #include <linux/uaccess.h>\n-#include <linux/vgaarb.h>\n+#include <linux/default_display.h>\n #include <linux/vga_switcheroo.h>\n \n /**\n@@ -320,7 +320,7 @@ int vga_switcheroo_register_client(struct pci_dev *pdev,\n \t\t\t\t   bool driver_power_control)\n {\n \treturn register_client(pdev, ops, VGA_SWITCHEROO_UNKNOWN_ID,\n-\t\t\t       pdev == vga_default_device(),\n+\t\t\t       pdev == pci_default_display(),\n \t\t\t       driver_power_control);\n }\n EXPORT_SYMBOL(vga_switcheroo_register_client);\n@@ -397,7 +397,7 @@ bool vga_switcheroo_client_probe_defer(struct pci_dev *pdev)\n \t\t * apple-gmux is needed on pre-retina MacBook Pro\n \t\t * to probe the panel if pdev is the inactive GPU.\n \t\t */\n-\t\tif (apple_gmux_present() && pdev != vga_default_device() &&\n+\t\tif (apple_gmux_present() && pdev != pci_default_display() &&\n \t\t    !vgasr_priv.handler_flags)\n \t\t\treturn true;\n \t}\n@@ -659,7 +659,7 @@ static int vga_switchto_stage1(struct vga_switcheroo_client *new_client)\n \tif (new_client->pwr_state == VGA_SWITCHEROO_OFF)\n \t\tvga_switchon(new_client);\n \n-\tvga_set_default_device(new_client->pdev);\n+\tpci_set_default_display(new_client->pdev);\n \treturn 0;\n }\n \ndiff --git a/drivers/gpu/vga/vgaarb.c b/drivers/gpu/vga/vgaarb.c\nindex 76875f6299b8..7654bb678587 100644\n--- a/drivers/gpu/vga/vgaarb.c\n+++ b/drivers/gpu/vga/vgaarb.c\n@@ -51,6 +51,7 @@\n \n #include <linux/uaccess.h>\n \n+#include <linux/default_display.h>\n #include <linux/vgaarb.h>\n \n static void vga_arbiter_notify_clients(void);\n@@ -119,9 +120,6 @@ static int vga_str_to_iostate(char *buf, int str_size, int *io_state)\n \treturn 1;\n }\n \n-/* this is only used a cookie - it should not be dereferenced */\n-static struct pci_dev *vga_default;\n-\n static void vga_arb_device_card_gone(struct pci_dev *pdev);\n \n /* Find somebody in our list */\n@@ -135,39 +133,6 @@ static struct vga_device *vgadev_find(struct pci_dev *pdev)\n \treturn NULL;\n }\n \n-/**\n- * vga_default_device - return the default VGA device, for vgacon\n- *\n- * This can be defined by the platform. The default implementation\n- * is rather dumb and will probably only work properly on single\n- * vga card setups and/or x86 platforms.\n- *\n- * If your VGA default device is not PCI, you'll have to return\n- * NULL here. In this case, I assume it will not conflict with\n- * any PCI card. If this is not true, I'll have to define two archs\n- * hooks for enabling/disabling the VGA default device if that is\n- * possible. This may be a problem with real _ISA_ VGA cards, in\n- * addition to a PCI one. I don't know at this point how to deal\n- * with that card. Can theirs IOs be disabled at all ? If not, then\n- * I suppose it's a matter of having the proper arch hook telling\n- * us about it, so we basically never allow anybody to succeed a\n- * vga_get()...\n- */\n-struct pci_dev *vga_default_device(void)\n-{\n-\treturn vga_default;\n-}\n-EXPORT_SYMBOL_GPL(vga_default_device);\n-\n-void vga_set_default_device(struct pci_dev *pdev)\n-{\n-\tif (vga_default == pdev)\n-\t\treturn;\n-\n-\tpci_dev_put(vga_default);\n-\tvga_default = pci_dev_get(pdev);\n-}\n-\n static inline void vga_irq_set_state(struct vga_device *vgadev, bool state)\n {\n \tif (vgadev->irq_set_state)\n@@ -423,7 +388,7 @@ int vga_get(struct pci_dev *pdev, unsigned int rsrc, int interruptible)\n \tvga_check_first_use();\n \t/* The one who calls us should check for this, but lets be sure... */\n \tif (pdev == NULL)\n-\t\tpdev = vga_default_device();\n+\t\tpdev = pci_default_display();\n \tif (pdev == NULL)\n \t\treturn 0;\n \n@@ -490,7 +455,7 @@ int vga_tryget(struct pci_dev *pdev, unsigned int rsrc)\n \n \t/* The one who calls us should check for this, but lets be sure... */\n \tif (pdev == NULL)\n-\t\tpdev = vga_default_device();\n+\t\tpdev = pci_default_display();\n \tif (pdev == NULL)\n \t\treturn 0;\n \tspin_lock_irqsave(&vga_lock, flags);\n@@ -524,7 +489,7 @@ void vga_put(struct pci_dev *pdev, unsigned int rsrc)\n \n \t/* The one who calls us should check for this, but lets be sure... */\n \tif (pdev == NULL)\n-\t\tpdev = vga_default_device();\n+\t\tpdev = pci_default_display();\n \tif (pdev == NULL)\n \t\treturn;\n \tspin_lock_irqsave(&vga_lock, flags);\n@@ -667,10 +632,10 @@ static bool vga_arbiter_add_pci_device(struct pci_dev *pdev)\n \t/* Deal with VGA default device. Use first enabled one\n \t * by default if arch doesn't have it's own hook\n \t */\n-\tif (vga_default == NULL &&\n+\tif (pci_default_display() == NULL &&\n \t    ((vgadev->owns & VGA_RSRC_LEGACY_MASK) == VGA_RSRC_LEGACY_MASK)) {\n \t\tvgaarb_info(&pdev->dev, \"setting as boot VGA device\\n\");\n-\t\tvga_set_default_device(pdev);\n+\t\tpci_set_default_display(pdev);\n \t}\n \n \tvga_arbiter_check_bridge_sharing(vgadev);\n@@ -704,8 +669,8 @@ static bool vga_arbiter_del_pci_device(struct pci_dev *pdev)\n \t\tgoto bail;\n \t}\n \n-\tif (vga_default == pdev)\n-\t\tvga_set_default_device(NULL);\n+\tif (pci_default_display() == pdev)\n+\t\tpci_set_default_display(NULL);\n \n \tif (vgadev->decodes & (VGA_RSRC_LEGACY_IO | VGA_RSRC_LEGACY_MEM))\n \t\tvga_decode_count--;\n@@ -1182,7 +1147,7 @@ static ssize_t vga_arb_write(struct file *file, const char __user *buf,\n \t\tpr_debug(\"client 0x%p called 'target'\\n\", priv);\n \t\t/* if target is default */\n \t\tif (!strncmp(curr_pos, \"default\", 7))\n-\t\t\tpdev = pci_dev_get(vga_default_device());\n+\t\t\tpdev = pci_dev_get(pci_default_display());\n \t\telse {\n \t\t\tif (!vga_pci_str_to_vars(curr_pos, remaining,\n \t\t\t\t\t\t &domain, &bus, &devfn)) {\n@@ -1292,7 +1257,7 @@ static int vga_arb_open(struct inode *inode, struct file *file)\n \tspin_unlock_irqrestore(&vga_user_lock, flags);\n \n \t/* Set the client' lists of locks */\n-\tpriv->target = vga_default_device(); /* Maybe this is still null! */\n+\tpriv->target = pci_default_display(); /* Maybe this is still null! */\n \tpriv->cards[0].pdev = priv->target;\n \tpriv->cards[0].io_cnt = 0;\n \tpriv->cards[0].mem_cnt = 0;\n@@ -1455,11 +1420,11 @@ static int __init vga_arb_device_init(void)\n \t\t\tif (screen_info.lfb_base < start || limit >= end)\n \t\t\t\tcontinue;\n \n-\t\t\tif (!vga_default_device())\n+\t\t\tif (!pci_default_display())\n \t\t\t\tvgaarb_info(dev, \"setting as boot device\\n\");\n-\t\t\telse if (vgadev->pdev != vga_default_device())\n+\t\t\telse if (vgadev->pdev != pci_default_display())\n \t\t\t\tvgaarb_info(dev, \"overriding boot device\\n\");\n-\t\t\tvga_set_default_device(vgadev->pdev);\n+\t\t\tpci_set_default_display(vgadev->pdev);\n \t\t}\n #endif\n \t\tif (vgadev->bridge_has_one_vga)\ndiff --git a/drivers/pci/pci-sysfs.c b/drivers/pci/pci-sysfs.c\nindex 1eecfa301f7f..31a37178fa8a 100644\n--- a/drivers/pci/pci-sysfs.c\n+++ b/drivers/pci/pci-sysfs.c\n@@ -27,7 +27,7 @@\n #include <linux/security.h>\n #include <linux/pci-aspm.h>\n #include <linux/slab.h>\n-#include <linux/vgaarb.h>\n+#include <linux/default_display.h>\n #include <linux/pm_runtime.h>\n #include <linux/of.h>\n #include \"pci.h\"\n@@ -785,7 +785,7 @@ static ssize_t boot_vga_show(struct device *dev, struct device_attribute *attr,\n \t\t\t     char *buf)\n {\n \tstruct pci_dev *pdev = to_pci_dev(dev);\n-\tstruct pci_dev *vga_dev = vga_default_device();\n+\tstruct pci_dev *vga_dev = pci_default_display();\n \n \tif (vga_dev)\n \t\treturn sprintf(buf, \"%u\\n\", (pdev == vga_dev));\ndiff --git a/include/linux/default_display.h b/include/linux/default_display.h\nnew file mode 100644\nindex 000000000000..5ccebde96b6a\n--- /dev/null\n+++ b/include/linux/default_display.h\n@@ -0,0 +1,44 @@\n+/*\n+ * default_display.h: What is the default/boot PCI VGA device?\n+ *\n+ * (C) Copyright 2005 Benjamin Herrenschmidt <benh@kernel.crashing.org>\n+ * (C) Copyright 2007 Paulo R. Zanoni <przanoni@gmail.com>\n+ * (C) Copyright 2007, 2009 Tiago Vignatti <vignatti@freedesktop.org>\n+ * (C) Copyright 2017 Canonical Ltd. (Author: Daniel Axtens <dja@axtens.net>)\n+ *\n+ * (License from vgaarb.h)\n+ * Permission is hereby granted, free of charge, to any person obtaining a\n+ * copy of this software and associated documentation files (the \"Software\"),\n+ * to deal in the Software without restriction, including without limitation\n+ * the rights to use, copy, modify, merge, publish, distribute, sublicense,\n+ * and/or sell copies of the Software, and to permit persons to whom the\n+ * Software is furnished to do so, subject to the following conditions:\n+ *\n+ * The above copyright notice and this permission notice (including the next\n+ * paragraph) shall be included in all copies or substantial portions of the\n+ * Software.\n+ *\n+ * THE SOFTWARE IS PROVIDED \"AS IS\", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR\n+ * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,\n+ * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT.  IN NO EVENT SHALL\n+ * THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER\n+ * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING\n+ * FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER\n+ * DEALINGS\n+ * IN THE SOFTWARE.\n+ */\n+\n+#ifndef LINUX_DEFAULT_DISPLAY_H\n+#define LINUX_DEFAULT_DISPLAY_H\n+\n+struct pci_dev;\n+\n+#ifdef CONFIG_DEFAULT_DISPLAY\n+extern struct pci_dev *pci_default_display(void);\n+extern void pci_set_default_display(struct pci_dev *pdev);\n+#else\n+static inline struct pci_dev *pci_default_display(void) { return NULL; };\n+static inline void pci_set_default_display(struct pci_dev *pdev) { };\n+#endif\n+\n+#endif\ndiff --git a/include/linux/vgaarb.h b/include/linux/vgaarb.h\nindex ee162e3e879b..5434ad4af32d 100644\n--- a/include/linux/vgaarb.h\n+++ b/include/linux/vgaarb.h\n@@ -42,12 +42,6 @@\n #define VGA_RSRC_NORMAL_IO     0x04\n #define VGA_RSRC_NORMAL_MEM    0x08\n \n-/* Passing that instead of a pci_dev to use the system \"default\"\n- * device, that is the one used by vgacon. Archs will probably\n- * have to provide their own vga_default_device();\n- */\n-#define VGA_DEFAULT_DEVICE     (NULL)\n-\n struct pci_dev;\n \n /* For use by clients */\n@@ -121,15 +115,6 @@ extern void vga_put(struct pci_dev *pdev, unsigned int rsrc);\n #define vga_put(pdev, rsrc)\n #endif\n \n-\n-#ifdef CONFIG_VGA_ARB\n-extern struct pci_dev *vga_default_device(void);\n-extern void vga_set_default_device(struct pci_dev *pdev);\n-#else\n-static inline struct pci_dev *vga_default_device(void) { return NULL; };\n-static inline void vga_set_default_device(struct pci_dev *pdev) { };\n-#endif\n-\n /*\n  * Architectures should define this if they have several\n  * independent PCI domains that can afford concurrent VGA\n",
    "prefixes": [
        "v3",
        "1/3"
    ]
}