Skip to content

Commit

Permalink
IB/mlx4: Use list_for_each_entry_safe
Browse files Browse the repository at this point in the history
Simplify the code in search_relocate_mgid0_group with by using
list_for_each_entry_safe().

Signed-off-by: Geliang Tang <geliangtang@163.com>
Reviewed-by: Leon Romanovsky <leonro@mellanox.com>
Signed-off-by: Doug Ledford <dledford@redhat.com>
  • Loading branch information
Geliang Tang authored and Doug Ledford committed May 13, 2016
1 parent 0f377d8 commit ee71b96
Showing 1 changed file with 2 additions and 5 deletions.
7 changes: 2 additions & 5 deletions drivers/infiniband/hw/mlx4/mcg.c
Original file line number Diff line number Diff line change
Expand Up @@ -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)) {
Expand Down

0 comments on commit ee71b96

Please sign in to comment.