Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1704543 > unrolled thread

[PATCH] thunderbolt: constify attribute_group structure

Started byAmitoj Kaur Chawla <amitoj1606@gmail.com>
First post2017-08-05 03:50 +0200
Last post2017-08-05 10:40 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] thunderbolt: constify attribute_group structure Amitoj Kaur Chawla <amitoj1606@gmail.com> - 2017-08-05 03:50 +0200
    Re: [PATCH] thunderbolt: constify attribute_group structure Mika Westerberg <mika.westerberg@linux.intel.com> - 2017-08-05 10:40 +0200

#1704543 — [PATCH] thunderbolt: constify attribute_group structure

FromAmitoj Kaur Chawla <amitoj1606@gmail.com>
Date2017-08-05 03:50 +0200
Subject[PATCH] thunderbolt: constify attribute_group structure
Message-ID<uaWo1-6wz-11@gated-at.bofh.it>
Functions working with attribute_groups provided by <linux/device.h>
work with const attribute_group. These attribute_group structures do not
change at runtime so mark them as const.

File size before:
 text      data     bss     dec     hex filename
 28565     7300       0   35865    8c19 drivers/thunderbolt/switch.o

File size after:
 text      data     bss     dec     hex filename
 28661     7204       0   35865    8c19 drivers/thunderbolt/switch.o

This change was made with the help of Coccinelle.

Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>
---
 drivers/thunderbolt/switch.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
index e9391bb..6cd4f14 100644
--- a/drivers/thunderbolt/switch.c
+++ b/drivers/thunderbolt/switch.c
@@ -970,7 +970,7 @@ static umode_t switch_attr_is_visible(struct kobject *kobj,
 	return sw->safe_mode ? 0 : attr->mode;
 }
 
-static struct attribute_group switch_group = {
+static const struct attribute_group switch_group = {
 	.is_visible = switch_attr_is_visible,
 	.attrs = switch_attrs,
 };
-- 
2.7.4

[toc] | [next] | [standalone]


#1704606

FromMika Westerberg <mika.westerberg@linux.intel.com>
Date2017-08-05 10:40 +0200
Message-ID<ub2MN-2we-11@gated-at.bofh.it>
In reply to#1704543
On Fri, Aug 04, 2017 at 09:42:09PM -0400, Amitoj Kaur Chawla wrote:
> Functions working with attribute_groups provided by <linux/device.h>
> work with const attribute_group. These attribute_group structures do not
> change at runtime so mark them as const.
> 
> File size before:
>  text      data     bss     dec     hex filename
>  28565     7300       0   35865    8c19 drivers/thunderbolt/switch.o
> 
> File size after:
>  text      data     bss     dec     hex filename
>  28661     7204       0   35865    8c19 drivers/thunderbolt/switch.o
> 
> This change was made with the help of Coccinelle.
> 
> Signed-off-by: Amitoj Kaur Chawla <amitoj1606@gmail.com>

Acked-by: Mika Westerberg <mika.westerberg@linux.intel.com>

Unfortunately you forgot to Cc Greg. He has been gathering Thunderbolt
related patches. I added him now but it may be that you need to resend
the patch to make it easier for him to apply.

> ---
>  drivers/thunderbolt/switch.c | 2 +-
>  1 file changed, 1 insertion(+), 1 deletion(-)
> 
> diff --git a/drivers/thunderbolt/switch.c b/drivers/thunderbolt/switch.c
> index e9391bb..6cd4f14 100644
> --- a/drivers/thunderbolt/switch.c
> +++ b/drivers/thunderbolt/switch.c
> @@ -970,7 +970,7 @@ static umode_t switch_attr_is_visible(struct kobject *kobj,
>  	return sw->safe_mode ? 0 : attr->mode;
>  }
>  
> -static struct attribute_group switch_group = {
> +static const struct attribute_group switch_group = {
>  	.is_visible = switch_attr_is_visible,
>  	.attrs = switch_attrs,
>  };
> -- 
> 2.7.4

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web