Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1285641 > unrolled thread

[PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group

Started byGeliang Tang <geliangtang@163.com>
First post2015-12-07 16:50 +0100
Last post2015-12-07 21:50 +0100
Articles 2 — 2 participants

Back to article view | Back to linux.kernel


Contents

  [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group Geliang Tang <geliangtang@163.com> - 2015-12-07 16:50 +0100
    Re: [PATCH] IB/mlx4: use list_for_each_entry_safe in  search_relocate_mgid0_group Leon Romanovsky <leon@leon.nu> - 2015-12-07 21:50 +0100

#1285641 — [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group

FromGeliang Tang <geliangtang@163.com>
Date2015-12-07 16:50 +0100
Subject[PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group
Message-ID<qD6d3-6qb-11@gated-at.bofh.it>
Simplify the code with list_for_each_entry_safe().

Signed-off-by: Geliang Tang <geliangtang@163.com>
---
 drivers/infiniband/hw/mlx4/mcg.c | 7 ++-----
 1 file changed, 2 insertions(+), 5 deletions(-)

diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
index 99451d8..ebdca2b 100644
--- a/drivers/infiniband/hw/mlx4/mcg.c
+++ b/drivers/infiniband/hw/mlx4/mcg.c
@@ -747,14 +747,11 @@ static struct mcast_group *search_relocate_mgid0_group(struct mlx4_ib_demux_ctx
 						       __be64 tid,
 						       union ib_gid *new_mgid)
 {
-	struct mcast_group *group = NULL, *cur_group;
+	struct mcast_group *group = NULL, *cur_group, *n;
 	struct mcast_req *req;
-	struct list_head *pos;
-	struct list_head *n;
 
 	mutex_lock(&ctx->mcg_table_lock);
-	list_for_each_safe(pos, n, &ctx->mcg_mgid0_list) {
-		group = list_entry(pos, struct mcast_group, mgid0_list);
+	list_for_each_entry_safe(group, n, &ctx->mcg_mgid0_list, mgid0_list) {
 		mutex_lock(&group->lock);
 		if (group->last_req_tid == tid) {
 			if (memcmp(new_mgid, &mgid0, sizeof mgid0)) {
-- 
2.5.0


--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [next] | [standalone]


#1285910 — Re: [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group

FromLeon Romanovsky <leon@leon.nu>
Date2015-12-07 21:50 +0100
SubjectRe: [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group
Message-ID<qDaTo-10f-9@gated-at.bofh.it>
In reply to#1285641
On Mon, Dec 07, 2015 at 11:04:43PM +0800, Geliang Tang wrote:
> Simplify the code with list_for_each_entry_safe().
> 
> Signed-off-by: Geliang Tang <geliangtang@163.com>
> ---
>  drivers/infiniband/hw/mlx4/mcg.c | 7 ++-----
>  1 file changed, 2 insertions(+), 5 deletions(-)
> 
> diff --git a/drivers/infiniband/hw/mlx4/mcg.c b/drivers/infiniband/hw/mlx4/mcg.c
> index 99451d8..ebdca2b 100644
> --- a/drivers/infiniband/hw/mlx4/mcg.c
> +++ b/drivers/infiniband/hw/mlx4/mcg.c
> @@ -747,14 +747,11 @@ static struct mcast_group *search_relocate_mgid0_group(struct mlx4_ib_demux_ctx
>  						       __be64 tid,
>  						       union ib_gid *new_mgid)
>  {
> -	struct mcast_group *group = NULL, *cur_group;
> +	struct mcast_group *group = NULL, *cur_group, *n;
>  	struct mcast_req *req;
> -	struct list_head *pos;
> -	struct list_head *n;
>  
>  	mutex_lock(&ctx->mcg_table_lock);
> -	list_for_each_safe(pos, n, &ctx->mcg_mgid0_list) {
> -		group = list_entry(pos, struct mcast_group, mgid0_list);
> +	list_for_each_entry_safe(group, n, &ctx->mcg_mgid0_list, mgid0_list) {
>  		mutex_lock(&group->lock);
>  		if (group->last_req_tid == tid) {
>  			if (memcmp(new_mgid, &mgid0, sizeof mgid0)) {
Thanks,
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>

> -- 
> 2.5.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo@vger.kernel.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html
Please read the FAQ at  http://www.tux.org/lkml/

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web