Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Greg KH
On Mon, Jul 17, 2017 at 09:36:58PM +, Kershner, David A wrote:
> > -Original Message-
> > From: Greg KH [mailto:g...@kroah.com]
> > Sent: Monday, July 17, 2017 8:38 AM
> > To: Arvind Yadav <arvind.yadav...@gmail.com>
> > Cc: Kershner, David A <david.kersh...@unisys.com>; Sell, Timothy C
> > <timothy.s...@unisys.com>; Thompson, Bryan E.
> > <bryan.thomp...@unisys.com>; jon.fri...@unisys.com; Binder, David
> > Anthony <david.bin...@unisys.com>; *S-Par-Maintainer
> > <sparmaintai...@unisys.com>; de...@driverdev.osuosl.org; linux-
> > ker...@vger.kernel.org
> > Subject: Re: [PATCH] staging: unisys: visorbus: constify attribute_group
> > structures.

Why is this in your email body?

> > 
> > On Mon, Jul 17, 2017 at 05:43:14PM +0530, Arvind Yadav wrote:
> > > Hi Greg,
> > >
> > >
> > > On Monday 17 July 2017 04:15 PM, Greg KH wrote:
> > > > On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> > > > > attribute_groups are not supposed to change at runtime. All functions
> > > > > working with attribute_groups provided by  work
> > > > > with const attribute_group. So mark the non-const structs as const.
> > > > >
> > > > > Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
> > > > > ---
> > > > >   drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
> > > > >   drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
> > > > >   2 files changed, 3 insertions(+), 3 deletions(-)
> > > > Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
> > > > something that is preventing that?
> > > Yes, we can use. if we are only initializing '.attrs'.
> > > ATTRIBUTE_GROUPS() will not work if we will initialize other member of
> > > attribute_group like 'bin_attrs', 'is_visible', and  'name'.
> > 
> > That means you should redo this patch :)
> > 
> > Also, your changelog text had a typo, it is "attribute_group", not
> > "attribute_groups".
> > 
> 
> Greg, are you recommending that we shouldn't be setting the attribute_group
> .name field? What does it pick up if we don't specify it?

Why do you want a name for your group?  Anyway, yes, you are right, if
you set a .name, then you can't use the macro, my fault, I hadn't looked
at it in a long time.

> Also, for our attribute_groups in visorchipset, we are defining it with two
> different attribute_group variables. Are you allowed to use two different
> attribute_group variables in an attribute_groups, or is this frowned upon and
> we should flatten it out to just one? An example that we used in the kernel 
> was:
> 
>   static const struct attribute_group *l2_cache_pmu_attr_grps[] = {
>   _cache_pmu_format_group,
>   _cache_pmu_cpumask_group,
>   NULL,
>   };

Nah, that's fine, sorry for the noise.  But the changelog text still
should be fixed so I can take this.

thanks,

greg k-h


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Greg KH
On Mon, Jul 17, 2017 at 09:36:58PM +, Kershner, David A wrote:
> > -Original Message-
> > From: Greg KH [mailto:g...@kroah.com]
> > Sent: Monday, July 17, 2017 8:38 AM
> > To: Arvind Yadav 
> > Cc: Kershner, David A ; Sell, Timothy C
> > ; Thompson, Bryan E.
> > ; jon.fri...@unisys.com; Binder, David
> > Anthony ; *S-Par-Maintainer
> > ; de...@driverdev.osuosl.org; linux-
> > ker...@vger.kernel.org
> > Subject: Re: [PATCH] staging: unisys: visorbus: constify attribute_group
> > structures.

Why is this in your email body?

> > 
> > On Mon, Jul 17, 2017 at 05:43:14PM +0530, Arvind Yadav wrote:
> > > Hi Greg,
> > >
> > >
> > > On Monday 17 July 2017 04:15 PM, Greg KH wrote:
> > > > On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> > > > > attribute_groups are not supposed to change at runtime. All functions
> > > > > working with attribute_groups provided by  work
> > > > > with const attribute_group. So mark the non-const structs as const.
> > > > >
> > > > > Signed-off-by: Arvind Yadav 
> > > > > ---
> > > > >   drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
> > > > >   drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
> > > > >   2 files changed, 3 insertions(+), 3 deletions(-)
> > > > Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
> > > > something that is preventing that?
> > > Yes, we can use. if we are only initializing '.attrs'.
> > > ATTRIBUTE_GROUPS() will not work if we will initialize other member of
> > > attribute_group like 'bin_attrs', 'is_visible', and  'name'.
> > 
> > That means you should redo this patch :)
> > 
> > Also, your changelog text had a typo, it is "attribute_group", not
> > "attribute_groups".
> > 
> 
> Greg, are you recommending that we shouldn't be setting the attribute_group
> .name field? What does it pick up if we don't specify it?

