From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-18.8 required=3.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_AU,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=unavailable autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 7F2CAC47082 for ; Tue, 8 Jun 2021 09:04:08 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [23.128.96.18]) by mail.kernel.org (Postfix) with ESMTP id 5A7EC61184 for ; Tue, 8 Jun 2021 09:04:08 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S231277AbhFHJF7 (ORCPT ); Tue, 8 Jun 2021 05:05:59 -0400 Received: from mail-lj1-f169.google.com ([209.85.208.169]:35675 "EHLO mail-lj1-f169.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S230306AbhFHJF6 (ORCPT ); Tue, 8 Jun 2021 05:05:58 -0400 Received: by mail-lj1-f169.google.com with SMTP id n17so8882186ljg.2 for ; Tue, 08 Jun 2021 02:04:05 -0700 (PDT) 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=MqMqLtyb+5m1H0JmACBUmV4zHe67wXm2g0Ei8rspGJgUJ4QmMAOYSSsJONVhTi5kXO P+KnHO3Sd/aTvXfZBJa+8JEz/o72sMqDDbs1ysPeF4HCoQJF1g2l3mB0mdtWubYkKOgP 3FVgQKoMqbmfEe9M7yr4OYwBe3nnBxSO+6HK/93yyLGLpQxZrZNikJHg14k28nUcGPnw ja6sr/axVvliu2guzl/CNsl05qVqb8YQ1woY9PJa+3zMFeGnfT71aHT/xXPAOEDsXIEY b4iij4QHH4w11gbIQmFkpcGZVhfJry6famayyn/dJ1E6l6Tx5oGwp/ipUrRwgjhqQVuj 2XPQ== X-Gm-Message-State: AOAM532IFmhoJigUSk7c3RYOd9eaPuBQcWLfuJNF7S5fbDkbG7A8TuiJ jtVuHU7dl1BRoHjMfsYtT2NrNQ== 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) 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 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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(-) 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); -- 2.25.1 From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-16.9 required=3.0 tests=BAYES_00,DKIMWL_WL_HIGH, DKIM_SIGNED,DKIM_VALID,HEADER_FROM_DIFFERENT_DOMAINS,INCLUDES_CR_TRAILER, INCLUDES_PATCH,MAILING_LIST_MULTI,SPF_HELO_NONE,SPF_PASS,URIBL_BLOCKED, USER_AGENT_GIT autolearn=ham autolearn_force=no version=3.4.0 Received: from mail.kernel.org (mail.kernel.org [198.145.29.99]) by smtp.lore.kernel.org (Postfix) with ESMTP id 3CA64C47082 for ; Tue, 8 Jun 2021 09:06:21 +0000 (UTC) Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.kernel.org (Postfix) with ESMTPS id 0CC3361184 for ; Tue, 8 Jun 2021 09:06:21 +0000 (UTC) DMARC-Filter: OpenDMARC Filter v1.3.2 mail.kernel.org 0CC3361184 Authentication-Results: mail.kernel.org; dmarc=fail (p=none dis=none) header.from=linaro.org Authentication-Results: mail.kernel.org; spf=none smtp.mailfrom=linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20210309; h=Sender: Content-Transfer-Encoding:Content-Type:List-Subscribe:List-Help:List-Post: List-Archive:List-Unsubscribe:List-Id:MIME-Version:References:In-Reply-To: Message-Id:Date:Subject:Cc:To:From:Reply-To:Content-ID:Content-Description: Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc:Resent-Message-ID: List-Owner; bh=co59EDxbzRoTda0uFV9uNExLAE6aQOHigpniHBlv2U0=; b=p5Fae8q73g3o9K O2sQ9eFgSXduOv8TKGpupgp3XYazEoxPJ6EjK8NWu7PL5p/davjvPZ0zi80snIJrBk3x6xNMvyj13 m6bI+Q1MeAeEuGEFkTk4ZbOjQBH06R8Qj5YEMflf44N6+NjVMOo1gV12gIgsh3I60TuTiQ+XoG4a3 4xfRl1l870aCfMj5o1QbFUBApPAZIJFHyvyacgZ+aDCcxejC0JsZVL+W8g77R+G/T3ISqDPEJK7oF +VWRd63iMQeZqcub4vMu92t1h/H1rH5NyH92smsFtTah8ccgGJqm09bXKGDzmmx2nko9I/WtGKkpy MJmQroqPTmvTzM6b11dQ==; Received: from localhost ([::1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqXer-007F6h-Ih; Tue, 08 Jun 2021 09:04:25 +0000 Received: from mail-lj1-f180.google.com ([209.85.208.180]) by bombadil.infradead.org with esmtps (Exim 4.94.2 #2 (Red Hat Linux)) id 1lqXeZ-007F0j-2f for linux-arm-kernel@lists.infradead.org; Tue, 08 Jun 2021 09:04:10 +0000 Received: by mail-lj1-f180.google.com with SMTP id x14so11676986ljp.7 for ; Tue, 08 Jun 2021 02:04:06 -0700 (PDT) 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=htcj1/YogmWgtlyGt0YQB5zHH+Nnlr//hOLD4DRHgSTZvkAejkG6zUgCrvKyeYDtdh wew1Dw0ND9tqGmE2dOOlh1DjsZXwin+z1UJCjgowUw6ZwBpAs+zCqinjg5Vw5s8U+gJg IzkD3jNXfLCkUIh25qagPt7kXEWZSaq67ChzNmVXT8NH/ITTQGhBhkHcwlPssUhBc0tN BceUw7LCYhj/Ml0d4ct3hM3Wcx8Nen270ZlHpyKt0GFJe5F+nc76/gfYPVePILhbOgXE r2EGlZk2w2/mOvfJJRGGNtLg8ruJymJ8UxDnrM/Hf/P7TyRlUY7pB8NOGobO1/A1pNmR Y9Kg== X-Gm-Message-State: AOAM53208Go5E+Upflw3pNSBniJ8FyjgeDnqFLvVK/bysME7Cc08rTR6 m/nxJTmfrxvf+oMq7ScdBL2I6g== 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) 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 X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20210608_020407_149080_4A4F5AD7 X-CRM114-Status: GOOD ( 17.71 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.34 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Content-Type: text/plain; charset="us-ascii" Content-Transfer-Encoding: 7bit Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+linux-arm-kernel=archiver.kernel.org@lists.infradead.org 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(-) 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); -- 2.25.1 _______________________________________________ linux-arm-kernel mailing list linux-arm-kernel@lists.infradead.org http://lists.infradead.org/mailman/listinfo/linux-arm-kernel