diff mbox series

[net-next] ethernet/intel: Use list_for_each_entry() helper

Message ID 20230821134229.3132692-1-ruanjinjie@huawei.com (mailing list archive)
State Awaiting Upstream
Delegated to: Netdev Maintainers
Headers show
Series [net-next] ethernet/intel: Use list_for_each_entry() helper | 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/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: 1330 this patch: 1330
netdev/cc_maintainers success CCed 8 of 8 maintainers
netdev/build_clang success Errors and warnings before: 1353 this patch: 1353
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: 1353 this patch: 1353
netdev/checkpatch success total: 0 errors, 0 warnings, 0 checks, 47 lines checked
netdev/kdoc success Errors and warnings before: 0 this patch: 0
netdev/source_inline success Was 0 now: 0

Commit Message

Jinjie Ruan Aug. 21, 2023, 1:42 p.m. UTC
Convert list_for_each() to list_for_each_entry() where applicable.

No functional changed.

Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
---
 drivers/net/ethernet/intel/igb/igb_main.c      | 7 ++-----
 drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 7 ++-----
 2 files changed, 4 insertions(+), 10 deletions(-)

Comments

Jacob Keller Aug. 23, 2023, 7:55 p.m. UTC | #1
On 8/21/2023 6:42 AM, Jinjie Ruan wrote:
> Convert list_for_each() to list_for_each_entry() where applicable.
> 
> No functional changed.
> 
> Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>

Thanks for cleaning these up!

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

