From patchwork Mon Dec 7 15:04:43 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Geliang Tang X-Patchwork-Id: 7787041 Return-Path: X-Original-To: patchwork-linux-rdma@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 607069F349 for ; Mon, 7 Dec 2015 15:43:51 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 99251203C0 for ; Mon, 7 Dec 2015 15:43:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B962D20265 for ; Mon, 7 Dec 2015 15:43:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S933156AbbLGPng (ORCPT ); Mon, 7 Dec 2015 10:43:36 -0500 Received: from m50-134.163.com ([123.125.50.134]:52322 "EHLO m50-134.163.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S933472AbbLGPFC (ORCPT ); Mon, 7 Dec 2015 10:05:02 -0500 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=163.com; s=s110527; h=From:Subject:Date:Message-Id; bh=mxdxL2+VxitxGfhZfZ WrMZuTIAI1wD4i8uNLIRjFwRo=; b=ZXAoakdI5WdUz2ja7OSncglUb0Kud2O932 0l4hRhFtX4ACj78EOk62GYKedaZXN47D4UAuL3aWi8ZbUJBLAwBj1aQxYiUc8WaQ x02pCNV+lN67Y5eEggL5/yv5s4OipbXYI9nz61arptXZEv9sesmXzQVT6iPgrqDi KeS8nf7eo= Received: from localhost (unknown [116.77.147.105]) by smtp4 (Coremail) with SMTP id DtGowEB5aWEOoGVW_NGaAA--.5636S3; Mon, 07 Dec 2015 23:04:47 +0800 (CST) From: Geliang Tang To: Doug Ledford , Sean Hefty , Hal Rosenstock Cc: Geliang Tang , linux-rdma@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH] IB/mlx4: use list_for_each_entry_safe in search_relocate_mgid0_group Date: Mon, 7 Dec 2015 23:04:43 +0800 Message-Id: X-Mailer: git-send-email 2.5.0 X-CM-TRANSID: DtGowEB5aWEOoGVW_NGaAA--.5636S3 X-Coremail-Antispam: 1Uf129KBjvdXoW7Jr4ruFW3Zry7WF1fKF4fuFg_yoWkXFg_Wa 4jyrn7Gr45Ar4FkryIg3s3CrWF93yYq3ZrZw4Dt3W5J3ZxGr45Za4vvr43W34ru3yxWay5 Cr9rur97KF1rWjkaLaAFLSUrUUUUUb8apTn2vfkv8UJUUUU8Yxn0WfASr-VFAUDa7-sFnT 9fnUUvcSsGvfC2KfnxnUUI43ZEXa7IUjsXo7UUUUU== X-Originating-IP: [116.77.147.105] X-CM-SenderInfo: 5jhoxtpqjwt0rj6rljoofrz/xtbByhDJmVO+gYInjgAAsN Sender: linux-rdma-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-rdma@vger.kernel.org X-Spam-Status: No, score=-6.8 required=5.0 tests=BAYES_00,DKIM_SIGNED, FREEMAIL_FROM,RCVD_IN_DNSWL_HI,T_DKIM_INVALID,T_RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=ham version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Simplify the code with list_for_each_entry_safe(). Signed-off-by: Geliang Tang Reviewed-by: Leon Romanovsky --- 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)) {