From patchwork Tue Jul 1 16:32:35 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 4460681 Return-Path: X-Original-To: patchwork-linux-arm-msm@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork2.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.19.201]) by patchwork2.web.kernel.org (Postfix) with ESMTP id 8E258BEEAA for ; Tue, 1 Jul 2014 16:38:27 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id CB95B203DA for ; Tue, 1 Jul 2014 16:38:26 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 06A782015A for ; Tue, 1 Jul 2014 16:38:26 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1758441AbaGAQe1 (ORCPT ); Tue, 1 Jul 2014 12:34:27 -0400 Received: from mail-pa0-f50.google.com ([209.85.220.50]:36992 "EHLO mail-pa0-f50.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1758432AbaGAQeY (ORCPT ); Tue, 1 Jul 2014 12:34:24 -0400 Received: by mail-pa0-f50.google.com with SMTP id bj1so10897186pad.37 for ; Tue, 01 Jul 2014 09:34:24 -0700 (PDT) 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:in-reply-to:references; bh=BMGtU+0847u6hG63hgA4tpnUM9WrgJb3emrI9wE59zg=; b=fKDm3xFx2WObAQUirl0sBtjX0ll72nFE3EDBYd4WbfT6ZfT6NBiONILAn3fAL4SWmI i2dNwHDvK4cUHF3XVdd7bE1up2VTeMjPEvLvmfSI7tV0+6HMzocfP6+lkDJ+4xi8PWCD opHXC0KOnbAZWMytwaksfBTebNdJdrhottMH6VhmqGYk38B6YlhEjq/e1fxcg4lodDyL Qk46B3HF6BMyvCC3pUKgaJEjqlvvD/31hJq69+/EKilw+LIx96Cd8klbUfesJAEFJxWa D7zBm+sbTR5lbyrhmC68a28lQ3rZSKqUXg6AXq5GlifkDA8DYGG/rl97W1ICJ6mNLUUP 0azQ== X-Gm-Message-State: ALoCoQmEm6o9ZF5a7kxRxn1WDb8/h9sNO8O9CQBzWz4rKECfWGseJrr5cDz1FF9sig/cNoGaBRY2 X-Received: by 10.66.66.199 with SMTP id h7mr2033148pat.30.1404232464060; Tue, 01 Jul 2014 09:34:24 -0700 (PDT) Received: from localhost ([122.166.172.22]) by mx.google.com with ESMTPSA id qk8sm22635785pbb.24.2014.07.01.09.34.17 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Tue, 01 Jul 2014 09:34:23 -0700 (PDT) From: Viresh Kumar To: rjw@rjwysocki.net, shawn.guo@linaro.org Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, arvind.chauhan@arm.com, sboyd@codeaurora.org, linux-arm-msm@vger.kernel.org, spk.linux@gmail.com, thomas.ab@samsung.com, nm@ti.com, t.figa@samsung.com, Viresh Kumar Subject: [PATCH 06/14] cpufreq: cpu0: defer probe if clock isn't registered yet Date: Tue, 1 Jul 2014 22:02:35 +0530 Message-Id: X-Mailer: git-send-email 2.0.0.rc2 In-Reply-To: References: In-Reply-To: References: Sender: linux-arm-msm-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-arm-msm@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=ham 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 Currently, we defer probe if regulator_get() returned -EPROBE_DEFER, i.e. regulator isn't registered yet. The same is true for clock as well, so lets defer in that case as well. Signed-off-by: Viresh Kumar --- drivers/cpufreq/cpufreq-cpu0.c | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/drivers/cpufreq/cpufreq-cpu0.c b/drivers/cpufreq/cpufreq-cpu0.c index 4273a5f..b5b8e1c 100644 --- a/drivers/cpufreq/cpufreq-cpu0.c +++ b/drivers/cpufreq/cpufreq-cpu0.c @@ -150,8 +150,17 @@ static int cpu0_cpufreq_probe(struct platform_device *pdev) cpu_clk = clk_get(cpu_dev, NULL); if (IS_ERR(cpu_clk)) { - ret = PTR_ERR(cpu_clk); - pr_err("failed to get cpu0 clock: %d\n", ret); + /* + * If cpu's clk node is present, but clock is not yet + * registered, we should try defering probe. + */ + if (PTR_ERR(cpu_clk) == -EPROBE_DEFER) { + dev_err(cpu_dev, "cpu0 clock not ready, retry\n"); + ret = -EPROBE_DEFER; + } else { + ret = PTR_ERR(cpu_clk); + dev_err(cpu_dev, "failed to get cpu0 clock: %d\n", ret); + } goto out_put_reg; }