Why do you want a name for your group?  Anyway, yes, you are right, if
you set a .name, then you can't use the macro, my fault, I hadn't looked
at it in a long time.

> Also, for our attribute_groups in visorchipset, we are defining it with two
> different attribute_group variables. Are you allowed to use two different
> attribute_group variables in an attribute_groups, or is this frowned upon and
> we should flatten it out to just one? An example that we used in the kernel 
> was:
> 
>   static const struct attribute_group *l2_cache_pmu_attr_grps[] = {
>   _cache_pmu_format_group,
>   _cache_pmu_cpumask_group,
>   NULL,
>   };

Nah, that's fine, sorry for the noise.  But the changelog text still
should be fixed so I can take this.

thanks,

greg k-h


RE: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Kershner, David A
> -Original Message-
> From: Greg KH [mailto:g...@kroah.com]
> Sent: Monday, July 17, 2017 8:38 AM
> To: Arvind Yadav <arvind.yadav...@gmail.com>
> Cc: Kershner, David A <david.kersh...@unisys.com>; Sell, Timothy C
> <timothy.s...@unisys.com>; Thompson, Bryan E.
> <bryan.thomp...@unisys.com>; jon.fri...@unisys.com; Binder, David
> Anthony <david.bin...@unisys.com>; *S-Par-Maintainer
> <sparmaintai...@unisys.com>; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] staging: unisys: visorbus: constify attribute_group
> structures.
> 
> On Mon, Jul 17, 2017 at 05:43:14PM +0530, Arvind Yadav wrote:
> > Hi Greg,
> >
> >
> > On Monday 17 July 2017 04:15 PM, Greg KH wrote:
> > > On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> > > > attribute_groups are not supposed to change at runtime. All functions
> > > > working with attribute_groups provided by  work
> > > > with const attribute_group. So mark the non-const structs as const.
> > > >
> > > > Signed-off-by: Arvind Yadav <arvind.yadav...@gmail.com>
> > > > ---
> > > >   drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
> > > >   drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
> > > >   2 files changed, 3 insertions(+), 3 deletions(-)
> > > Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
> > > something that is preventing that?
> > Yes, we can use. if we are only initializing '.attrs'.
> > ATTRIBUTE_GROUPS() will not work if we will initialize other member of
> > attribute_group like 'bin_attrs', 'is_visible', and  'name'.
> 
> That means you should redo this patch :)
> 
> Also, your changelog text had a typo, it is "attribute_group", not
> "attribute_groups".
> 

Greg, are you recommending that we shouldn't be setting the attribute_group
.name field? What does it pick up if we don't specify it?

Also, for our attribute_groups in visorchipset, we are defining it with two
different attribute_group variables. Are you allowed to use two different
attribute_group variables in an attribute_groups, or is this frowned upon and
we should flatten it out to just one? An example that we used in the kernel was:

static const struct attribute_group *l2_cache_pmu_attr_grps[] = {
_cache_pmu_format_group,
_cache_pmu_cpumask_group,
NULL,
};

Thanks,
David Kershner

> thanks,
> 
> greg k-h


RE: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Kershner, David A
> -Original Message-
> From: Greg KH [mailto:g...@kroah.com]
> Sent: Monday, July 17, 2017 8:38 AM
> To: Arvind Yadav 
> Cc: Kershner, David A ; Sell, Timothy C
> ; Thompson, Bryan E.
> ; jon.fri...@unisys.com; Binder, David
> Anthony ; *S-Par-Maintainer
> ; de...@driverdev.osuosl.org; linux-
> ker...@vger.kernel.org
> Subject: Re: [PATCH] staging: unisys: visorbus: constify attribute_group
> structures.
> 
> On Mon, Jul 17, 2017 at 05:43:14PM +0530, Arvind Yadav wrote:
> > Hi Greg,
> >
> >
> > On Monday 17 July 2017 04:15 PM, Greg KH wrote:
> > > On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> > > > attribute_groups are not supposed to change at runtime. All functions
> > > > working with attribute_groups provided by  work
> > > > with const attribute_group. So mark the non-const structs as const.
> > > >
> > > > Signed-off-by: Arvind Yadav 
> > > > ---
> > > >   drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
> > > >   drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
> > > >   2 files changed, 3 insertions(+), 3 deletions(-)
> > > Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
> > > something that is preventing that?
> > Yes, we can use. if we are only initializing '.attrs'.
> > ATTRIBUTE_GROUPS() will not work if we will initialize other member of
> > attribute_group like 'bin_attrs', 'is_visible', and  'name'.
> 
> That means you should redo this patch :)
> 
> Also, your changelog text had a typo, it is "attribute_group", not
> "attribute_groups".
> 

Greg, are you recommending that we shouldn't be setting the attribute_group
.name field? What does it pick up if we don't specify it?

Also, for our attribute_groups in visorchipset, we are defining it with two
different attribute_group variables. Are you allowed to use two different
attribute_group variables in an attribute_groups, or is this frowned upon and
we should flatten it out to just one? An example that we used in the kernel was:

static const struct attribute_group *l2_cache_pmu_attr_grps[] = {
_cache_pmu_format_group,
_cache_pmu_cpumask_group,
NULL,
};

Thanks,
David Kershner

> thanks,
> 
> greg k-h


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Greg KH
On Mon, Jul 17, 2017 at 05:43:14PM +0530, Arvind Yadav wrote:
> Hi Greg,
> 
> 
> On Monday 17 July 2017 04:15 PM, Greg KH wrote:
> > On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> > > attribute_groups are not supposed to change at runtime. All functions
> > > working with attribute_groups provided by  work
> > > with const attribute_group. So mark the non-const structs as const.
> > > 
> > > Signed-off-by: Arvind Yadav 
> > > ---
> > >   drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
> > >   drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
> > >   2 files changed, 3 insertions(+), 3 deletions(-)
> > Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
> > something that is preventing that?
> Yes, we can use. if we are only initializing '.attrs'.
> ATTRIBUTE_GROUPS() will not work if we will initialize other member of
> attribute_group like 'bin_attrs', 'is_visible', and  'name'.

That means you should redo this patch :)

Also, your changelog text had a typo, it is "attribute_group", not
"attribute_groups".

thanks,

greg k-h


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Greg KH
On Mon, Jul 17, 2017 at 05:43:14PM +0530, Arvind Yadav wrote:
> Hi Greg,
> 
> 
> On Monday 17 July 2017 04:15 PM, Greg KH wrote:
> > On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> > > attribute_groups are not supposed to change at runtime. All functions
> > > working with attribute_groups provided by  work
> > > with const attribute_group. So mark the non-const structs as const.
> > > 
> > > Signed-off-by: Arvind Yadav 
> > > ---
> > >   drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
> > >   drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
> > >   2 files changed, 3 insertions(+), 3 deletions(-)
> > Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
> > something that is preventing that?
> Yes, we can use. if we are only initializing '.attrs'.
> ATTRIBUTE_GROUPS() will not work if we will initialize other member of
> attribute_group like 'bin_attrs', 'is_visible', and  'name'.

That means you should redo this patch :)

Also, your changelog text had a typo, it is "attribute_group", not
"attribute_groups".

thanks,

greg k-h


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Arvind Yadav

Hi Greg,


On Monday 17 July 2017 04:15 PM, Greg KH wrote:

On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by  work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
  drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
  drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
something that is preventing that?

Yes, we can use. if we are only initializing '.attrs'.
ATTRIBUTE_GROUPS() will not work if we will initialize other member of
attribute_group like 'bin_attrs', 'is_visible', and  'name'.


thanks,

greg k-h

Thanks,
~arvind


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Arvind Yadav

Hi Greg,


On Monday 17 July 2017 04:15 PM, Greg KH wrote:

On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:

attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by  work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
  drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
  drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
  2 files changed, 3 insertions(+), 3 deletions(-)

Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
something that is preventing that?

Yes, we can use. if we are only initializing '.attrs'.
ATTRIBUTE_GROUPS() will not work if we will initialize other member of
attribute_group like 'bin_attrs', 'is_visible', and  'name'.


thanks,

greg k-h

Thanks,
~arvind


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Greg KH
On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by  work
> with const attribute_group. So mark the non-const structs as const.
> 
> Signed-off-by: Arvind Yadav 
> ---
>  drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
>  drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
something that is preventing that?

thanks,

greg k-h


Re: [PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Greg KH
On Mon, Jul 17, 2017 at 02:55:37PM +0530, Arvind Yadav wrote:
> attribute_groups are not supposed to change at runtime. All functions
> working with attribute_groups provided by  work
> with const attribute_group. So mark the non-const structs as const.
> 
> Signed-off-by: Arvind Yadav 
> ---
>  drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
>  drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
>  2 files changed, 3 insertions(+), 3 deletions(-)

Why not just use the ATTRIBUTE_GROUPS() macro for these?  Or is there
something that is preventing that?

thanks,

greg k-h


[PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Arvind Yadav
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by  work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
 drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 1c785dd..bba10dc 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -249,7 +249,7 @@ static ssize_t typename_show(struct device *dev, struct 
device_attribute *attr,
NULL
 };
 
-static struct attribute_group channel_attr_grp = {
+static const struct attribute_group channel_attr_grp = {
.name = "channel",
.attrs = channel_attrs,
 };
@@ -340,7 +340,7 @@ static ssize_t channel_id_show(struct device *dev,
NULL
 };
 
-static struct attribute_group dev_attr_grp = {
+static const struct attribute_group dev_attr_grp = {
.attrs = dev_attrs,
 };
 
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 2215056..798a92e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1146,7 +1146,7 @@ static ssize_t deviceenabled_store(struct device *dev,
NULL
 };
 
-static struct attribute_group visorchipset_parahotplug_group = {
+static const struct attribute_group visorchipset_parahotplug_group = {
.name = "parahotplug",
.attrs = visorchipset_parahotplug_attrs
 };
-- 
1.9.1



[PATCH] staging: unisys: visorbus: constify attribute_group structures.

2017-07-17 Thread Arvind Yadav
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by  work
with const attribute_group. So mark the non-const structs as const.

Signed-off-by: Arvind Yadav 
---
 drivers/staging/unisys/visorbus/visorbus_main.c | 4 ++--
 drivers/staging/unisys/visorbus/visorchipset.c  | 2 +-
 2 files changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/unisys/visorbus/visorbus_main.c 
b/drivers/staging/unisys/visorbus/visorbus_main.c
index 1c785dd..bba10dc 100644
--- a/drivers/staging/unisys/visorbus/visorbus_main.c
+++ b/drivers/staging/unisys/visorbus/visorbus_main.c
@@ -249,7 +249,7 @@ static ssize_t typename_show(struct device *dev, struct 
device_attribute *attr,
NULL
 };
 
-static struct attribute_group channel_attr_grp = {
+static const struct attribute_group channel_attr_grp = {
.name = "channel",
.attrs = channel_attrs,
 };
@@ -340,7 +340,7 @@ static ssize_t channel_id_show(struct device *dev,
NULL
 };
 
-static struct attribute_group dev_attr_grp = {
+static const struct attribute_group dev_attr_grp = {
.attrs = dev_attrs,
 };
 
diff --git a/drivers/staging/unisys/visorbus/visorchipset.c 
b/drivers/staging/unisys/visorbus/visorchipset.c
index 2215056..798a92e 100644
--- a/drivers/staging/unisys/visorbus/visorchipset.c
+++ b/drivers/staging/unisys/visorbus/visorchipset.c
@@ -1146,7 +1146,7 @@ static ssize_t deviceenabled_store(struct device *dev,
NULL
 };
 
-static struct attribute_group visorchipset_parahotplug_group = {
+static const struct attribute_group visorchipset_parahotplug_group = {
.name = "parahotplug",
.attrs = visorchipset_parahotplug_attrs
 };
-- 
1.9.1