X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/aa3defff60b9e1766574b78c0a8f8c09878fbdbd..c291b847846f5921d669b17478cbf59f0c83ee19:/package/switch/src/switch-core.c?ds=sidebyside diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c index 87aa9729c..c34386b76 100644 --- a/package/switch/src/switch-core.c +++ b/package/switch/src/switch-core.c @@ -404,6 +404,21 @@ switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf) } +int switch_device_registered (char* device) { + struct list_head *pos; + switch_driver *new; + + list_for_each(pos, &drivers.list) { + if (strcmp(list_entry(pos, switch_driver, list)->interface, device) == 0) { + printk("There is already a switch registered on the device '%s'\n", device); + return -EINVAL; + } + } + + return 0; +} + + int switch_register_driver(switch_driver *driver) { struct list_head *pos; @@ -476,6 +491,7 @@ static void __exit switch_exit(void) MODULE_AUTHOR("Felix Fietkau "); MODULE_LICENSE("GPL"); +EXPORT_SYMBOL(switch_device_registered); EXPORT_SYMBOL(switch_register_driver); EXPORT_SYMBOL(switch_unregister_driver); EXPORT_SYMBOL(switch_parse_vlan);