From patchwork Thu Dec 6 10:17:02 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 153006 Delivered-To: patches@linaro.org Received: by 2002:a2e:299d:0:0:0:0:0 with SMTP id p29-v6csp10345276ljp; Thu, 6 Dec 2018 02:17:17 -0800 (PST) X-Received: by 2002:a2e:9694:: with SMTP id q20-v6mr17883371lji.173.1544091437704; Thu, 06 Dec 2018 02:17:17 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1544091437; cv=none; d=google.com; s=arc-20160816; b=glFS0yoVMzCAbBm1jn3wjrRpWRgJFWI5OBdzWe5Ajqdm6HTX8hQU9TLsyD9w2tqa4A GZEeldxuZpxIOem4Rn9SZKS43PA7zLYxdDrgL2sE7zPESe830U/+bH//q/YFNiu+1Vh8 Rdu6aS9FCETHpuEqA4Bt2S8ZkaIEXGTpealljdupT9yMDhJKLV2H1eGS47dKwHW8m/ei 1c6+2OemYkAxa7hET0YnbrTXo6LduNzg2B0B+aALqN94sOPf8PTrrHrqkTrAgduw90A9 yJxOmPwGI0FsqqqYkkM3VSc0iBbM4fO+1H8FVvWOZeoUsJ1CDBvdvJjQMw2b38pOAdG6 hvIQ== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=message-id:date:subject:cc:to:from:dkim-signature; bh=3ooPhCqed2RG1NkUEwEYzsAbfWMdflyIK+H+IAkpd4M=; b=0wps64FCfCIaATl7TfGoy9TFfgeeDTm+VYJcQjy0/dVxiM1yl7rqbuDlBARPFfCrys Tqxf9tsgxnKdD6of+9ZGer5jqRYniDkNjJLd05Kz+Kh+dWPPT7jLr2+2Aom1j5EUiDR3 IceMs/q/wCCFAHGT7fGAc55ckVJQos2RpOj2nPrDP/gHQiYGHaKvZFHZlTGwyoHUDxsQ 8W+xLexa48ihHDm3l98uDmglsUszpLkxVmr6UDtQZ2kPAcEXKxlJEd9Tg8lDMgXJphHJ e8LnOdjB2QOMT6zEzM2Ju9emjufWpo7PHHzo8DXQyIjbUr7039YeRdn30xwDHjOWCwL7 IxmA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X9kPMdps; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 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-f65.google.com (mail-sor-f65.google.com. [209.85.220.65]) by mx.google.com with SMTPS id a13-v6sor14151534ljj.25.2018.12.06.02.17.17 for (Google Transport Security); Thu, 06 Dec 2018 02:17:17 -0800 (PST) Received-SPF: pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 as permitted sender) client-ip=209.85.220.65; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=X9kPMdps; spf=pass (google.com: domain of ulf.hansson@linaro.org designates 209.85.220.65 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; bh=3ooPhCqed2RG1NkUEwEYzsAbfWMdflyIK+H+IAkpd4M=; b=X9kPMdpsPddadfFsnyoa46WYDIm0uN19Iuw/UfdAFN1idRKCb6OTuIaWcFzuNI/Li2 ovwuR7kBgJIwBeCnCAvE3hN1obdvgY9mL+kijYx/5GACsUQa9VfWd/ILeJsaxQvjzvPe VuNiiqy1bxRiGN+VWB0yD4l6Zk7nYffys7nUc= 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; bh=3ooPhCqed2RG1NkUEwEYzsAbfWMdflyIK+H+IAkpd4M=; b=hg2UVm3cGy/Kjk0Y7kLNNWMF1eJD3JQvbP0kfggBA5Uxw5UlHWbM6b1kHnneRsSrP8 unwCmiVC30GZAKNMt970R/AgaW6yZnWv6Cmq6DBrqAyTNFm/uOx7Ur3OqvKWECqoHnQy 7ycWgTILNSHROhemLqgJp7x2id2MRfl8SeD2BBEriZ6m/95ho84yovNtF5fxtwJjCzoU lM5Le73yOEbkETQxyEc/3zNv8+tj3QwN+gGzJgvcRovSsge1zmhV2/0Yz+dsE32f2paZ DwVq3R6q/QdxN/G/LAsNn7i88k9YzLQoE9/hCD0iKNUBbOOCXiwTS62nAelg0VWv6RMb hPKg== X-Gm-Message-State: AA+aEWZd0o27Zw7nLRdbpZfyGuimBMCEoiBjfIS/aqsyQcX3lDs6iw5g atMJc10mtizBlNK/sfqNoc5HXR3y X-Google-Smtp-Source: AFSGD/Ui+fSLeT8+kdifa7Vfc2FWBDMhh6v5OE04kOcBSUHk3YIZr3qAH4db24N9hmnsGcWkYAKvnQ== X-Received: by 2002:a2e:5703:: with SMTP id l3-v6mr2697577ljb.106.1544091437177; Thu, 06 Dec 2018 02:17:17 -0800 (PST) Return-Path: Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id h21sm4119460lfk.41.2018.12.06.02.17.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Thu, 06 Dec 2018 02:17:16 -0800 (PST) From: Ulf Hansson To: "Rafael J . Wysocki" , Viresh Kumar , linux-pm@vger.kernel.org Cc: Ulf Hansson , Rajendra Nayak , Vincent Guittot , Stephen Boyd , Mike Turquette , Graham Roff Subject: [PATCH] PM / Domains: Make genpd performance states orthogonal to the idlestates Date: Thu, 6 Dec 2018 11:17:02 +0100 Message-Id: <20181206101702.26418-1-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 It's quite questionable whether genpd internally should care about if the corresponding PM domain for a device is powered on, as to allow setting a new performance state for it. The assumptions creates an unnecessary limitation at this point, for both consumers and providers, but more importantly it also makes the code more complicated. Therefore, let's simplify the code to allow setting a performance state, by invoking the ->set_performance_state() callback, no matter whether the PM domain is powered on or off. Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) -- 2.17.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 7f38a92b444a..4c39ea1b2cf6 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -311,12 +311,10 @@ int dev_pm_genpd_set_performance_state(struct device *dev, unsigned int state) */ update_state: - if (genpd_status_on(genpd)) { - ret = genpd->set_performance_state(genpd, state); - if (ret) { - gpd_data->performance_state = prev; - goto unlock; - } + ret = genpd->set_performance_state(genpd, state); + if (ret) { + gpd_data->performance_state = prev; + goto unlock; } genpd->performance_state = state; @@ -347,15 +345,6 @@ static int _genpd_power_on(struct generic_pm_domain *genpd, bool timed) return ret; elapsed_ns = ktime_to_ns(ktime_sub(ktime_get(), time_start)); - - if (unlikely(genpd->set_performance_state)) { - ret = genpd->set_performance_state(genpd, genpd->performance_state); - if (ret) { - pr_warn("%s: Failed to set performance state %d (%d)\n", - genpd->name, genpd->performance_state, ret); - } - } - if (elapsed_ns <= genpd->states[state_idx].power_on_latency_ns) return ret;