X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/aa3defff60b9e1766574b78c0a8f8c09878fbdbd..accff9a4a72195bc2be35d0edfcd1f4f51954971:/package/switch/src/switch-core.c diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c index 87aa9729c..87306a05e 100644 --- a/package/switch/src/switch-core.c +++ b/package/switch/src/switch-core.c @@ -17,7 +17,6 @@ * along with this program; if not, write to the Free Software * Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA. * - * $Id: $ * * Basic doc of driver's /proc interface: * /proc/switch// @@ -404,6 +403,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 +490,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);