diff options
author | Johannes Berg <johannes.berg@intel.com> | 2016-10-24 08:40:05 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2016-10-27 16:16:09 -0400 |
commit | 56989f6d8568c21257dcec0f5e644d5570ba3281 (patch) | |
tree | 60a6b44865e68e25dbc8bcc38d0000e12106f2d8 | |
parent | 2ae0f17df1cd52aafd1ab0415ea1f1dd56dc0e2a (diff) |
genetlink: mark families as __ro_after_init
Now genl_register_family() is the only thing (other than the
users themselves, perhaps, but I didn't find any doing that)
writing to the family struct.
In all families that I found, genl_register_family() is only
called from __init functions (some indirectly, in which case
I've add __init annotations to clarifly things), so all can
actually be marked __ro_after_init.
This protects the data structure from accidental corruption.
Signed-off-by: Johannes Berg <johannes.berg@intel.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
35 files changed, 51 insertions, 51 deletions
diff --git a/drivers/acpi/event.c b/drivers/acpi/event.c index 1ab12ad7d5ba..7fceb3b4691b 100644 --- a/drivers/acpi/event.c +++ b/drivers/acpi/event.c | |||
@@ -82,7 +82,7 @@ static const struct genl_multicast_group acpi_event_mcgrps[] = { | |||
82 | { .name = ACPI_GENL_MCAST_GROUP_NAME, }, | 82 | { .name = ACPI_GENL_MCAST_GROUP_NAME, }, |
83 | }; | 83 | }; |
84 | 84 | ||
85 | static struct genl_family acpi_event_genl_family = { | 85 | static struct genl_family acpi_event_genl_family __ro_after_init = { |
86 | .module = THIS_MODULE, | 86 | .module = THIS_MODULE, |
87 | .name = ACPI_GENL_FAMILY_NAME, | 87 | .name = ACPI_GENL_FAMILY_NAME, |
88 | .version = ACPI_GENL_VERSION, | 88 | .version = ACPI_GENL_VERSION, |
@@ -144,7 +144,7 @@ int acpi_bus_generate_netlink_event(const char *device_class, | |||
144 | 144 | ||
145 | EXPORT_SYMBOL(acpi_bus_generate_netlink_event); | 145 | EXPORT_SYMBOL(acpi_bus_generate_netlink_event); |
146 | 146 | ||
147 | static int acpi_event_genetlink_init(void) | 147 | static int __init acpi_event_genetlink_init(void) |
148 | { | 148 | { |
149 | return genl_register_family(&acpi_event_genl_family); | 149 | return genl_register_family(&acpi_event_genl_family); |
150 | } | 150 | } |
diff --git a/drivers/net/gtp.c b/drivers/net/gtp.c index 0604fd78f826..719d19f35673 100644 --- a/drivers/net/gtp.c +++ b/drivers/net/gtp.c | |||
@@ -1290,7 +1290,7 @@ static const struct genl_ops gtp_genl_ops[] = { | |||
1290 | }, | 1290 | }, |
1291 | }; | 1291 | }; |
1292 | 1292 | ||
1293 | static struct genl_family gtp_genl_family = { | 1293 | static struct genl_family gtp_genl_family __ro_after_init = { |
1294 | .name = "gtp", | 1294 | .name = "gtp", |
1295 | .version = 0, | 1295 | .version = 0, |
1296 | .hdrsize = 0, | 1296 | .hdrsize = 0, |
diff --git a/drivers/net/macsec.c b/drivers/net/macsec.c index 63ca7a3c77cf..0a715ab9d9cc 100644 --- a/drivers/net/macsec.c +++ b/drivers/net/macsec.c | |||
@@ -2648,7 +2648,7 @@ static const struct genl_ops macsec_genl_ops[] = { | |||
2648 | }, | 2648 | }, |
2649 | }; | 2649 | }; |
2650 | 2650 | ||
2651 | static struct genl_family macsec_fam = { | 2651 | static struct genl_family macsec_fam __ro_after_init = { |
2652 | .name = MACSEC_GENL_NAME, | 2652 | .name = MACSEC_GENL_NAME, |
2653 | .hdrsize = 0, | 2653 | .hdrsize = 0, |
2654 | .version = MACSEC_GENL_VERSION, | 2654 | .version = MACSEC_GENL_VERSION, |
diff --git a/drivers/net/team/team.c b/drivers/net/team/team.c index 46bf7c1216c0..bdc58567d10e 100644 --- a/drivers/net/team/team.c +++ b/drivers/net/team/team.c | |||
@@ -2740,7 +2740,7 @@ static const struct genl_multicast_group team_nl_mcgrps[] = { | |||
2740 | { .name = TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME, }, | 2740 | { .name = TEAM_GENL_CHANGE_EVENT_MC_GRP_NAME, }, |
2741 | }; | 2741 | }; |
2742 | 2742 | ||
2743 | static struct genl_family team_nl_family = { | 2743 | static struct genl_family team_nl_family __ro_after_init = { |
2744 | .name = TEAM_GENL_NAME, | 2744 | .name = TEAM_GENL_NAME, |
2745 | .version = TEAM_GENL_VERSION, | 2745 | .version = TEAM_GENL_VERSION, |
2746 | .maxattr = TEAM_ATTR_MAX, | 2746 | .maxattr = TEAM_ATTR_MAX, |
@@ -2773,7 +2773,7 @@ static int team_nl_send_event_port_get(struct team *team, | |||
2773 | port); | 2773 | port); |
2774 | } | 2774 | } |
2775 | 2775 | ||
2776 | static int team_nl_init(void) | 2776 | static int __init team_nl_init(void) |
2777 | { | 2777 | { |
2778 | return genl_register_family(&team_nl_family); | 2778 | return genl_register_family(&team_nl_family); |
2779 | } | 2779 | } |
diff --git a/drivers/net/wireless/mac80211_hwsim.c b/drivers/net/wireless/mac80211_hwsim.c index 5d4637e586e8..220e9dc8ccf8 100644 --- a/drivers/net/wireless/mac80211_hwsim.c +++ b/drivers/net/wireless/mac80211_hwsim.c | |||
@@ -3228,7 +3228,7 @@ static const struct genl_ops hwsim_ops[] = { | |||
3228 | }, | 3228 | }, |
3229 | }; | 3229 | }; |
3230 | 3230 | ||
3231 | static struct genl_family hwsim_genl_family = { | 3231 | static struct genl_family hwsim_genl_family __ro_after_init = { |
3232 | .name = "MAC80211_HWSIM", | 3232 | .name = "MAC80211_HWSIM", |
3233 | .version = 1, | 3233 | .version = 1, |
3234 | .maxattr = HWSIM_ATTR_MAX, | 3234 | .maxattr = HWSIM_ATTR_MAX, |
@@ -3287,7 +3287,7 @@ static struct notifier_block hwsim_netlink_notifier = { | |||
3287 | .notifier_call = mac80211_hwsim_netlink_notify, | 3287 | .notifier_call = mac80211_hwsim_netlink_notify, |
3288 | }; | 3288 | }; |
3289 | 3289 | ||
3290 | static int hwsim_init_netlink(void) | 3290 | static int __init hwsim_init_netlink(void) |
3291 | { | 3291 | { |
3292 | int rc; | 3292 | int rc; |
3293 | 3293 | ||
diff --git a/drivers/scsi/pmcraid.c b/drivers/scsi/pmcraid.c index c0ab7bb8c3ce..845affa112f7 100644 --- a/drivers/scsi/pmcraid.c +++ b/drivers/scsi/pmcraid.c | |||
@@ -1368,7 +1368,7 @@ static struct genl_multicast_group pmcraid_mcgrps[] = { | |||
1368 | { .name = "events", /* not really used - see ID discussion below */ }, | 1368 | { .name = "events", /* not really used - see ID discussion below */ }, |
1369 | }; | 1369 | }; |
1370 | 1370 | ||
1371 | static struct genl_family pmcraid_event_family = { | 1371 | static struct genl_family pmcraid_event_family __ro_after_init = { |
1372 | .module = THIS_MODULE, | 1372 | .module = THIS_MODULE, |
1373 | .name = "pmcraid", | 1373 | .name = "pmcraid", |
1374 | .version = 1, | 1374 | .version = 1, |
@@ -1384,7 +1384,7 @@ static struct genl_family pmcraid_event_family = { | |||
1384 | * 0 if the pmcraid_event_family is successfully registered | 1384 | * 0 if the pmcraid_event_family is successfully registered |
1385 | * with netlink generic, non-zero otherwise | 1385 | * with netlink generic, non-zero otherwise |
1386 | */ | 1386 | */ |
1387 | static int pmcraid_netlink_init(void) | 1387 | static int __init pmcraid_netlink_init(void) |
1388 | { | 1388 | { |
1389 | int result; | 1389 | int result; |
1390 | 1390 | ||
diff --git a/drivers/target/target_core_user.c b/drivers/target/target_core_user.c index 3483372f5562..0f173bf7dbac 100644 --- a/drivers/target/target_core_user.c +++ b/drivers/target/target_core_user.c | |||
@@ -147,7 +147,7 @@ static const struct genl_multicast_group tcmu_mcgrps[] = { | |||
147 | }; | 147 | }; |
148 | 148 | ||
149 | /* Our generic netlink family */ | 149 | /* Our generic netlink family */ |
150 | static struct genl_family tcmu_genl_family = { | 150 | static struct genl_family tcmu_genl_family __ro_after_init = { |
151 | .module = THIS_MODULE, | 151 | .module = THIS_MODULE, |
152 | .hdrsize = 0, | 152 | .hdrsize = 0, |
153 | .name = "TCM-USER", | 153 | .name = "TCM-USER", |
diff --git a/drivers/thermal/thermal_core.c b/drivers/thermal/thermal_core.c index 93b6caab2d9f..911fd964c742 100644 --- a/drivers/thermal/thermal_core.c +++ b/drivers/thermal/thermal_core.c | |||
@@ -2163,7 +2163,7 @@ static const struct genl_multicast_group thermal_event_mcgrps[] = { | |||
2163 | { .name = THERMAL_GENL_MCAST_GROUP_NAME, }, | 2163 | { .name = THERMAL_GENL_MCAST_GROUP_NAME, }, |
2164 | }; | 2164 | }; |
2165 | 2165 | ||
2166 | static struct genl_family thermal_event_genl_family = { | 2166 | static struct genl_family thermal_event_genl_family __ro_after_init = { |
2167 | .module = THIS_MODULE, | 2167 | .module = THIS_MODULE, |
2168 | .name = THERMAL_GENL_FAMILY_NAME, | 2168 | .name = THERMAL_GENL_FAMILY_NAME, |
2169 | .version = THERMAL_GENL_VERSION, | 2169 | .version = THERMAL_GENL_VERSION, |
@@ -2235,7 +2235,7 @@ int thermal_generate_netlink_event(struct thermal_zone_device *tz, | |||
2235 | } | 2235 | } |
2236 | EXPORT_SYMBOL_GPL(thermal_generate_netlink_event); | 2236 | EXPORT_SYMBOL_GPL(thermal_generate_netlink_event); |
2237 | 2237 | ||
2238 | static int genetlink_init(void) | 2238 | static int __init genetlink_init(void) |
2239 | { | 2239 | { |
2240 | return genl_register_family(&thermal_event_genl_family); | 2240 | return genl_register_family(&thermal_event_genl_family); |
2241 | } | 2241 | } |
diff --git a/fs/dlm/netlink.c b/fs/dlm/netlink.c index 04042d69573c..0643ae44f342 100644 --- a/fs/dlm/netlink.c +++ b/fs/dlm/netlink.c | |||
@@ -72,7 +72,7 @@ static struct genl_ops dlm_nl_ops[] = { | |||
72 | }, | 72 | }, |
73 | }; | 73 | }; |
74 | 74 | ||
75 | static struct genl_family family = { | 75 | static struct genl_family family __ro_after_init = { |
76 | .name = DLM_GENL_NAME, | 76 | .name = DLM_GENL_NAME, |
77 | .version = DLM_GENL_VERSION, | 77 | .version = DLM_GENL_VERSION, |
78 | .ops = dlm_nl_ops, | 78 | .ops = dlm_nl_ops, |
diff --git a/fs/quota/netlink.c b/fs/quota/netlink.c index 9457c7b0dfa2..e99b1a72d9a7 100644 --- a/fs/quota/netlink.c +++ b/fs/quota/netlink.c | |||
@@ -12,7 +12,7 @@ static const struct genl_multicast_group quota_mcgrps[] = { | |||
12 | }; | 12 | }; |
13 | 13 | ||
14 | /* Netlink family structure for quota */ | 14 | /* Netlink family structure for quota */ |
15 | static struct genl_family quota_genl_family = { | 15 | static struct genl_family quota_genl_family __ro_after_init = { |
16 | .module = THIS_MODULE, | 16 | .module = THIS_MODULE, |
17 | .hdrsize = 0, | 17 | .hdrsize = 0, |
18 | .name = "VFS_DQUOT", | 18 | .name = "VFS_DQUOT", |
diff --git a/include/linux/genl_magic_func.h b/include/linux/genl_magic_func.h index 40c2e39362c8..377257d8f7e3 100644 --- a/include/linux/genl_magic_func.h +++ b/include/linux/genl_magic_func.h | |||
@@ -293,7 +293,7 @@ static int CONCAT_(GENL_MAGIC_FAMILY, _genl_multicast_ ## group)( \ | |||
293 | #undef GENL_mc_group | 293 | #undef GENL_mc_group |
294 | #define GENL_mc_group(group) | 294 | #define GENL_mc_group(group) |
295 | 295 | ||
296 | static struct genl_family ZZZ_genl_family __read_mostly = { | 296 | static struct genl_family ZZZ_genl_family __ro_after_init = { |
297 | .name = __stringify(GENL_MAGIC_FAMILY), | 297 | .name = __stringify(GENL_MAGIC_FAMILY), |
298 | .version = GENL_MAGIC_VERSION, | 298 | .version = GENL_MAGIC_VERSION, |
299 | #ifdef GENL_MAGIC_FAMILY_HDRSZ | 299 | #ifdef GENL_MAGIC_FAMILY_HDRSZ |
diff --git a/kernel/taskstats.c b/kernel/taskstats.c index 4075ece592f2..9b7f838511ce 100644 --- a/kernel/taskstats.c +++ b/kernel/taskstats.c | |||
@@ -646,7 +646,7 @@ static const struct genl_ops taskstats_ops[] = { | |||
646 | }, | 646 | }, |
647 | }; | 647 | }; |
648 | 648 | ||
649 | static struct genl_family family = { | 649 | static struct genl_family family __ro_after_init = { |
650 | .name = TASKSTATS_GENL_NAME, | 650 | .name = TASKSTATS_GENL_NAME, |
651 | .version = TASKSTATS_GENL_VERSION, | 651 | .version = TASKSTATS_GENL_VERSION, |
652 | .maxattr = TASKSTATS_CMD_ATTR_MAX, | 652 | .maxattr = TASKSTATS_CMD_ATTR_MAX, |
diff --git a/net/batman-adv/netlink.c b/net/batman-adv/netlink.c index e28cec34a016..005012ba9b48 100644 --- a/net/batman-adv/netlink.c +++ b/net/batman-adv/netlink.c | |||
@@ -603,7 +603,7 @@ static struct genl_ops batadv_netlink_ops[] = { | |||
603 | 603 | ||
604 | }; | 604 | }; |
605 | 605 | ||
606 | struct genl_family batadv_netlink_family = { | 606 | struct genl_family batadv_netlink_family __ro_after_init = { |
607 | .hdrsize = 0, | 607 | .hdrsize = 0, |
608 | .name = BATADV_NL_NAME, | 608 | .name = BATADV_NL_NAME, |
609 | .version = 1, | 609 | .version = 1, |
diff --git a/net/core/devlink.c b/net/core/devlink.c index 063da8091aef..c14f8b661db9 100644 --- a/net/core/devlink.c +++ b/net/core/devlink.c | |||
@@ -1612,7 +1612,7 @@ static const struct genl_ops devlink_nl_ops[] = { | |||
1612 | }, | 1612 | }, |
1613 | }; | 1613 | }; |
1614 | 1614 | ||
1615 | static struct genl_family devlink_nl_family = { | 1615 | static struct genl_family devlink_nl_family __ro_after_init = { |
1616 | .name = DEVLINK_GENL_NAME, | 1616 | .name = DEVLINK_GENL_NAME, |
1617 | .version = DEVLINK_GENL_VERSION, | 1617 | .version = DEVLINK_GENL_VERSION, |
1618 | .maxattr = DEVLINK_ATTR_MAX, | 1618 | .maxattr = DEVLINK_ATTR_MAX, |
diff --git a/net/core/drop_monitor.c b/net/core/drop_monitor.c index 80c002794ff6..8e0c0635ee97 100644 --- a/net/core/drop_monitor.c +++ b/net/core/drop_monitor.c | |||
@@ -346,7 +346,7 @@ static const struct genl_ops dropmon_ops[] = { | |||
346 | }, | 346 | }, |
347 | }; | 347 | }; |
348 | 348 | ||
349 | static struct genl_family net_drop_monitor_family = { | 349 | static struct genl_family net_drop_monitor_family __ro_after_init = { |
350 | .hdrsize = 0, | 350 | .hdrsize = 0, |
351 | .name = "NET_DM", | 351 | .name = "NET_DM", |
352 | .version = 2, | 352 | .version = 2, |
diff --git a/net/hsr/hsr_netlink.c b/net/hsr/hsr_netlink.c index aab34c7f6f89..1ab30e7d3f99 100644 --- a/net/hsr/hsr_netlink.c +++ b/net/hsr/hsr_netlink.c | |||
@@ -461,7 +461,7 @@ static const struct genl_ops hsr_ops[] = { | |||
461 | }, | 461 | }, |
462 | }; | 462 | }; |
463 | 463 | ||
464 | static struct genl_family hsr_genl_family = { | 464 | static struct genl_family hsr_genl_family __ro_after_init = { |
465 | .hdrsize = 0, | 465 | .hdrsize = 0, |
466 | .name = "HSR", | 466 | .name = "HSR", |
467 | .version = 1, | 467 | .version = 1, |
diff --git a/net/ieee802154/netlink.c b/net/ieee802154/netlink.c index 08e62470bac2..6bde9e5a5503 100644 --- a/net/ieee802154/netlink.c +++ b/net/ieee802154/netlink.c | |||
@@ -131,7 +131,7 @@ static const struct genl_multicast_group ieee802154_mcgrps[] = { | |||
131 | [IEEE802154_BEACON_MCGRP] = { .name = IEEE802154_MCAST_BEACON_NAME, }, | 131 | [IEEE802154_BEACON_MCGRP] = { .name = IEEE802154_MCAST_BEACON_NAME, }, |
132 | }; | 132 | }; |
133 | 133 | ||
134 | struct genl_family nl802154_family = { | 134 | struct genl_family nl802154_family __ro_after_init = { |
135 | .hdrsize = 0, | 135 | .hdrsize = 0, |
136 | .name = IEEE802154_NL_NAME, | 136 | .name = IEEE802154_NL_NAME, |
137 | .version = 1, | 137 | .version = 1, |
diff --git a/net/ieee802154/nl802154.c b/net/ieee802154/nl802154.c index f7e75578aedd..fc60cd061f39 100644 --- a/net/ieee802154/nl802154.c +++ b/net/ieee802154/nl802154.c | |||
@@ -2462,7 +2462,7 @@ static const struct genl_ops nl802154_ops[] = { | |||
2462 | #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ | 2462 | #endif /* CONFIG_IEEE802154_NL802154_EXPERIMENTAL */ |
2463 | }; | 2463 | }; |
2464 | 2464 | ||
2465 | static struct genl_family nl802154_fam = { | 2465 | static struct genl_family nl802154_fam __ro_after_init = { |
2466 | .name = NL802154_GENL_NAME, /* have users key off the name instead */ | 2466 | .name = NL802154_GENL_NAME, /* have users key off the name instead */ |
2467 | .hdrsize = 0, /* no private header */ | 2467 | .hdrsize = 0, /* no private header */ |
2468 | .version = 1, /* no particular meaning now */ | 2468 | .version = 1, /* no particular meaning now */ |
@@ -2478,7 +2478,7 @@ static struct genl_family nl802154_fam = { | |||
2478 | }; | 2478 | }; |
2479 | 2479 | ||
2480 | /* initialisation/exit functions */ | 2480 | /* initialisation/exit functions */ |
2481 | int nl802154_init(void) | 2481 | int __init nl802154_init(void) |
2482 | { | 2482 | { |
2483 | return genl_register_family(&nl802154_fam); | 2483 | return genl_register_family(&nl802154_fam); |
2484 | } | 2484 | } |
diff --git a/net/ipv4/fou.c b/net/ipv4/fou.c index 5b5226a2434f..6cb57bb8692d 100644 --- a/net/ipv4/fou.c +++ b/net/ipv4/fou.c | |||
@@ -824,7 +824,7 @@ static const struct genl_ops fou_nl_ops[] = { | |||
824 | }, | 824 | }, |
825 | }; | 825 | }; |
826 | 826 | ||
827 | static struct genl_family fou_nl_family = { | 827 | static struct genl_family fou_nl_family __ro_after_init = { |
828 | .hdrsize = 0, | 828 | .hdrsize = 0, |
829 | .name = FOU_GENL_NAME, | 829 | .name = FOU_GENL_NAME, |
830 | .version = FOU_GENL_VERSION, | 830 | .version = FOU_GENL_VERSION, |
diff --git a/net/ipv4/tcp_metrics.c b/net/ipv4/tcp_metrics.c index bba3c72c4a39..d46f4d5b1c62 100644 --- a/net/ipv4/tcp_metrics.c +++ b/net/ipv4/tcp_metrics.c | |||
@@ -1109,7 +1109,7 @@ static const struct genl_ops tcp_metrics_nl_ops[] = { | |||
1109 | }, | 1109 | }, |
1110 | }; | 1110 | }; |
1111 | 1111 | ||
1112 | static struct genl_family tcp_metrics_nl_family = { | 1112 | static struct genl_family tcp_metrics_nl_family __ro_after_init = { |
1113 | .hdrsize = 0, | 1113 | .hdrsize = 0, |
1114 | .name = TCP_METRICS_GENL_NAME, | 1114 | .name = TCP_METRICS_GENL_NAME, |
1115 | .version = TCP_METRICS_GENL_VERSION, | 1115 | .version = TCP_METRICS_GENL_VERSION, |
diff --git a/net/ipv6/ila/ila_xlat.c b/net/ipv6/ila/ila_xlat.c index 97f7b0cc4675..628ae6d85b59 100644 --- a/net/ipv6/ila/ila_xlat.c +++ b/net/ipv6/ila/ila_xlat.c | |||
@@ -553,7 +553,7 @@ static const struct genl_ops ila_nl_ops[] = { | |||
553 | }, | 553 | }, |
554 | }; | 554 | }; |
555 | 555 | ||
556 | static struct genl_family ila_nl_family = { | 556 | static struct genl_family ila_nl_family __ro_after_init = { |
557 | .hdrsize = 0, | 557 | .hdrsize = 0, |
558 | .name = ILA_GENL_NAME, | 558 | .name = ILA_GENL_NAME, |
559 | .version = ILA_GENL_VERSION, | 559 | .version = ILA_GENL_VERSION, |
@@ -627,7 +627,7 @@ static int ila_xlat_addr(struct sk_buff *skb, bool set_csum_neutral) | |||
627 | return 0; | 627 | return 0; |
628 | } | 628 | } |
629 | 629 | ||
630 | int ila_xlat_init(void) | 630 | int __init ila_xlat_init(void) |
631 | { | 631 | { |
632 | int ret; | 632 | int ret; |
633 | 633 | ||
diff --git a/net/irda/irnetlink.c b/net/irda/irnetlink.c index 07877347c2f7..7fc340e574cf 100644 --- a/net/irda/irnetlink.c +++ b/net/irda/irnetlink.c | |||
@@ -141,7 +141,7 @@ static const struct genl_ops irda_nl_ops[] = { | |||
141 | 141 | ||
142 | }; | 142 | }; |
143 | 143 | ||
144 | static struct genl_family irda_nl_family = { | 144 | static struct genl_family irda_nl_family __ro_after_init = { |
145 | .name = IRDA_NL_NAME, | 145 | .name = IRDA_NL_NAME, |
146 | .hdrsize = 0, | 146 | .hdrsize = 0, |
147 | .version = IRDA_NL_VERSION, | 147 | .version = IRDA_NL_VERSION, |
@@ -151,7 +151,7 @@ static struct genl_family irda_nl_family = { | |||
151 | .n_ops = ARRAY_SIZE(irda_nl_ops), | 151 | .n_ops = ARRAY_SIZE(irda_nl_ops), |
152 | }; | 152 | }; |
153 | 153 | ||
154 | int irda_nl_register(void) | 154 | int __init irda_nl_register(void) |
155 | { | 155 | { |
156 | return genl_register_family(&irda_nl_family); | 156 | return genl_register_family(&irda_nl_family); |
157 | } | 157 | } |
diff --git a/net/l2tp/l2tp_netlink.c b/net/l2tp/l2tp_netlink.c index e4e8c0769a6b..59aa2d204e4a 100644 --- a/net/l2tp/l2tp_netlink.c +++ b/net/l2tp/l2tp_netlink.c | |||
@@ -970,7 +970,7 @@ static const struct genl_ops l2tp_nl_ops[] = { | |||
970 | }, | 970 | }, |
971 | }; | 971 | }; |
972 | 972 | ||
973 | static struct genl_family l2tp_nl_family = { | 973 | static struct genl_family l2tp_nl_family __ro_after_init = { |
974 | .name = L2TP_GENL_NAME, | 974 | .name = L2TP_GENL_NAME, |
975 | .version = L2TP_GENL_VERSION, | 975 | .version = L2TP_GENL_VERSION, |
976 | .hdrsize = 0, | 976 | .hdrsize = 0, |
@@ -1016,7 +1016,7 @@ void l2tp_nl_unregister_ops(enum l2tp_pwtype pw_type) | |||
1016 | } | 1016 | } |
1017 | EXPORT_SYMBOL_GPL(l2tp_nl_unregister_ops); | 1017 | EXPORT_SYMBOL_GPL(l2tp_nl_unregister_ops); |
1018 | 1018 | ||
1019 | static int l2tp_nl_init(void) | 1019 | static int __init l2tp_nl_init(void) |
1020 | { | 1020 | { |
1021 | pr_info("L2TP netlink interface\n"); | 1021 | pr_info("L2TP netlink interface\n"); |
1022 | return genl_register_family(&l2tp_nl_family); | 1022 | return genl_register_family(&l2tp_nl_family); |
diff --git a/net/netfilter/ipvs/ip_vs_ctl.c b/net/netfilter/ipvs/ip_vs_ctl.c index ea3e8aed063f..6b85ded4f91d 100644 --- a/net/netfilter/ipvs/ip_vs_ctl.c +++ b/net/netfilter/ipvs/ip_vs_ctl.c | |||
@@ -3865,7 +3865,7 @@ static const struct genl_ops ip_vs_genl_ops[] = { | |||
3865 | }, | 3865 | }, |
3866 | }; | 3866 | }; |
3867 | 3867 | ||
3868 | static struct genl_family ip_vs_genl_family = { | 3868 | static struct genl_family ip_vs_genl_family __ro_after_init = { |
3869 | .hdrsize = 0, | 3869 | .hdrsize = 0, |
3870 | .name = IPVS_GENL_NAME, | 3870 | .name = IPVS_GENL_NAME, |
3871 | .version = IPVS_GENL_VERSION, | 3871 | .version = IPVS_GENL_VERSION, |
diff --git a/net/netlabel/netlabel_calipso.c b/net/netlabel/netlabel_calipso.c index ca7c9c411a5c..d177dd066504 100644 --- a/net/netlabel/netlabel_calipso.c +++ b/net/netlabel/netlabel_calipso.c | |||
@@ -349,7 +349,7 @@ static const struct genl_ops netlbl_calipso_ops[] = { | |||
349 | }, | 349 | }, |
350 | }; | 350 | }; |
351 | 351 | ||
352 | static struct genl_family netlbl_calipso_gnl_family = { | 352 | static struct genl_family netlbl_calipso_gnl_family __ro_after_init = { |
353 | .hdrsize = 0, | 353 | .hdrsize = 0, |
354 | .name = NETLBL_NLTYPE_CALIPSO_NAME, | 354 | .name = NETLBL_NLTYPE_CALIPSO_NAME, |
355 | .version = NETLBL_PROTO_VERSION, | 355 | .version = NETLBL_PROTO_VERSION, |
diff --git a/net/netlabel/netlabel_cipso_v4.c b/net/netlabel/netlabel_cipso_v4.c index a665eae91245..4149d3e63589 100644 --- a/net/netlabel/netlabel_cipso_v4.c +++ b/net/netlabel/netlabel_cipso_v4.c | |||
@@ -760,7 +760,7 @@ static const struct genl_ops netlbl_cipsov4_ops[] = { | |||
760 | }, | 760 | }, |
761 | }; | 761 | }; |
762 | 762 | ||
763 | static struct genl_family netlbl_cipsov4_gnl_family = { | 763 | static struct genl_family netlbl_cipsov4_gnl_family __ro_after_init = { |
764 | .hdrsize = 0, | 764 | .hdrsize = 0, |
765 | .name = NETLBL_NLTYPE_CIPSOV4_NAME, | 765 | .name = NETLBL_NLTYPE_CIPSOV4_NAME, |
766 | .version = NETLBL_PROTO_VERSION, | 766 | .version = NETLBL_PROTO_VERSION, |
diff --git a/net/netlabel/netlabel_mgmt.c b/net/netlabel/netlabel_mgmt.c index ecfe8eb149db..21e0095b1d14 100644 --- a/net/netlabel/netlabel_mgmt.c +++ b/net/netlabel/netlabel_mgmt.c | |||
@@ -828,7 +828,7 @@ static const struct genl_ops netlbl_mgmt_genl_ops[] = { | |||
828 | }, | 828 | }, |
829 | }; | 829 | }; |
830 | 830 | ||
831 | static struct genl_family netlbl_mgmt_gnl_family = { | 831 | static struct genl_family netlbl_mgmt_gnl_family __ro_after_init = { |
832 | .hdrsize = 0, | 832 | .hdrsize = 0, |
833 | .name = NETLBL_NLTYPE_MGMT_NAME, | 833 | .name = NETLBL_NLTYPE_MGMT_NAME, |
834 | .version = NETLBL_PROTO_VERSION, | 834 | .version = NETLBL_PROTO_VERSION, |
diff --git a/net/netlabel/netlabel_unlabeled.c b/net/netlabel/netlabel_unlabeled.c index 5dbbad41114f..22dc1b9d6362 100644 --- a/net/netlabel/netlabel_unlabeled.c +++ b/net/netlabel/netlabel_unlabeled.c | |||
@@ -1372,7 +1372,7 @@ static const struct genl_ops netlbl_unlabel_genl_ops[] = { | |||
1372 | }, | 1372 | }, |
1373 | }; | 1373 | }; |
1374 | 1374 | ||
1375 | static struct genl_family netlbl_unlabel_gnl_family = { | 1375 | static struct genl_family netlbl_unlabel_gnl_family __ro_after_init = { |
1376 | .hdrsize = 0, | 1376 | .hdrsize = 0, |
1377 | .name = NETLBL_NLTYPE_UNLABELED_NAME, | 1377 | .name = NETLBL_NLTYPE_UNLABELED_NAME, |
1378 | .version = NETLBL_PROTO_VERSION, | 1378 | .version = NETLBL_PROTO_VERSION, |
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 85659921e7b2..df0cbcddda2c 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -936,7 +936,7 @@ static const struct genl_multicast_group genl_ctrl_groups[] = { | |||
936 | { .name = "notify", }, | 936 | { .name = "notify", }, |
937 | }; | 937 | }; |
938 | 938 | ||
939 | static struct genl_family genl_ctrl = { | 939 | static struct genl_family genl_ctrl __ro_after_init = { |
940 | .module = THIS_MODULE, | 940 | .module = THIS_MODULE, |
941 | .ops = genl_ctrl_ops, | 941 | .ops = genl_ctrl_ops, |
942 | .n_ops = ARRAY_SIZE(genl_ctrl_ops), | 942 | .n_ops = ARRAY_SIZE(genl_ctrl_ops), |
diff --git a/net/nfc/netlink.c b/net/nfc/netlink.c index 450b1e5144cc..03f3d5c7beb8 100644 --- a/net/nfc/netlink.c +++ b/net/nfc/netlink.c | |||
@@ -1746,7 +1746,7 @@ static const struct genl_ops nfc_genl_ops[] = { | |||
1746 | }, | 1746 | }, |
1747 | }; | 1747 | }; |
1748 | 1748 | ||
1749 | static struct genl_family nfc_genl_family = { | 1749 | static struct genl_family nfc_genl_family __ro_after_init = { |
1750 | .hdrsize = 0, | 1750 | .hdrsize = 0, |
1751 | .name = NFC_GENL_NAME, | 1751 | .name = NFC_GENL_NAME, |
1752 | .version = NFC_GENL_VERSION, | 1752 | .version = NFC_GENL_VERSION, |
diff --git a/net/openvswitch/datapath.c b/net/openvswitch/datapath.c index ad6a111a0014..fa8760176b7d 100644 --- a/net/openvswitch/datapath.c +++ b/net/openvswitch/datapath.c | |||
@@ -670,7 +670,7 @@ static const struct genl_ops dp_packet_genl_ops[] = { | |||
670 | } | 670 | } |
671 | }; | 671 | }; |
672 | 672 | ||
673 | static struct genl_family dp_packet_genl_family = { | 673 | static struct genl_family dp_packet_genl_family __ro_after_init = { |
674 | .hdrsize = sizeof(struct ovs_header), | 674 | .hdrsize = sizeof(struct ovs_header), |
675 | .name = OVS_PACKET_FAMILY, | 675 | .name = OVS_PACKET_FAMILY, |
676 | .version = OVS_PACKET_VERSION, | 676 | .version = OVS_PACKET_VERSION, |
@@ -1435,7 +1435,7 @@ static const struct genl_ops dp_flow_genl_ops[] = { | |||
1435 | }, | 1435 | }, |
1436 | }; | 1436 | }; |
1437 | 1437 | ||
1438 | static struct genl_family dp_flow_genl_family = { | 1438 | static struct genl_family dp_flow_genl_family __ro_after_init = { |
1439 | .hdrsize = sizeof(struct ovs_header), | 1439 | .hdrsize = sizeof(struct ovs_header), |
1440 | .name = OVS_FLOW_FAMILY, | 1440 | .name = OVS_FLOW_FAMILY, |
1441 | .version = OVS_FLOW_VERSION, | 1441 | .version = OVS_FLOW_VERSION, |
@@ -1821,7 +1821,7 @@ static const struct genl_ops dp_datapath_genl_ops[] = { | |||
1821 | }, | 1821 | }, |
1822 | }; | 1822 | }; |
1823 | 1823 | ||
1824 | static struct genl_family dp_datapath_genl_family = { | 1824 | static struct genl_family dp_datapath_genl_family __ro_after_init = { |
1825 | .hdrsize = sizeof(struct ovs_header), | 1825 | .hdrsize = sizeof(struct ovs_header), |
1826 | .name = OVS_DATAPATH_FAMILY, | 1826 | .name = OVS_DATAPATH_FAMILY, |
1827 | .version = OVS_DATAPATH_VERSION, | 1827 | .version = OVS_DATAPATH_VERSION, |
@@ -2243,7 +2243,7 @@ static const struct genl_ops dp_vport_genl_ops[] = { | |||
2243 | }, | 2243 | }, |
2244 | }; | 2244 | }; |
2245 | 2245 | ||
2246 | struct genl_family dp_vport_genl_family = { | 2246 | struct genl_family dp_vport_genl_family __ro_after_init = { |
2247 | .hdrsize = sizeof(struct ovs_header), | 2247 | .hdrsize = sizeof(struct ovs_header), |
2248 | .name = OVS_VPORT_FAMILY, | 2248 | .name = OVS_VPORT_FAMILY, |
2249 | .version = OVS_VPORT_VERSION, | 2249 | .version = OVS_VPORT_VERSION, |
@@ -2272,7 +2272,7 @@ static void dp_unregister_genl(int n_families) | |||
2272 | genl_unregister_family(dp_genl_families[i]); | 2272 | genl_unregister_family(dp_genl_families[i]); |
2273 | } | 2273 | } |
2274 | 2274 | ||
2275 | static int dp_register_genl(void) | 2275 | static int __init dp_register_genl(void) |
2276 | { | 2276 | { |
2277 | int err; | 2277 | int err; |
2278 | int i; | 2278 | int i; |
diff --git a/net/tipc/netlink.c b/net/tipc/netlink.c index 74a405bf107b..26ca8dd64ded 100644 --- a/net/tipc/netlink.c +++ b/net/tipc/netlink.c | |||
@@ -249,7 +249,7 @@ static const struct genl_ops tipc_genl_v2_ops[] = { | |||
249 | #endif | 249 | #endif |
250 | }; | 250 | }; |
251 | 251 | ||
252 | struct genl_family tipc_genl_family = { | 252 | struct genl_family tipc_genl_family __ro_after_init = { |
253 | .name = TIPC_GENL_V2_NAME, | 253 | .name = TIPC_GENL_V2_NAME, |
254 | .version = TIPC_GENL_V2_VERSION, | 254 | .version = TIPC_GENL_V2_VERSION, |
255 | .hdrsize = 0, | 255 | .hdrsize = 0, |
@@ -271,7 +271,7 @@ int tipc_nlmsg_parse(const struct nlmsghdr *nlh, struct nlattr ***attr) | |||
271 | return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy); | 271 | return nlmsg_parse(nlh, GENL_HDRLEN, *attr, maxattr, tipc_nl_policy); |
272 | } | 272 | } |
273 | 273 | ||
274 | int tipc_netlink_start(void) | 274 | int __init tipc_netlink_start(void) |
275 | { | 275 | { |
276 | int res; | 276 | int res; |
277 | 277 | ||
diff --git a/net/tipc/netlink_compat.c b/net/tipc/netlink_compat.c index 07b19931e458..e1ae8a8a2b8e 100644 --- a/net/tipc/netlink_compat.c +++ b/net/tipc/netlink_compat.c | |||
@@ -1222,7 +1222,7 @@ static struct genl_ops tipc_genl_compat_ops[] = { | |||
1222 | }, | 1222 | }, |
1223 | }; | 1223 | }; |
1224 | 1224 | ||
1225 | static struct genl_family tipc_genl_compat_family = { | 1225 | static struct genl_family tipc_genl_compat_family __ro_after_init = { |
1226 | .name = TIPC_GENL_NAME, | 1226 | .name = TIPC_GENL_NAME, |
1227 | .version = TIPC_GENL_VERSION, | 1227 | .version = TIPC_GENL_VERSION, |
1228 | .hdrsize = TIPC_GENL_HDRLEN, | 1228 | .hdrsize = TIPC_GENL_HDRLEN, |
@@ -1233,7 +1233,7 @@ static struct genl_family tipc_genl_compat_family = { | |||
1233 | .n_ops = ARRAY_SIZE(tipc_genl_compat_ops), | 1233 | .n_ops = ARRAY_SIZE(tipc_genl_compat_ops), |
1234 | }; | 1234 | }; |
1235 | 1235 | ||
1236 | int tipc_netlink_compat_start(void) | 1236 | int __init tipc_netlink_compat_start(void) |
1237 | { | 1237 | { |
1238 | int res; | 1238 | int res; |
1239 | 1239 | ||
diff --git a/net/wimax/stack.c b/net/wimax/stack.c index 587e1627681f..5db731512014 100644 --- a/net/wimax/stack.c +++ b/net/wimax/stack.c | |||
@@ -576,7 +576,7 @@ static const struct genl_multicast_group wimax_gnl_mcgrps[] = { | |||
576 | { .name = "msg", }, | 576 | { .name = "msg", }, |
577 | }; | 577 | }; |
578 | 578 | ||
579 | struct genl_family wimax_gnl_family = { | 579 | struct genl_family wimax_gnl_family __ro_after_init = { |
580 | .name = "WiMAX", | 580 | .name = "WiMAX", |
581 | .version = WIMAX_GNL_VERSION, | 581 | .version = WIMAX_GNL_VERSION, |
582 | .hdrsize = 0, | 582 | .hdrsize = 0, |
diff --git a/net/wireless/nl80211.c b/net/wireless/nl80211.c index 8e5ca3c47593..271707dacfea 100644 --- a/net/wireless/nl80211.c +++ b/net/wireless/nl80211.c | |||
@@ -12586,7 +12586,7 @@ static const struct genl_ops nl80211_ops[] = { | |||
12586 | }, | 12586 | }, |
12587 | }; | 12587 | }; |
12588 | 12588 | ||
12589 | static struct genl_family nl80211_fam = { | 12589 | static struct genl_family nl80211_fam __ro_after_init = { |
12590 | .name = NL80211_GENL_NAME, /* have users key off the name instead */ | 12590 | .name = NL80211_GENL_NAME, /* have users key off the name instead */ |
12591 | .hdrsize = 0, /* no private header */ | 12591 | .hdrsize = 0, /* no private header */ |
12592 | .version = 1, /* no particular meaning now */ | 12592 | .version = 1, /* no particular meaning now */ |
@@ -14563,7 +14563,7 @@ void nl80211_send_ap_stopped(struct wireless_dev *wdev) | |||
14563 | 14563 | ||
14564 | /* initialisation/exit functions */ | 14564 | /* initialisation/exit functions */ |
14565 | 14565 | ||
14566 | int nl80211_init(void) | 14566 | int __init nl80211_init(void) |
14567 | { | 14567 | { |
14568 | int err; | 14568 | int err; |
14569 | 14569 | ||