diff mbox series

[net-next] ice: Make use of assign_bit() API

Message ID 20240902131407.3087903-1-lihongbo22@huawei.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ice: Make use of assign_bit() API | expand

Checks

Context Check Description
netdev/series_format success Single patches do not need cover letters
netdev/tree_selection success Clearly marked for net-next
netdev/ynl success Generated files up to date; no warnings/errors; no diff in generated;
netdev/fixes_present success Fixes tag not required for -next series
netdev/header_inline success No static functions without inline keyword in header files
netdev/build_32bit success Errors and warnings before: 16 this patch: 16
netdev/build_tools success No tools touched, skip
netdev/cc_maintainers success CCed 7 of 7 maintainers
netdev/build_clang success Errors and warnings before: 16 this patch: 16
netdev/verify_signedoff success Signed-off-by tag matches author and committer
netdev/deprecated_api success None detected
netdev/check_selftest success No net selftest shell script
netdev/verify_fixes success No Fixes tag
netdev/build_allmodconfig_warn success Errors and warnings before: 16 this patch: 16
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 9 lines checked
netdev/build_clang_rust success No Rust files in patch. Skipping build
netdev/kdoc success Errors and warnings before: 116 this patch: 116
netdev/source_inline success Was 0 now: 0
netdev/contest success net-next-2024-09-02--21-00 (tests: 714)

Commit Message

Hongbo Li Sept. 2, 2024, 1:14 p.m. UTC
We have for some time the assign_bit() API to replace open coded

    if (foo)
            set_bit(n, bar);
    else
            clear_bit(n, bar);

Use this API to clean the code. No functional change intended.

Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
---
 drivers/net/ethernet/intel/ice/ice_main.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)

Comments

Gerhard Engleder Sept. 4, 2024, 7:07 p.m. UTC | #1
On 02.09.24 15:14, Hongbo Li wrote:
> We have for some time the assign_bit() API to replace open coded
> 
>      if (foo)
>              set_bit(n, bar);
>      else
>              clear_bit(n, bar);
> 
> Use this API to clean the code. No functional change intended.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>   drivers/net/ethernet/intel/ice/ice_main.c | 3 +--
>   1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index 46d3c5a34d6a..e3ad91b3ba77 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -6522,8 +6522,7 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)
>   	if (changed & NETIF_F_HW_TC) {
>   		bool ena = !!(features & NETIF_F_HW_TC);
>   
> -		ena ? set_bit(ICE_FLAG_CLS_FLOWER, pf->flags) :
> -		      clear_bit(ICE_FLAG_CLS_FLOWER, pf->flags);
> +		assign_bit(ICE_FLAG_CLS_FLOWER, pf->flags, ena);
>   	}
>   
>   	if (changed & NETIF_F_LOOPBACK)

Reviewed-by: Gerhard Engleder <gerhard@engleder-embedded.com>
Kuruvinakunnel, George Sept. 17, 2024, 7:10 p.m. UTC | #2
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of Hongbo
> Li
> Sent: Monday, September 2, 2024 6:14 AM
> To: Nguyen, Anthony L <anthony.l.nguyen@intel.com>
> Cc: Kitszel, Przemyslaw <przemyslaw.kitszel@intel.com>; edumazet@google.com;
> intel-wired-lan@lists.osuosl.org; lihongbo22@huawei.com; netdev@vger.kernel.org;
> kuba@kernel.org; pabeni@redhat.com; davem@davemloft.net
> Subject: [Intel-wired-lan] [PATCH net-next] ice: Make use of assign_bit() API
> 
> We have for some time the assign_bit() API to replace open coded
> 
>     if (foo)
>             set_bit(n, bar);
>     else
>             clear_bit(n, bar);
> 
> Use this API to clean the code. No functional change intended.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 

Tested-by: George Kuruvinakunnel <george.kuruvinakunnel@intel.com>
Jacob Keller Sept. 17, 2024, 10:22 p.m. UTC | #3
On 9/2/2024 6:14 AM, Hongbo Li wrote:
> We have for some time the assign_bit() API to replace open coded
> 
>     if (foo)
>             set_bit(n, bar);
>     else
>             clear_bit(n, bar);
> 
> Use this API to clean the code. No functional change intended.
> 
> Signed-off-by: Hongbo Li <lihongbo22@huawei.com>
> ---
>  drivers/net/ethernet/intel/ice/ice_main.c | 3 +--
>  1 file changed, 1 insertion(+), 2 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
> index 46d3c5a34d6a..e3ad91b3ba77 100644
> --- a/drivers/net/ethernet/intel/ice/ice_main.c
> +++ b/drivers/net/ethernet/intel/ice/ice_main.c
> @@ -6522,8 +6522,7 @@ ice_set_features(struct net_device *netdev, netdev_features_t features)
>  	if (changed & NETIF_F_HW_TC) {
>  		bool ena = !!(features & NETIF_F_HW_TC);
>  
> -		ena ? set_bit(ICE_FLAG_CLS_FLOWER, pf->flags) :
> -		      clear_bit(ICE_FLAG_CLS_FLOWER, pf->flags);
> +		assign_bit(ICE_FLAG_CLS_FLOWER, pf->flags, ena);
>  	}
>  
>  	if (changed & NETIF_F_LOOPBACK)

Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/ice/ice_main.c b/drivers/net/ethernet/intel/ice/ice_main.c
index 46d3c5a34d6a..e3ad91b3ba77 100644
--- a/drivers/net/ethernet/intel/ice/ice_main.c
+++ b/drivers/net/ethernet/intel/ice/ice_main.c
@@ -6522,8 +6522,7 @@  ice_set_features(struct net_device *netdev, netdev_features_t features)
 	if (changed & NETIF_F_HW_TC) {
 		bool ena = !!(features & NETIF_F_HW_TC);
 
-		ena ? set_bit(ICE_FLAG_CLS_FLOWER, pf->flags) :
-		      clear_bit(ICE_FLAG_CLS_FLOWER, pf->flags);
+		assign_bit(ICE_FLAG_CLS_FLOWER, pf->flags, ena);
 	}
 
 	if (changed & NETIF_F_LOOPBACK)