> ---
>  drivers/net/ethernet/intel/igb/igb_main.c      | 7 ++-----
>  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 7 ++-----
>  2 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
> index 9f63a10c6f80..bf9c2f6a1164 100644
> --- a/drivers/net/ethernet/intel/igb/igb_main.c
> +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> @@ -7850,7 +7850,6 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
>  {
>  	struct pci_dev *pdev = adapter->pdev;
>  	struct vf_data_storage *vf_data = &adapter->vf_data[vf];
> -	struct list_head *pos;
>  	struct vf_mac_filter *entry = NULL;
>  	int ret = 0;
>  
> @@ -7871,8 +7870,7 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
>  	switch (info) {
>  	case E1000_VF_MAC_FILTER_CLR:
>  		/* remove all unicast MAC filters related to the current VF */
> -		list_for_each(pos, &adapter->vf_macs.l) {
> -			entry = list_entry(pos, struct vf_mac_filter, l);
> +		list_for_each_entry(entry, &adapter->vf_macs.l, l) {
>  			if (entry->vf == vf) {
>  				entry->vf = -1;
>  				entry->free = true;
> @@ -7882,8 +7880,7 @@ static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
>  		break;
>  	case E1000_VF_MAC_FILTER_ADD:
>  		/* try to find empty slot in the list */
> -		list_for_each(pos, &adapter->vf_macs.l) {
> -			entry = list_entry(pos, struct vf_mac_filter, l);
> +		list_for_each_entry(entry, &adapter->vf_macs.l, l) {
>  			if (entry->free)
>  				break;
>  		}
> diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> index 29cc60988071..4c6e2a485d8e 100644
> --- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> +++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
> @@ -639,12 +639,10 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
>  				int vf, int index, unsigned char *mac_addr)
>  {
>  	struct vf_macvlans *entry;
> -	struct list_head *pos;
>  	int retval = 0;
>  
>  	if (index <= 1) {
> -		list_for_each(pos, &adapter->vf_mvs.l) {
> -			entry = list_entry(pos, struct vf_macvlans, l);
> +		list_for_each_entry(entry, &adapter->vf_mvs.l, l) {
>  			if (entry->vf == vf) {
>  				entry->vf = -1;
>  				entry->free = true;
> @@ -664,8 +662,7 @@ static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
>  
>  	entry = NULL;
>  
> -	list_for_each(pos, &adapter->vf_mvs.l) {
> -		entry = list_entry(pos, struct vf_macvlans, l);
> +	list_for_each_entry(entry, &adapter->vf_mvs.l, l) {
>  		if (entry->free)
>  			break;
>  	}
Romanowski, Rafal Aug. 31, 2023, 8:30 a.m. UTC | #2
> -----Original Message-----
> From: Intel-wired-lan <intel-wired-lan-bounces@osuosl.org> On Behalf Of
> Jacob Keller
> Sent: Wednesday, August 23, 2023 9:56 PM
> To: Jinjie Ruan <ruanjinjie@huawei.com>; intel-wired-lan@lists.osuosl.org;
> netdev@vger.kernel.org; Brandeburg, Jesse <jesse.brandeburg@intel.com>;
> Nguyen, Anthony L <anthony.l.nguyen@intel.com>; David S. Miller
> <davem@davemloft.net>; Eric Dumazet <edumazet@google.com>; Jakub
> Kicinski <kuba@kernel.org>; Paolo Abeni <pabeni@redhat.com>
> Subject: Re: [Intel-wired-lan] [PATCH net-next] ethernet/intel: Use
> list_for_each_entry() helper
> 
> 
> 
> On 8/21/2023 6:42 AM, Jinjie Ruan wrote:
> > Convert list_for_each() to list_for_each_entry() where applicable.
> >
> > No functional changed.
> >
> > Signed-off-by: Jinjie Ruan <ruanjinjie@huawei.com>
> 
> Thanks for cleaning these up!
> 
> Reviewed-by: Jacob Keller <jacob.e.keller@intel.com>
> 
> > ---
> >  drivers/net/ethernet/intel/igb/igb_main.c      | 7 ++-----
> >  drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c | 7 ++-----
> >  2 files changed, 4 insertions(+), 10 deletions(-)
> >
> > diff --git a/drivers/net/ethernet/intel/igb/igb_main.c
> > b/drivers/net/ethernet/intel/igb/igb_main.c
> > index 9f63a10c6f80..bf9c2f6a1164 100644
> > --- a/drivers/net/ethernet/intel/igb/igb_main.c
> > +++ b/drivers/net/ethernet/intel/igb/igb_main.c
> > @@ -7850,7 +7850,6 @@ static int igb_set_vf_mac_filter(struct


Tested-by: Rafal Romanowski <rafal.romanowski@intel.com>
diff mbox series

Patch

diff --git a/drivers/net/ethernet/intel/igb/igb_main.c b/drivers/net/ethernet/intel/igb/igb_main.c
index 9f63a10c6f80..bf9c2f6a1164 100644
--- a/drivers/net/ethernet/intel/igb/igb_main.c
+++ b/drivers/net/ethernet/intel/igb/igb_main.c
@@ -7850,7 +7850,6 @@  static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
 {
 	struct pci_dev *pdev = adapter->pdev;
 	struct vf_data_storage *vf_data = &adapter->vf_data[vf];
-	struct list_head *pos;
 	struct vf_mac_filter *entry = NULL;
 	int ret = 0;
 
@@ -7871,8 +7870,7 @@  static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
 	switch (info) {
 	case E1000_VF_MAC_FILTER_CLR:
 		/* remove all unicast MAC filters related to the current VF */
-		list_for_each(pos, &adapter->vf_macs.l) {
-			entry = list_entry(pos, struct vf_mac_filter, l);
+		list_for_each_entry(entry, &adapter->vf_macs.l, l) {
 			if (entry->vf == vf) {
 				entry->vf = -1;
 				entry->free = true;
@@ -7882,8 +7880,7 @@  static int igb_set_vf_mac_filter(struct igb_adapter *adapter, const int vf,
 		break;
 	case E1000_VF_MAC_FILTER_ADD:
 		/* try to find empty slot in the list */
-		list_for_each(pos, &adapter->vf_macs.l) {
-			entry = list_entry(pos, struct vf_mac_filter, l);
+		list_for_each_entry(entry, &adapter->vf_macs.l, l) {
 			if (entry->free)
 				break;
 		}
diff --git a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
index 29cc60988071..4c6e2a485d8e 100644
--- a/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
+++ b/drivers/net/ethernet/intel/ixgbe/ixgbe_sriov.c
@@ -639,12 +639,10 @@  static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
 				int vf, int index, unsigned char *mac_addr)
 {
 	struct vf_macvlans *entry;
-	struct list_head *pos;
 	int retval = 0;
 
 	if (index <= 1) {
-		list_for_each(pos, &adapter->vf_mvs.l) {
-			entry = list_entry(pos, struct vf_macvlans, l);
+		list_for_each_entry(entry, &adapter->vf_mvs.l, l) {
 			if (entry->vf == vf) {
 				entry->vf = -1;
 				entry->free = true;
@@ -664,8 +662,7 @@  static int ixgbe_set_vf_macvlan(struct ixgbe_adapter *adapter,
 
 	entry = NULL;
 
-	list_for_each(pos, &adapter->vf_mvs.l) {
-		entry = list_entry(pos, struct vf_macvlans, l);
+	list_for_each_entry(entry, &adapter->vf_mvs.l, l) {
 		if (entry->free)
 			break;
 	}