* [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items @ 2016-06-18 2:53 weiyj_lk 2016-06-20 15:50 ` Thomas Falcon 0 siblings, 1 reply; 7+ messages in thread From: weiyj_lk @ 2016-06-18 2:53 UTC (permalink / raw) To: Thomas Falcon, John Allen, Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: Wei Yongjun, netdev, linuxppc-dev From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Since we will remove items off the list using list_del() we need to use a safe version of the list_for_each() macro aptly named list_for_each_safe(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> --- drivers/net/ethernet/ibm/ibmvnic.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 864cb21..0b6a922 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) { - struct ibmvnic_inflight_cmd *inflight_cmd; + struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; struct device *dev = &adapter->vdev->dev; - struct ibmvnic_error_buff *error_buff; + struct ibmvnic_error_buff *error_buff, *tmp2; unsigned long flags; unsigned long flags2; spin_lock_irqsave(&adapter->inflight_lock, flags); - list_for_each_entry(inflight_cmd, &adapter->inflight, list) { + list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { switch (inflight_cmd->crq.generic.cmd) { case LOGIN: dma_unmap_single(dev, adapter->login_buf_token, @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) break; case REQUEST_ERROR_INFO: spin_lock_irqsave(&adapter->error_list_lock, flags2); - list_for_each_entry(error_buff, &adapter->errors, - list) { + list_for_each_entry_safe(error_buff, tmp2, + &adapter->errors, list) { dma_unmap_single(dev, error_buff->dma, error_buff->len, DMA_FROM_DEVICE); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items 2016-06-18 2:53 [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items weiyj_lk @ 2016-06-20 15:50 ` Thomas Falcon 2016-06-21 16:01 ` Thomas Falcon 0 siblings, 1 reply; 7+ messages in thread From: Thomas Falcon @ 2016-06-20 15:50 UTC (permalink / raw) To: weiyj_lk, John Allen, Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman Cc: netdev, Wei Yongjun, linuxppc-dev On 06/17/2016 09:53 PM, weiyj_lk@163.com wrote: > From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > > Since we will remove items off the list using list_del() we need > to use a safe version of the list_for_each() macro aptly named > list_for_each_safe(). > > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> > --- > drivers/net/ethernet/ibm/ibmvnic.c | 10 +++++----- > 1 file changed, 5 insertions(+), 5 deletions(-) > > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c > index 864cb21..0b6a922 100644 > --- a/drivers/net/ethernet/ibm/ibmvnic.c > +++ b/drivers/net/ethernet/ibm/ibmvnic.c > @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, > > static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) > { > - struct ibmvnic_inflight_cmd *inflight_cmd; > + struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; > struct device *dev = &adapter->vdev->dev; > - struct ibmvnic_error_buff *error_buff; > + struct ibmvnic_error_buff *error_buff, *tmp2; > unsigned long flags; > unsigned long flags2; > > spin_lock_irqsave(&adapter->inflight_lock, flags); > - list_for_each_entry(inflight_cmd, &adapter->inflight, list) { > + list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { > switch (inflight_cmd->crq.generic.cmd) { > case LOGIN: > dma_unmap_single(dev, adapter->login_buf_token, > @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) > break; > case REQUEST_ERROR_INFO: > spin_lock_irqsave(&adapter->error_list_lock, flags2); > - list_for_each_entry(error_buff, &adapter->errors, > - list) { > + list_for_each_entry_safe(error_buff, tmp2, > + &adapter->errors, list) { > dma_unmap_single(dev, error_buff->dma, > error_buff->len, > DMA_FROM_DEVICE); > Thanks! Acked-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> > > > > _______________________________________________ > Linuxppc-dev mailing list > Linuxppc-dev@lists.ozlabs.org > https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply [flat|nested] 7+ messages in thread
* Re: [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items 2016-06-20 15:50 ` Thomas Falcon @ 2016-06-21 16:01 ` Thomas Falcon 2016-06-22 2:23 ` Wei Yongjun 2016-06-22 2:51 ` [PATCH v2] " Wei Yongjun 0 siblings, 2 replies; 7+ messages in thread From: Thomas Falcon @ 2016-06-21 16:01 UTC (permalink / raw) To: weiyj_lk; +Cc: John Allen, netdev, Wei Yongjun, linuxppc-dev On 06/20/2016 10:50 AM, Thomas Falcon wrote: > On 06/17/2016 09:53 PM, weiyj_lk@163.com wrote: >> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >> >> Since we will remove items off the list using list_del() we need >> to use a safe version of the list_for_each() macro aptly named >> list_for_each_safe(). >> >> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >> --- >> drivers/net/ethernet/ibm/ibmvnic.c | 10 +++++----- >> 1 file changed, 5 insertions(+), 5 deletions(-) >> >> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c >> index 864cb21..0b6a922 100644 >> --- a/drivers/net/ethernet/ibm/ibmvnic.c >> +++ b/drivers/net/ethernet/ibm/ibmvnic.c >> @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, >> >> static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) >> { >> - struct ibmvnic_inflight_cmd *inflight_cmd; >> + struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; >> struct device *dev = &adapter->vdev->dev; >> - struct ibmvnic_error_buff *error_buff; >> + struct ibmvnic_error_buff *error_buff, *tmp2; >> unsigned long flags; >> unsigned long flags2; >> >> spin_lock_irqsave(&adapter->inflight_lock, flags); >> - list_for_each_entry(inflight_cmd, &adapter->inflight, list) { >> + list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { >> switch (inflight_cmd->crq.generic.cmd) { >> case LOGIN: >> dma_unmap_single(dev, adapter->login_buf_token, >> @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) >> break; >> case REQUEST_ERROR_INFO: >> spin_lock_irqsave(&adapter->error_list_lock, flags2); >> - list_for_each_entry(error_buff, &adapter->errors, >> - list) { >> + list_for_each_entry_safe(error_buff, tmp2, >> + &adapter->errors, list) { >> dma_unmap_single(dev, error_buff->dma, >> error_buff->len, >> DMA_FROM_DEVICE); >> > Thanks! > > Acked-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> Hello, I apologize for prematurely ack'ing this. There is another situation where you could use list_for_each_entry_safe in the function handle_error_info_rsp. Could you include this in your patch, please? diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 864cb21..e9968d9 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2121,7 +2121,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, struct ibmvnic_adapter *adapter) { struct device *dev = &adapter->vdev->dev; - struct ibmvnic_error_buff *error_buff; + struct ibmvnic_error_buff *error_buff, *tmp; unsigned long flags; bool found = false; int i; @@ -2133,7 +2133,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, } spin_lock_irqsave(&adapter->error_list_lock, flags); - list_for_each_entry(error_buff, &adapter->errors, list) + list_for_each_entry_safe(error_buff, tmp, &adapter->errors, list) if (error_buff->error_id == crq->request_error_rsp.error_id) { found = true; list_del(&error_buff->list); >> >> >> _______________________________________________ >> Linuxppc-dev mailing list >> Linuxppc-dev@lists.ozlabs.org >> https://lists.ozlabs.org/listinfo/linuxppc-dev ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items 2016-06-21 16:01 ` Thomas Falcon @ 2016-06-22 2:23 ` Wei Yongjun 2016-06-22 2:51 ` [PATCH v2] " Wei Yongjun 1 sibling, 0 replies; 7+ messages in thread From: Wei Yongjun @ 2016-06-22 2:23 UTC (permalink / raw) To: Thomas Falcon; +Cc: John Allen, netdev, Wei Yongjun, linuxppc-dev Hi Thomas Falcon, Thanks for found this. I will send new patch include your changes. Regards, Yongjun Wei On 06/22/2016 12:01 AM, Thomas Falcon wrote: > On 06/20/2016 10:50 AM, Thomas Falcon wrote: >> On 06/17/2016 09:53 PM, weiyj_lk@163.com wrote: >>> From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >>> >>> Since we will remove items off the list using list_del() we need >>> to use a safe version of the list_for_each() macro aptly named >>> list_for_each_safe(). >>> >>> Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> >>> --- >>> drivers/net/ethernet/ibm/ibmvnic.c | 10 +++++----- >>> 1 file changed, 5 insertions(+), 5 deletions(-) >>> >>> diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c >>> index 864cb21..0b6a922 100644 >>> --- a/drivers/net/ethernet/ibm/ibmvnic.c >>> +++ b/drivers/net/ethernet/ibm/ibmvnic.c >>> @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, >>> >>> static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) >>> { >>> - struct ibmvnic_inflight_cmd *inflight_cmd; >>> + struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; >>> struct device *dev = &adapter->vdev->dev; >>> - struct ibmvnic_error_buff *error_buff; >>> + struct ibmvnic_error_buff *error_buff, *tmp2; >>> unsigned long flags; >>> unsigned long flags2; >>> >>> spin_lock_irqsave(&adapter->inflight_lock, flags); >>> - list_for_each_entry(inflight_cmd, &adapter->inflight, list) { >>> + list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { >>> switch (inflight_cmd->crq.generic.cmd) { >>> case LOGIN: >>> dma_unmap_single(dev, adapter->login_buf_token, >>> @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) >>> break; >>> case REQUEST_ERROR_INFO: >>> spin_lock_irqsave(&adapter->error_list_lock, flags2); >>> - list_for_each_entry(error_buff, &adapter->errors, >>> - list) { >>> + list_for_each_entry_safe(error_buff, tmp2, >>> + &adapter->errors, list) { >>> dma_unmap_single(dev, error_buff->dma, >>> error_buff->len, >>> DMA_FROM_DEVICE); >>> >> Thanks! >> >> Acked-by: Thomas Falcon <tlfalcon@linux.vnet.ibm.com> > Hello, I apologize for prematurely ack'ing this. There is another situation where you could use list_for_each_entry_safe in the function handle_error_info_rsp. Could you include this in your patch, please? > > diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c > index 864cb21..e9968d9 100644 > --- a/drivers/net/ethernet/ibm/ibmvnic.c > +++ b/drivers/net/ethernet/ibm/ibmvnic.c > @@ -2121,7 +2121,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, > struct ibmvnic_adapter *adapter) > { > struct device *dev = &adapter->vdev->dev; > - struct ibmvnic_error_buff *error_buff; > + struct ibmvnic_error_buff *error_buff, *tmp; > unsigned long flags; > bool found = false; > int i; > @@ -2133,7 +2133,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, > } > > spin_lock_irqsave(&adapter->error_list_lock, flags); > - list_for_each_entry(error_buff, &adapter->errors, list) > + list_for_each_entry_safe(error_buff, tmp, &adapter->errors, list) > if (error_buff->error_id == crq->request_error_rsp.error_id) { > found = true; > list_del(&error_buff->list); > >>> >>> _______________________________________________ >>> Linuxppc-dev mailing list >>> Linuxppc-dev@lists.ozlabs.org >>> https://lists.ozlabs.org/listinfo/linuxppc-dev > ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] ibmvnic: fix to use list_for_each_safe() when delete items 2016-06-21 16:01 ` Thomas Falcon 2016-06-22 2:23 ` Wei Yongjun @ 2016-06-22 2:51 ` Wei Yongjun 2016-06-25 16:02 ` David Miller 1 sibling, 1 reply; 7+ messages in thread From: Wei Yongjun @ 2016-06-22 2:51 UTC (permalink / raw) To: Thomas Falcon; +Cc: John Allen, netdev, Wei Yongjun, linuxppc-dev Since we will remove items off the list using list_del() we need to use a safe version of the list_for_each() macro aptly named list_for_each_safe(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> --- drivers/net/ethernet/ibm/ibmvnic.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 864cb21..ecdb685 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2121,7 +2121,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, struct ibmvnic_adapter *adapter) { struct device *dev = &adapter->vdev->dev; - struct ibmvnic_error_buff *error_buff; + struct ibmvnic_error_buff *error_buff, *tmp; unsigned long flags; bool found = false; int i; @@ -2133,7 +2133,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, } spin_lock_irqsave(&adapter->error_list_lock, flags); - list_for_each_entry(error_buff, &adapter->errors, list) + list_for_each_entry_safe(error_buff, tmp, &adapter->errors, list) if (error_buff->error_id == crq->request_error_rsp.error_id) { found = true; list_del(&error_buff->list); @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) { - struct ibmvnic_inflight_cmd *inflight_cmd; + struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; struct device *dev = &adapter->vdev->dev; - struct ibmvnic_error_buff *error_buff; + struct ibmvnic_error_buff *error_buff, *tmp2; unsigned long flags; unsigned long flags2; spin_lock_irqsave(&adapter->inflight_lock, flags); - list_for_each_entry(inflight_cmd, &adapter->inflight, list) { + list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { switch (inflight_cmd->crq.generic.cmd) { case LOGIN: dma_unmap_single(dev, adapter->login_buf_token, @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) break; case REQUEST_ERROR_INFO: spin_lock_irqsave(&adapter->error_list_lock, flags2); - list_for_each_entry(error_buff, &adapter->errors, - list) { + list_for_each_entry_safe(error_buff, tmp2, + &adapter->errors, list) { dma_unmap_single(dev, error_buff->dma, error_buff->len, DMA_FROM_DEVICE); ^ permalink raw reply related [flat|nested] 7+ messages in thread
* Re: [PATCH v2] ibmvnic: fix to use list_for_each_safe() when delete items 2016-06-22 2:51 ` [PATCH v2] " Wei Yongjun @ 2016-06-25 16:02 ` David Miller 2016-06-27 12:48 ` weiyj_lk 0 siblings, 1 reply; 7+ messages in thread From: David Miller @ 2016-06-25 16:02 UTC (permalink / raw) To: weiyj_lk; +Cc: tlfalcon, jallen, netdev, yongjun_wei, linuxppc-dev From: Wei Yongjun <weiyj_lk@163.com> Date: Wed, 22 Jun 2016 10:51:46 +0800 > Since we will remove items off the list using list_del() we need > to use a safe version of the list_for_each() macro aptly named > list_for_each_safe(). > > Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Your email client has corrupted the spacing in this patch, making it unusable. ^ permalink raw reply [flat|nested] 7+ messages in thread
* [PATCH v2] ibmvnic: fix to use list_for_each_safe() when delete items 2016-06-25 16:02 ` David Miller @ 2016-06-27 12:48 ` weiyj_lk 0 siblings, 0 replies; 7+ messages in thread From: weiyj_lk @ 2016-06-27 12:48 UTC (permalink / raw) To: Benjamin Herrenschmidt, Paul Mackerras, Michael Ellerman, Thomas Falcon, John Allen Cc: Wei Yongjun, linuxppc-dev, netdev From: Wei Yongjun <yongjun_wei@trendmicro.com.cn> Since we will remove items off the list using list_del() we need to use a safe version of the list_for_each() macro aptly named list_for_each_safe(). Signed-off-by: Wei Yongjun <yongjun_wei@trendmicro.com.cn> --- drivers/net/ethernet/ibm/ibmvnic.c | 14 +++++++------- 1 file changed, 7 insertions(+), 7 deletions(-) diff --git a/drivers/net/ethernet/ibm/ibmvnic.c b/drivers/net/ethernet/ibm/ibmvnic.c index 864cb21..ecdb685 100644 --- a/drivers/net/ethernet/ibm/ibmvnic.c +++ b/drivers/net/ethernet/ibm/ibmvnic.c @@ -2121,7 +2121,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, struct ibmvnic_adapter *adapter) { struct device *dev = &adapter->vdev->dev; - struct ibmvnic_error_buff *error_buff; + struct ibmvnic_error_buff *error_buff, *tmp; unsigned long flags; bool found = false; int i; @@ -2133,7 +2133,7 @@ static void handle_error_info_rsp(union ibmvnic_crq *crq, } spin_lock_irqsave(&adapter->error_list_lock, flags); - list_for_each_entry(error_buff, &adapter->errors, list) + list_for_each_entry_safe(error_buff, tmp, &adapter->errors, list) if (error_buff->error_id == crq->request_error_rsp.error_id) { found = true; list_del(&error_buff->list); @@ -3141,14 +3141,14 @@ static void handle_request_ras_comp_num_rsp(union ibmvnic_crq *crq, static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) { - struct ibmvnic_inflight_cmd *inflight_cmd; + struct ibmvnic_inflight_cmd *inflight_cmd, *tmp1; struct device *dev = &adapter->vdev->dev; - struct ibmvnic_error_buff *error_buff; + struct ibmvnic_error_buff *error_buff, *tmp2; unsigned long flags; unsigned long flags2; spin_lock_irqsave(&adapter->inflight_lock, flags); - list_for_each_entry(inflight_cmd, &adapter->inflight, list) { + list_for_each_entry_safe(inflight_cmd, tmp1, &adapter->inflight, list) { switch (inflight_cmd->crq.generic.cmd) { case LOGIN: dma_unmap_single(dev, adapter->login_buf_token, @@ -3165,8 +3165,8 @@ static void ibmvnic_free_inflight(struct ibmvnic_adapter *adapter) break; case REQUEST_ERROR_INFO: spin_lock_irqsave(&adapter->error_list_lock, flags2); - list_for_each_entry(error_buff, &adapter->errors, - list) { + list_for_each_entry_safe(error_buff, tmp2, + &adapter->errors, list) { dma_unmap_single(dev, error_buff->dma, error_buff->len, DMA_FROM_DEVICE); ^ permalink raw reply related [flat|nested] 7+ messages in thread
end of thread, other threads:[~2016-06-27 12:49 UTC | newest] Thread overview: 7+ messages (download: mbox.gz follow: Atom feed -- links below jump to the message on this page -- 2016-06-18 2:53 [PATCH] ibmvnic: fix to use list_for_each_safe() when delete items weiyj_lk 2016-06-20 15:50 ` Thomas Falcon 2016-06-21 16:01 ` Thomas Falcon 2016-06-22 2:23 ` Wei Yongjun 2016-06-22 2:51 ` [PATCH v2] " Wei Yongjun 2016-06-25 16:02 ` David Miller 2016-06-27 12:48 ` weiyj_lk
This is a public inbox, see mirroring instructions for how to clone and mirror all data and code used for this inbox; as well as URLs for NNTP newsgroup(s).