Skip to content

Commit 92c14d9

Browse files
Jiri Bencdavem330
authored andcommitted
genetlink: simplify genl_notify
The genl_notify function has too many arguments for no real reason - all callers use genl_info to get them anyway. Just pass the genl_info down to genl_notify. Signed-off-by: Jiri Benc <jbenc@redhat.com> Signed-off-by: David S. Miller <davem@davemloft.net>
1 parent 06e60e5 commit 92c14d9

4 files changed

Lines changed: 11 additions & 14 deletions

File tree

‎drivers/net/wireless/mac80211_hwsim.c‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -2190,9 +2190,8 @@ static void hwsim_mcast_config_msg(struct sk_buff *mcast_skb,
21902190
struct genl_info *info)
21912191
{
21922192
if (info)
2193-
genl_notify(&hwsim_genl_family, mcast_skb,
2194-
genl_info_net(info), info->snd_portid,
2195-
HWSIM_MCGRP_CONFIG, info->nlhdr, GFP_KERNEL);
2193+
genl_notify(&hwsim_genl_family, mcast_skb, info,
2194+
HWSIM_MCGRP_CONFIG, GFP_KERNEL);
21962195
else
21972196
genlmsg_multicast(&hwsim_genl_family, mcast_skb, 0,
21982197
HWSIM_MCGRP_CONFIG, GFP_KERNEL);

‎include/net/genetlink.h‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,8 @@ _genl_register_family_with_ops_grps(struct genl_family *family,
183183
(grps), ARRAY_SIZE(grps))
184184

185185
int genl_unregister_family(struct genl_family *family);
186-
void genl_notify(struct genl_family *family,
187-
struct sk_buff *skb, struct net *net, u32 portid,
188-
u32 group, struct nlmsghdr *nlh, gfp_t flags);
186+
void genl_notify(struct genl_family *family, struct sk_buff *skb,
187+
struct genl_info *info, u32 group, gfp_t flags);
189188

190189
struct sk_buff *genlmsg_new_unicast(size_t payload, struct genl_info *info,
191190
gfp_t flags);

‎net/netlink/genetlink.c‎

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1136,19 +1136,19 @@ int genlmsg_multicast_allns(struct genl_family *family, struct sk_buff *skb,
11361136
}
11371137
EXPORT_SYMBOL(genlmsg_multicast_allns);
11381138

1139-
void genl_notify(struct genl_family *family,
1140-
struct sk_buff *skb, struct net *net, u32 portid, u32 group,
1141-
struct nlmsghdr *nlh, gfp_t flags)
1139+
void genl_notify(struct genl_family *family, struct sk_buff *skb,
1140+
struct genl_info *info, u32 group, gfp_t flags)
11421141
{
1142+
struct net *net = genl_info_net(info);
11431143
struct sock *sk = net->genl_sock;
11441144
int report = 0;
11451145

1146-
if (nlh)
1147-
report = nlmsg_report(nlh);
1146+
if (info->nlhdr)
1147+
report = nlmsg_report(info->nlhdr);
11481148

11491149
if (WARN_ON_ONCE(group >= family->n_mcgrps))
11501150
return;
11511151
group = family->mcgrp_offset + group;
1152-
nlmsg_notify(sk, skb, portid, group, report, flags);
1152+
nlmsg_notify(sk, skb, info->snd_portid, group, report, flags);
11531153
}
11541154
EXPORT_SYMBOL(genl_notify);

‎net/openvswitch/datapath.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -91,8 +91,7 @@ static bool ovs_must_notify(struct genl_family *family, struct genl_info *info,
9191
static void ovs_notify(struct genl_family *family,
9292
struct sk_buff *skb, struct genl_info *info)
9393
{
94-
genl_notify(family, skb, genl_info_net(info), info->snd_portid,
95-
0, info->nlhdr, GFP_KERNEL);
94+
genl_notify(family, skb, info, 0, GFP_KERNEL);
9695
}
9796

9897
/**

0 commit comments

Comments
 (0)