X-Git-Url: https://git.rohieb.name/openwrt.git/blobdiff_plain/3814202702cc6ab529c1a0977ea5615c87ce48a8..fcb2538f2b451558abc10a18fa0c509f3f31cb2c:/package/switch/src/switch-robo.c?ds=inline diff --git a/package/switch/src/switch-robo.c b/package/switch/src/switch-robo.c index 5bcd85bd1..779b89f61 100644 --- a/package/switch/src/switch-robo.c +++ b/package/switch/src/switch-robo.c @@ -62,6 +62,10 @@ #define SIOCGETCPHYRD (SIOCDEVPRIVATE + 9) #define SIOCSETCPHYWR (SIOCDEVPRIVATE + 10) +/* linux 2.4 does not have 'bool' */ +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,5,0) +#define bool int +#endif /* Data structure for a Roboswitch device. */ struct robo_switch { @@ -292,7 +296,11 @@ static int robo_probe(char *devname) printk(KERN_INFO PFX "Probing device %s: ", devname); strcpy(robo.ifr.ifr_name, devname); +#if LINUX_VERSION_CODE < KERNEL_VERSION(2,6,24) if ((robo.dev = dev_get_by_name(devname)) == NULL) { +#else + if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) { +#endif printk("No such device\n"); return 1; } @@ -520,7 +528,8 @@ static int __init robo_init(void) 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]--;