Re: ALTPATCH: 8139cp: LinkChg support

From: Jeff Garzik (jgarzik@mandrakesoft.com)
Date: Fri Sep 20 2002 - 08:21:17 EST


Felipe W Damasio wrote:
>>+ int advertise, lpa, media, duplex;
>
>
> Shouldn't advertise and lpa be either "unsigned short" or u16?

No, they don't need to be.

>>+ lpa = mii->mdio_read(mii->dev, mii->phy_id, MII_LPA);
>>+
>>+ /* figure out media and duplex from advertise and LPA values */
>>+ media = mii_nway_result(lpa & advertise);
>
> ^^^^^^^^^^^^^^^^^^^^^^^
>
> mii_nway_result returns a "unsigned int", so media also doesn't look
> good.

mii_nway_result _really_ returns a small bitmapped value, so it doesn't
matter.

>>+ duplex = (media & (ADVERTISE_100FULL | ADVERTISE_10FULL)) ? 1 : 0;
>
>
> Or we could do
>
> duplex = (media & ADVERTISE_FULL) ? 1 : 0;

True. I forgot about that constant...

        Jeff

-
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/



This archive was generated by hypermail 2b29 : Mon Sep 23 2002 - 22:00:30 EST