Re: [RFCv4 5/7] drivers/perf: arm_pmu: expose a cpumask in sysfs

From: Mark Rutland
Date: Fri Sep 09 2016 - 07:05:21 EST


On Fri, Sep 09, 2016 at 11:24:43AM +0100, Will Deacon wrote:
> On Thu, Sep 08, 2016 at 11:21:50AM +0100, Mark Rutland wrote:
> > +static ssize_t armpmu_cpumask_show(struct device *dev,
> > + struct device_attribute *attr, char *buf)
> > +{
> > + struct arm_pmu *armpmu = to_arm_pmu(dev_get_drvdata(dev));
> > + return cpumap_print_to_pagebuf(true, buf, &armpmu->supported_cpus);
> > +}
> > +
> > +static struct device_attribute armpmu_cpumask_attr =
> > + __ATTR(cpus, S_IRUGO, armpmu_cpumask_show, NULL);
>
> You can use the DEVICE_ATTR macro for this.

Ok. I've made use of this locally.

I'll send an updated version of the patches shortly, once I've given
this a spin on HW

Mark.