diff options
author | Felix Fietkau <nbd@openwrt.org> | 2008-06-15 11:10:27 +0000 |
---|---|---|
committer | Felix Fietkau <nbd@openwrt.org> | 2008-06-15 11:10:27 +0000 |
commit | 40990382e5823fc3d6a50374cfb989615e143c14 (patch) | |
tree | 99dfe44d2d4c35b2f542151d1da292f5f5c0a7f5 /package/switch/src/switch-core.c | |
parent | 9621d872ca496eadb79399d0351abf96abc35338 (diff) | |
download | mtk-20170518-40990382e5823fc3d6a50374cfb989615e143c14.zip mtk-20170518-40990382e5823fc3d6a50374cfb989615e143c14.tar.gz mtk-20170518-40990382e5823fc3d6a50374cfb989615e143c14.tar.bz2 |
(4/6) bcm57xx: switch-core.c/switch-robo.c check for port already registered
This patch prevents switch-robo.c from attempting robo_probe on a port
that is already registered. robo_probe will adjust kernel reference counts
if it detects a switch on the port. If this patch wasn't applied, the
wrt350n would hang on reboot, waiting for the network driver reference count
to reach zero indefinitely.
Signed-off-by: Ben Pfountz <netprince (at) vt (dot) edu>
SVN-Revision: 11469
Diffstat (limited to 'package/switch/src/switch-core.c')
-rw-r--r-- | package/switch/src/switch-core.c | 16 |
1 files changed, 16 insertions, 0 deletions
diff --git a/package/switch/src/switch-core.c b/package/switch/src/switch-core.c index 87aa972..c34386b 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 <openwrt@nbd.name>"); MODULE_LICENSE("GPL"); +EXPORT_SYMBOL(switch_device_registered); EXPORT_SYMBOL(switch_register_driver); EXPORT_SYMBOL(switch_unregister_driver); EXPORT_SYMBOL(switch_parse_vlan); |