get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 1282823,
    "url": "http://patchwork.ozlabs.org/api/patches/1282823/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200504164349.1523441-1-jeffrey.t.kirsher@intel.com/",
    "project": {
        "id": 46,
        "url": "http://patchwork.ozlabs.org/api/projects/46/?format=api",
        "name": "Intel Wired Ethernet development",
        "link_name": "intel-wired-lan",
        "list_id": "intel-wired-lan.osuosl.org",
        "list_email": "intel-wired-lan@osuosl.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<20200504164349.1523441-1-jeffrey.t.kirsher@intel.com>",
    "list_archive_url": null,
    "date": "2020-05-04T16:43:41",
    "name": "[net-next,v3,1/9] Implementation of Virtual Bus",
    "commit_ref": null,
    "pull_url": null,
    "state": "changes-requested",
    "archived": false,
    "hash": "03c2bd04d8fe9eb18509532bd4a7296b006eca2d",
    "submitter": {
        "id": 473,
        "url": "http://patchwork.ozlabs.org/api/people/473/?format=api",
        "name": "Kirsher, Jeffrey T",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "delegate": {
        "id": 68,
        "url": "http://patchwork.ozlabs.org/api/users/68/?format=api",
        "username": "jtkirshe",
        "first_name": "Jeff",
        "last_name": "Kirsher",
        "email": "jeffrey.t.kirsher@intel.com"
    },
    "mbox": "http://patchwork.ozlabs.org/project/intel-wired-lan/patch/20200504164349.1523441-1-jeffrey.t.kirsher@intel.com/mbox/",
    "series": [
        {
            "id": 174549,
            "url": "http://patchwork.ozlabs.org/api/series/174549/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/intel-wired-lan/list/?series=174549",
            "date": "2020-05-04T16:43:44",
            "name": "[net-next,v3,1/9] Implementation of Virtual Bus",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/174549/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/1282823/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/1282823/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<intel-wired-lan-bounces@osuosl.org>",
        "X-Original-To": [
            "incoming@patchwork.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Delivered-To": [
            "patchwork-incoming@bilbo.ozlabs.org",
            "intel-wired-lan@lists.osuosl.org"
        ],
        "Authentication-Results": [
            "ozlabs.org;\n spf=pass (sender SPF authorized) smtp.mailfrom=osuosl.org\n (client-ip=140.211.166.136; helo=silver.osuosl.org;\n envelope-from=intel-wired-lan-bounces@osuosl.org; receiver=<UNKNOWN>)",
            "ozlabs.org;\n dmarc=fail (p=none dis=none) header.from=intel.com"
        ],
        "Received": [
            "from silver.osuosl.org (smtp3.osuosl.org [140.211.166.136])\n\t(using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits))\n\t(No client certificate requested)\n\tby ozlabs.org (Postfix) with ESMTPS id 49G7wd3wYyz9sP7\n\tfor <incoming@patchwork.ozlabs.org>; Tue,  5 May 2020 02:44:00 +1000 (AEST)",
            "from localhost (localhost [127.0.0.1])\n\tby silver.osuosl.org (Postfix) with ESMTP id 0DA5D20482;\n\tMon,  4 May 2020 16:43:59 +0000 (UTC)",
            "from silver.osuosl.org ([127.0.0.1])\n\tby localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n\twith ESMTP id 8rzzQM1dxhm2; Mon,  4 May 2020 16:43:54 +0000 (UTC)",
            "from ash.osuosl.org (ash.osuosl.org [140.211.166.34])\n\tby silver.osuosl.org (Postfix) with ESMTP id 9BBFE20117;\n\tMon,  4 May 2020 16:43:54 +0000 (UTC)",
            "from hemlock.osuosl.org (smtp2.osuosl.org [140.211.166.133])\n by ash.osuosl.org (Postfix) with ESMTP id C2EBD1BF857\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2020 16:43:53 +0000 (UTC)",
            "from localhost (localhost [127.0.0.1])\n by hemlock.osuosl.org (Postfix) with ESMTP id BE32D88C99\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2020 16:43:53 +0000 (UTC)",
            "from hemlock.osuosl.org ([127.0.0.1])\n by localhost (.osuosl.org [127.0.0.1]) (amavisd-new, port 10024)\n with ESMTP id uqDSHuUX74al for <intel-wired-lan@lists.osuosl.org>;\n Mon,  4 May 2020 16:43:52 +0000 (UTC)",
            "from mga03.intel.com (mga03.intel.com [134.134.136.65])\n by hemlock.osuosl.org (Postfix) with ESMTPS id 0E11B88378\n for <intel-wired-lan@lists.osuosl.org>; Mon,  4 May 2020 16:43:51 +0000 (UTC)",
            "from fmsmga006.fm.intel.com ([10.253.24.20])\n by orsmga103.jf.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384;\n 04 May 2020 09:43:51 -0700",
            "from jtkirshe-desk1.jf.intel.com ([134.134.177.86])\n by fmsmga006.fm.intel.com with ESMTP; 04 May 2020 09:43:50 -0700"
        ],
        "X-Virus-Scanned": [
            "amavisd-new at osuosl.org",
            "amavisd-new at osuosl.org"
        ],
        "X-Greylist": "domain auto-whitelisted by SQLgrey-1.7.6",
        "IronPort-SDR": [
            "\n +a9yrziffCtiqziWKVM6S0+q7GUnsOstZf1CZMQS+cipOhooeEL+jIgzDMhFWCb6QKLgxCxjpB\n SA0J8C6+oJnA==",
            "\n nCb382/I+WNbuzt0HhmMU+oMhnqodVl7vE8GM/+NJHOY1WN0/O3R1+TrSsRd6w77aHf/6OfLK8\n y75KkPmC3M+A=="
        ],
        "X-Amp-Result": "SKIPPED(no attachment in message)",
        "X-Amp-File-Uploaded": "False",
        "X-ExtLoop1": "1",
        "X-IronPort-AV": "E=Sophos;i=\"5.73,352,1583222400\"; d=\"scan'208\";a=\"461073905\"",
        "From": "Jeff Kirsher <jeffrey.t.kirsher@intel.com>",
        "To": "intel-wired-lan@lists.osuosl.org",
        "Date": "Mon,  4 May 2020 09:43:41 -0700",
        "Message-Id": "<20200504164349.1523441-1-jeffrey.t.kirsher@intel.com>",
        "X-Mailer": "git-send-email 2.26.2",
        "MIME-Version": "1.0",
        "Subject": "[Intel-wired-lan] [net-next v3 1/9] Implementation of Virtual Bus",
        "X-BeenThere": "intel-wired-lan@osuosl.org",
        "X-Mailman-Version": "2.1.29",
        "Precedence": "list",
        "List-Id": "Intel Wired Ethernet Linux Kernel Driver Development\n <intel-wired-lan.osuosl.org>",
        "List-Unsubscribe": "<https://lists.osuosl.org/mailman/options/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=unsubscribe>",
        "List-Archive": "<http://lists.osuosl.org/pipermail/intel-wired-lan/>",
        "List-Post": "<mailto:intel-wired-lan@osuosl.org>",
        "List-Help": "<mailto:intel-wired-lan-request@osuosl.org?subject=help>",
        "List-Subscribe": "<https://lists.osuosl.org/mailman/listinfo/intel-wired-lan>,\n <mailto:intel-wired-lan-request@osuosl.org?subject=subscribe>",
        "Cc": "Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>",
        "Content-Type": "text/plain; charset=\"us-ascii\"",
        "Content-Transfer-Encoding": "7bit",
        "Errors-To": "intel-wired-lan-bounces@osuosl.org",
        "Sender": "\"Intel-wired-lan\" <intel-wired-lan-bounces@osuosl.org>"
    },
    "content": "From: Dave Ertman <david.m.ertman@intel.com>\n\nThis is the initial implementation of the Virtual Bus,\nvirtbus_device and virtbus_driver.  The virtual bus is\na software based bus intended to support registering\nvirtbus_devices and virtbus_drivers and provide matching\nbetween them and probing of the registered drivers.\n\nThe bus will support probe/remove shutdown and\nsuspend/resume callbacks.\n\nKconfig and Makefile alterations are included\n\nSigned-off-by: Dave Ertman <david.m.ertman@intel.com>\nSigned-off-by: Kiran Patil <kiran.patil@intel.com>\nReviewed-by: Pierre-Louis Bossart <pierre-louis.bossart@linux.intel.com>\nTested-by: Andrew Bowers <andrewx.bowers@intel.com>\nSigned-off-by: Jeff Kirsher <jeffrey.t.kirsher@intel.com>\n---\n Documentation/driver-api/virtual_bus.rst |  88 ++++++++\n drivers/bus/Kconfig                      |  10 +\n drivers/bus/Makefile                     |   2 +\n drivers/bus/virtual_bus.c                | 255 +++++++++++++++++++++++\n include/linux/mod_devicetable.h          |   8 +\n include/linux/virtual_bus.h              |  62 ++++++\n scripts/mod/devicetable-offsets.c        |   3 +\n scripts/mod/file2alias.c                 |   7 +\n 8 files changed, 435 insertions(+)\n create mode 100644 Documentation/driver-api/virtual_bus.rst\n create mode 100644 drivers/bus/virtual_bus.c\n create mode 100644 include/linux/virtual_bus.h",
    "diff": "diff --git a/Documentation/driver-api/virtual_bus.rst b/Documentation/driver-api/virtual_bus.rst\nnew file mode 100644\nindex 000000000000..33cef5433dcd\n--- /dev/null\n+++ b/Documentation/driver-api/virtual_bus.rst\n@@ -0,0 +1,88 @@\n+===============================\n+Virtual Bus Devices and Drivers\n+===============================\n+\n+See <linux/virtual_bus.h> for the models for virtbus_device and virtbus_driver.\n+This bus is meant to be a minimalist software based bus to attach generic\n+devices and drivers to so that a chunk of data can be passed between them.\n+\n+Memory Allocation Lifespan and Model\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+Originating KO - The kernel object that is defining either the\n+virtbus_device or the virtbus_driver and registering it with the virtual_bus.\n+\n+The originating KO is expected to allocate memory for the virtbus_device or\n+virtbus_driver before registering it with the virtual_bus.\n+\n+For a virtbus_device, this memory is expected to remain viable until the\n+device's mandatory .release() callback is accessed.  The memory cleanup will\n+ideally be performed within this callback.\n+\n+For a virtbus_driver, this memory is expected to remain viable until the\n+driver's .remove() or .shutdown() callbacks are accessed.  The memory cleanup\n+will ideally be performed with these callbacks.\n+\n+Device Enumeration\n+~~~~~~~~~~~~~~~~~~\n+\n+Enumeration is handled automatically by the bus infrastructure.\n+\n+Device naming and driver binding\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+The virtbus_device.dev.name is the canonical name for the device. It is\n+built from two other parts:\n+\n+        - virtbus_device.match_name (used for matching).\n+        - virtbus_device.id (generated automatically from ida_simple calls)\n+\n+Virtbus device's sub-device names are always in \"<name>.<instance>\" format.\n+\n+For a virtbus_device to be matched with a virtbus_driver, the device's match\n+name must be populated, as this is what will be evaluated to perform the match.\n+\n+Common Usage and Structure Design\n+~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~\n+\n+The two (or more) Originating KO's (one for the driver and one or more for\n+the devices) will have to have a common header file, so that a struct can\n+be defined that they both use.  This allows for the following design.\n+\n+In the common header file outside of the virtual_bus infrastructure, define\n+struct virtbus_object:\n+\n+                 virtbus_object\n+                        |\n+                -------------------------\n+                |                       |\n+        virtbus_device          private_struct/data\n+\n+The virtbus_device cannot be a pointer so that a container_of can be\n+performed by the driver.\n+\n+The device originating KO will allocate a virtbus_object and then populate\n+virtbus_device->match_name and register the virtbus_device with virtbus.\n+\n+When the virtbus_driver registers with the virtual_bus and a match is made,\n+the .probe() callback of the driver will be called with the virtbus_device\n+struct as a parameter.  This allows the virtbus_driver to perform a\n+contain_of call to get access to the virtbus_object, and to the pointer to\n+the private_struct/data.\n+\n+This is the main goal of virtual_bus, to get a common pointer available\n+to both of the originating KOs involved in a match.\n+\n+Mandatory Elements\n+~~~~~~~~~~~~~~~~~\n+\n+virtbus_device:\n+        .relase() callback must not be NULL and is expected to perform\n+                memory cleanup.\n+        .match_name must be populated to be able to match with a driver\n+\n+virtbus_driver:\n+        .probe() callback must not be NULL\n+        .remove() callback must not be NULL\n+        .shutdown() callback must not be NULL\n+        .id_table must not be NULL, used to perform matching\ndiff --git a/drivers/bus/Kconfig b/drivers/bus/Kconfig\nindex 6d4e4497b59b..00553c78510c 100644\n--- a/drivers/bus/Kconfig\n+++ b/drivers/bus/Kconfig\n@@ -203,4 +203,14 @@ config DA8XX_MSTPRI\n source \"drivers/bus/fsl-mc/Kconfig\"\n source \"drivers/bus/mhi/Kconfig\"\n \n+config VIRTUAL_BUS\n+       tristate \"Software based Virtual Bus\"\n+       help\n+         Provides a software bus for virtbus_devices to be added to it\n+         and virtbus_drivers to be registered on it.  It matches driver\n+         and device based on id and calls the driver's probe routine.\n+         One example is the irdma driver needing to connect with various\n+         PCI LAN drivers to request resources (queues) to be able to perform\n+         its function.\n+\n endmenu\ndiff --git a/drivers/bus/Makefile b/drivers/bus/Makefile\nindex 05f32cd694a4..d30828a4768c 100644\n--- a/drivers/bus/Makefile\n+++ b/drivers/bus/Makefile\n@@ -37,3 +37,5 @@ obj-$(CONFIG_DA8XX_MSTPRI)\t+= da8xx-mstpri.o\n \n # MHI\n obj-$(CONFIG_MHI_BUS)\t\t+= mhi/\n+\n+obj-$(CONFIG_VIRTUAL_BUS)\t+= virtual_bus.o\ndiff --git a/drivers/bus/virtual_bus.c b/drivers/bus/virtual_bus.c\nnew file mode 100644\nindex 000000000000..fe8000a53a0a\n--- /dev/null\n+++ b/drivers/bus/virtual_bus.c\n@@ -0,0 +1,255 @@\n+// SPDX-License-Identifier: GPL-2.0-only\n+/*\n+ * virtual_bus.c - lightweight software based bus for virtual devices\n+ *\n+ * Copyright (c) 2019-2020 Intel Corporation\n+ *\n+ * Please see Documentation/driver-api/virtual_bus.rst for\n+ * more information\n+ */\n+\n+#include <linux/string.h>\n+#include <linux/virtual_bus.h>\n+#include <linux/of_irq.h>\n+#include <linux/module.h>\n+#include <linux/init.h>\n+#include <linux/pm_runtime.h>\n+#include <linux/pm_domain.h>\n+#include <linux/acpi.h>\n+#include <linux/device.h>\n+\n+MODULE_LICENSE(\"GPL v2\");\n+MODULE_DESCRIPTION(\"Virtual Bus\");\n+MODULE_AUTHOR(\"David Ertman <david.m.ertman@intel.com>\");\n+MODULE_AUTHOR(\"Kiran Patil <kiran.patil@intel.com>\");\n+\n+static DEFINE_IDA(virtbus_dev_ida);\n+#define VIRTBUS_INVALID_ID\t0xFFFFFFFF\n+\n+static const\n+struct virtbus_dev_id *virtbus_match_id(const struct virtbus_dev_id *id,\n+\t\t\t\t\tstruct virtbus_device *vdev)\n+{\n+\twhile (id->name[0]) {\n+\t\tif (!strcmp(vdev->match_name, id->name))\n+\t\t\treturn id;\n+\t\tid++;\n+\t}\n+\treturn NULL;\n+}\n+\n+static int virtbus_match(struct device *dev, struct device_driver *drv)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(drv);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(dev);\n+\n+\treturn virtbus_match_id(vdrv->id_table, vdev) != NULL;\n+}\n+\n+static int virtbus_probe(struct device *dev)\n+{\n+\treturn dev->driver->probe(dev);\n+}\n+\n+static int virtbus_remove(struct device *dev)\n+{\n+\treturn dev->driver->remove(dev);\n+}\n+\n+static void virtbus_shutdown(struct device *dev)\n+{\n+\tdev->driver->shutdown(dev);\n+}\n+\n+static int virtbus_suspend(struct device *dev, pm_message_t state)\n+{\n+\tif (!dev->driver->suspend)\n+\t\treturn 0;\n+\n+\treturn dev->driver->suspend(dev, state);\n+}\n+\n+static int virtbus_resume(struct device *dev)\n+{\n+\tif (!dev->driver->resume)\n+\t\treturn 0;\n+\n+\treturn dev->driver->resume(dev);\n+}\n+\n+struct bus_type virtual_bus_type = {\n+\t.name = \"virtbus\",\n+\t.match = virtbus_match,\n+\t.probe = virtbus_probe,\n+\t.remove = virtbus_remove,\n+\t.shutdown = virtbus_shutdown,\n+\t.suspend = virtbus_suspend,\n+\t.resume = virtbus_resume,\n+};\n+\n+/**\n+ * virtbus_release_device - Destroy a virtbus device\n+ * @_dev: device to release\n+ */\n+static void virtbus_release_device(struct device *_dev)\n+{\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\tu32 ida = vdev->id;\n+\n+\tvdev->release(vdev);\n+\tif (ida != VIRTBUS_INVALID_ID)\n+\t\tida_simple_remove(&virtbus_dev_ida, ida);\n+}\n+\n+/**\n+ * virtbus_register_device - add a virtual bus device\n+ * @vdev: virtual bus device to add\n+ */\n+int virtbus_register_device(struct virtbus_device *vdev)\n+{\n+\tint ret;\n+\n+\tif (WARN_ON(!vdev->release))\n+\t\treturn -EINVAL;\n+\n+\t/* All error paths out of this function after the device_initialize\n+\t * must perform a put_device() so that the .release() callback is\n+\t * called for an error condition.\n+\t */\n+\tdevice_initialize(&vdev->dev);\n+\n+\tvdev->dev.bus = &virtual_bus_type;\n+\tvdev->dev.release = virtbus_release_device;\n+\n+\t/* All device IDs are automatically allocated */\n+\tret = ida_simple_get(&virtbus_dev_ida, 0, 0, GFP_KERNEL);\n+\n+\tif (ret < 0) {\n+\t\tvdev->id = VIRTBUS_INVALID_ID;\n+\t\tdev_err(&vdev->dev, \"get IDA idx for virtbus device failed!\\n\");\n+\t\tgoto device_add_err;\n+\t}\n+\n+\tvdev->id = ret;\n+\n+\tret = dev_set_name(&vdev->dev, \"%s.%d\", vdev->match_name, vdev->id);\n+\tif (ret) {\n+\t\tdev_err(&vdev->dev, \"dev_set_name failed for device\\n\");\n+\t\tgoto device_add_err;\n+\t}\n+\n+\tdev_dbg(&vdev->dev, \"Registering virtbus device '%s'\\n\",\n+\t\tdev_name(&vdev->dev));\n+\n+\tret = device_add(&vdev->dev);\n+\tif (ret)\n+\t\tgoto device_add_err;\n+\n+\treturn 0;\n+\n+device_add_err:\n+\tdev_err(&vdev->dev, \"Add device to virtbus failed!: %d\\n\", ret);\n+\tput_device(&vdev->dev);\n+\n+\treturn ret;\n+}\n+EXPORT_SYMBOL_GPL(virtbus_register_device);\n+\n+static int virtbus_probe_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\tint ret;\n+\n+\tret = dev_pm_domain_attach(_dev, true);\n+\tif (ret) {\n+\t\tdev_warn(_dev, \"Failed to attach to PM Domain : %d\\n\", ret);\n+\t\treturn ret;\n+\t}\n+\n+\tret = vdrv->probe(vdev);\n+\tif (ret) {\n+\t\tdev_err(&vdev->dev, \"Probe returned error\\n\");\n+\t\tdev_pm_domain_detach(_dev, true);\n+\t}\n+\n+\treturn ret;\n+}\n+\n+static int virtbus_remove_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\tint ret = 0;\n+\n+\tret = vdrv->remove(vdev);\n+\tdev_pm_domain_detach(_dev, true);\n+\n+\treturn ret;\n+}\n+\n+static void virtbus_shutdown_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tvdrv->shutdown(vdev);\n+}\n+\n+static int virtbus_suspend_driver(struct device *_dev, pm_message_t state)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tif (!vdrv->suspend)\n+\t\treturn 0;\n+\n+\treturn vdrv->suspend(vdev, state);\n+}\n+\n+static int virtbus_resume_driver(struct device *_dev)\n+{\n+\tstruct virtbus_driver *vdrv = to_virtbus_drv(_dev->driver);\n+\tstruct virtbus_device *vdev = to_virtbus_dev(_dev);\n+\n+\tif (!vdrv->resume)\n+\t\treturn 0;\n+\n+\treturn vdrv->resume(vdev);\n+}\n+\n+/**\n+ * __virtbus_register_driver - register a driver for virtual bus devices\n+ * @vdrv: virtbus_driver structure\n+ * @owner: owning module/driver\n+ */\n+int __virtbus_register_driver(struct virtbus_driver *vdrv, struct module *owner)\n+{\n+\tif (!vdrv->probe || !vdrv->remove || !vdrv->shutdown || !vdrv->id_table)\n+\t\treturn -EINVAL;\n+\n+\tvdrv->driver.owner = owner;\n+\tvdrv->driver.bus = &virtual_bus_type;\n+\tvdrv->driver.probe = virtbus_probe_driver;\n+\tvdrv->driver.remove = virtbus_remove_driver;\n+\tvdrv->driver.shutdown = virtbus_shutdown_driver;\n+\tvdrv->driver.suspend = virtbus_suspend_driver;\n+\tvdrv->driver.resume = virtbus_resume_driver;\n+\n+\treturn driver_register(&vdrv->driver);\n+}\n+EXPORT_SYMBOL_GPL(__virtbus_register_driver);\n+\n+static int __init virtual_bus_init(void)\n+{\n+\treturn bus_register(&virtual_bus_type);\n+}\n+\n+static void __exit virtual_bus_exit(void)\n+{\n+\tbus_unregister(&virtual_bus_type);\n+\tida_destroy(&virtbus_dev_ida);\n+}\n+\n+module_init(virtual_bus_init);\n+module_exit(virtual_bus_exit);\ndiff --git a/include/linux/mod_devicetable.h b/include/linux/mod_devicetable.h\nindex 4c2ddd0941a7..60bcfe75fb94 100644\n--- a/include/linux/mod_devicetable.h\n+++ b/include/linux/mod_devicetable.h\n@@ -832,4 +832,12 @@ struct mhi_device_id {\n \tkernel_ulong_t driver_data;\n };\n \n+#define VIRTBUS_NAME_SIZE 20\n+#define VIRTBUS_MODULE_PREFIX \"virtbus:\"\n+\n+struct virtbus_dev_id {\n+\tchar name[VIRTBUS_NAME_SIZE];\n+\tkernel_ulong_t driver_data;\n+};\n+\n #endif /* LINUX_MOD_DEVICETABLE_H */\ndiff --git a/include/linux/virtual_bus.h b/include/linux/virtual_bus.h\nnew file mode 100644\nindex 000000000000..4872fd5a9218\n--- /dev/null\n+++ b/include/linux/virtual_bus.h\n@@ -0,0 +1,62 @@\n+/* SPDX-License-Identifier: GPL-2.0-only */\n+/*\n+ * virtual_bus.h - lightweight software bus\n+ *\n+ * Copyright (c) 2019-2020 Intel Corporation\n+ *\n+ * Please see Documentation/driver-api/virtual_bus.rst for more information\n+ */\n+\n+#ifndef _VIRTUAL_BUS_H_\n+#define _VIRTUAL_BUS_H_\n+\n+#include <linux/device.h>\n+\n+struct virtbus_device {\n+\tstruct device dev;\n+\tconst char *match_name;\n+\tvoid (*release)(struct virtbus_device *);\n+\tu32 id;\n+};\n+\n+struct virtbus_driver {\n+\tint (*probe)(struct virtbus_device *);\n+\tint (*remove)(struct virtbus_device *);\n+\tvoid (*shutdown)(struct virtbus_device *);\n+\tint (*suspend)(struct virtbus_device *, pm_message_t);\n+\tint (*resume)(struct virtbus_device *);\n+\tstruct device_driver driver;\n+\tconst struct virtbus_dev_id *id_table;\n+};\n+\n+static inline\n+struct virtbus_device *to_virtbus_dev(struct device *dev)\n+{\n+\treturn container_of(dev, struct virtbus_device, dev);\n+}\n+\n+static inline\n+struct virtbus_driver *to_virtbus_drv(struct device_driver *drv)\n+{\n+\treturn container_of(drv, struct virtbus_driver, driver);\n+}\n+\n+int virtbus_register_device(struct virtbus_device *vdev);\n+\n+int\n+__virtbus_register_driver(struct virtbus_driver *vdrv, struct module *owner);\n+\n+#define virtbus_register_driver(vdrv) \\\n+\t__virtbus_register_driver(vdrv, THIS_MODULE)\n+\n+static inline void virtbus_unregister_device(struct virtbus_device *vdev)\n+{\n+\tdevice_unregister(&vdev->dev);\n+}\n+\n+static inline void virtbus_unregister_driver(struct virtbus_driver *vdrv)\n+{\n+\tdriver_unregister(&vdrv->driver);\n+}\n+\n+#endif /* _VIRTUAL_BUS_H_ */\ndiff --git a/scripts/mod/devicetable-offsets.c b/scripts/mod/devicetable-offsets.c\nindex 010be8ba2116..0c8e0e3a7c84 100644\n--- a/scripts/mod/devicetable-offsets.c\n+++ b/scripts/mod/devicetable-offsets.c\n@@ -241,5 +241,8 @@ int main(void)\n \tDEVID(mhi_device_id);\n \tDEVID_FIELD(mhi_device_id, chan);\n \n+\tDEVID(virtbus_dev_id);\n+\tDEVID_FIELD(virtbus_dev_id, name);\n+\n \treturn 0;\n }\ndiff --git a/scripts/mod/file2alias.c b/scripts/mod/file2alias.c\nindex 02d5d79da284..7d78fa3fba34 100644\n--- a/scripts/mod/file2alias.c\n+++ b/scripts/mod/file2alias.c\n@@ -1358,7 +1358,13 @@ static int do_mhi_entry(const char *filename, void *symval, char *alias)\n {\n \tDEF_FIELD_ADDR(symval, mhi_device_id, chan);\n \tsprintf(alias, MHI_DEVICE_MODALIAS_FMT, *chan);\n+\treturn 1;\n+}\n \n+static int do_virtbus_entry(const char *filename, void *symval, char *alias)\n+{\n+\tDEF_FIELD_ADDR(symval, virtbus_dev_id, name);\n+\tsprintf(alias, VIRTBUS_MODULE_PREFIX \"%s\", *name);\n \treturn 1;\n }\n \n@@ -1436,6 +1442,7 @@ static const struct devtable devtable[] = {\n \t{\"tee\", SIZE_tee_client_device_id, do_tee_entry},\n \t{\"wmi\", SIZE_wmi_device_id, do_wmi_entry},\n \t{\"mhi\", SIZE_mhi_device_id, do_mhi_entry},\n+\t{\"virtbus\", SIZE_virtbus_dev_id, do_virtbus_entry},\n };\n \n /* Create MODULE_ALIAS() statements.\n",
    "prefixes": [
        "net-next",
        "v3",
        "1/9"
    ]
}