From patchwork Wed Oct 3 14:38:15 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Ulf Hansson X-Patchwork-Id: 148057 Delivered-To: patches@linaro.org Received: by 2002:a2e:8595:0:0:0:0:0 with SMTP id b21-v6csp6557468lji; Wed, 3 Oct 2018 07:38:43 -0700 (PDT) X-Received: by 2002:a2e:b04b:: with SMTP id d11-v6mr1342013ljl.93.1538577523175; Wed, 03 Oct 2018 07:38:43 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1538577523; cv=none; d=google.com; s=arc-20160816; b=rXuZ7impl82VUglV+FvjKARF1eckDaS2dMrOJgB+PyTybK7ho6A7xr/JAVLzVadZAE Lzgawe0oIhORQHtb2Y9dVKrmxWdtH+TUoX9kR1ri0UCJirOVJG+gHhb3SKlJkQdJmb6R 0ZvD/1idj3z0DY+Hwkz+QYG+2vykRafBhKRcm5h/bI+yg9BcTBniwctACIKMZ7e1HA/m xIsfFNbqbOAXAAuDKScAAYeE5ioIlFkakoK0u9+VUtHXCmh8Vh7rNoU67GaMHjGghXRg s1HCN0sRiUHAe/ccteFm55M3Hl8ORaRLnoOCY9BlMdm9WVQU9Rl7MdzO6DudE3Anr75f i4Qg== 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; bh=kJSeKBUogM0CddiVrJB+tVbUEkpCSyoWfL42ruK06nI=; b=QGpR3AQFelJOzBtQ5B90pZmH5eoHmZGVmijKDahhVHK052j4/MCTVESyBDCnrmmX/T MV+dPihpvtj7CyglOSBEvvlKotblBapX0+CIdBDjlTffOJ6v2ylHrYeknD5oFYv4/OS4 yNkcgsFCBO1NTTDULogbvfsZDf9Q7/tkXhuEbmZ/0+IiTjJ1TcjHKbznda7xjOmKhrtw OBIr3lFo/swpFHBfmEJS2Fjwyq3bwMLHG6gkIe4Tq4F3JaeLK+pT9BxKD5QUMrR2W/No j+90pfK+UCndUzHJRQ11mngWIU7vIANtKmNyqVFGDotzuFese4R6rrCrQp/NAfUp3aQF 9o4g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@linaro.org header.s=google header.b=DwRFYkao; 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 j24-v6sor964766ljb.14.2018.10.03.07.38.43 for (Google Transport Security); Wed, 03 Oct 2018 07:38:43 -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=DwRFYkao; 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=kJSeKBUogM0CddiVrJB+tVbUEkpCSyoWfL42ruK06nI=; b=DwRFYkaoZ6lC+9pxBSR4zeinWa7QO2knEkf2vgyEZ51boEFWR8kOhlNQrxpBY0F/Bv 9rFf56a4v0+He2NkyQVaeO2FF/UBKU51JdN7abJuUVv0q1eopsLZsVq4lBHVf+zDLYUt azaa9ZQZe93Cgh/u0+FgfbwSmdE4bBOgwxbvo= 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=kJSeKBUogM0CddiVrJB+tVbUEkpCSyoWfL42ruK06nI=; b=OONz0l6f2+b63TctRYChJVgMIikq3x7pO1AwyUXHMmJqd0eVp+VUdZZr/B9JzMPDQG acBF5eRwrfgyPW05nPsjaNtDs+D7LTY3k0HzrkBUrjuVLUsKUSFnDq9QHoH8bkXaXwtT A9ErqgImih/QOMqTauGycqe0IYO2wLmXqlBheVMcYClRwfzcsEXDR4W2qrYDUgulArx2 kauT+iZZHgQ/hG5j0CKjf5ELcMypDPoKgzVY4kiU2l+udYaoHxngY+zEMcfoWk+Og6sW afge1wv74bT6OAeebr/tHlQ3yj0mPBJyE3RJ3rexAo0kcRk9SnHX6OdjoCq1mB5AFZZp TjcQ== X-Gm-Message-State: ABuFfoh5kJ0zcwY7ol73oQ+ZYEpSaQ1cPVQiClSCqONBkper7BEu2sDW 6yc4NWxKlZYZSKxYJPxYu8fFH7KZ X-Google-Smtp-Source: ACcGV6370bjHoVakbi2zeNv/IgWVUeb5Wz40qgaKOiXCLbCfIn0ouaVWSqOVrCfjNlpSIpy+kZ3erg== X-Received: by 2002:a2e:9993:: with SMTP id w19-v6mr1327092lji.165.1538577522876; Wed, 03 Oct 2018 07:38:42 -0700 (PDT) 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 18-v6sm380867ljo.74.2018.10.03.07.38.41 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 03 Oct 2018 07:38:42 -0700 (PDT) From: Ulf Hansson To: "Rafael J . Wysocki" , Sudeep Holla , Lorenzo Pieralisi , Mark Rutland , Daniel Lezcano , linux-pm@vger.kernel.org Cc: Tony Lindgren , Kevin Hilman , Lina Iyer , Ulf Hansson , Rob Herring , Viresh Kumar , Vincent Guittot , Geert Uytterhoeven , linux-arm-kernel@lists.infradead.org, linux-arm-msm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v9 02/11] PM / Domains: Deal with multiple states but no governor in genpd Date: Wed, 3 Oct 2018 16:38:15 +0200 Message-Id: <20181003143824.13059-3-ulf.hansson@linaro.org> X-Mailer: git-send-email 2.17.1 In-Reply-To: <20181003143824.13059-1-ulf.hansson@linaro.org> References: <20181003143824.13059-1-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 Reviewed-by: Lina Iyer --- drivers/base/power/domain.c | 6 ++++++ 1 file changed, 6 insertions(+) -- 2.17.1 diff --git a/drivers/base/power/domain.c b/drivers/base/power/domain.c index e1bbddb02871..7f38a92b444a 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);