提交 ee71b968 编写于 作者: G Geliang Tang 提交者: Doug Ledford

IB/mlx4: Use list_for_each_entry_safe

Simplify the code in search_relocate_mgid0_group with by using
list_for_each_entry_safe().
Signed-off-by: NGeliang Tang <geliangtang@163.com>
Reviewed-by: NLeon Romanovsky <leonro@mellanox.com>
Signed-off-by: NDoug Ledford <dledford@redhat.com>
上级 0f377d86
...@@ -747,14 +747,11 @@ static struct mcast_group *search_relocate_mgid0_group(struct mlx4_ib_demux_ctx ...@@ -747,14 +747,11 @@ static struct mcast_group *search_relocate_mgid0_group(struct mlx4_ib_demux_ctx
__be64 tid, __be64 tid,
union ib_gid *new_mgid) 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 mcast_req *req;
struct list_head *pos;
struct list_head *n;
mutex_lock(&ctx->mcg_table_lock); mutex_lock(&ctx->mcg_table_lock);
list_for_each_safe(pos, n, &ctx->mcg_mgid0_list) { list_for_each_entry_safe(group, n, &ctx->mcg_mgid0_list, mgid0_list) {
group = list_entry(pos, struct mcast_group, mgid0_list);
mutex_lock(&group->lock); mutex_lock(&group->lock);
if (group->last_req_tid == tid) { if (group->last_req_tid == tid) {
if (memcmp(new_mgid, &mgid0, sizeof mgid0)) { if (memcmp(new_mgid, &mgid0, sizeof mgid0)) {
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册