aboutsummaryrefslogtreecommitdiffstats
path: root/target
diff options
context:
space:
mode:
authorDavid Bauer <mail@david-bauer.net>2021-08-14 00:22:28 +0200
committerDavid Bauer <mail@david-bauer.net>2021-08-14 14:47:51 +0200
commit685c790e9f0f44f3962276dbaddb784cce16423d (patch)
treefa84370b20685a18de0cba332f9b1a8256160db0 /target
parentb9162a9c85a5c22ed15ec539b0042cf5167f8a70 (diff)
downloadupstream-685c790e9f0f44f3962276dbaddb784cce16423d.tar.gz
upstream-685c790e9f0f44f3962276dbaddb784cce16423d.tar.bz2
upstream-685c790e9f0f44f3962276dbaddb784cce16423d.zip
ipq40xx: ar40xx: use FIELD_GET macro
This improves code readability. Signed-off-by: David Bauer <mail@david-bauer.net>
Diffstat (limited to 'target')
-rw-r--r--target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c15
1 files changed, 8 insertions, 7 deletions
diff --git a/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c b/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c
index c35ba2799f..a33bc0de2c 100644
--- a/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c
+++ b/target/linux/ipq40xx/files/drivers/net/phy/ar40xx.c
@@ -13,6 +13,7 @@
* 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>
@@ -1336,13 +1337,13 @@ ar40xx_sw_mac_polling_task(struct ar40xx_priv *priv)
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];