modules: update swconfig.c to compile on 3.13 (compile-tested)

Signed-off-by: Zoltan HERPAI <wigyori@uid0.hu>



git-svn-id: svn://svn.openwrt.org/openwrt/trunk@39359 3c298f89-4303-0410-b956-a3cf2f4a3e73
master
Zoltan HERPAI 2014-01-21 14:24:45 +00:00
parent 6e4da6b956
commit 6e1ec287bf
1 changed files with 8 additions and 0 deletions

View File

@ -24,6 +24,7 @@
#include <linux/skbuff.h> #include <linux/skbuff.h>
#include <linux/switch.h> #include <linux/switch.h>
#include <linux/of.h> #include <linux/of.h>
#include <linux/version.h>
#define SWCONFIG_DEVNAME "switch%d" #define SWCONFIG_DEVNAME "switch%d"
@ -1109,6 +1110,8 @@ swconfig_init(void)
int i, err; int i, err;
INIT_LIST_HEAD(&swdevs); INIT_LIST_HEAD(&swdevs);
#if (LINUX_VERSION_CODE < KERNEL_VERSION(3,13,0))
err = genl_register_family(&switch_fam); err = genl_register_family(&switch_fam);
if (err) if (err)
return err; return err;
@ -1120,6 +1123,11 @@ swconfig_init(void)
} }
return 0; return 0;
#else
err = genl_register_family_with_ops(&switch_fam, swconfig_ops);
if (err)
goto unregister;
#endif
unregister: unregister:
genl_unregister_family(&switch_fam); genl_unregister_family(&switch_fam);