From patchwork Thu Jun 3 09:34:36 2021 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 453239 Delivered-To: patches@linaro.org Received: by 2002:a02:c735:0:0:0:0:0 with SMTP id h21csp114832jao; Thu, 3 Jun 2021 02:34:49 -0700 (PDT) X-Received: by 2002:a19:4085:: with SMTP id n127mr26727700lfa.415.1622712889000; Thu, 03 Jun 2021 02:34:49 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1622712888; cv=none; d=google.com; s=arc-20160816; b=s5euG7a8dG1QZY2hj9HCNd3a8M5Wtp4xJE5yQzoE8IifAavk9qXHUu4Pv9DqRk52I5 6oxLWlzolDEGZ6eHaTw/4yCnDzFygufMewqFia+PGsQay4IRKtNCEf0QvOq7D+eiKT6H OUsrPOSyOueHHbr2JmxEklQr1D3UZARN0FekT3/6x8ibHSMLeRvkGjiDJFZTylhiIg9I z4O5cfr1K5aLaSNCJ005Pc6tiL2+2DSUhHQlNJkdDDfjpRtATkB2Tb0rOEXnHeLCx16l nN/WSrk05lCuRMrxzWygF4JQpypWWg6R4Vmqk06Fl4Vf9uicj933A1n6kKb9rGxkrd6b GN4g== 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=lFoDekDYb/UgHdylIZARPBsEDFKjhn6BdLJDbtckeQE=; b=GJ6ikXSdKGNky0t9aCgubKQeFLtsIVw//p994ZpfYDRGG4txbzwF8ZDNvxRHaw7y43 174Y0FORXEer4CV8p+TcYRP/9z0qs5B2dARWvfTlFFFieSev+UePV1xuo4aiNm25hzwt PNj0Wpj0xsM/DcLYz4blDoO+kRbH9irL9yBcp4xyY+5Ls6sNUxSoFJiZuWLbxd81IYGM tAIpy6G/zcSc2XYjhTlomLONanHJRWXXVDxYrk4lyicnWqS6S/3C5TvRmO0But+wYfXe Z8urX6pACKbtM0CTT4JlVWzkWYyfdUgKXexBAN7dN5rxZCM4BU/DPw33CNkV7u/DvuNh hEeA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=JwdfSDzJ; 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 e16sor1109512ljk.22.2021.06.03.02.34.48 for (Google Transport Security); Thu, 03 Jun 2021 02:34:48 -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=JwdfSDzJ; 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=lFoDekDYb/UgHdylIZARPBsEDFKjhn6BdLJDbtckeQE=; b=JwdfSDzJpLBesUo4+88/C3oqVb/3B86q53A6DEJr2ZBkKnyTIRPbDaSACI/sePRLIp gwg+b6LjuKTGQI/vxI2t9qZrQtdgJTaGhkMl02vSnx+QbSvvdaZn44F72bqAfLFY6wKo GFxgoPbOcNT8sJJd690+WTKApuI3sWs1NsKPt/HEqrPCJVmGrpfh46PaEp3eGZOKLN0d b5n3chr1U+LbMeJHTigal0Oc7hYVdmo6DwpAH4gkrBdIW0jBgiLFgDDFbvmn8K9uw+Pl uYkXHmfMTdXpFwK8IDnr68gi50LJ8pMRtBuotoQZo9dZ1lQPDJi8ldsN8OZLe6ay0DQy klnA== 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=lFoDekDYb/UgHdylIZARPBsEDFKjhn6BdLJDbtckeQE=; b=Ls3OLBm0onJaJ5Jnhvja8znhgfyrocwICXcR3KrsP9+UY55IfDfiAZ4YSDkzh7v3UQ vkZbrwVfqlvYFheUBpeMBCZ6xSF/AaX8i4v+Xdr0ticQoGgHyomCSL7cKnR4DnqT5SHt 8OuBGVu/d4SQYB/njrBQ3TAaaCn4hBEM4IHAw0hyPy+Efx5+k+6NBRtEosqkyLDbcgl3 vwU1CEI0RLzC/bQRIWdOnLDmPTeViRbUUbGHptAI74zVGScK3oj05IPSYJmB5R8Inysd tK7hUjPR2E9mpu1KVJpxW8gHIUnq6YXPkYkYNEjiQF6abSyZKpnyGJjw2q1GLFm6ik1k d+2A== X-Gm-Message-State: AOAM532GTZ92KyxZlUfKRBeUDdUPtJNANwioP2FkmiWAB+oWKl+62Qtd B6P+WdoY4pEqoXhgxPuw+N/4sdYl X-Google-Smtp-Source: ABdhPJwg8KCHV0Hm4Ebc/CXC0Dea/8+lkoKKVArxsAIppRYHAbwPcXW5vLK4PJ8lxuaB3Ecfq3EHaA== X-Received: by 2002:a2e:a594:: with SMTP id m20mr29675302ljp.114.1622712888689; Thu, 03 Jun 2021 02:34:48 -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 q4sm263373lfc.172.2021.06.03.02.34.47 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 03 Jun 2021 02:34:47 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org Cc: Ulf Hansson , Dmitry Osipenko , Jonathan Hunter , Thierry Reding , Rajendra Nayak , Stephan Gerhold , Roja Rani Yarubandi , Bjorn Andersson , Vincent Guittot , Stephen Boyd , linux-kernel@vger.kernel.org Subject: [PATCH v2 2/4] PM: domains: Return early if perf state is already set for the device Date: Thu, 3 Jun 2021 11:34:36 +0200 Message-Id: <20210603093438.138705-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.25.1 In-Reply-To: <20210603093438.138705-1-ulf.hansson@linaro.org> References: <20210603093438.138705-1-ulf.hansson@linaro.org> MIME-Version: 1.0 When dev_pm_genpd_set_performance_state() gets called to set a new performance state for the device, let's take a quicker path by doing an early return, if it turns out that the new state is already set for the device. Suggested-by: Viresh Kumar Signed-off-by: Ulf Hansson --- Changes in v2: - New patch. --- drivers/base/power/domain.c | 3 +++ 1 file changed, 3 insertions(+) -- 2.25.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 5c476ed1c6c9..ef25a5b18587 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -387,6 +387,9 @@ static int genpd_set_performance_state(struct device *dev, unsigned int state) int ret; prev_state = gpd_data->performance_state; + if (prev_state == state) + return 0; + gpd_data->performance_state = state; state = _genpd_reeval_performance_state(genpd, state);