Changeset 34991


Ignore:
Timestamp:
2013-01-03T02:57:19+01:00 (5 years ago)
Author:
hauke
Message:

switch: improve error messages

This is in part based on a patch send by Nathan Hintz <nlhintz@…>

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/package/switch/src/switch-robo.c

    r34988 r34991  
    104104        err = do_ioctl(SIOCGMIIREG); 
    105105        if (err < 0) { 
    106                 printk(KERN_ERR PFX 
    107                        "[%s:%d] SIOCGMIIREG failed! err: %i\n", __FILE__, __LINE__, err); 
     106                printk(KERN_ERR PFX "failed to read mdio reg %i with err %i.\n", reg, err); 
    108107 
    109108                return 0xffff; 
     
    124123        err = do_ioctl(SIOCSMIIREG); 
    125124        if (err < 0) { 
    126                 printk(KERN_ERR PFX 
    127                        "[%s:%d] SIOCSMIIREG failed! err: %i\n", __FILE__, __LINE__, err); 
     125                printk(KERN_ERR PFX "failed to write mdio reg: %i with err %i.\n", reg, err); 
    128126                return; 
    129127        } 
     
    148146        } 
    149147 
    150         printk(KERN_ERR PFX "[%s:%d] timeout in robo_reg!\n", __FILE__, __LINE__); 
     148        printk(KERN_ERR PFX "timeout in robo_reg on page %i and reg %i with op %i.\n", page, reg, op); 
    151149 
    152150        return 0; 
     
    225223                val = robo_read16(ROBO_CTRL_PAGE, ROBO_SWITCH_MODE); 
    226224                if (!(val & (1 << 1))) { 
    227                         printk("Failed to enable switch\n"); 
     225                        printk(KERN_ERR PFX "Failed to enable switch\n"); 
    228226                        return -EBUSY; 
    229227                } 
     
    263261        int err = 1; 
    264262 
    265         printk(KERN_INFO PFX "Probing device %s: ", devname); 
     263        printk(KERN_INFO PFX "Probing device '%s'\n", devname); 
    266264        strcpy(robo.ifr.ifr_name, devname); 
    267265 
    268266        if ((robo.dev = dev_get_by_name(&init_net, devname)) == NULL) { 
    269                 printk("No such device\n"); 
     267                printk(KERN_ERR PFX "No such device\n"); 
    270268                return 1; 
    271269        } 
    272270        if (!robo.dev->netdev_ops || !robo.dev->netdev_ops->ndo_do_ioctl) { 
    273                 printk("ndo_do_ioctl not implemented in ethernet driver\n"); 
     271                printk(KERN_ERR PFX "ndo_do_ioctl not implemented in ethernet driver\n"); 
    274272                return 1; 
    275273        } 
     
    281279 
    282280        /* try access using MII ioctls - get phy address */ 
    283         if (do_ioctl(SIOCGMIIPHY) < 0) { 
    284                 printk("error while accessing MII phy registers with ioctls\n"); 
     281        err = do_ioctl(SIOCGMIIPHY); 
     282        if (err < 0) { 
     283                printk(KERN_ERR PFX "error (%i) while accessing MII phy registers with ioctls\n", err); 
    285284                goto done; 
    286285        } 
     
    291290            (mii->phy_id != ROBO_PHY_ADDR_BCM63XX) && 
    292291            (mii->phy_id != ROBO_PHY_ADDR_TG3)) { 
    293                 printk("Invalid phy address (%d)\n", mii->phy_id); 
     292                printk(KERN_ERR PFX "Invalid phy address (%d)\n", mii->phy_id); 
    294293                goto done; 
    295294        } 
     
    299298 
    300299        if (phyid == 0xffffffff || phyid == 0x55210022) { 
    301                 printk("No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid); 
     300                printk(KERN_ERR PFX "No Robo switch in managed mode found, phy_id = 0x%08x\n", phyid); 
    302301                goto done; 
    303302        } 
     
    320319        err = 0; 
    321320 
    322         printk("found a 5%s%x!%s\n", robo.devid & 0xff00 ? "" : "3", robo.devid, 
    323                 robo.is_5350 ? " It's a 5350." : ""); 
     321        printk(KERN_INFO PFX "found a 5%s%x!%s at %s\n", robo.devid & 0xff00 ? "" : "3", robo.devid, 
     322                robo.is_5350 ? " It's a 5350." : "", devname); 
    324323 
    325324done: 
Note: See TracChangeset for help on using the changeset viewer.