attribute_groups are not supposed to change at runtime.
So mark the non-const structs as const.
Arvind Yadav (4):
[PATCH 1/4] scsi: scsi_transport_iscsi: constify attribute_group structures.
[PATCH 2/4] scsi: iscsi_boot_sysfs: constify attribute_group structures.
[PATCH 3/4] scsi: scsi_transport_fc: constify attribute_group structures.
[PATCH 4/4] scsi: scsi_transport_spi: constify attribute_group structures.
drivers/scsi/iscsi_boot_sysfs.c | 10 +++++-----
drivers/scsi/scsi_transport_fc.c | 2 +-
drivers/scsi/scsi_transport_iscsi.c | 12 ++++++------
drivers/scsi/scsi_transport_spi.c | 4 ++--
include/linux/iscsi_boot_sysfs.h | 2 +-
5 files changed, 15 insertions(+), 15 deletions(-)
--
1.9.1
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.
File size before:
text data bss dec hex filename
40380 10422 44 50846 c69e scsi/scsi_transport_iscsi.o
File size After adding 'const':
text data bss dec hex filename
40764 10070 44 50878 c6be scsi/scsi_transport_iscsi.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/scsi/scsi_transport_iscsi.c | 12 ++++++------
1 file changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/scsi_transport_iscsi.c b/drivers/scsi/scsi_transport_iscsi.c
index a424eae..55393b3 100644
--- a/drivers/scsi/scsi_transport_iscsi.c
+++ b/drivers/scsi/scsi_transport_iscsi.c
@@ -139,7 +139,7 @@ static void iscsi_transport_release(struct device *dev)
NULL,
};
-static struct attribute_group iscsi_transport_group = {
+static const struct attribute_group iscsi_transport_group = {
.attrs = iscsi_transport_attrs,
};
@@ -177,7 +177,7 @@ static void iscsi_endpoint_release(struct device *dev)
NULL,
};
-static struct attribute_group iscsi_endpoint_group = {
+static const struct attribute_group iscsi_endpoint_group = {
.attrs = iscsi_endpoint_attrs,
};
@@ -680,7 +680,7 @@ static umode_t iscsi_iface_attr_is_visible(struct kobject *kobj,
NULL,
};
-static struct attribute_group iscsi_iface_group = {
+static const struct attribute_group iscsi_iface_group = {
.attrs = iscsi_iface_attrs,
.is_visible = iscsi_iface_attr_is_visible,
};
@@ -3922,7 +3922,7 @@ static umode_t iscsi_conn_attr_is_visible(struct kobject *kobj,
return t->attr_is_visible(ISCSI_PARAM, param);
}
-static struct attribute_group iscsi_conn_group = {
+static const struct attribute_group iscsi_conn_group = {
.attrs = iscsi_conn_attrs,
.is_visible = iscsi_conn_attr_is_visible,
};
@@ -4217,7 +4217,7 @@ static umode_t iscsi_session_attr_is_visible(struct kobject *kobj,
return t->attr_is_visible(ISCSI_PARAM, param);
}
-static struct attribute_group iscsi_session_group = {
+static const struct attribute_group iscsi_session_group = {
.attrs = iscsi_session_attrs,
.is_visible = iscsi_session_attr_is_visible,
};
@@ -4285,7 +4285,7 @@ static umode_t iscsi_host_attr_is_visible(struct kobject *kobj,
return priv->iscsi_transport->attr_is_visible(ISCSI_HOST_PARAM, param);
}
-static struct attribute_group iscsi_host_group = {
+static const struct attribute_group iscsi_host_group = {
.attrs = iscsi_host_attrs,
.is_visible = iscsi_host_attr_is_visible,
};
--
1.9.1
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 <[email protected]>
---
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
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.
File size before:
text data bss dec hex filename
2548 1768 0 4316 10dc drivers/scsi/iscsi_boot_sysfs.o
File size After adding 'const':
text data bss dec hex filename
2804 1512 0 4316 10dc drivers/scsi/iscsi_boot_sysfs.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/scsi/iscsi_boot_sysfs.c | 10 +++++-----
include/linux/iscsi_boot_sysfs.h | 2 +-
2 files changed, 6 insertions(+), 6 deletions(-)
diff --git a/drivers/scsi/iscsi_boot_sysfs.c b/drivers/scsi/iscsi_boot_sysfs.c
index d453667..9670a04 100644
--- a/drivers/scsi/iscsi_boot_sysfs.c
+++ b/drivers/scsi/iscsi_boot_sysfs.c
@@ -157,7 +157,7 @@ static umode_t iscsi_boot_tgt_attr_is_visible(struct kobject *kobj,
return 0;
}
-static struct attribute_group iscsi_boot_target_attr_group = {
+static const struct attribute_group iscsi_boot_target_attr_group = {
.attrs = target_attrs,
.is_visible = iscsi_boot_tgt_attr_is_visible,
};
@@ -243,7 +243,7 @@ static umode_t iscsi_boot_eth_attr_is_visible(struct kobject *kobj,
return 0;
}
-static struct attribute_group iscsi_boot_ethernet_attr_group = {
+static const struct attribute_group iscsi_boot_ethernet_attr_group = {
.attrs = ethernet_attrs,
.is_visible = iscsi_boot_eth_attr_is_visible,
};
@@ -301,7 +301,7 @@ static umode_t iscsi_boot_ini_attr_is_visible(struct kobject *kobj,
return 0;
}
-static struct attribute_group iscsi_boot_initiator_attr_group = {
+static const struct attribute_group iscsi_boot_initiator_attr_group = {
.attrs = initiator_attrs,
.is_visible = iscsi_boot_ini_attr_is_visible,
};
@@ -337,14 +337,14 @@ static umode_t iscsi_boot_acpitbl_attr_is_visible(struct kobject *kobj,
return 0;
}
-static struct attribute_group iscsi_boot_acpitbl_attr_group = {
+static const struct attribute_group iscsi_boot_acpitbl_attr_group = {
.attrs = acpitbl_attrs,
.is_visible = iscsi_boot_acpitbl_attr_is_visible,
};
static struct iscsi_boot_kobj *
iscsi_boot_create_kobj(struct iscsi_boot_kset *boot_kset,
- struct attribute_group *attr_group,
+ const struct attribute_group *attr_group,
const char *name, int index, void *data,
ssize_t (*show) (void *data, int type, char *buf),
umode_t (*is_visible) (void *data, int type),
diff --git a/include/linux/iscsi_boot_sysfs.h b/include/linux/iscsi_boot_sysfs.h
index 10923d7..3fb07e0 100644
--- a/include/linux/iscsi_boot_sysfs.h
+++ b/include/linux/iscsi_boot_sysfs.h
@@ -74,7 +74,7 @@ enum iscsi_boot_acpitbl_properties_enum {
struct iscsi_boot_kobj {
struct kobject kobj;
- struct attribute_group *attr_group;
+ const struct attribute_group *attr_group;
struct list_head list;
/*
--
1.9.1
attribute_groups are not supposed to change at runtime. All functions
working with attribute_groups provided by <linux/transport_class.h>
work with const attribute_group. So mark the non-const structs as const.
File size before:
text data bss dec hex filename
34122 1932 4 36058 8cda drivers/scsi/scsi_transport_fc.o
File size After adding 'const':
text data bss dec hex filename
34186 1868 4 36058 8cda drivers/scsi/scsi_transport_fc.o
Signed-off-by: Arvind Yadav <[email protected]>
---
drivers/scsi/scsi_transport_fc.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/scsi/scsi_transport_fc.c b/drivers/scsi/scsi_transport_fc.c
index 7e24aa3..eda39cc 100644
--- a/drivers/scsi/scsi_transport_fc.c
+++ b/drivers/scsi/scsi_transport_fc.c
@@ -1808,7 +1808,7 @@ static FC_DEVICE_ATTR(host, reset_statistics, S_IWUSR, NULL,
NULL
};
-static struct attribute_group fc_statistics_group = {
+static const struct attribute_group fc_statistics_group = {
.name = "statistics",
.attrs = fc_statistics_attrs,
};
--
1.9.1