From patchwork Wed Mar 14 16:58:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 131671 Delivered-To: patches@linaro.org Received: by 10.80.210.197 with SMTP id q5csp410170edg; Wed, 14 Mar 2018 09:59:06 -0700 (PDT) X-Received: by 2002:a19:53cf:: with SMTP id h76-v6mr3882319lfl.87.1521046746056; Wed, 14 Mar 2018 09:59:06 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1521046746; cv=none; d=google.com; s=arc-20160816; b=Z7pXWKXMMScvFPk3NkpSjbZZUPij/LD7NNt3u71fhD7EcRwaAk3l+jpyATGqy0lYMB BcPdVItGRElZU0jzQSBjgdxw0z5sAIMJvGF8Wj/bkZl9ZZ9R/lh0DITKWcWfFZX32uWy YBf2at9IOm6t2sRb+T/iWFCiEEiTO9w4hSmt2IlA74ghTsmuwjCsDkePWVM86Z/6TOky 1Q19tO7YfkHxeHzGl1UVKSudOhLNcK4rJcCpHdMwnzbmbKaPIYpJQ/V9y+WH1frThwqc nD/23XCYVQWDn4fg2cgqLw+7MavwFCy+5rETIHf53IDfuDEgf9xY7b1gBkTHazVnQbZf ovow== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:arc-authentication-results; bh=hSa1vuv7p5LGnqIFGONCS9906USFez9Y+cts+oPVryk=; b=tkYmuiHQhYktC1HKnhSUkaiCsxM/JANs8MX1XX/TDdVaDU8iJiE8mh5puZYm6eubto fSSHEvfweB6rQjqqF3mfHsHpYIZ5AT7ts81yoyI6T6qlaM65oRmAQAZVN6mZ0Hr58sut qVELjP4X4DjxI8cfaNPZ0B7ZGiPpp4VGfX7XAHmnn+naRSzTe2yjWfQnNhyZUMT+l4A1 pVuH6mlFMwItUHZLq35zbAnJ0lyjSkoJJR5a8orlmWZUo2ZPnCDyWe/cRBIoAlEGLf55 ExY0JmNUkbazfVMOkIpemK7Q42zojRdKgq9iS3m58JiYSTp5T+E6Xgut8tBKlQEA7i11 Kx2g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=P0CiJn70; 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 c5-v6sor836377lfh.103.2018.03.14.09.59.05 for (Google Transport Security); Wed, 14 Mar 2018 09:59:06 -0700 (PDT) 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=P0CiJn70; 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:in-reply-to:references; bh=hSa1vuv7p5LGnqIFGONCS9906USFez9Y+cts+oPVryk=; b=P0CiJn705qOhcjGca5bz8eUBHXn3meODQ6jYF+/kEeYFDblxGO3p/417IMjroSoStO JJNMnudAop4Rz7lqUhmcj+ns3kU8b8nRBtRLsEGUTyPNmczz62PTNi4i1rWSoyKi6Agt VHR9VZ4+E6R9jQaIq8lUNSEjv/lfsCc5V5YjY= 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; bh=hSa1vuv7p5LGnqIFGONCS9906USFez9Y+cts+oPVryk=; b=bfq3V4mf+RoiDzU5sGiMIn7j+GNW2SONpLamQMG3gOAbyg3DUcNbbZkb6ysjAC5luG oNiDUFhmY/TX1+KAn+wTguv80d/qOu55n49lQS9yx9nD+QAeJguUbz4/I7u+Hxa9g07M yMggls2wLjq+5w9f6x0DsTPZ83TxAIOnRgSmjz6jNmCRKfgwS0xBrUQ5PlMzyLDVisRv GFIoRZfsOH6eFzMyHQyyS2XtFfFM/J2nPJ4OSIlBqXCY8uv9E1+Yr3BLzMMwlOR1Ca/I 2MksfcSX78++8wDl2VuDCykVeGgmS7C6Zg4l8rPHGlhla+HsF9leHfmx2XSjHALqlasg jkcQ== X-Gm-Message-State: AElRT7Gq9TaC9bp/1Zgb2gHcF3WvTQC8GWwN7kxFYchVx32TuDzw8Y/i 0hD+Cc17PCw5UYgE/Ui/zjDxSXiH X-Google-Smtp-Source: AG47ELuusa1xbv/nmnv+1O9CYgqmdmemWUivDZQt/P0urbSTvY6vZy+jc7jw+c9OW1ah26aI4+hJTA== X-Received: by 2002:a19:48c7:: with SMTP id v190-v6mr1361194lfa.26.1521046745790; Wed, 14 Mar 2018 09:59:05 -0700 (PDT) Return-Path: Received: from uffe-XPS-13-9360.ideon.se ([85.235.10.227]) by smtp.gmail.com with ESMTPSA id t24-v6sm724849lfi.30.2018.03.14.09.59.04 (version=TLS1_2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Wed, 14 Mar 2018 09:59:04 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , linux-pm@vger.kernel.org Cc: Kevin Hilman , Lina Iyer , Lina Iyer , Ulf Hansson , Rob Herring , Daniel Lezcano , Thomas Gleixner , Vincent Guittot , Stephen Boyd , Juri Lelli , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v6 02/25] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 14 Mar 2018 17:58:12 +0100 Message-Id: <1521046715-30683-3-git-send-email-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.7.4 In-Reply-To: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> References: <1521046715-30683-1-git-send-email-ulf.hansson@linaro.org> A caller of pm_genpd_init() that provides some states for the genpd via the ->states pointer in the struct generic_pm_domain, should also provide a governor. This because it's the job of the governor to pick a state that satisfies the constraints. Therefore, let's print a warning to inform the user about such bogus configuration and avoid to bail out, by instead picking the shallowest state before genpd invokes the ->power_off() callback. Cc: Lina Iyer Signed-off-by: Ulf Hansson --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.7.4 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index c2ef944..9aff79d 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -466,6 +466,10 @@ static int genpd_power_off(struct generic_pm_domain *genpd, bool one_dev_on, return -EAGAIN; } + /* Default to shallowest state. */ + if (!genpd->gov) + genpd->state_idx = 0; + if (genpd->power_off) { int ret; @@ -1694,6 +1698,8 @@ int pm_genpd_init(struct generic_pm_domain *genpd, ret = genpd_set_default_power_state(genpd); if (ret) return ret; + } else if (!gov) { + pr_warn("%s : no governor for states\n", genpd->name); } mutex_lock(&gpd_list_lock);