Skip to content

Commit b54452b

Browse files
Alexey Dobriyandavem330
authored andcommitted
const: struct nla_policy
Make remaining netlink policies as const. Fixup coding style where needed. Signed-off-by: Alexey Dobriyan <adobriyan@gmail.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 3ffe533 commit b54452b

10 files changed

Lines changed: 22 additions & 33 deletions

File tree

‎include/net/netlink.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -196,7 +196,7 @@ enum {
196196
* All other Exact length of attribute payload
197197
*
198198
* Example:
199-
* static struct nla_policy my_policy[ATTR_MAX+1] __read_mostly = {
199+
* static const struct nla_policy my_policy[ATTR_MAX+1] = {
200200
* [ATTR_FOO] = { .type = NLA_U16 },
201201
* [ATTR_BAR] = { .type = NLA_STRING, .len = BARSIZ },
202202
* [ATTR_BAZ] = { .len = sizeof(struct mystruct) },

‎kernel/taskstats.c‎

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -46,15 +46,13 @@ static struct genl_family family = {
4646
.maxattr = TASKSTATS_CMD_ATTR_MAX,
4747
};
4848

49-
static struct nla_policy taskstats_cmd_get_policy[TASKSTATS_CMD_ATTR_MAX+1]
50-
__read_mostly = {
49+
static const struct nla_policy taskstats_cmd_get_policy[TASKSTATS_CMD_ATTR_MAX+1] = {
5150
[TASKSTATS_CMD_ATTR_PID] = { .type = NLA_U32 },
5251
[TASKSTATS_CMD_ATTR_TGID] = { .type = NLA_U32 },
5352
[TASKSTATS_CMD_ATTR_REGISTER_CPUMASK] = { .type = NLA_STRING },
5453
[TASKSTATS_CMD_ATTR_DEREGISTER_CPUMASK] = { .type = NLA_STRING },};
5554

56-
static struct nla_policy
57-
cgroupstats_cmd_get_policy[CGROUPSTATS_CMD_ATTR_MAX+1] __read_mostly = {
55+
static const struct nla_policy cgroupstats_cmd_get_policy[CGROUPSTATS_CMD_ATTR_MAX+1] = {
5856
[CGROUPSTATS_CMD_ATTR_FD] = { .type = NLA_U32 },
5957
};
6058

‎net/dcb/dcbnl.c‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ MODULE_LICENSE("GPL");
5454
/**************** DCB attribute policies *************************************/
5555

5656
/* DCB netlink attributes policy */
57-
static struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = {
57+
static const struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = {
5858
[DCB_ATTR_IFNAME] = {.type = NLA_NUL_STRING, .len = IFNAMSIZ - 1},
5959
[DCB_ATTR_STATE] = {.type = NLA_U8},
6060
[DCB_ATTR_PFC_CFG] = {.type = NLA_NESTED},
@@ -68,7 +68,7 @@ static struct nla_policy dcbnl_rtnl_policy[DCB_ATTR_MAX + 1] = {
6868
};
6969

7070
/* DCB priority flow control to User Priority nested attributes */
71-
static struct nla_policy dcbnl_pfc_up_nest[DCB_PFC_UP_ATTR_MAX + 1] = {
71+
static const struct nla_policy dcbnl_pfc_up_nest[DCB_PFC_UP_ATTR_MAX + 1] = {
7272
[DCB_PFC_UP_ATTR_0] = {.type = NLA_U8},
7373
[DCB_PFC_UP_ATTR_1] = {.type = NLA_U8},
7474
[DCB_PFC_UP_ATTR_2] = {.type = NLA_U8},
@@ -81,7 +81,7 @@ static struct nla_policy dcbnl_pfc_up_nest[DCB_PFC_UP_ATTR_MAX + 1] = {
8181
};
8282

8383
/* DCB priority grouping nested attributes */
84-
static struct nla_policy dcbnl_pg_nest[DCB_PG_ATTR_MAX + 1] = {
84+
static const struct nla_policy dcbnl_pg_nest[DCB_PG_ATTR_MAX + 1] = {
8585
[DCB_PG_ATTR_TC_0] = {.type = NLA_NESTED},
8686
[DCB_PG_ATTR_TC_1] = {.type = NLA_NESTED},
8787
[DCB_PG_ATTR_TC_2] = {.type = NLA_NESTED},
@@ -103,7 +103,7 @@ static struct nla_policy dcbnl_pg_nest[DCB_PG_ATTR_MAX + 1] = {
103103
};
104104

105105
/* DCB traffic class nested attributes. */
106-
static struct nla_policy dcbnl_tc_param_nest[DCB_TC_ATTR_PARAM_MAX + 1] = {
106+
static const struct nla_policy dcbnl_tc_param_nest[DCB_TC_ATTR_PARAM_MAX + 1] = {
107107
[DCB_TC_ATTR_PARAM_PGID] = {.type = NLA_U8},
108108
[DCB_TC_ATTR_PARAM_UP_MAPPING] = {.type = NLA_U8},
109109
[DCB_TC_ATTR_PARAM_STRICT_PRIO] = {.type = NLA_U8},
@@ -112,7 +112,7 @@ static struct nla_policy dcbnl_tc_param_nest[DCB_TC_ATTR_PARAM_MAX + 1] = {
112112
};
113113

114114
/* DCB capabilities nested attributes. */
115-
static struct nla_policy dcbnl_cap_nest[DCB_CAP_ATTR_MAX + 1] = {
115+
static const struct nla_policy dcbnl_cap_nest[DCB_CAP_ATTR_MAX + 1] = {
116116
[DCB_CAP_ATTR_ALL] = {.type = NLA_FLAG},
117117
[DCB_CAP_ATTR_PG] = {.type = NLA_U8},
118118
[DCB_CAP_ATTR_PFC] = {.type = NLA_U8},
@@ -124,14 +124,14 @@ static struct nla_policy dcbnl_cap_nest[DCB_CAP_ATTR_MAX + 1] = {
124124
};
125125

126126
/* DCB capabilities nested attributes. */
127-
static struct nla_policy dcbnl_numtcs_nest[DCB_NUMTCS_ATTR_MAX + 1] = {
127+
static const struct nla_policy dcbnl_numtcs_nest[DCB_NUMTCS_ATTR_MAX + 1] = {
128128
[DCB_NUMTCS_ATTR_ALL] = {.type = NLA_FLAG},
129129
[DCB_NUMTCS_ATTR_PG] = {.type = NLA_U8},
130130
[DCB_NUMTCS_ATTR_PFC] = {.type = NLA_U8},
131131
};
132132

133133
/* DCB BCN nested attributes. */
134-
static struct nla_policy dcbnl_bcn_nest[DCB_BCN_ATTR_MAX + 1] = {
134+
static const struct nla_policy dcbnl_bcn_nest[DCB_BCN_ATTR_MAX + 1] = {
135135
[DCB_BCN_ATTR_RP_0] = {.type = NLA_U8},
136136
[DCB_BCN_ATTR_RP_1] = {.type = NLA_U8},
137137
[DCB_BCN_ATTR_RP_2] = {.type = NLA_U8},
@@ -160,7 +160,7 @@ static struct nla_policy dcbnl_bcn_nest[DCB_BCN_ATTR_MAX + 1] = {
160160
};
161161

162162
/* DCB APP nested attributes. */
163-
static struct nla_policy dcbnl_app_nest[DCB_APP_ATTR_MAX + 1] = {
163+
static const struct nla_policy dcbnl_app_nest[DCB_APP_ATTR_MAX + 1] = {
164164
[DCB_APP_ATTR_IDTYPE] = {.type = NLA_U8},
165165
[DCB_APP_ATTR_ID] = {.type = NLA_U16},
166166
[DCB_APP_ATTR_PRIORITY] = {.type = NLA_U8},

‎net/irda/irnetlink.c‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -124,7 +124,7 @@ static int irda_nl_get_mode(struct sk_buff *skb, struct genl_info *info)
124124
return ret;
125125
}
126126

127-
static struct nla_policy irda_nl_policy[IRDA_NL_ATTR_MAX + 1] = {
127+
static const struct nla_policy irda_nl_policy[IRDA_NL_ATTR_MAX + 1] = {
128128
[IRDA_NL_ATTR_IFNAME] = { .type = NLA_NUL_STRING,
129129
.len = IFNAMSIZ-1 },
130130
[IRDA_NL_ATTR_MODE] = { .type = NLA_U32 },

‎net/wimax/op-msg.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -320,8 +320,7 @@ int wimax_msg(struct wimax_dev *wimax_dev, const char *pipe_name,
320320
EXPORT_SYMBOL_GPL(wimax_msg);
321321

322322

323-
static const
324-
struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
323+
static const struct nla_policy wimax_gnl_msg_policy[WIMAX_GNL_ATTR_MAX + 1] = {
325324
[WIMAX_GNL_MSG_IFIDX] = {
326325
.type = NLA_U32,
327326
},

‎net/wimax/op-reset.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ int wimax_reset(struct wimax_dev *wimax_dev)
9191
EXPORT_SYMBOL(wimax_reset);
9292

9393

94-
static const
95-
struct nla_policy wimax_gnl_reset_policy[WIMAX_GNL_ATTR_MAX + 1] = {
94+
static const struct nla_policy wimax_gnl_reset_policy[WIMAX_GNL_ATTR_MAX + 1] = {
9695
[WIMAX_GNL_RESET_IFIDX] = {
9796
.type = NLA_U32,
9897
},

‎net/wimax/op-rfkill.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -410,8 +410,7 @@ void wimax_rfkill_rm(struct wimax_dev *wimax_dev)
410410
* just query).
411411
*/
412412

413-
static const
414-
struct nla_policy wimax_gnl_rfkill_policy[WIMAX_GNL_ATTR_MAX + 1] = {
413+
static const struct nla_policy wimax_gnl_rfkill_policy[WIMAX_GNL_ATTR_MAX + 1] = {
415414
[WIMAX_GNL_RFKILL_IFIDX] = {
416415
.type = NLA_U32,
417416
},

‎net/wimax/op-state-get.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,7 @@
3333
#include "debug-levels.h"
3434

3535

36-
static const
37-
struct nla_policy wimax_gnl_state_get_policy[WIMAX_GNL_ATTR_MAX + 1] = {
36+
static const struct nla_policy wimax_gnl_state_get_policy[WIMAX_GNL_ATTR_MAX + 1] = {
3837
[WIMAX_GNL_STGET_IFIDX] = {
3938
.type = NLA_U32,
4039
},

‎net/wimax/stack.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -75,8 +75,7 @@ MODULE_PARM_DESC(debug,
7575
* close to where the data is generated.
7676
*/
7777
/*
78-
static const
79-
struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = {
78+
static const struct nla_policy wimax_gnl_re_status_change[WIMAX_GNL_ATTR_MAX + 1] = {
8079
[WIMAX_GNL_STCH_STATE_OLD] = { .type = NLA_U8 },
8180
[WIMAX_GNL_STCH_STATE_NEW] = { .type = NLA_U8 },
8281
};

‎net/wireless/nl80211.c‎

Lines changed: 5 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ static int get_rdev_dev_by_info_ifindex(struct genl_info *info,
5858
}
5959

6060
/* policy for the attributes */
61-
static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
61+
static const struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] = {
6262
[NL80211_ATTR_WIPHY] = { .type = NLA_U32 },
6363
[NL80211_ATTR_WIPHY_NAME] = { .type = NLA_NUL_STRING,
6464
.len = 20-1 },
@@ -148,8 +148,7 @@ static struct nla_policy nl80211_policy[NL80211_ATTR_MAX+1] __read_mostly = {
148148
};
149149

150150
/* policy for the attributes */
151-
static struct nla_policy
152-
nl80211_key_policy[NL80211_KEY_MAX + 1] __read_mostly = {
151+
static const struct nla_policy nl80211_key_policy[NL80211_KEY_MAX + 1] = {
153152
[NL80211_KEY_DATA] = { .type = NLA_BINARY, .len = WLAN_MAX_KEY_LEN },
154153
[NL80211_KEY_IDX] = { .type = NLA_U8 },
155154
[NL80211_KEY_CIPHER] = { .type = NLA_U32 },
@@ -2501,8 +2500,7 @@ static int nl80211_set_bss(struct sk_buff *skb, struct genl_info *info)
25012500
return err;
25022501
}
25032502

2504-
static const struct nla_policy
2505-
reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = {
2503+
static const struct nla_policy reg_rule_policy[NL80211_REG_RULE_ATTR_MAX + 1] = {
25062504
[NL80211_ATTR_REG_RULE_FLAGS] = { .type = NLA_U32 },
25072505
[NL80211_ATTR_FREQ_RANGE_START] = { .type = NLA_U32 },
25082506
[NL80211_ATTR_FREQ_RANGE_END] = { .type = NLA_U32 },
@@ -2671,8 +2669,7 @@ do {\
26712669
} \
26722670
} while (0);\
26732671

2674-
static struct nla_policy
2675-
nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] __read_mostly = {
2672+
static const struct nla_policy nl80211_meshconf_params_policy[NL80211_MESHCONF_ATTR_MAX+1] = {
26762673
[NL80211_MESHCONF_RETRY_TIMEOUT] = { .type = NLA_U16 },
26772674
[NL80211_MESHCONF_CONFIRM_TIMEOUT] = { .type = NLA_U16 },
26782675
[NL80211_MESHCONF_HOLDING_TIMEOUT] = { .type = NLA_U16 },
@@ -4470,8 +4467,7 @@ static u32 rateset_to_mask(struct ieee80211_supported_band *sband,
44704467
return mask;
44714468
}
44724469

4473-
static struct nla_policy
4474-
nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] __read_mostly = {
4470+
static const struct nla_policy nl80211_txattr_policy[NL80211_TXRATE_MAX + 1] = {
44754471
[NL80211_TXRATE_LEGACY] = { .type = NLA_BINARY,
44764472
.len = NL80211_MAX_SUPP_RATES },
44774473
};

0 commit comments

Comments
 (0)