From mboxrd@z Thu Jan 1 00:00:00 1970 Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1754021AbcIIK07 (ORCPT ); Fri, 9 Sep 2016 06:26:59 -0400 Received: from foss.arm.com ([217.140.101.70]:37926 "EHLO foss.arm.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753970AbcIIKZ4 (ORCPT ); Fri, 9 Sep 2016 06:25:56 -0400 Date: Fri, 9 Sep 2016 11:25:54 +0100 From: Will Deacon To: Mark Rutland Cc: linux-arm-kernel@lists.infradead.org, linux-kernel@vger.kernel.org, acme@kernel.org, alexander.shishkin@linux.intel.com, jolsa@kernel.org, mingo@redhat.com, peterz@infradead.org Subject: Re: [RFCv4 1/7] drivers/perf: arm_pmu: add common attr group fields Message-ID: <20160909102554.GF20192@arm.com> References: <1473330112-28528-1-git-send-email-mark.rutland@arm.com> <1473330112-28528-2-git-send-email-mark.rutland@arm.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <1473330112-28528-2-git-send-email-mark.rutland@arm.com> User-Agent: Mutt/1.5.23 (2014-03-12) Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org On Thu, Sep 08, 2016 at 11:21:46AM +0100, Mark Rutland wrote: > In preparation for adding common attribute groups, add an array of > attribute group pointers to arm_pmu, which will be used if the > backend hasn't already set pmu::attr_groups. > > Subsequent patches will move backends over to using these, before adding > common fields. > > Signed-off-by: Mark Rutland > Cc: Will Deacon > --- > drivers/perf/arm_pmu.c | 3 +++ > include/linux/perf/arm_pmu.h | 9 ++++++++- > 2 files changed, 11 insertions(+), 1 deletion(-) > > diff --git a/drivers/perf/arm_pmu.c b/drivers/perf/arm_pmu.c > index f5e1008..145caf4 100644 > --- a/drivers/perf/arm_pmu.c > +++ b/drivers/perf/arm_pmu.c > @@ -1039,6 +1039,9 @@ int arm_pmu_device_probe(struct platform_device *pdev, > goto out_free; > } > > + if (!pmu->pmu.attr_groups) > + pmu->pmu.attr_groups = pmu->attr_groups; > + > ret = cpu_pmu_init(pmu); > if (ret) > goto out_free; > diff --git a/include/linux/perf/arm_pmu.h b/include/linux/perf/arm_pmu.h > index e188438..8030814 100644 > --- a/include/linux/perf/arm_pmu.h > +++ b/include/linux/perf/arm_pmu.h > @@ -14,7 +14,7 @@ > > #include > #include > - > +#include > #include > > /* > @@ -77,6 +77,12 @@ struct pmu_hw_events { > struct arm_pmu *percpu_pmu; > }; > > +enum armpmu_attr_groups { > + ARMPMU_ATTR_GROUP_EVENTS, > + ARMPMU_ATTR_GROUP_FORMATS, > + ARMPMU_NR_ATTR_GROUPS > +}; > + > struct arm_pmu { > struct pmu pmu; > cpumask_t active_irqs; > @@ -111,6 +117,7 @@ struct arm_pmu { > struct pmu_hw_events __percpu *hw_events; > struct list_head entry; > struct notifier_block cpu_pm_nb; > + const struct attribute_group *attr_groups[ARMPMU_NR_ATTR_GROUPS + 1]; Is the '+ 1' because the array has to be NULL terminated? Probably worth a comment to disuade people from sending "obvious" fixes. Will