Received: by 2002:ac0:a581:0:0:0:0:0 with SMTP id m1-v6csp1036980imm; Wed, 20 Jun 2018 10:29:43 -0700 (PDT) X-Google-Smtp-Source: ADUXVKIU3kMhbXFzmEdfrBvqWvvpJYVPWzpa1eR0OLK6M91wlPTkJg9JhFwfpj0qA6KKQDznsNaR X-Received: by 2002:a17:902:6046:: with SMTP id a6-v6mr25043116plt.59.1529515783443; Wed, 20 Jun 2018 10:29:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1529515783; cv=none; d=google.com; s=arc-20160816; b=w7qoPdikGNKGGV46ONYH9sMTYZc297VF4OMW2fXyL+ykZiHMiSjGIedIFaonHSw6hJ hFcw47tKCDUAi+vDVfzU+mwgrwYcr3lH7tZAUAqihcrz4YUePLH6dZHTkyVOeoSzDrUb k7yRyVSDvDsalCp6YM7XAKxDmT5G1HW/hEqAeYbi2Z1+XcRBLYOKZKLickk35c/rrzSI +ElUqrjT4I6rMTcyBZQGfXvbVdq0YDYO8kfLajmhvspFrU3ZZmSU4YWJfZxkaFC18zVd txlyF35Gf2Nen3G5hdEyJ0mvR/K2YyoAg2rBuPDxM7LAezWgXYAfT6Xwd5SY1pPKvw3h fDKw== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:references:in-reply-to:message-id:date :subject:cc:to:from:dkim-signature:arc-authentication-results; bh=BZqpdm4C3crCBCfotBf9OcWNkhZg/AfpeooWj+mQ4ng=; b=V3WQ2c2tSWqRXAZ+zJNYR0bl/bPEwYtogvqqFBcrnNW8LsfCF6s4W6ImDFUBn6/d81 27yQzIkMFB+cEM5GJ3zHXM4dJ35SPae5p+phM3OJ+stuBFLFqMJaXXuygaN/pkFMKAyv aAUYUfvIv/f3W7Qc5YPbfaUsI1V/CqdgPWyeKvokFFBf/dL8IWtle6o6+eiBO5Z4PGvA u6zp+0BDlPn/xfHh6VzffF/RfJAzls1z3kZBEAoHu1KBR0Gifi3YdBMQCBKgO/edP21M iLvOOX7arA8Z0OE8W3ryt5X9/4DE/xe4a0ttURzYrMyyAVXsA85ZWXii6I7fY+VsS+um iiTg== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuZKqg5P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t14-v6si2285092pgr.275.2018.06.20.10.29.29; Wed, 20 Jun 2018 10:29:43 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=HuZKqg5P; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=linaro.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754505AbeFTRWr (ORCPT + 99 others); Wed, 20 Jun 2018 13:22:47 -0400 Received: from mail-lf0-f67.google.com ([209.85.215.67]:46745 "EHLO mail-lf0-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1754365AbeFTRWk (ORCPT ); Wed, 20 Jun 2018 13:22:40 -0400 Received: by mail-lf0-f67.google.com with SMTP id u5-v6so436434lff.13 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=N/3XfdL/ISEYBmwqQC/lzySDVD0u4Weug9/l68iIGqbwXt6pk102MQilq7lCDSyE9I sYvdNmp4FsvzFRZ4fXZFZ5Ta57YjBZ7tZbKnuxCgYKeQ3194jneJhAXMCQOxisAaflDF zkjq4vPXsbzpunHjtb9cg75RhAf1JgTwuRmyeTRwfuXEFtWcJBB9/xusFNbDziyyhm9Y lzMVGiKIedcFm4bI3LQcy2xaubZ7wTb9/HXVKWDY/kKQCWi0XyV7le6Vzu0XvJ9fw6Mn kd/lZzfd/EkWagfUtR/lcomd1Oxr5Nge8aMZXaNxhx1WTIZPFIt1JeNLWS/i0f5wPcqD jB8w== X-Gm-Message-State: APt69E3RuMRnas+H2D8jBnNbwHKjwRAtNl5a0Yczf673/WBBeBZkmRxc AF7sujd3x79hsaiYodYMBFN9LA== 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 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 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> Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.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 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); -- 2.17.1