> +static int korina_mdio_wait(struct korina_private *lp)
> +{
> +     u32 value;
> +
> +     return readl_poll_timeout_atomic(&lp->eth_regs->miimind,
> +                                      value, value & ETH_MII_IND_BSY,
> +                                      1, 1000);
> +}
> +
> +static int korina_mdio_read(struct net_device *dev, int phy, int reg)
>  {
>       struct korina_private *lp = netdev_priv(dev);
>       int ret;
>  
> -     mii_id = ((lp->rx_irq == 0x2c ? 1 : 0) << 8);
> +     if (korina_mdio_wait(lp))
> +             return -ETIMEDOUT;
>  
> -     writel(0, &lp->eth_regs->miimcfg);
> -     writel(0, &lp->eth_regs->miimcmd);
> -     writel(mii_id | reg, &lp->eth_regs->miimaddr);
> -     writel(ETH_MII_CMD_SCN, &lp->eth_regs->miimcmd);
> +     writel(phy << 8 | reg, &lp->eth_regs->miimaddr);
> +     writel(1, &lp->eth_regs->miimcmd);
> +
> +     if (korina_mdio_wait(lp))
> +             return -ETIMEDOUT;

Just return what readl_poll_timeout_atomic() returns. In general, you
should not change error codes.

>  
> -     ret = (int)(readl(&lp->eth_regs->miimrdd));
> +     if (readl(&lp->eth_regs->miimind) & ETH_MII_IND_NV)
> +             return -1;

Please use -ESOMETHING, not -1.

       Andrew

Reply via email to