All the mail mirrored from lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group
@ 2015-12-07 15:04 ` Geliang Tang
  0 siblings, 0 replies; 4+ messages in thread
From: Geliang Tang @ 2015-12-07 15:04 UTC (permalink / raw
  To: Doug Ledford, Sean Hefty, Hal Rosenstock
  Cc: Geliang Tang, linux-rdma, linux-kernel

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



^ permalink raw reply related	[flat|nested] 4+ messages in thread

* [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group
@ 2015-12-07 15:04 ` Geliang Tang
  0 siblings, 0 replies; 4+ messages in thread
From: Geliang Tang @ 2015-12-07 15:04 UTC (permalink / raw
  To: Doug Ledford, Sean Hefty, Hal Rosenstock
  Cc: Geliang Tang, linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

Simplify the code with list_for_each_entry_safe().

Signed-off-by: Geliang Tang <geliangtang-9Onoh4P/yGk@public.gmane.org>
---
 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-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply related	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group
@ 2015-12-07 20:44   ` Leon Romanovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2015-12-07 20:44 UTC (permalink / raw
  To: Geliang Tang
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock, linux-rdma,
	linux-kernel

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

^ permalink raw reply	[flat|nested] 4+ messages in thread

* Re: [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group
@ 2015-12-07 20:44   ` Leon Romanovsky
  0 siblings, 0 replies; 4+ messages in thread
From: Leon Romanovsky @ 2015-12-07 20:44 UTC (permalink / raw
  To: Geliang Tang
  Cc: Doug Ledford, Sean Hefty, Hal Rosenstock,
	linux-rdma-u79uwXL29TY76Z2rM5mHXA,
	linux-kernel-u79uwXL29TY76Z2rM5mHXA

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-9Onoh4P/yGk@public.gmane.org>
> ---
>  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-VPRAkNaXOzVWk0Htik3J/w@public.gmane.org>

> -- 
> 2.5.0
> 
> 
> --
> To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
> the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
> More majordomo info at  http://vger.kernel.org/majordomo-info.html
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to majordomo-u79uwXL29TY76Z2rM5mHXA@public.gmane.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

^ permalink raw reply	[flat|nested] 4+ messages in thread

end of thread, other threads:[~2015-12-07 20:45 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2015-12-07 15:04 [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group Geliang Tang
2015-12-07 15:04 ` Geliang Tang
2015-12-07 20:44 ` Leon Romanovsky
2015-12-07 20:44   ` Leon Romanovsky

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.