Re: [PATCH][2.6.10-rc2-mm4] perfctr sysfs update 1/4: core
From: Greg KH
Date: Fri Dec 03 2004 - 12:35:15 EST
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@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/