[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <9b105274-212e-1ec1-8b9e-6dd3d6c16484@arm.com>
Date: Wed, 5 Jul 2017 17:03:11 +0100
From: Suzuki K Poulose <Suzuki.Poulose@....com>
To: Arvind Yadav <arvind.yadav.cs@...il.com>, nico@...aro.org,
mark.rutland@....com, mingo@...nel.org, lorenzo.pieralisi@....com
Cc: linux-kernel@...r.kernel.org
Subject: Re: [PATCH] bus: arm-cci: constify attribute_group structures.
On 03/07/17 08:46, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by <linux/sysfs.h> work with const
> attribute_group. So mark the non-const structs as const.
>
> Signed-off-by: Arvind Yadav <arvind.yadav.cs@...il.com>
> ---
> drivers/bus/arm-cci.c | 6 +++---
> 1 file changed, 3 insertions(+), 3 deletions(-)
>
> diff --git a/drivers/bus/arm-cci.c b/drivers/bus/arm-cci.c
> index c49da15..64c75d2 100644
> --- a/drivers/bus/arm-cci.c
> +++ b/drivers/bus/arm-cci.c
> @@ -1445,16 +1445,16 @@ static ssize_t pmu_cpumask_attr_show(struct device *dev,
> NULL,
> };
>
> -static struct attribute_group pmu_attr_group = {
> +static const struct attribute_group pmu_attr_group = {
> .attrs = pmu_attrs,
> };
>
> -static struct attribute_group pmu_format_attr_group = {
> +static const struct attribute_group pmu_format_attr_group = {
> .name = "format",
> .attrs = NULL, /* Filled in cci_pmu_init_attrs */
> };
>
> -static struct attribute_group pmu_event_attr_group = {
> +static const struct attribute_group pmu_event_attr_group = {
> .name = "events",
> .attrs = NULL, /* Filled in cci_pmu_init_attrs */
> };
>
I think we cannot make these const, as the attrs field gets filled in at runtime, indicated
by the comments next to them.
Cheers
Suzuki
Powered by blists - more mailing lists