From patchwork Wed Jun 20 17:22: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: 10478031 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 37750601D7 for ; Wed, 20 Jun 2018 17:23:03 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1AF2328B16 for ; Wed, 20 Jun 2018 17:23:03 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0F1AE28ED6; Wed, 20 Jun 2018 17:23:03 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-2.9 required=2.0 tests=BAYES_00,DKIM_SIGNED, DKIM_VALID,MAILING_LIST_MULTI autolearn=ham version=3.3.1 Received: from bombadil.infradead.org (bombadil.infradead.org [198.137.202.133]) (using TLSv1.2 with cipher AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by mail.wl.linuxfoundation.org (Postfix) with ESMTPS id 851B828B16 for ; Wed, 20 Jun 2018 17:23:02 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=lists.infradead.org; s=bombadil.20170209; h=Sender: Content-Transfer-Encoding:Content-Type:MIME-Version:Cc:List-Subscribe: List-Help:List-Post:List-Archive:List-Unsubscribe:List-Id:References: In-Reply-To:Message-Id:Date:Subject:To:From:Reply-To:Content-ID: Content-Description:Resent-Date:Resent-From:Resent-Sender:Resent-To:Resent-Cc :Resent-Message-ID:List-Owner; bh=vj3CnqxJnCIs22V8hdcSqB5J2UdnG6nI5yJXYdA6vc4=; b=FPiEdOXQvMSrcOupgQNI46dgzE N6p2MkYdl53iR1Y3jCaR5zp9gTKKyUCXKhqJD5rz6wZrBuN/XDCEhxspZtM649iqEu/ZYhxMf3NmW AXGmrqk+HVy5bWxb+L/R3fo5YYCCMT6zLxXiQrDcYC50pI+UgANAXB5OTQAh1/3KwpdHYz/DZ2LnY eG2LRUOdB+CVHVFXoGS6Njp3UePujspXWXJkC7JHmtWSsrKCcYcFEyZ46IIZtTPi6VBHU7uPy5WGH d+5NH8xxSWxrX1naLayl+MyWDoGcogyqnBGvSyT5Ytuhpq9rAdmfm67/9SWGSCLzjobg8uhTGv/2n jMks1dpA==; Received: from localhost ([127.0.0.1] helo=bombadil.infradead.org) by bombadil.infradead.org with esmtp (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVgom-0005Xg-PZ; Wed, 20 Jun 2018 17:22:52 +0000 Received: from mail-lf0-x243.google.com ([2a00:1450:4010:c07::243]) by bombadil.infradead.org with esmtps (Exim 4.90_1 #2 (Red Hat Linux)) id 1fVgoh-0005V0-O4 for linux-arm-kernel@lists.infradead.org; Wed, 20 Jun 2018 17:22:49 +0000 Received: by mail-lf0-x243.google.com with SMTP id a13-v6so441734lfk.12 for ; Wed, 20 Jun 2018 10:22:40 -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; bh=BZqpdm4C3crCBCfotBf9OcWNkhZg/AfpeooWj+mQ4ng=; b=HuZKqg5POieJbocrPk9ygoclVSJQuhhEuFrRfV+4xXpfR9GYqCiSTE7nQU8vuMEqZW 2DiX2fjdAa8dUMsMo+P9lNOfJ3Md1XR4lvfQZ7nNwEMUtR2o5XTyDvE0MaVgEzKdmEGU 9OB3SEj3oB8gI4wqYtPMvfL0CoiyoZnb2ShpM= 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=BZqpdm4C3crCBCfotBf9OcWNkhZg/AfpeooWj+mQ4ng=; b=D7HfkG3sk2ClE9Qj3hxsHGySm26tf4Sm/bnfoXv9nrze3aFGMykO+dwrSBDumXHauS jTUD1T2EZTF9KnhZz4OzJ/xdJEcTRqM247mfbbu+Vez1OZAo2d0ysYyP0EpK5Q55/Hj5 X9kgXO9KvBtfQzc3dlkbnFSFJKKWyWkrvU2wwYIE51YQxCj/Ut8tOouw+fbqgQmTM5MN qcwNYEvA3YZQYOkaB79mvJEgFd7pUBjbHA62cmmlALaXBFNqNU3qFDmRiFSya7EjNMO7 LW5DX8+7anZHi83++ql6iQo4Cm5b7VIzZNJQdHZCBdRsGEm50HREaWLgLV1Nf8+ryqs3 2JOA== X-Gm-Message-State: APt69E09JJbXTXgtxlAuUufFF0QedaxljXJykneTMXOzsDmL3jG8HSKW wIBFcX5EcY6Sy0e/LA0HA8JRBQ== X-Google-Smtp-Source: ADUXVKK38wCwZLwB7I+7b8fn114FAubC4FEf9GTEb8eTjTSMDF6qQC6hOxWLaufsFg64ot3ikFni4w== X-Received: by 2002:a19:20c1:: with SMTP id g184-v6mr14014452lfg.96.1529515359346; Wed, 20 Jun 2018 10:22:39 -0700 (PDT) Received: from localhost.localdomain (h-158-174-22-210.NA.cust.bahnhof.se. [158.174.22.210]) by smtp.gmail.com with ESMTPSA id b2-v6sm514441lji.85.2018.06.20.10.22.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 20 Jun 2018 10:22:38 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , linux-pm@vger.kernel.org Subject: [PATCH v8 02/26] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 20 Jun 2018 19:22:02 +0200 Message-Id: <20180620172226.15012-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20180620172226.15012-1-ulf.hansson@linaro.org> References: <20180620172226.15012-1-ulf.hansson@linaro.org> X-CRM114-Version: 20100106-BlameMichelson ( TRE 0.8.0 (BSD) ) MR-646709E3 X-CRM114-CacheID: sfid-20180620_102247_798041_4837CCD6 X-CRM114-Status: GOOD ( 16.09 ) X-BeenThere: linux-arm-kernel@lists.infradead.org X-Mailman-Version: 2.1.21 Precedence: list List-Id: List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Cc: Ulf Hansson , Vincent Guittot , Juri Lelli , Geert Uytterhoeven , Kevin Hilman , Stephen Boyd , linux-arm-msm@vger.kernel.org, Daniel Lezcano , linux-kernel@vger.kernel.org, Lina Iyer , Rob Herring , linux-arm-kernel@lists.infradead.org, Thomas Gleixner , Lina Iyer MIME-Version: 1.0 Sender: "linux-arm-kernel" Errors-To: linux-arm-kernel-bounces+patchwork-linux-arm=patchwork.kernel.org@lists.infradead.org X-Virus-Scanned: ClamAV using ClamSMTP 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 Reviewed-by: Lina Iyer --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index 62969c3d5d04..21d298e1820b 100644 --- a/drivers/base/power/domain.c +++ b/drivers/base/power/domain.c @@ -467,6 +467,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; @@ -1687,6 +1691,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); } device_initialize(&genpd->dev);