}
+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;
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);
} switch_vlan_config;
+extern int switch_device_registered (char* device);
extern int switch_register_driver(switch_driver *driver);
extern void switch_unregister_driver(char *name);
extern switch_vlan_config *switch_parse_vlan(switch_driver *driver, char *buf);
device = strdup("ethX");
for (device[3] = '0'; (device[3] <= '3') && notfound; device[3]++) {
- notfound = robo_probe(device);
+ if (! switch_device_registered (device))
+ notfound = robo_probe(device);
}
device[3]--;