Commit 42d5179c authored by Rikard Falkeborn's avatar Rikard Falkeborn Committed by Jason Gunthorpe

RDMA/core: Constify struct attribute_group

The only usage of the pma_table field in the ib_port struct is to pass its
address to sysfs_create_group() and sysfs_remove_group(). Make it const to
make it possible to constify a couple of static struct
attribute_group. This allows the compiler to put them in read-only memory.

Link: https://lore.kernel.org/r/20200930224004.24279-2-rikard.falkeborn@gmail.comSigned-off-by: default avatarRikard Falkeborn <rikard.falkeborn@gmail.com>
Signed-off-by: default avatarJason Gunthorpe <jgg@nvidia.com>
parent a03bfc37
...@@ -59,7 +59,7 @@ struct ib_port { ...@@ -59,7 +59,7 @@ struct ib_port {
struct gid_attr_group *gid_attr_group; struct gid_attr_group *gid_attr_group;
struct attribute_group gid_group; struct attribute_group gid_group;
struct attribute_group *pkey_group; struct attribute_group *pkey_group;
struct attribute_group *pma_table; const struct attribute_group *pma_table;
struct attribute_group *hw_stats_ag; struct attribute_group *hw_stats_ag;
struct rdma_hw_stats *hw_stats; struct rdma_hw_stats *hw_stats;
u8 port_num; u8 port_num;
...@@ -653,17 +653,17 @@ static struct attribute *pma_attrs_noietf[] = { ...@@ -653,17 +653,17 @@ static struct attribute *pma_attrs_noietf[] = {
NULL NULL
}; };
static struct attribute_group pma_group = { static const struct attribute_group pma_group = {
.name = "counters", .name = "counters",
.attrs = pma_attrs .attrs = pma_attrs
}; };
static struct attribute_group pma_group_ext = { static const struct attribute_group pma_group_ext = {
.name = "counters", .name = "counters",
.attrs = pma_attrs_ext .attrs = pma_attrs_ext
}; };
static struct attribute_group pma_group_noietf = { static const struct attribute_group pma_group_noietf = {
.name = "counters", .name = "counters",
.attrs = pma_attrs_noietf .attrs = pma_attrs_noietf
}; };
...@@ -778,7 +778,7 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *, ...@@ -778,7 +778,7 @@ alloc_group_attrs(ssize_t (*show)(struct ib_port *,
* Figure out which counter table to use depending on * Figure out which counter table to use depending on
* the device capabilities. * the device capabilities.
*/ */
static struct attribute_group *get_counter_table(struct ib_device *dev, static const struct attribute_group *get_counter_table(struct ib_device *dev,
int port_num) int port_num)
{ {
struct ib_class_port_info cpi; struct ib_class_port_info cpi;
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment