From patchwork Fri May 28 09:11:47 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 449501 Delivered-To: patches@linaro.org Received: by 2002:a02:7a1b:0:0:0:0:0 with SMTP id a27csp163347jac; Fri, 28 May 2021 02:11:52 -0700 (PDT) X-Received: by 2002:a05:6512:3457:: with SMTP id j23mr4399084lfr.505.1622193111880; Fri, 28 May 2021 02:11:51 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622193111; cv=none; d=google.com; s=arc-20160816; b=qG1yjk8xnP2NHbbPIyKg2vWAk2oBgwWqMqjeVRqJIntSR4DUr3LCWZMTF/avOMWZzX HgbOuvn0oxy5/dgSaW3BS9zPXS+L2w5XBVAZHF3s4FFspiO3/psO56vel3F0VIndfydl XSXmCRws42W6m1gxOW/n0fCFH6VPJU/5qQIUvidr9PpEZrTND9SgIWT/1R0xrewLDTiN bJa9xUsEkAJc1nFP9PYQB8aLi2jXPGPE2BZFmmyGSFt1xl3OAcKbWzDSdfaR3ngf9pN0 4zNyj/QEFNl73H/wftqTQFR2oEQ6TJrEMQaoSs1S14hV/7KPHlF+y32Gvcw8oaD5lj7N 30Cw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=content-transfer-encoding:mime-version:message-id:date:subject:cc :to:from:dkim-signature; bh=sUYpUgduivuCVF6eHvNxAOyVhrifC73di+ff0lHlcsA=; b=ktgKpUDobCWxkSM3QlO0/UienBw1nXNEoF/WgINw2QgXpMrfvMjr+6N5bh/bfiUi02 g5MiP7meGILlKj6kdRNT2NOIhSHLjhnfOVsxZLyKlg6FikOYlmAB8n85esXeQsylrbZw WQPJCbXArkipV8vJm3m7WthNqD3AF6GsvMIur9Mq7Dck4UhW6tGQ7+IJxHVDYycxwI3F bBHonI3uO7VLnIdYBbNjYelvBgbyA5Be6FtIFehrJvDrGRbiLtp2KiQYAtT6qyuUJ3xX +HeRFp1tjJ47A2GdqUdPDpwH9lGt9/O6fKRAXLgZMJbvp4w9R5neJmRDvvxailHaWsz5 QBtg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=wyZ4T5i+; 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 z4sor1169389lfq.45.2021.05.28.02.11.51 for (Google Transport Security); Fri, 28 May 2021 02:11:51 -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=wyZ4T5i+; 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:mime-version :content-transfer-encoding; bh=sUYpUgduivuCVF6eHvNxAOyVhrifC73di+ff0lHlcsA=; b=wyZ4T5i+3aVchglrAZqFAVF0C6hOe/zQhiG/Y2DqaSz/q2fNL7xknah6KEG0xpQN3A qg34hQVg80hsXJnqaNIMyx+RpN/y8DQ41nGBEPG/xBJ8/N6MfM+4yG5VAI1iwDWtJ7IN vsdoma7Wxm/rhHsbi4rGtxG7lNuXCSDOXForFR1s6FEyAt+o5MJp4tps0GAuUyCiq25r yr0E0DXczvkGlrHEnEXfWRWJnuw3Mqo7iNaozOpvj5rllSI1mfflbG4RSybvt24L5Dro G3tKsOcQCYEmNN4QEe42/KZJa+zWf5t/d7Qt17qWGFIULkOsu0hVEJC9j5VCRTzildIH nTHA== 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:mime-version :content-transfer-encoding; bh=sUYpUgduivuCVF6eHvNxAOyVhrifC73di+ff0lHlcsA=; b=FpgjiRHNyqLFGP2DTK0RoIoqGipLG4oqMK0zHYwOK8BDJrgHNHYgsQDVzZN8Yd2bqg XreXSE08+rlKYo/CrfBbPkdP6RTEdg2g+zBeclFwe0FxYPSNVG6w0Jw6RdC66FfJN4pC +dKFnJ3ywYO3H0Bvi7Vj3gFgKMxDSbKeWO76ZGHOHXnJhje5IbGd13cSm2U/tFB6vqMY En+BttwxAEnrjJQTgtUXkJSDvp7KS/vl0IRnCxjSOmEfP7rOGcXx9t7eHoPbQ28Uqfhh XRtUKeeydtc+8EBMBQfPs/6nYvmS9/OCu4/hRVB66Apic7YLpGbrOGUVpo5cKqViZ51T Sa7A== X-Gm-Message-State: AOAM531tcBEAzU4jSbqKsU8YOthWvgu3zBfCY+FrTRNDxD+mw8SyPO4R JWbd+T84aL2rX8+RMq5lBdGehJ6W X-Google-Smtp-Source: ABdhPJwsVzF+nC4WNJPqBtVliQbqeg943XE0P+2MUBvV2a1tnubgAiDDFZnyk++mWwJZ3eEuHuTE4Q== X-Received: by 2002:ac2:4908:: with SMTP id n8mr5125093lfi.641.1622193111489; Fri, 28 May 2021 02:11:51 -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 n15sm421927lfq.274.2021.05.28.02.11.50 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 28 May 2021 02:11:50 -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 1/2] PM: runtime: Improve path in rpm_idle() when no callback Date: Fri, 28 May 2021 11:11:47 +0200 Message-Id: <20210528091147.11541-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 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 --- 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);