* OF OR IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
*/
+#include <linux/bitfield.h>
#include <linux/module.h>
#include <linux/list.h>
#include <linux/bitops.h>
for (i = 1; i < AR40XX_NUM_PORTS; ++i) {
port_phy_status[i] =
mdiobus_read(bus, i-1, AR40XX_PHY_SPEC_STATUS);
- speed = link = duplex = port_phy_status[i];
- speed &= AR40XX_PHY_SPEC_STATUS_SPEED;
- speed >>= 14;
- link &= AR40XX_PHY_SPEC_STATUS_LINK;
- link >>= 10;
- duplex &= AR40XX_PHY_SPEC_STATUS_DUPLEX;
- duplex >>= 13;
+
+ speed = FIELD_GET(AR40XX_PHY_SPEC_STATUS_SPEED,
+ port_phy_status[i]);
+ link = FIELD_GET(AR40XX_PHY_SPEC_STATUS_LINK,
+ port_phy_status[i]);
+ duplex = FIELD_GET(AR40XX_PHY_SPEC_STATUS_DUPLEX,
+ port_phy_status[i]);
if (link != priv->ar40xx_port_old_link[i]) {
++link_cnt[i];