Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S932358Ab3FFI1r (ORCPT ); Thu, 6 Jun 2013 04:27:47 -0400 Received: from mail-ob0-f170.google.com ([209.85.214.170]:49764 "EHLO mail-ob0-f170.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S932326Ab3FFI1f (ORCPT ); Thu, 6 Jun 2013 04:27:35 -0400 MIME-Version: 1.0 In-Reply-To: <1370502472-7249-2-git-send-email-l.majewski@samsung.com> References: <1370502472-7249-1-git-send-email-l.majewski@samsung.com> <1370502472-7249-2-git-send-email-l.majewski@samsung.com> Date: Thu, 6 Jun 2013 13:57:34 +0530 Message-ID: Subject: Re: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes From: Viresh Kumar To: Lukasz Majewski 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 Content-Type: text/plain; charset=ISO-8859-1 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1885 Lines: 47 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. > 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. > + 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. -- 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/