Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1752444AbcKRDJl (ORCPT ); Thu, 17 Nov 2016 22:09:41 -0500 Received: from mail-pg0-f46.google.com ([74.125.83.46]:34500 "EHLO mail-pg0-f46.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1751174AbcKRDJi (ORCPT ); Thu, 17 Nov 2016 22:09:38 -0500 Date: Fri, 18 Nov 2016 08:39:34 +0530 From: Viresh Kumar To: Markus Mayer Cc: Markus Mayer , "Rafael J . Wysocki" , Power Management List , Broadcom Kernel List , Linux Kernel Mailing List Subject: Re: [PATCH] cpufreq: brcmstb-cpufreq: CPUfreq driver for older Broadcom STB SoCs Message-ID: <20161118030934.GB3110@vireshk-i7> References: <20161110235601.71395-1-code@mmayer.net> <20161117090219.GE4894@vireshk-i7> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: User-Agent: Mutt/1.5.24 (2015-08-30) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1146 Lines: 36 On 17-11-16, 10:38, Markus Mayer wrote: > No, because I am trying to find the lowest frequency that doesn't > require safe mode and it's looping through the table from highest to > lowest. So there could still be a lower frequency after the current > one that doesn't require safe mode. > > What I can do, however, is something like this: > > static ssize_t show_brcmstb_safe_freq(struct cpufreq_policy *policy, char *buf) > { > struct cpufreq_frequency_table *entry; > unsigned int safe_freq = 0; > > cpufreq_for_each_valid_entry(entry, policy->freq_table) { > if (!(entry->driver_data & BRCMSTB_TBL_SAFE_MODE)) > safe_freq = entry->frequency; > } > > return sprintf(buf, "%u\n", safe_freq); > } > > This is using the existing data from the frequency table rather than > re-generating it on the fly by calling freq_requires_safe_mode(). > All my allocations are managed (i.e. using devm* functions), so > cleanup should be automatic. Do I still need one? > It's using for a clock node (brcm,brcmstb-cpu-clk-div) which exists > independently of this driver. All these seem fine to me. -- viresh