On Monday, September 06, 2010 10:59:16 Reinhard Meyer wrote:
> +int enc_miiphy_read(const char *devname, u8 phy_adr, u8 reg, u16 *value)
> +{
> +     struct eth_device *dev = eth_get_dev_by_name(devname);
> +     if (dev) {
> +             enc_dev_t *enc = to_enc(dev);
> +
> +             if (phy_adr != 0)
> +                     return -1;
> +             spi_claim_bus(enc->slave);
> +             *value = phy_read(enc, reg);
> +             spi_release_bus(enc->slave);
> +             return 0;
> +     }
> +     return -1;
> +}

seems like this (and the write func) would be nicer if it were:
if (!dev)
        return -1;
...

> +static int enc_init(struct eth_device *dev, bd_t *bis)
> +{
> +     enc_dev_t *enc = to_enc(dev);
> +     u8 status;
> +     uint64_t etime;
> +
> +     spi_claim_bus(enc->slave);

check the return value

otherwise this looks pretty good ... i'll try and test on my hardware this 
week
-mike

Attachment: signature.asc
Description: This is a digitally signed message part.

_______________________________________________
U-Boot mailing list
U-Boot@lists.denx.de
http://lists.denx.de/mailman/listinfo/u-boot

Reply via email to