From patchwork Thu Nov 27 00:37:51 2014 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 41587 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ee0-f70.google.com (mail-ee0-f70.google.com [74.125.83.70]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 60AAB25E18 for ; Thu, 27 Nov 2014 00:38:36 +0000 (UTC) Received: by mail-ee0-f70.google.com with SMTP id b57sf2561664eek.9 for ; Wed, 26 Nov 2014 16:38:35 -0800 (PST) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :sender:precedence:list-id:x-original-sender :x-original-authentication-results:mailing-list:list-post:list-help :list-archive:list-unsubscribe; bh=XyzOZTMdCRPE/Mn2tTQqWrP2rOEIVznH3h3wiBKzRv8=; b=QL7oZa+rCO+Nm5XRXfoHwTl93n2jKNm9Z0cpytJmrZjtwjJ4+2nhoHgWjfTOgoajXl KgMMYtmWiXJuzPwPgeBDPkJJ1D1XSiiJkcyj6Lu/33/8k96N+N07vagWYBOGahlRZ8yB J4fi7/oxExjDcUiivYrBxBrlV/UfBXuqauNnRPc0QpwXQM8+4+lC1wQL1DM6D+jZVJyD p/uvvoaakjrDYCnCjC8LVN+E7elOE6t5uOIfBUlf9EafjEm4IhP4Xy5GsoyIeiNd2qhE atw1MVyHwV22Zd/vb11hlUcQ8dNo7hCUX/5m+EIK/JAg7q5pINFLWeDzpcr7q79IZJcE 2fpg== X-Gm-Message-State: ALoCoQlufZvHcEgzeDf8wpAYDPIrCYN9PzLrfQl2aB2lZbTTI/mhsTmfsZ5v1EuUwjvCvI5CgAFF X-Received: by 10.152.6.133 with SMTP id b5mr2586laa.10.1417048715634; Wed, 26 Nov 2014 16:38:35 -0800 (PST) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.153.11.131 with SMTP id ei3ls625331lad.106.gmail; Wed, 26 Nov 2014 16:38:35 -0800 (PST) X-Received: by 10.112.133.138 with SMTP id pc10mr36702730lbb.48.1417048715230; Wed, 26 Nov 2014 16:38:35 -0800 (PST) Received: from mail-lb0-f177.google.com (mail-lb0-f177.google.com. [209.85.217.177]) by mx.google.com with ESMTPS id kv10si5736175lac.131.2014.11.26.16.38.35 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Wed, 26 Nov 2014 16:38:35 -0800 (PST) Received-SPF: pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) client-ip=209.85.217.177; Received: by mail-lb0-f177.google.com with SMTP id 10so3293712lbg.22 for ; Wed, 26 Nov 2014 16:38:35 -0800 (PST) X-Received: by 10.152.8.170 with SMTP id s10mr36392769laa.56.1417048715136; Wed, 26 Nov 2014 16:38:35 -0800 (PST) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patch@linaro.org Received: by 10.112.184.201 with SMTP id ew9csp725278lbc; Wed, 26 Nov 2014 16:38:34 -0800 (PST) X-Received: by 10.70.36.236 with SMTP id t12mr24024136pdj.143.1417048713394; Wed, 26 Nov 2014 16:38:33 -0800 (PST) Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id s1si9240651pda.28.2014.11.26.16.38.32 for ; Wed, 26 Nov 2014 16:38:33 -0800 (PST) Received-SPF: none (google.com: linux-pm-owner@vger.kernel.org does not designate permitted sender hosts) client-ip=209.132.180.67; Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752760AbaK0Aic (ORCPT + 12 others); Wed, 26 Nov 2014 19:38:32 -0500 Received: from mail-pa0-f43.google.com ([209.85.220.43]:55292 "EHLO mail-pa0-f43.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751699AbaK0Aib (ORCPT ); Wed, 26 Nov 2014 19:38:31 -0500 Received: by mail-pa0-f43.google.com with SMTP id kx10so3880835pab.30 for ; Wed, 26 Nov 2014 16:38:31 -0800 (PST) X-Received: by 10.70.87.173 with SMTP id az13mr46317223pdb.134.1417048711375; Wed, 26 Nov 2014 16:38:31 -0800 (PST) Received: from localhost ([122.167.111.40]) by mx.google.com with ESMTPSA id cy4sm5421552pdb.0.2014.11.26.16.38.30 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Wed, 26 Nov 2014 16:38:30 -0800 (PST) From: Viresh Kumar To: Rafael Wysocki , edubezval@gmail.com Cc: linaro-kernel@lists.linaro.org, linux-pm@vger.kernel.org, l.majewski@samsung.com, Viresh Kumar Subject: [PATCH V2 3/4] cpufreq: Introduce ->ready() callback for cpufreq drivers Date: Thu, 27 Nov 2014 06:07:51 +0530 Message-Id: <8291de0dd69c731f1fc259acee190e26481f9f77.1417048449.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 2.0.3.693.g996b0fd In-Reply-To: References: In-Reply-To: References: Sender: linux-pm-owner@vger.kernel.org Precedence: list List-ID: X-Mailing-List: linux-pm@vger.kernel.org X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=pass (google.com: domain of patch+caf_=patchwork-forward=linaro.org@linaro.org designates 209.85.217.177 as permitted sender) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Currently there is no callback for cpufreq drivers which is called once the policy is ready to be used. There are some requirements where such a callback is required. One of them is registering a cooling device with the help of of_cpufreq_cooling_register(). This routine tries to get 'struct cpufreq_policy' for CPUs which isn't yet initialed at the time ->init() is called and so we face issues while registering the cooling device. Because we can't register cooling device from ->init(), we need a callback that is called after the policy is ready to be used and hence we introduce ->ready() callback. Signed-off-by: Viresh Kumar Reviewed-by: Eduardo Valentin Tested-by: Eduardo Valentin --- drivers/cpufreq/cpufreq.c | 5 +++++ include/linux/cpufreq.h | 4 ++++ 2 files changed, 9 insertions(+) diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c index de2c3e1..a09a29c 100644 --- a/drivers/cpufreq/cpufreq.c +++ b/drivers/cpufreq/cpufreq.c @@ -1285,8 +1285,13 @@ static int __cpufreq_add_dev(struct device *dev, struct subsys_interface *sif) up_write(&policy->rwsem); kobject_uevent(&policy->kobj, KOBJ_ADD); + up_read(&cpufreq_rwsem); + /* Callback for handling stuff after policy is ready */ + if (cpufreq_driver->ready) + cpufreq_driver->ready(policy); + pr_debug("initialization complete\n"); return 0; diff --git a/include/linux/cpufreq.h b/include/linux/cpufreq.h index db3c130..4d078ce 100644 --- a/include/linux/cpufreq.h +++ b/include/linux/cpufreq.h @@ -267,6 +267,10 @@ struct cpufreq_driver { void (*stop_cpu)(struct cpufreq_policy *policy); int (*suspend)(struct cpufreq_policy *policy); int (*resume)(struct cpufreq_policy *policy); + + /* Will be called after the driver is fully initialized */ + void (*ready)(struct cpufreq_policy *policy); + struct freq_attr **attr; /* platform specific boost support code */