[dpdk-dev,1/3] kni: minor opto

Message ID 1433358478-12668-1-git-send-email-rolette@infiniteio.com (mailing list archive)
State Superseded, archived
Headers

Commit Message

Jay Rolette June 3, 2015, 7:07 p.m. UTC
  Don't need the 'safe' version of list_for_each_entry() if you aren't deleting from the list as you iterate over it

Signed-off-by: Jay Rolette <rolette@infiniteio.com>
---
 lib/librte_eal/linuxapp/kni/kni_misc.c | 5 ++---
 1 file changed, 2 insertions(+), 3 deletions(-)
  

Comments

Zhang, Helin June 16, 2015, 1:12 a.m. UTC | #1
> -----Original Message-----
> From: dev [mailto:dev-bounces@dpdk.org] On Behalf Of Jay Rolette
> Sent: Thursday, June 4, 2015 3:08 AM
> To: dev@dpdk.org
> Subject: [dpdk-dev] [PATCH 1/3] kni: minor opto
> 
> Don't need the 'safe' version of list_for_each_entry() if you aren't deleting from
> the list as you iterate over it
> 
> Signed-off-by: Jay Rolette <rolette@infiniteio.com>
Acked-by: Helin Zhang <helin.zhang@intel.com>

> ---
>  lib/librte_eal/linuxapp/kni/kni_misc.c | 5 ++---
>  1 file changed, 2 insertions(+), 3 deletions(-)
> 
> diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c
> b/lib/librte_eal/linuxapp/kni/kni_misc.c
> index 1935d32..312f196 100644
> --- a/lib/librte_eal/linuxapp/kni/kni_misc.c
> +++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
> @@ -213,13 +213,12 @@ static int
>  kni_thread_single(void *unused)
>  {
>  	int j;
> -	struct kni_dev *dev, *n;
> +	struct kni_dev *dev;
> 
>  	while (!kthread_should_stop()) {
>  		down_read(&kni_list_lock);
>  		for (j = 0; j < KNI_RX_LOOP_NUM; j++) {
> -			list_for_each_entry_safe(dev, n,
> -					&kni_list_head, list) {
> +			list_for_each_entry(dev, &kni_list_head, list) {
>  #ifdef RTE_KNI_VHOST
>  				kni_chk_vhost_rx(dev);
>  #else
> --
> 2.3.2 (Apple Git-55)
  

Patch

diff --git a/lib/librte_eal/linuxapp/kni/kni_misc.c b/lib/librte_eal/linuxapp/kni/kni_misc.c
index 1935d32..312f196 100644
--- a/lib/librte_eal/linuxapp/kni/kni_misc.c
+++ b/lib/librte_eal/linuxapp/kni/kni_misc.c
@@ -213,13 +213,12 @@  static int
 kni_thread_single(void *unused)
 {
 	int j;
-	struct kni_dev *dev, *n;
+	struct kni_dev *dev;
 
 	while (!kthread_should_stop()) {
 		down_read(&kni_list_lock);
 		for (j = 0; j < KNI_RX_LOOP_NUM; j++) {
-			list_for_each_entry_safe(dev, n,
-					&kni_list_head, list) {
+			list_for_each_entry(dev, &kni_list_head, list) {
 #ifdef RTE_KNI_VHOST
 				kni_chk_vhost_rx(dev);
 #else