Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S937358Ab3DIKET (ORCPT ); Tue, 9 Apr 2013 06:04:19 -0400 Received: from co1ehsobe004.messaging.microsoft.com ([216.32.180.187]:39381 "EHLO co1outboundpool.messaging.microsoft.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S934845Ab3DIKEO (ORCPT ); Tue, 9 Apr 2013 06:04:14 -0400 X-Forefront-Antispam-Report: CIP:70.37.183.190;KIP:(null);UIP:(null);IPV:NLI;H:mail.freescale.net;RD:none;EFVD:NLI X-SpamScore: -3 X-BigFish: VS-3(zz98dIc89bh542I1432I4015Izz1f42h1fc6h1ee6h1de0h1fdah1202h1e76h1d1ah1d2ahzz8275bhz2dh2a8h668h839h8e2h8e3h941hd25hf0ah1269h1288h12a5h12a9h12bdh12e1h137ah13b6h1441h1504h1537h153bh15d0h162dh1631h1758h18e1h1946h19b5h1ad9h1b0ahbe9i1155h) From: Tang Yuantian-B29983 To: Viresh Kumar CC: "rjw@sisk.pl" , "cpufreq@vger.kernel.org" , "linux-pm@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , Li Yang-R58472 Subject: RE: [PATCH v4] cpufreq: powerpc: Add cpufreq driver for Freescale e500mc SoCs Thread-Topic: [PATCH v4] cpufreq: powerpc: Add cpufreq driver for Freescale e500mc SoCs Thread-Index: AQHONQI7NwrNmkrAu0qLWr8UGqf5Z5jNpGWAgAAEf6A= Date: Tue, 9 Apr 2013 10:04:11 +0000 Message-ID: References: <1365496365-28450-1-git-send-email-Yuantian.Tang@freescale.com> In-Reply-To: Accept-Language: zh-CN, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.192.208.128] Content-Type: text/plain; charset="gb2312" MIME-Version: 1.0 X-OriginatorOrg: freescale.com Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id r39A4L1f002601 Content-Length: 2459 Lines: 73 Thanks, you make my code look better each review. Thanks, Yuantian > -----Original Message----- > From: Viresh Kumar [mailto:viresh.kumar@linaro.org] > Sent: 2013??4??9?? 17:47 > To: Tang Yuantian-B29983 > Cc: rjw@sisk.pl; cpufreq@vger.kernel.org; linux-pm@vger.kernel.org; > linux-kernel@vger.kernel.org; linuxppc-dev@lists.ozlabs.org; Li Yang- > R58472 > Subject: Re: [PATCH v4] cpufreq: powerpc: Add cpufreq driver for > Freescale e500mc SoCs > > Mostly good now, V5 should be the final one. > > On 9 April 2013 14:02, wrote: > > diff --git a/drivers/cpufreq/ppc-corenet-cpufreq.c > > b/drivers/cpufreq/ppc-corenet-cpufreq.c > > > +static int corenet_cpufreq_target(struct cpufreq_policy *policy, > > + unsigned int target_freq, unsigned int relation) { > > + struct cpufreq_freqs freqs; > > + unsigned int new; > > + struct clk *parent; > > + int ret; > > + struct cpu_data *data = per_cpu(cpu_data, policy->cpu); > > + > > + cpufreq_frequency_table_target(policy, data->table, > > + target_freq, relation, &new); > > + > > + if (policy->cur == data->table[new].frequency) > > + return 0; > > + > > + freqs.old = policy->cur; > > + freqs.new = data->table[new].frequency; > > + freqs.cpu = policy->cpu; > > You don't need to set freqs.cpu.. > > > + mutex_lock(&cpufreq_lock); > > + cpufreq_notify_transition(policy, &freqs, CPUFREQ_PRECHANGE); > > + > > + parent = of_clk_get(data->parent, new); > > + ret = clk_set_parent(data->clk, parent); > > + if (ret) { > > + freqs.new = freqs.old; > > + cpufreq_notify_transition(policy, &freqs, > CPUFREQ_POSTCHANGE); > > + mutex_unlock(&cpufreq_lock); > > + return ret; > > + } > > + > > + cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); > > + mutex_unlock(&cpufreq_lock); > > What about writing it as: > > + ret = clk_set_parent(data->clk, parent); > + if (ret) > + freqs.new = freqs.old; > + > + cpufreq_notify_transition(policy, &freqs, CPUFREQ_POSTCHANGE); > + mutex_unlock(&cpufreq_lock); > > return ret; > > > + return 0; > > +} ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?