get:
Show a patch.

patch:
Update a patch.

put:
Update a patch.

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

{
    "id": 807143,
    "url": "http://patchwork.ozlabs.org/api/patches/807143/?format=api",
    "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/patch/1504018610-10822-2-git-send-email-ulf.hansson@linaro.org/",
    "project": {
        "id": 35,
        "url": "http://patchwork.ozlabs.org/api/projects/35/?format=api",
        "name": "Linux I2C development",
        "link_name": "linux-i2c",
        "list_id": "linux-i2c.vger.kernel.org",
        "list_email": "linux-i2c@vger.kernel.org",
        "web_url": "",
        "scm_url": "",
        "webscm_url": "",
        "list_archive_url": "",
        "list_archive_url_format": "",
        "commit_url_format": ""
    },
    "msgid": "<1504018610-10822-2-git-send-email-ulf.hansson@linaro.org>",
    "list_archive_url": null,
    "date": "2017-08-29T14:56:43",
    "name": "[v3,1/8] PM / Sleep: Make the runtime PM centric path known to the PM core",
    "commit_ref": null,
    "pull_url": null,
    "state": "not-applicable",
    "archived": false,
    "hash": "ff16f2bff14f3ef8a88cd620f15c0084312e0206",
    "submitter": {
        "id": 21036,
        "url": "http://patchwork.ozlabs.org/api/people/21036/?format=api",
        "name": "Ulf Hansson",
        "email": "ulf.hansson@linaro.org"
    },
    "delegate": null,
    "mbox": "http://patchwork.ozlabs.org/project/linux-i2c/patch/1504018610-10822-2-git-send-email-ulf.hansson@linaro.org/mbox/",
    "series": [
        {
            "id": 387,
            "url": "http://patchwork.ozlabs.org/api/series/387/?format=api",
            "web_url": "http://patchwork.ozlabs.org/project/linux-i2c/list/?series=387",
            "date": "2017-08-29T14:56:42",
            "name": "PM / ACPI / i2c: Deploy runtime PM centric path for system sleep",
            "version": 3,
            "mbox": "http://patchwork.ozlabs.org/series/387/mbox/"
        }
    ],
    "comments": "http://patchwork.ozlabs.org/api/patches/807143/comments/",
    "check": "pending",
    "checks": "http://patchwork.ozlabs.org/api/patches/807143/checks/",
    "tags": {},
    "related": [],
    "headers": {
        "Return-Path": "<linux-i2c-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-i2c-owner@vger.kernel.org;\n\treceiver=<UNKNOWN>)",
            "ozlabs.org; dkim=pass (1024-bit key;\n\tunprotected) header.d=linaro.org header.i=@linaro.org\n\theader.b=\"jjn6j+ha\"; dkim-atps=neutral"
        ],
        "Received": [
            "from vger.kernel.org (vger.kernel.org [209.132.180.67])\n\tby ozlabs.org (Postfix) with ESMTP id 3xhWvX0w9Mz9sR9\n\tfor <incoming@patchwork.ozlabs.org>;\n\tWed, 30 Aug 2017 00:57:28 +1000 (AEST)",
            "(majordomo@vger.kernel.org) by vger.kernel.org via listexpand\n\tid S1754669AbdH2O5H (ORCPT <rfc822;incoming@patchwork.ozlabs.org>);\n\tTue, 29 Aug 2017 10:57:07 -0400",
            "from mail-lf0-f52.google.com ([209.85.215.52]:36079 \"EHLO\n\tmail-lf0-f52.google.com\" rhost-flags-OK-OK-OK-OK) by vger.kernel.org\n\twith ESMTP id S1754658AbdH2O5D (ORCPT\n\t<rfc822; linux-i2c@vger.kernel.org>); Tue, 29 Aug 2017 10:57:03 -0400",
            "by mail-lf0-f52.google.com with SMTP id z12so14368994lfd.3\n\tfor <linux-i2c@vger.kernel.org>; Tue, 29 Aug 2017 07:57:02 -0700 (PDT)",
            "from localhost.localdomain (h-158-174-22-67.NA.cust.bahnhof.se.\n\t[158.174.22.67]) by smtp.gmail.com with ESMTPSA id\n\ty23sm652454ljd.19.2017.08.29.07.56.59\n\t(version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128);\n\tTue, 29 Aug 2017 07:57:00 -0700 (PDT)"
        ],
        "DKIM-Signature": "v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google;\n\th=from:to:cc:subject:date:message-id:in-reply-to:references;\n\tbh=Fo+NtBKyToNny54nckr1MxS5d4RhjFqGF0/5CAXxONY=;\n\tb=jjn6j+haoh360x0zIcu37UQ/R4YZ5h9hpLAiPzt5S5ZUUw3GF6tEjDpViBrP3E8G8G\n\tcuHL8iAzAu/7OsTXIIPcWoA1Ytha8LevSZLDUUP6uHZpWrVtQ2xo2nyYB3bxHipntjdX\n\tG5A2LS/Bn2lR8pcLIOpc6wxtrhlwZYopqXXI0=",
        "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=Fo+NtBKyToNny54nckr1MxS5d4RhjFqGF0/5CAXxONY=;\n\tb=O3Dc2yz6mJNuToqGcBEdRlL65tZXQzG9lr1kg4eeyIw2go8uvQEptLspeuWtH2l6t7\n\tl7IC4KhxMaQoeE04Cn01ZqsyfCm/4l61kGki7aqg5aPmUDL20/z4eRZ65fVxVbh4AUM3\n\tak40UEkDlU+SltAQwAfhoNLyYnf5b3RoQoJvJDpxsEC9FIvhfIpbh/wuj8KCAUOaaAK4\n\tY5xeW/hrOprlZbkbaN+VdJ5QSQ+fgVZoxwJbjv1b2YVEcIjXD+P/OsOmZpZEy3mXJEH0\n\t4xgH/VztWjoOe5hrbSHX9NJBHBVxaEInejXSkcXvj+FovLhFbSkwZLYhatQLgwj/I5Y2\n\tEN8Q==",
        "X-Gm-Message-State": "AHYfb5hpUu1ozXLAyUKrZnKeSrXn2z13CdJCFEQWLzfiSPbn5IscjlJ6\n\tQuYZKmI2hK0+CDeO",
        "X-Received": "by 10.46.33.151 with SMTP id h23mr298552lji.92.1504018621596;\n\tTue, 29 Aug 2017 07:57:01 -0700 (PDT)",
        "From": "Ulf Hansson <ulf.hansson@linaro.org>",
        "To": "Wolfram Sang <wsa@the-dreams.de>,\n\t\"Rafael J . Wysocki\" <rjw@rjwysocki.net>,\n\tLen Brown <lenb@kernel.org>, linux-acpi@vger.kernel.org,\n\tlinux-pm@vger.kernel.org",
        "Cc": "Kevin Hilman <khilman@kernel.org>,\n\tJarkko Nikula <jarkko.nikula@linux.intel.com>,\n\tAndy Shevchenko <andriy.shevchenko@linux.intel.com>,\n\tMika Westerberg <mika.westerberg@linux.intel.com>,\n\tJisheng Zhang <jszhang@marvell.com>,\n\tJohn Stultz <john.stultz@linaro.org>, Guodong Xu <guodong.xu@linaro.org>,\n\tSumit Semwal <sumit.semwal@linaro.org>,\n\tHaojian Zhuang <haojian.zhuang@linaro.org>,\n\tJohannes Stezenbach <js@sig21.net>,\n\tlinux-arm-kernel@lists.infradead.org, linux-i2c@vger.kernel.org,\n\tUlf Hansson <ulf.hansson@linaro.org>",
        "Subject": "[PATCH v3 1/8] PM / Sleep: Make the runtime PM centric path known\n\tto the PM core",
        "Date": "Tue, 29 Aug 2017 16:56:43 +0200",
        "Message-Id": "<1504018610-10822-2-git-send-email-ulf.hansson@linaro.org>",
        "X-Mailer": "git-send-email 2.7.4",
        "In-Reply-To": "<1504018610-10822-1-git-send-email-ulf.hansson@linaro.org>",
        "References": "<1504018610-10822-1-git-send-email-ulf.hansson@linaro.org>",
        "Sender": "linux-i2c-owner@vger.kernel.org",
        "Precedence": "bulk",
        "List-ID": "<linux-i2c.vger.kernel.org>",
        "X-Mailing-List": "linux-i2c@vger.kernel.org"
    },
    "content": "The main principle behind the runtime PM centric path, is to re-use the\nruntime PM callbacks to implement system sleep - and while doing that also\nachieve a fully optimized behaviour from PM point of view.\n\nMore precisely, avoid to wake up a device from its low power state during\nsystem sleep, unless the device is really needed to be operational. That\ndoes not only mean avoiding to waste power, but may also decrease system\nsuspend/resume time for a device.\n\nHowever, using the runtime PM centric path for a device, does put some\nrequirements on the behaviour of the PM core and a potential PM domain that\nmay be attached to the device. So far, these requirements are not being\nspecially considered, except by the generic PM domain.\n\nTo move forward and to make it possible to deploy the runtime PM centric\npath for cross SoC drivers, which may have different PM domains attached to\nits devices depending on the SoC, we must address how to deal with these\nrequirements. This change starts by making some adoptions to the PM core,\nwhile other parts, such as the ACPI PM domain needs to be taken care of\nseparately.\n\nIn the runtime PM centric path, the driver is expected to make use of the\npm_runtime_force_suspend|resume() helpers, to deploy system sleep support.\nMore precisely it may assign the system sleep callbacks to these helpers or\nmay call them from its own callbacks, in case it needs to perform\nadditional actions during system sleep.\n\nIn other words, the PM core must always invoke the system sleep callbacks\nfor the device when they are present, to allow the driver to deal with\nthe system sleep operations.\n\nIn case the PM core decides to run the direct_complete path for the device,\nit skips invoking most of the system sleep callbacks, besides\n->prepare|complete(). Therefore using the direct_complete path in\ncombination with the runtime PM centric patch for a device, does not play\nwell.\n\nTo deal with this issue, let's add a flag 'is_rpm_sleep', to the struct\ndev_pm_info. The driver that deploys the runtime PM centric path, shall set\nthe flag for the device during ->probe(), to inform the PM core about that\nit must not use the direct_complete path for the device.\n\nNote, not allowing the direct_complete path for a device, doesn't implicit\nneed to propagate to the device's parent/suppliers. Therefore make the PM\ncore check this condition in device_suspend(), before it decides to abandon\nthe direct_complete path for parent/suppliers.\n\nTo make the is_rpm_sleep flag internal to the PM core, let's add two APIs.\n\t- dev_pm_use_rpm_sleep(): It sets the flag and should be called by\n\t  the driver during ->probe().\n\t- dev_pm_is_rpm_sleep(): Makes it possible for users of the device,\n\t  like a PM domain, to fetch the state of the flag.\n\nSigned-off-by: Ulf Hansson <ulf.hansson@linaro.org>\n---\n\nChanges in v3:\n\t- New patch.\n\t- This replaces the earlier method of adding the no_direct_complete to\n\tthe ACPI structures, according to comments from Rafael.\n\t- This change also address the consern Rafael had around that\n\tdirect_complete should not have to be disabled for parent/suppliers, in\n\tcase a device use the runtime PM centric path for system sleep.\n\n---\n drivers/base/power/main.c    | 49 +++++++++++++++++++++++++++++++++++++++-----\n drivers/base/power/runtime.c |  1 +\n include/linux/pm.h           |  7 +++++++\n 3 files changed, 52 insertions(+), 5 deletions(-)",
    "diff": "diff --git a/drivers/base/power/main.c b/drivers/base/power/main.c\nindex ea1732e..865737a 100644\n--- a/drivers/base/power/main.c\n+++ b/drivers/base/power/main.c\n@@ -1549,14 +1549,16 @@ static int __device_suspend(struct device *dev, pm_message_t state, bool async)\n \t\tif (parent) {\n \t\t\tspin_lock_irq(&parent->power.lock);\n \n-\t\t\tdev->parent->power.direct_complete = false;\n+\t\t\tif (!dev->power.is_rpm_sleep)\n+\t\t\t\tdev->parent->power.direct_complete = false;\n \t\t\tif (dev->power.wakeup_path\n \t\t\t    && !dev->parent->power.ignore_children)\n \t\t\t\tdev->parent->power.wakeup_path = true;\n \n \t\t\tspin_unlock_irq(&parent->power.lock);\n \t\t}\n-\t\tdpm_clear_suppliers_direct_complete(dev);\n+\t\tif (!dev->power.is_rpm_sleep)\n+\t\t\tdpm_clear_suppliers_direct_complete(dev);\n \t}\n \n \tdevice_unlock(dev);\n@@ -1709,11 +1711,14 @@ static int device_prepare(struct device *dev, pm_message_t state)\n \t * A positive return value from ->prepare() means \"this device appears\n \t * to be runtime-suspended and its state is fine, so if it really is\n \t * runtime-suspended, you can leave it in that state provided that you\n-\t * will do the same thing with all of its descendants\".  This only\n-\t * applies to suspend transitions, however.\n+\t * will do the same thing with all of its descendants\". To allow this,\n+\t * the is_rpm_sleep flag must not be set, which is default false, but\n+\t * may have been changed by a driver. This only applies to suspend\n+\t * transitions, however.\n \t */\n \tspin_lock_irq(&dev->power.lock);\n-\tdev->power.direct_complete = ret > 0 && state.event == PM_EVENT_SUSPEND;\n+\tdev->power.direct_complete = ret > 0 && !dev->power.is_rpm_sleep &&\n+\t\t\t\tstate.event == PM_EVENT_SUSPEND;\n \tspin_unlock_irq(&dev->power.lock);\n \treturn 0;\n }\n@@ -1841,6 +1846,40 @@ void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *))\n }\n EXPORT_SYMBOL_GPL(dpm_for_each_dev);\n \n+/**\n+ * dev_pm_use_rpm_sleep - use the runtime PM centric sleep path.\n+ * @dev: the device to use the path for.\n+ *\n+ * The runtime PM centric path requires the system sleep callbacks for the\n+ * driver of the device to be invoked. This function sets the is_rpm_sleep flag\n+ * to enable this path to be used, which makes the PM core to adopt to this\n+ * behaviour. More precisely the PM core makes sure to not run the\n+ * direct_complete path for the chosen device during system sleep, when the\n+ * is_rpm_sleep flag is set. A driver using the runtime PM centric path, shall\n+ * use the pm_runtime_force_suspend|resume() helpers, to deploy system sleep\n+ * support and call this function during ->probe().\n+ * The is_rpm_sleep flag is cleared when unbinding/bind-failure of the driver.\n+ */\n+void dev_pm_use_rpm_sleep(struct device *dev)\n+{\n+\tdev->power.is_rpm_sleep = true;\n+}\n+EXPORT_SYMBOL_GPL(dev_pm_use_rpm_sleep);\n+\n+/**\n+ * dev_pm_is_rpm_sleep - Returns the value of the is_rpm_sleep flag.\n+ * @dev: the device to return the flag for.\n+ *\n+ * The caller of this function is typically a subsystem or a PM domain that\n+ * needs to know if the runtime PM centric path is used for the device. It may\n+ * be invoked during any of the system sleep phases.\n+ */\n+bool dev_pm_is_rpm_sleep(struct device *dev)\n+{\n+\treturn dev->power.is_rpm_sleep;\n+}\n+EXPORT_SYMBOL_GPL(dev_pm_is_rpm_sleep);\n+\n static bool pm_ops_is_empty(const struct dev_pm_ops *ops)\n {\n \tif (!ops)\ndiff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c\nindex 7bcf80f..b2ab22c 100644\n--- a/drivers/base/power/runtime.c\n+++ b/drivers/base/power/runtime.c\n@@ -1522,6 +1522,7 @@ void pm_runtime_reinit(struct device *dev)\n \t\t\t\tpm_runtime_put(dev->parent);\n \t\t}\n \t}\n+\tdev->power.is_rpm_sleep = false;\n }\n \n /**\ndiff --git a/include/linux/pm.h b/include/linux/pm.h\nindex 47ded8a..5bf96d2 100644\n--- a/include/linux/pm.h\n+++ b/include/linux/pm.h\n@@ -559,6 +559,7 @@ struct dev_pm_info {\n \tbool\t\t\tis_suspended:1;\t/* Ditto */\n \tbool\t\t\tis_noirq_suspended:1;\n \tbool\t\t\tis_late_suspended:1;\n+\tbool\t\t\tis_rpm_sleep:1;\t/* Owned by the PM core */\n \tbool\t\t\tearly_init:1;\t/* Owned by the PM core */\n \tbool\t\t\tdirect_complete:1;\t/* Owned by the PM core */\n \tspinlock_t\t\tlock;\n@@ -716,6 +717,9 @@ extern void __suspend_report_result(const char *function, void *fn, int ret);\n extern int device_pm_wait_for_dev(struct device *sub, struct device *dev);\n extern void dpm_for_each_dev(void *data, void (*fn)(struct device *, void *));\n \n+extern void dev_pm_use_rpm_sleep(struct device *dev);\n+extern bool dev_pm_is_rpm_sleep(struct device *dev);\n+\n extern int pm_generic_prepare(struct device *dev);\n extern int pm_generic_suspend_late(struct device *dev);\n extern int pm_generic_suspend_noirq(struct device *dev);\n@@ -759,6 +763,9 @@ static inline void dpm_for_each_dev(void *data, void (*fn)(struct device *, void\n {\n }\n \n+static inline void dev_pm_use_rpm_sleep(struct device *dev) {}\n+static inline bool dev_pm_is_rpm_sleep(struct device *dev) { return false; }\n+\n #define pm_generic_prepare\t\tNULL\n #define pm_generic_suspend_late\t\tNULL\n #define pm_generic_suspend_noirq\tNULL\n",
    "prefixes": [
        "v3",
        "1/8"
    ]
}