mirror of https://github.com/hak5/openwrt.git
parent
3f0c0c6935
commit
f3360fdf67
|
@ -278,7 +278,7 @@ static int robo_probe(char *devname)
|
||||||
{
|
{
|
||||||
__u32 phyid;
|
__u32 phyid;
|
||||||
unsigned int i;
|
unsigned int i;
|
||||||
int err = 1;
|
int err = -1;
|
||||||
struct mii_ioctl_data *mii;
|
struct mii_ioctl_data *mii;
|
||||||
|
|
||||||
printk(KERN_INFO PFX "Probing device '%s'\n", devname);
|
printk(KERN_INFO PFX "Probing device '%s'\n", devname);
|
||||||
|
@ -286,11 +286,13 @@ static int robo_probe(char *devname)
|
||||||
|
|
||||||
if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) {
|
if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) {
|
||||||
printk(KERN_ERR PFX "No such device\n");
|
printk(KERN_ERR PFX "No such device\n");
|
||||||
return 1;
|
err = -ENODEV;
|
||||||
|
goto err_done;
|
||||||
}
|
}
|
||||||
if (!robo.dev->netdev_ops || !robo.dev->netdev_ops->ndo_do_ioctl) {
|
if (!robo.dev->netdev_ops || !robo.dev->netdev_ops->ndo_do_ioctl) {
|
||||||
printk(KERN_ERR PFX "ndo_do_ioctl not implemented in ethernet driver\n");
|
printk(KERN_ERR PFX "ndo_do_ioctl not implemented in ethernet driver\n");
|
||||||
return 1;
|
err = -ENXIO;
|
||||||
|
goto err_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
robo.device = devname;
|
robo.device = devname;
|
||||||
|
@ -302,7 +304,7 @@ static int robo_probe(char *devname)
|
||||||
err = do_ioctl(SIOCGMIIPHY);
|
err = do_ioctl(SIOCGMIIPHY);
|
||||||
if (err < 0) {
|
if (err < 0) {
|
||||||
printk(KERN_ERR PFX "error (%i) while accessing MII phy registers with ioctls\n", err);
|
printk(KERN_ERR PFX "error (%i) while accessing MII phy registers with ioctls\n", err);
|
||||||
goto done;
|
goto err_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* got phy address check for robo address */
|
/* got phy address check for robo address */
|
||||||
|
@ -311,7 +313,8 @@ static int robo_probe(char *devname)
|
||||||
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
|
(mii->phy_id != ROBO_PHY_ADDR_BCM63XX) &&
|
||||||
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
|
(mii->phy_id != ROBO_PHY_ADDR_TG3)) {
|
||||||
printk(KERN_ERR PFX "Invalid phy address (%d)\n", mii->phy_id);
|
printk(KERN_ERR PFX "Invalid phy address (%d)\n", mii->phy_id);
|
||||||
goto done;
|
err = -ENODEV;
|
||||||
|
goto err_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
phyid = mdio_read(ROBO_PHY_ADDR, 0x2) |
|
phyid = mdio_read(ROBO_PHY_ADDR, 0x2) |
|
||||||
|
@ -319,7 +322,8 @@ static int robo_probe(char *devname)
|
||||||
|
|
||||||
if (phyid == 0xffffffff || phyid == 0x55210022) {
|
if (phyid == 0xffffffff || phyid == 0x55210022) {
|
||||||
printk(KERN_ERR PFX "No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
|
printk(KERN_ERR PFX "No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid);
|
||||||
goto done;
|
err = -ENODEV;
|
||||||
|
goto err_put;
|
||||||
}
|
}
|
||||||
|
|
||||||
/* Get the device ID */
|
/* Get the device ID */
|
||||||
|
@ -336,17 +340,16 @@ static int robo_probe(char *devname)
|
||||||
robo_switch_reset();
|
robo_switch_reset();
|
||||||
err = robo_switch_enable();
|
err = robo_switch_enable();
|
||||||
if (err)
|
if (err)
|
||||||
goto done;
|
goto err_put;
|
||||||
err = 0;
|
|
||||||
|
|
||||||
printk(KERN_INFO PFX "found a 5%s%x!%s at %s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
|
printk(KERN_INFO PFX "found a 5%s%x!%s at %s\n", robo.devid & 0xff00 ? "" : "3", robo.devid,
|
||||||
robo.is_5350 ? " It's a 5350." : "", devname);
|
robo.is_5350 ? " It's a 5350." : "", devname);
|
||||||
|
|
||||||
done:
|
return 0;
|
||||||
if (err) {
|
err_put:
|
||||||
dev_put(robo.dev);
|
dev_put(robo.dev);
|
||||||
robo.dev = NULL;
|
robo.dev = NULL;
|
||||||
}
|
err_done:
|
||||||
return err;
|
return err;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue