lkml.org 
[lkml]   [2004]   [Dec]   [3]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH][2.6.10-rc2-mm4] perfctr sysfs update 1/4: core
On Fri, Dec 03, 2004 at 10:52:15AM +0100, Mikael Pettersson wrote:
> Greg KH writes:
> > On Thu, Dec 02, 2004 at 11:10:24AM +0100, Mikael Pettersson wrote:
> > > +static int __init perfctr_class_init(void)
> > > +{
> > > + int ret;
> > > +
> > > + ret = class_register(&perfctr_class);
> > > + if (ret)
> > > + return ret;
> > > + ret |= class_create_file(&perfctr_class, &class_attr_driver_version);
> > > + ret |= class_create_file(&perfctr_class, &class_attr_cpu_type);
> > > + ret |= class_create_file(&perfctr_class, &class_attr_cpu_features);
> > > + ret |= class_create_file(&perfctr_class, &class_attr_cpu_khz);
> > > + ret |= class_create_file(&perfctr_class, &class_attr_tsc_to_cpu_mult);
> > > + ret |= class_create_file(&perfctr_class, &class_attr_cpus_online);
> > > + ret |= class_create_file(&perfctr_class, &class_attr_cpus_forbidden);
> > > + if (ret)
> > > + class_unregister(&perfctr_class);
> > > + return ret;
> >
> > It's easier to use sysfs_create_group() instead of registering all of
> > the individual files.
>
> Thanks for the hint. While looking around I noticed I can simplify
> it even further by having perfctr_class.class_attrs point to an array
> of attributes at class_register() time.

Nice, I forgot about that :)

greg k-h
-
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/

\
 
 \ /
  Last update: 2005-03-22 14:08    [W:0.050 / U:0.420 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site