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


Groups > linux.kernel > #1687147 > unrolled thread

[PATCH 4/4] scsi: scsi_transport_spi: constify attribute_group structures.

Started byArvind Yadav <arvind.yadav.cs@gmail.com>
First post2017-07-14 10:30 +0200
Last post2017-07-14 10:30 +0200
Articles 1 — 1 participant

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 4/4] scsi: scsi_transport_spi: constify attribute_group structures. Arvind Yadav <arvind.yadav.cs@gmail.com> - 2017-07-14 10:30 +0200

#1687147 — [PATCH 4/4] scsi: scsi_transport_spi: constify attribute_group structures.

FromArvind Yadav <arvind.yadav.cs@gmail.com>
Date2017-07-14 10:30 +0200
Subject[PATCH 4/4] scsi: scsi_transport_spi: constify attribute_group structures.
Message-ID<u3493-LP-1@gated-at.bofh.it>
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/attribute_container.h>
and <linux/sysfs.h> work with const attribute_group. So mark the non-const
structs as const.

File size before:
   text	   data	    bss	    dec	    hex	filename
  15444	   1616	      0	  17060	   42a4	drivers/scsi/scsi_transport_spi.o

File size After adding 'const':
   text	   data	    bss	    dec	    hex	filename
  15572	   1488	      0	  17060	   42a4	drivers/scsi/scsi_transport_spi.o

Signed-off-by: Arvind Yadav <arvind.yadav.cs@gmail.com>
---
 drivers/scsi/scsi_transport_spi.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/scsi/scsi_transport_spi.c b/drivers/scsi/scsi_transport_spi.c
index d0219e3..ec723b2 100644
--- a/drivers/scsi/scsi_transport_spi.c
+++ b/drivers/scsi/scsi_transport_spi.c
@@ -1426,7 +1426,7 @@ static DECLARE_ANON_TRANSPORT_CLASS(spi_device_class,
 	NULL
 };
 
-static struct attribute_group host_attribute_group = {
+static const struct attribute_group host_attribute_group = {
 	.attrs = host_attributes,
 };
 
@@ -1536,7 +1536,7 @@ static umode_t target_attribute_is_visible(struct kobject *kobj,
 	NULL
 };
 
-static struct attribute_group target_attribute_group = {
+static const struct attribute_group target_attribute_group = {
 	.attrs = target_attributes,
 	.is_visible = target_attribute_is_visible,
 };
-- 
1.9.1

[toc] | [standalone]


Back to top | Article view | linux.kernel


csiph-web