lkml.org 
[lkml]   [2013]   [Jun]   [6]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    SubjectRe: [PATCH 1/5] cpufreq: Define cpufreq_set_drv_attr_files() to add per CPU sysfs attributes
    From
    On 6 June 2013 12:37, Lukasz Majewski <l.majewski@samsung.com> 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 <l.majewski@samsung.com>
    > Signed-off-by: Myungjoo Ham <myungjoo.ham@samsung.com>
    > ---
    > 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.


    \
     
     \ /
      Last update: 2013-06-06 11:01    [W:3.196 / U:0.064 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site