]> www.infradead.org Git - users/hch/misc.git/commitdiff
net: phy: nxp-c45-tja11xx: use bitmap_empty() where appropriate
authorYury Norov (NVIDIA) <yury.norov@gmail.com>
Sat, 13 Sep 2025 18:28:36 +0000 (14:28 -0400)
committerPaolo Abeni <pabeni@redhat.com>
Tue, 16 Sep 2025 10:15:49 +0000 (12:15 +0200)
The driver opencodes bitmap_empty() in a couple of funcitons. Switch to
the proper and more verbose API.

Signed-off-by: Yury Norov (NVIDIA) <yury.norov@gmail.com>
Link: https://patch.msgid.link/20250913182837.206800-1-yury.norov@gmail.com
Signed-off-by: Paolo Abeni <pabeni@redhat.com>
drivers/net/phy/nxp-c45-tja11xx-macsec.c

index 550ef08970f444d8d0f6b7a8ac15b1051736d042..fc897ba79b039656da11a27c54f3e6987fcffc1d 100644 (file)
@@ -926,7 +926,6 @@ static int nxp_c45_mdo_dev_open(struct macsec_context *ctx)
        struct phy_device *phydev = ctx->phydev;
        struct nxp_c45_phy *priv = phydev->priv;
        struct nxp_c45_secy *phy_secy;
-       int any_bit_set;
 
        phy_secy = nxp_c45_find_secy(&priv->macsec->secy_list, ctx->secy->sci);
        if (IS_ERR(phy_secy))
@@ -939,8 +938,7 @@ static int nxp_c45_mdo_dev_open(struct macsec_context *ctx)
        if (phy_secy->rx_sc)
                nxp_c45_rx_sc_en(phydev, phy_secy->rx_sc, true);
 
-       any_bit_set = find_first_bit(priv->macsec->secy_bitmap, TX_SC_MAX);
-       if (any_bit_set == TX_SC_MAX)
+       if (bitmap_empty(priv->macsec->secy_bitmap, TX_SC_MAX))
                nxp_c45_macsec_en(phydev, true);
 
        set_bit(phy_secy->secy_id, priv->macsec->secy_bitmap);
@@ -953,7 +951,6 @@ static int nxp_c45_mdo_dev_stop(struct macsec_context *ctx)
        struct phy_device *phydev = ctx->phydev;
        struct nxp_c45_phy *priv = phydev->priv;
        struct nxp_c45_secy *phy_secy;
-       int any_bit_set;
 
        phy_secy = nxp_c45_find_secy(&priv->macsec->secy_list, ctx->secy->sci);
        if (IS_ERR(phy_secy))
@@ -967,8 +964,7 @@ static int nxp_c45_mdo_dev_stop(struct macsec_context *ctx)
        nxp_c45_set_rx_sc0_impl(phydev, false);
 
        clear_bit(phy_secy->secy_id, priv->macsec->secy_bitmap);
-       any_bit_set = find_first_bit(priv->macsec->secy_bitmap, TX_SC_MAX);
-       if (any_bit_set == TX_SC_MAX)
+       if (bitmap_empty(priv->macsec->secy_bitmap, TX_SC_MAX))
                nxp_c45_macsec_en(phydev, false);
 
        return 0;