diff options
author | Krishna Kumar <krkumar2@in.ibm.com> | 2009-10-14 15:54:53 -0400 |
---|---|---|
committer | David S. Miller <davem@davemloft.net> | 2009-10-18 02:57:26 -0400 |
commit | 93860b08e31a3202b6e67e386811545e719a0165 (patch) | |
tree | 332e0431ec85fc7109e50de6ecd8c67d55f3aa75 /net/netlink/genetlink.c | |
parent | 0d9a40de60a4470777913d8d42044ae548e6545d (diff) |
genetlink: Optimize genl_register_family()
genl_register_family() doesn't need to call genl_family_find_byid
when GENL_ID_GENERATE is passed during register.
Patch on net-next-2.6, compile and reboot testing only.
Signed-off-by: Krishna Kumar <krkumar2@in.ibm.com>
Signed-off-by: David S. Miller <davem@davemloft.net>
Diffstat (limited to 'net/netlink/genetlink.c')
-rw-r--r-- | net/netlink/genetlink.c | 8 |
1 files changed, 3 insertions, 5 deletions
diff --git a/net/netlink/genetlink.c b/net/netlink/genetlink.c index 44ff3f3810fa..ddfdb7d2e02b 100644 --- a/net/netlink/genetlink.c +++ b/net/netlink/genetlink.c | |||
@@ -374,11 +374,6 @@ int genl_register_family(struct genl_family *family) | |||
374 | goto errout_locked; | 374 | goto errout_locked; |
375 | } | 375 | } |
376 | 376 | ||
377 | if (genl_family_find_byid(family->id)) { | ||
378 | err = -EEXIST; | ||
379 | goto errout_locked; | ||
380 | } | ||
381 | |||
382 | if (family->id == GENL_ID_GENERATE) { | 377 | if (family->id == GENL_ID_GENERATE) { |
383 | u16 newid = genl_generate_id(); | 378 | u16 newid = genl_generate_id(); |
384 | 379 | ||
@@ -388,6 +383,9 @@ int genl_register_family(struct genl_family *family) | |||
388 | } | 383 | } |
389 | 384 | ||
390 | family->id = newid; | 385 | family->id = newid; |
386 | } else if (genl_family_find_byid(family->id)) { | ||
387 | err = -EEXIST; | ||
388 | goto errout_locked; | ||
391 | } | 389 | } |
392 | 390 | ||
393 | if (family->maxattr) { | 391 | if (family->maxattr) { |