From patchwork Fri Aug 16 02:25:21 2013 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Viresh Kumar X-Patchwork-Id: 19197 Return-Path: X-Original-To: linaro@patches.linaro.org Delivered-To: linaro@patches.linaro.org Received: from mail-ye0-f200.google.com (mail-ye0-f200.google.com [209.85.213.200]) by ip-10-151-82-157.ec2.internal (Postfix) with ESMTPS id 375692486D for ; Fri, 16 Aug 2013 02:28:53 +0000 (UTC) Received: by mail-ye0-f200.google.com with SMTP id r14sf651440yen.7 for ; Thu, 15 Aug 2013 19:28:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=20120113; h=mime-version:x-gm-message-state:delivered-to:from:to:cc:subject :date:message-id:in-reply-to:references:in-reply-to:references :x-original-sender:x-original-authentication-results:precedence :mailing-list:list-id:list-post:list-help:list-archive :list-unsubscribe; bh=VXhgm/b2c27KWoUFvtrzyxky5/IVIQTAxVWyjPkoixM=; b=Bvod2ZoImyMvtjoICj417A6KP55iF2J6CrWg2liEO0VsMVtbH0yF/tNThrZ1p7HOEA uWiWVhMkdycO4i66tsGO0mA5gh3zJ2rN1TzJ9FakmYKrcqGyaWGlW3ssOuUUfANbz4N9 oJIu0sI7XSmsl3mA23rpqhDUCYPVp+TVG+aQXnpRgkaM7FYVqEMTVIAXcakhkm6xYLYY Ctq7gDiHIRmK7xvJmnGlpTH97SpqeaFzFP1ZWFQk1wcbrHV+4JSVIX0hr+7cV9V4Y7VH DyRUSU7fPmKv0KxIg0mepsTPXcX3i/lTDiiAUAY3NC5nMkEqgSmTJioV8MuJGkkf/2/R rZ7g== X-Received: by 10.236.4.234 with SMTP id 70mr31451yhj.57.1376620132754; Thu, 15 Aug 2013 19:28:52 -0700 (PDT) MIME-Version: 1.0 X-BeenThere: patchwork-forward@linaro.org Received: by 10.49.95.9 with SMTP id dg9ls625643qeb.63.gmail; Thu, 15 Aug 2013 19:28:52 -0700 (PDT) X-Received: by 10.52.34.40 with SMTP id w8mr14640118vdi.7.1376620132534; Thu, 15 Aug 2013 19:28:52 -0700 (PDT) Received: from mail-ve0-f180.google.com (mail-ve0-f180.google.com [209.85.128.180]) by mx.google.com with ESMTPS id gn1si687749vec.105.2013.08.15.19.28.52 for (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:28:52 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) client-ip=209.85.128.180; Received: by mail-ve0-f180.google.com with SMTP id pb11so1126623veb.11 for ; Thu, 15 Aug 2013 19:28:52 -0700 (PDT) X-Gm-Message-State: ALoCoQlgHkerAEHN5iLn7h5EGgLqcoKzcVnId8dINInlMW3fUTe6t85RohURMfit81UaNDqybE6F X-Received: by 10.58.217.167 with SMTP id oz7mr17230303vec.15.1376620132443; Thu, 15 Aug 2013 19:28:52 -0700 (PDT) X-Forwarded-To: patchwork-forward@linaro.org X-Forwarded-For: patch@linaro.org patchwork-forward@linaro.org Delivered-To: patches@linaro.org Received: by 10.220.174.196 with SMTP id u4csp45238vcz; Thu, 15 Aug 2013 19:28:51 -0700 (PDT) X-Received: by 10.68.136.7 with SMTP id pw7mr18405347pbb.106.1376620131473; Thu, 15 Aug 2013 19:28:51 -0700 (PDT) Received: from mail-pa0-f42.google.com (mail-pa0-f42.google.com [209.85.220.42]) by mx.google.com with ESMTPS id yo4si29806pac.266.1969.12.31.16.00.00 (version=TLSv1 cipher=ECDHE-RSA-RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:28:51 -0700 (PDT) Received-SPF: neutral (google.com: 209.85.220.42 is neither permitted nor denied by best guess record for domain of viresh.kumar@linaro.org) client-ip=209.85.220.42; Received: by mail-pa0-f42.google.com with SMTP id lj1so1346537pab.29 for ; Thu, 15 Aug 2013 19:28:50 -0700 (PDT) X-Received: by 10.66.121.131 with SMTP id lk3mr675436pab.43.1376620130861; Thu, 15 Aug 2013 19:28:50 -0700 (PDT) Received: from localhost ([122.172.193.46]) by mx.google.com with ESMTPSA id yg1sm3159432pbb.1.2013.08.15.19.28.46 for (version=TLSv1.2 cipher=RC4-SHA bits=128/128); Thu, 15 Aug 2013 19:28:50 -0700 (PDT) From: Viresh Kumar To: rjw@sisk.pl Cc: linaro-kernel@lists.linaro.org, patches@linaro.org, cpufreq@vger.kernel.org, linux-pm@vger.kernel.org, linux-kernel@vger.kernel.org, linux-arm-kernel@lists.infradead.org, Viresh Kumar Subject: [PATCH 24/34] cpufreq: powernow: remove calls to cpufreq_notify_transition() Date: Fri, 16 Aug 2013 07:55:21 +0530 Message-Id: <68dee0a7584dcc2ee8a8afa2cb29e6af80cf99a4.1376619363.git.viresh.kumar@linaro.org> X-Mailer: git-send-email 1.7.12.rc2.18.g61b472e In-Reply-To: References: In-Reply-To: References: X-Removed-Original-Auth: Dkim didn't pass. X-Original-Sender: viresh.kumar@linaro.org X-Original-Authentication-Results: mx.google.com; spf=neutral (google.com: 209.85.128.180 is neither permitted nor denied by best guess record for domain of patch+caf_=patchwork-forward=linaro.org@linaro.org) smtp.mail=patch+caf_=patchwork-forward=linaro.org@linaro.org Precedence: list Mailing-list: list patchwork-forward@linaro.org; contact patchwork-forward+owners@linaro.org List-ID: X-Google-Group-Id: 836684582541 List-Post: , List-Help: , List-Archive: List-Unsubscribe: , Most of the drivers do following in their ->target_index() routines: struct cpufreq_freqs freqs; freqs.old = old freq... freqs.new = new freq... cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Change rate here */ cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); This is replicated over all cpufreq drivers today and there doesn't exists a good enough reason why this shouldn't be moved to cpufreq core instead. Earlier patches have added support in cpufreq core to do cpufreq notification on frequency change, this one removes it from this driver. Some related minor cleanups are also done along with it. Signed-off-by: Viresh Kumar --- drivers/cpufreq/powernow-k6.c | 8 -------- drivers/cpufreq/powernow-k7.c | 11 +---------- drivers/cpufreq/powernow-k8.c | 15 +-------------- 3 files changed, 2 insertions(+), 32 deletions(-) diff --git a/drivers/cpufreq/powernow-k6.c b/drivers/cpufreq/powernow-k6.c index 643e795..fedbe87 100644 --- a/drivers/cpufreq/powernow-k6.c +++ b/drivers/cpufreq/powernow-k6.c @@ -73,18 +73,12 @@ static int powernow_k6_target(struct cpufreq_policy *policy, { unsigned long outvalue = 0, invalue = 0; unsigned long msrval; - struct cpufreq_freqs freqs; if (clock_ratio[best_i].driver_data > max_multiplier) { printk(KERN_ERR PFX "invalid target frequency\n"); return -EINVAL; } - freqs.old = busfreq * powernow_k6_get_cpu_multiplier(); - freqs.new = busfreq * clock_ratio[best_i].driver_data; - - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - /* we now need to transform best_i to the BVC format, see AMD#23446 */ outvalue = (1<<12) | (1<<10) | (1<<9) | (best_i<<5); @@ -98,8 +92,6 @@ static int powernow_k6_target(struct cpufreq_policy *policy, msrval = POWERNOW_IOPORT + 0x0; wrmsr(MSR_K6_EPMR, msrval, 0); /* disable it again */ - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - return 0; } diff --git a/drivers/cpufreq/powernow-k7.c b/drivers/cpufreq/powernow-k7.c index 946708a..8e52463 100644 --- a/drivers/cpufreq/powernow-k7.c +++ b/drivers/cpufreq/powernow-k7.c @@ -251,7 +251,6 @@ static void change_VID(int vid) static int powernow_target(struct cpufreq_policy *policy, unsigned int index) { u8 fid, vid; - struct cpufreq_freqs freqs; union msr_fidvidstatus fidvidstatus; int cfid; @@ -265,18 +264,13 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) rdmsrl(MSR_K7_FID_VID_STATUS, fidvidstatus.val); cfid = fidvidstatus.bits.CFID; - freqs.old = fsb * fid_codes[cfid] / 10; - - freqs.new = powernow_table[index].frequency; - - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); /* Now do the magic poking into the MSRs. */ if (have_a0 == 1) /* A0 errata 5 */ local_irq_disable(); - if (freqs.old > freqs.new) { + if (fsb * fid_codes[cfid] / 10 > powernow_table[index].frequency) { /* Going down, so change FID first */ change_FID(fid); change_VID(vid); @@ -286,12 +280,9 @@ static int powernow_target(struct cpufreq_policy *policy, unsigned int index) change_FID(fid); } - if (have_a0 == 1) local_irq_enable(); - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - return 0; } diff --git a/drivers/cpufreq/powernow-k8.c b/drivers/cpufreq/powernow-k8.c index 62a1ce4..b00eabe 100644 --- a/drivers/cpufreq/powernow-k8.c +++ b/drivers/cpufreq/powernow-k8.c @@ -931,8 +931,6 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, struct cpufreq_policy *policy; u32 fid = 0; u32 vid = 0; - int res; - struct cpufreq_freqs freqs; pr_debug("cpu %d transition to index %u\n", smp_processor_id(), index); @@ -957,22 +955,11 @@ static int transition_frequency_fidvid(struct powernow_k8_data *data, pr_debug("cpu %d, changing to fid 0x%x, vid 0x%x\n", smp_processor_id(), fid, vid); - freqs.old = find_khz_freq_from_fid(data->currfid); - freqs.new = find_khz_freq_from_fid(fid); policy = cpufreq_cpu_get(smp_processor_id()); cpufreq_cpu_put(policy); - cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); - - res = transition_fid_vid(data, fid, vid); - if (res) - freqs.new = freqs.old; - else - freqs.new = find_khz_freq_from_fid(data->currfid); - - cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); - return res; + return transition_fid_vid(data, fid, vid); } struct powernowk8_target_arg {