Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932311Ab3FFI6d (ORCPT ); Thu, 6 Jun 2013 04:58:33 -0400 Received: from mailout1.samsung.com ([203.254.224.24]:25104 "EHLO mailout1.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932264Ab3FFI60 (ORCPT ); Thu, 6 Jun 2013 04:58:26 -0400 X-AuditID: cbfee61b-b7f8e6d00000524c-02-51b04f317709 Date: Thu, 06 Jun 2013 10:58:14 +0200 From: Lukasz Majewski To: Viresh Kumar Cc: "Rafael J. Wysocky" , "cpufreq@vger.kernel.org" , Linux PM list , Vincent Guittot , Jonghwa Lee , Myungjoo Ham , linux-kernel , Lukasz Majewski , Andre Przywara , Daniel Lezcano , Lists linaro-kernel Subject: Re: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes Message-id: <20130606105814.3495e3a9@amdc308.digital.local> In-reply-to: References: <1370502472-7249-1-git-send-email-l.majewski@samsung.com> <1370502472-7249-2-git-send-email-l.majewski@samsung.com> Organization: SPRC Poland X-Mailer: Claws Mail 3.8.1 (GTK+ 2.24.10; x86_64-pc-linux-gnu) MIME-version: 1.0 Content-type: text/plain; charset=US-ASCII Content-transfer-encoding: 7bit X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFvrPLMWRmVeSWpSXmKPExsVy+t9jQV1D/w2BBssvCVr8ebuc1eJp0w92 i3mfZS06zz5htnjziNvi/aFnzBaXd81hs/jce4TR4nbjCjaL/oW9TBYdR74xW2z86uHA43Hn 2h42j9v/HjN7rJv2ltmjb8sqRo9Hi1sYPT5vkgtgi+KySUnNySxLLdK3S+DKODH1BFPBL6GK l6flGxhP83UxcnJICJhIvF54jBnCFpO4cG89WxcjF4eQwHRGiftfvrCBJIQE2pkkzm/wBbFZ BFQlZmy8C9bAJqAn8fnuU6YuRg4OEQEtiZc3U0F6mQV+MUu0vFrADBIXFkiXeLXNAsTkFbCW aGksBzE5BYIlVk7xhNh0glHi1ZtLYBP5BSQl2v/9gDrHTuLcpw3sIDavgKDEj8n3WEBsZqBN m7c1sULY8hKb17xlnsAoOAtJ2SwkZbOQlC1gZF7FKJpakFxQnJSea6RXnJhbXJqXrpecn7uJ ERwtz6R3MK5qsDjEKMDBqMTDKxGwPlCINbGsuDL3EKMEB7OSCO8unw2BQrwpiZVVqUX58UWl OanFhxilOViUxHkPtloHCgmkJ5akZqemFqQWwWSZODilGhg97C0P16xn1jHfOtciePpn+bnC 34/a1n0NyfO2mde2+8U0j+e2zrX1NuIPH7K0qIf+y1vW3u/wx0nn5tkzz713SIudTCvYbyFg tnTuiod6oZ7WdxjfWM1TeXqeZeP2i30zvhndXH9704qamQEP1OfqHM41ZNTeWF+iefeZcPNe 0/Jrh7YfWNCuxFKckWioxVxUnAgAIynDRpICAAA= Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 2591 Lines: 85 Hi Viresh, > On 6 June 2013 12:37, Lukasz Majewski wrote: > > > Subject: cpufreq: Define cpufreq_set_drv_attr_files() to add per > > CPU sysfs attributes > > Its not per-cpu. We just add it for policy->cpu and other routines > actually create links. > > > The cpufreq_set_drv_attr_files() function creates sysfs file entry > > for each available CPU. With it in place it is possible to add > > different set of attributes without code duplication. > > Not for each available cpu but are linked to a policy->kobj and so > shows up on each policy->cpus. Yes, you are right here. Thanks for detailed explanation. Being "per-cpu" comes from kobj embedded at policy, which has information about cpus affected. > > > Signed-off-by: Lukasz Majewski > > Signed-off-by: Myungjoo Ham > > --- > > drivers/cpufreq/cpufreq.c | 23 +++++++++++++++-------- > > 1 file changed, 15 insertions(+), 8 deletions(-) > > > > diff --git a/drivers/cpufreq/cpufreq.c b/drivers/cpufreq/cpufreq.c > > index 1b8a48e..ca74e27 100644 > > --- a/drivers/cpufreq/cpufreq.c > > +++ b/drivers/cpufreq/cpufreq.c > > @@ -730,12 +730,23 @@ static int cpufreq_add_dev_symlink(unsigned > > int cpu, return ret; > > } > > > > +static int cpufreq_set_drv_attr_files(struct cpufreq_policy > > *policy, > > + struct freq_attr **drv_attr) > > +{ > > + while ((drv_attr) && (*drv_attr)) { > > + if (sysfs_create_file(&policy->kobj, > > &((*drv_attr)->attr))) > > + return 1; > > You are changing the semantics here. We used to return error > value from sysfs_create_file() and you are returning 1. Yes, correct. The ret from sysfs_create_file shall be returned. Returning 1 causes information lost. > > > + drv_attr++; > > If drv_attr was valid initially, then drv_attr++ can't make it NULL. > So, we don't need to check validity of drv_attr for every loop. I'm confused here. So you want to check dev_attr for NULL just after: drv_attr = cpufreq_driver->attr; if (!drv_attr) goto error; and skip the check at the while loop: while ((drv_attr) && (*drv_attr)) to while ((*drv_attr)) Am I correct? -- Best regards, Lukasz Majewski Samsung R&D Institute Poland (SRPOL) | Linux Platform Group -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/