From patchwork Tue Dec 16 23:09:39 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Dmitry Torokhov X-Patchwork-Id: 5504151 X-Patchwork-Delegate: rjw@sisk.pl Return-Path: X-Original-To: patchwork-linux-pm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork1.web.kernel.org (Postfix) with ESMTP id DEFCF9F1CD for ; Tue, 16 Dec 2014 23:10:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 1CABF20A1B for ; Tue, 16 Dec 2014 23:10:51 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 006AF209E5 for ; Tue, 16 Dec 2014 23:10:50 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1751926AbaLPXKd (ORCPT ); Tue, 16 Dec 2014 18:10:33 -0500 Received: from mail-ie0-f170.google.com ([209.85.223.170]:40244 "EHLO mail-ie0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751448AbaLPXJ4 (ORCPT ); Tue, 16 Dec 2014 18:09:56 -0500 Received: by mail-ie0-f170.google.com with SMTP id rd18so14019818iec.15 for ; Tue, 16 Dec 2014 15:09:55 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references; bh=KZ3NANt1PP1UolfjZgQeZ6d+vOHMa7QjrKYZ6N6w7Xk=; b=MZwpDz38ssxFi7BlgfHdPlu9mJcIqxJ2qJeSbvEHxe+IdiILBv5WavJF5bMrr0xvoD ufDoDZ4Dw7V7TZcQrDPVX6YldZsWbRc/P0MM26VwiC7is2E2rS+eQhmaEu20W+3vDHD1 HwTEvS9H8KZCqPpOJyiE3yL8acX1S5EvJqgj9udgR68zBpdYtsH1NrN/gIU36Y68/2Ou QMNRD5pvzOEnpj6XQ/7V0DrtYD9TNkVoVQ5feC9SEPFijqUv0Zh1oVyP23IJ/mXIiJsb ntFWa+GBp4+MR6NaYsaj2mOCYB+609WWt+2yurlYuSbP08QZajT8Iv0qTyK4C4u9g6KJ JPiA== X-Gm-Message-State: ALoCoQkBIwtxL9f+TXt5hbWOrSV0tFbWycugpW7WcWFDxM8BTvSPdebOO334kYianPLkMimiobiJ X-Received: by 10.42.100.199 with SMTP id b7mr14588143ico.36.1418771395701; Tue, 16 Dec 2014 15:09:55 -0800 (PST) Received: from dtor-ws.mtv.corp.google.com ([172.22.64.149]) by mx.google.com with ESMTPSA id s10sm1424817igr.2.2014.12.16.15.09.54 (version=TLSv1.2 cipher=ECDHE-RSA-AES128-SHA bits=128/128); Tue, 16 Dec 2014 15:09:55 -0800 (PST) From: Dmitry Torokhov To: "Rafael J. Wysocki" , Viresh Kumar Cc: Thomas Petazzoni , Geert Uytterhoeven , Stefan Wahren , Paul Gortmaker , Nishanth Menon , linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/4] cpufreq-dt: defer probing if OPP table is not ready Date: Tue, 16 Dec 2014 15:09:39 -0800 Message-Id: <1418771379-24369-5-git-send-email-dtor@chromium.org> X-Mailer: git-send-email 2.2.0.rc0.207.ga3a616c In-Reply-To: <1418771379-24369-1-git-send-email-dtor@chromium.org> References: <1418771379-24369-1-git-send-email-dtor@chromium.org> Sender: linux-pm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Spam-Status: No, score=-6.9 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP cpufreq-dt driver supports mode when OPP table is provided by platform code and not device tree. However on certain platforms code that fills OPP table may run after cpufreq driver tries to initialize, so let's report -EPROBE_DEFER if we do not find any entires in OPP table for the CPU. Signed-off-by: Dmitry Torokhov Acked-by: Viresh Kumar --- drivers/cpufreq/cpufreq-dt.c | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/drivers/cpufreq/cpufreq-dt.c b/drivers/cpufreq/cpufreq-dt.c index f56147a..fde97d6 100644 --- a/drivers/cpufreq/cpufreq-dt.c +++ b/drivers/cpufreq/cpufreq-dt.c @@ -211,6 +211,17 @@ static int cpufreq_init(struct cpufreq_policy *policy) /* OPPs might be populated at runtime, don't check for error here */ of_init_opp_table(cpu_dev); + /* + * But we need OPP table to function so if it is not there let's + * give platform code chance to provide it for us. + */ + ret = dev_pm_opp_get_opp_count(cpu_dev); + if (ret <= 0) { + pr_debug("OPP table is not ready, deferring probe\n"); + ret = -EPROBE_DEFER; + goto out_free_opp; + } + priv = kzalloc(sizeof(*priv), GFP_KERNEL); if (!priv) { ret = -ENOMEM;