From patchwork Tue Jun 8 09:02:48 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 455764 Delivered-To: patches@linaro.org Received: by 2002:a02:735a:0:0:0:0:0 with SMTP id a26csp3492023jae; Tue, 8 Jun 2021 02:03:05 -0700 (PDT) X-Received: by 2002:a19:4810:: with SMTP id v16mr14546734lfa.254.1623142985375; Tue, 08 Jun 2021 02:03:05 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1623142985; cv=none; d=google.com; s=arc-20160816; b=nbMoDg1KqcSU8n2cLwBCEpX86zWPCJwFIU3zyeztcSXRNKCHf0UwjuWLLBrepm2Zpn uFsnMYcsvrSOkMGB/TY2gqB6S3sXpq08XhQw5bHG4ThG6M+2TFOnXe4XVvYnfTCVi0xU iTylkvTZDUK/5LzTGfEbZTHWb3uW3yiRULmjJCNDLU54xgDRwObKAOKUOSaPd7zBS5c9 rnPCKG4N3PNdW0U1xnHYrD4mafxg2rjlZ3Ig3jFz93xWECL6CS4VtSw6UzCz1R3GYbNo fWZ1C4qI9Wsaj84fna8nbwtSbPIbremSgv3wdAgtTB29/e3wm/0JVzQn5lYAqLBWpyym 9s7g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:references:in-reply-to :message-id:date:subject:cc:to:from:dkim-signature; bh=WHAUVw9IK/B21jxzKRMs6//VXx/YmyYDw1kGjq54fl8=; b=A/pmaIg+roib5N9KdDfs/RfkdQ/bTYHs4FJABkzJmk4HO4yThFusGtP8MRkzVCSGG0 502w7xuJ9BCzizUbQ5w4aKmrBzzMYqTFvtdE9m8aEwlxBgQzg+ibCULIVMigdR1xO8Km GTYNq/zhqx+PpR9DQ6676Sj/AucmyJ8yxr4LuxoTSZo5Na6JmNry84nq6Dg3DBKIVeEW w5fpF2vQQmtiNY66MgxPMcqVsHnCm227s3OjW/w8E0Z+4JRBQbMMtbB/ygAMcRXzF9Vl mTuGDLWskk3USgAo22TsxEhDIdNFBMB+KMU9VnEXCIebcqwoEquZhMHOrapgIEUzacSN MwQw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x/pah5O+"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from mail-sor-f41.google.com (mail-sor-f41.google.com. [209.85.220.41]) by mx.google.com with SMTPS id i16sor5397378ljj.3.2021.06.08.02.03.05 for (Google Transport Security); Tue, 08 Jun 2021 02:03:05 -0700 (PDT) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) client-ip=209.85.220.41; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b="x/pah5O+"; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.41 as permitted sender) smtp.mailfrom=ulf.hansson@linaro.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=linaro.org; s=google; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=WHAUVw9IK/B21jxzKRMs6//VXx/YmyYDw1kGjq54fl8=; b=x/pah5O+Sx0Z4lOP+fg3cHpCidQHkwi2heJOoPI5fIm1clzrgyKI13b4uwfi3BlBxP /S0N0zrCeQF9cx46GmExNiFLG+CoAZiQ9GVZo2PlPEB0/jmkVVLsB7HvQP/V3jil1/UN AAThDTp13HUJNpENh5WHIuZJVSy7KqKn5DRraGh9A+xEhxVBph7DhYVp3pvehkNdD+Km Vc0HMkMTuTfbQoYseFrw1C/WLH7QowToT7c4D9JEu+oNpdcW12gmuW6+trM/ZLKHhb8Q QpZ0y3KNzPDE0fRDOEk7jC1pl3ge11zUYo/JbuVzufsttqqEY7TeE4xc4K4HhoCKw9/G IYeQ== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=WHAUVw9IK/B21jxzKRMs6//VXx/YmyYDw1kGjq54fl8=; b=g5LoN7DFlHDixWgRV5ETW41V7vwmIJvxv8FT2I7iypdeRlw1Vu9LDdxKxTnjODfLx1 akvOqFW+0Z+D7UKuZG+jQdVVcKhBjkxAOgllGfSNBYhfVlQd3sR2RXkxG09C/6Jx91tk 1HyVBBx7Z1Ceo6b6iX5XA87sNIRL3h6WTREb9iooHoZrRxjwCAtRtZq73N41DNh0Mv+I QLIpe1qbXWVeF2dbreKAluLCCapm50IV6kI3Pcetxd9yQxFfRhgMLytazKqjAP5q4v9f OD4MDBj4yfBmKRAR08R7Fyx33xQPUDE8GjjHCiFpv5HqPVApxMNktZ3hno0O3fWwKKM2 LQKg== X-Gm-Message-State: AOAM533CUOFpr/t5vYMar9wa0pdtuh5G/rQPhxRNY4Guf9W15KLGkRfW 5A95iLP5M6/9NWt0Tbhx6DybphGTJbld1eOadzM= X-Google-Smtp-Source: ABdhPJxhC0tQCmxGqeuhNNx51utAaeSuu/R6EEKrqA/ZMKUME6+3IFqg+FSKkB3lncYPy8y9mbgomg== X-Received: by 2002:a2e:7011:: with SMTP id l17mr17753121ljc.372.1623142984661; Tue, 08 Jun 2021 02:03:04 -0700 (PDT) Return-Path: Received: from localhost.localdomain (h-155-4-129-146.NA.cust.bahnhof.se. [155.4.129.146]) by smtp.gmail.com with ESMTPSA id n17sm1295197lfq.118.2021.06.08.02.03.02 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Tue, 08 Jun 2021 02:03:03 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , linux-pm@vger.kernel.org Cc: Ulf Hansson , Saravana Kannan , Alan Stern , Adrian Hunter , Tony Lindgren , Kevin Hilman , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 1/3] PM: runtime: Improve path in rpm_idle() when no callback Date: Tue, 8 Jun 2021 11:02:48 +0200 Message-Id: <20210608090250.85256-2-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210608090250.85256-1-ulf.hansson@linaro.org> References: <20210608090250.85256-1-ulf.hansson@linaro.org> MIME-Version: 1.0 When pm_runtime_no_callbacks() has been called for a struct device to set the dev->power.no_callbacks flag for it, it enables rpm_idle() to take a slightly quicker path by assuming that a ->runtime_idle() callback would have returned 0 to indicate success. A device that does not have the dev->power.no_callbacks flag set for it, may still be missing a corresponding ->runtime_idle() callback, in which case the slower path in rpm_idle() is taken. Let's improve the behaviour for this case, by aligning code to the quicker path. Signed-off-by: Ulf Hansson --- Changes in v2: - None. --- drivers/base/power/runtime.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) -- 2.25.1 diff --git a/drivers/base/power/runtime.c b/drivers/base/power/runtime.c index b570848d23e0..68bebbf81347 100644 --- a/drivers/base/power/runtime.c +++ b/drivers/base/power/runtime.c @@ -446,7 +446,10 @@ static int rpm_idle(struct device *dev, int rpmflags) /* Pending requests need to be canceled. */ dev->power.request = RPM_REQ_NONE; - if (dev->power.no_callbacks) + callback = RPM_GET_CALLBACK(dev, runtime_idle); + + /* If no callback assume success. */ + if (!callback || dev->power.no_callbacks) goto out; /* Carry out an asynchronous or a synchronous idle notification. */ @@ -462,10 +465,7 @@ static int rpm_idle(struct device *dev, int rpmflags) dev->power.idle_notification = true; - callback = RPM_GET_CALLBACK(dev, runtime_idle); - - if (callback) - retval = __rpm_callback(callback, dev); + retval = __rpm_callback(callback, dev); dev->power.idle_notification = false; wake_up_all(&dev->power.wait_queue);