Skip to content

Commit 667e427

Browse files
shemmingerdavem330
authored andcommitted
net: mark receive queue attributes ro_after_init
Signed-off-by: Stephen Hemminger <sthemmin@microsoft.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 2b9c758 commit 667e427

File tree

1 file changed

+13
-12
lines changed

1 file changed

+13
-12
lines changed

net/core/net-sysfs.c

Lines changed: 13 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -655,7 +655,7 @@ static const struct attribute_group wireless_group = {
655655
static ssize_t rx_queue_attr_show(struct kobject *kobj, struct attribute *attr,
656656
char *buf)
657657
{
658-
struct rx_queue_attribute *attribute = to_rx_queue_attr(attr);
658+
const struct rx_queue_attribute *attribute = to_rx_queue_attr(attr);
659659
struct netdev_rx_queue *queue = to_rx_queue(kobj);
660660

661661
if (!attribute->show)
@@ -667,7 +667,7 @@ static ssize_t rx_queue_attr_show(struct kobject *kobj, struct attribute *attr,
667667
static ssize_t rx_queue_attr_store(struct kobject *kobj, struct attribute *attr,
668668
const char *buf, size_t count)
669669
{
670-
struct rx_queue_attribute *attribute = to_rx_queue_attr(attr);
670+
const struct rx_queue_attribute *attribute = to_rx_queue_attr(attr);
671671
struct netdev_rx_queue *queue = to_rx_queue(kobj);
672672

673673
if (!attribute->store)
@@ -842,16 +842,15 @@ static ssize_t store_rps_dev_flow_table_cnt(struct netdev_rx_queue *queue,
842842
return len;
843843
}
844844

845-
static struct rx_queue_attribute rps_cpus_attribute =
846-
__ATTR(rps_cpus, S_IRUGO | S_IWUSR, show_rps_map, store_rps_map);
845+
static struct rx_queue_attribute rps_cpus_attribute __ro_after_init
846+
= __ATTR(rps_cpus, S_IRUGO | S_IWUSR, show_rps_map, store_rps_map);
847847

848-
849-
static struct rx_queue_attribute rps_dev_flow_table_cnt_attribute =
850-
__ATTR(rps_flow_cnt, S_IRUGO | S_IWUSR,
851-
show_rps_dev_flow_table_cnt, store_rps_dev_flow_table_cnt);
848+
static struct rx_queue_attribute rps_dev_flow_table_cnt_attribute __ro_after_init
849+
= __ATTR(rps_flow_cnt, S_IRUGO | S_IWUSR,
850+
show_rps_dev_flow_table_cnt, store_rps_dev_flow_table_cnt);
852851
#endif /* CONFIG_RPS */
853852

854-
static struct attribute *rx_queue_default_attrs[] = {
853+
static struct attribute *rx_queue_default_attrs[] __ro_after_init = {
855854
#ifdef CONFIG_RPS
856855
&rps_cpus_attribute.attr,
857856
&rps_dev_flow_table_cnt_attribute.attr,
@@ -896,7 +895,7 @@ static const void *rx_queue_namespace(struct kobject *kobj)
896895
return ns;
897896
}
898897

899-
static struct kobj_type rx_queue_ktype = {
898+
static struct kobj_type rx_queue_ktype __ro_after_init = {
900899
.sysfs_ops = &rx_queue_sysfs_ops,
901900
.release = rx_queue_release,
902901
.default_attrs = rx_queue_default_attrs,
@@ -983,7 +982,8 @@ struct netdev_queue_attribute {
983982
static ssize_t netdev_queue_attr_show(struct kobject *kobj,
984983
struct attribute *attr, char *buf)
985984
{
986-
struct netdev_queue_attribute *attribute = to_netdev_queue_attr(attr);
985+
const struct netdev_queue_attribute *attribute
986+
= to_netdev_queue_attr(attr);
987987
struct netdev_queue *queue = to_netdev_queue(kobj);
988988

989989
if (!attribute->show)
@@ -996,7 +996,8 @@ static ssize_t netdev_queue_attr_store(struct kobject *kobj,
996996
struct attribute *attr,
997997
const char *buf, size_t count)
998998
{
999-
struct netdev_queue_attribute *attribute = to_netdev_queue_attr(attr);
999+
const struct netdev_queue_attribute *attribute
1000+
= to_netdev_queue_attr(attr);
10001001
struct netdev_queue *queue = to_netdev_queue(kobj);
10011002

10021003
if (!attribute->store)

0 commit comments

Comments
 (0)