Skip to contentSkip to conversation

IB/mlx4: Code cleanup in cm.c

PATCH In review Hakon Bugge 3 participants 6 messages Apr 28, 2017 – May 1, 2017 3 messages not in the archive

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover IB/mlx4: Code cleanup in cm.c

This patchset contains two non-functional patches that cleans up two issues.

Hakon Bugge (2):
IB/mlx4: Change flush logic so it adheres to the variable name IB/mlx4: Fix incorrect order of formal and actual parameters

 drivers/infiniband/hw/mlx4/cm.c | 10 +++++-----
 1 file changed, 5 insertions(+), 5 deletions(-)

--
2.9.3
--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in the body of a message to [email protected] More majordomo info at http://vger.kernel.org/majordomo-info.html

#2 lore raw

PATCH 1/2 IB/mlx4: Change flush logic so it adheres to the variable name

In reply to a message not in the archive

Change and simplify the code to match the variable name. This is a non-functional change which improves readability.

---
 drivers/infiniband/hw/mlx4/cm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
drivers/infiniband/hw/mlx4/cm.c +3 -3
index d648453..61f63fe 100644
@@ -414,7 +414,7 @@ void mlx4_ib_cm_paravirt_clean(struct mlx4_ib_dev *dev, int slave)
 	struct rb_root *sl_id_map = &sriov->sl_id_map;
 	struct list_head lh;
 	struct rb_node *nd;
-	int need_flush = 1;
+	int need_flush = 0;
 	struct id_map_entry *map, *tmp_map;
 	/* cancel all delayed work queue entries */
 	INIT_LIST_HEAD(&lh);
@@ -422,13 +422,13 @@ void mlx4_ib_cm_paravirt_clean(struct mlx4_ib_dev *dev, int slave)
 	list_for_each_entry_safe(map, tmp_map, &dev->sriov.cm_list, list) {
 		if (slave < 0 || slave == map->slave_id) {
 			if (map->scheduled_delete)
-				need_flush &= !!cancel_delayed_work(&map->timeout);
+				need_flush |= !cancel_delayed_work(&map->timeout);
 		}
 	}
 
 	spin_unlock(&sriov->id_map_lock);
 
-	if (!need_flush)
+	if (need_flush)
 		flush_scheduled_work(); /* make sure all timers were flushed */
 
 	/* now, remove all leftover entries from databases*/
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#5 lore raw

PATCH 2/2 IB/mlx4: Fix incorrect order of formal and actual parameters

In reply to a message not in the archive

The last two actual parameters when calling id_map_find_by_sl_id() from id_map_get() are swapped. However, the same formal parameters to id_map_get() have them swapped as well, inverting the effect of the first error.

Hence, this commit is a non-functional fix, improving readability.

---
 drivers/infiniband/hw/mlx4/cm.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/infiniband/hw/mlx4/cm.c +2 -2
index 61f63fe..1e6c526 100644
@@ -279,14 +279,14 @@ id_map_alloc(struct ib_device *ibdev, int slave_id, u32 sl_cm_id)
 }
 
 static struct id_map_entry *
-id_map_get(struct ib_device *ibdev, int *pv_cm_id, int sl_cm_id, int slave_id)
+id_map_get(struct ib_device *ibdev, int *pv_cm_id, int slave_id, int sl_cm_id)
 {
 	struct id_map_entry *ent;
 	struct mlx4_ib_sriov *sriov = &to_mdev(ibdev)->sriov;
 
 	spin_lock(&sriov->id_map_lock);
 	if (*pv_cm_id == -1) {
-		ent = id_map_find_by_sl_id(ibdev, sl_cm_id, slave_id);
+		ent = id_map_find_by_sl_id(ibdev, slave_id, sl_cm_id);
 		if (ent)
 			*pv_cm_id = (int) ent->pv_cm_id;
 	} else
Signature · 6 lines
2.9.3

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html
#4 lore raw

Re: [PATCH 1/2] IB/mlx4: Change flush logic so it adheres to the variable name

In reply to a message not in the archive
Quoted 11 lines · Hakon Bugge

Change and simplify the code to match the variable name. This is a non-functional change which improves readability.

---
 drivers/infiniband/hw/mlx4/cm.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

Except the word, "non-functional change", instead of "no functional change", everything looks good.

Thanks,

#7 lore raw

Re: [PATCH 2/2] IB/mlx4: Fix incorrect order of formal and actual parameters

In reply to a message not in the archive
Quoted 11 lines · Hakon Bugge

The last two actual parameters when calling id_map_find_by_sl_id() from id_map_get() are swapped. However, the same formal parameters to id_map_get() have them swapped as well, inverting the effect of the first error.

Hence, this commit is a non-functional fix, improving readability.

---

"non-functional fix" => "no functional change"

Thanks,

#8 lore raw
In reply to a message not in the archive
Quoted 9 lines · Hakon Bugge

This patchset contains two non-functional patches that cleans up two issues.

Hakon Bugge (2):
  IB/mlx4: Change flush logic so it adheres to the variable name IB/mlx4: Fix incorrect order of formal and actual parameters

 drivers/infiniband/hw/mlx4/cm.c | 10 +++++-----

 1 file changed, 5 insertions(+), 5 deletions(-)

I made the commit messages a bit clearer, but otherwise, series applied, thanks.

Signature · 9 lines
Doug Ledford <[email protected]>
    GPG KeyID: B826A3330E572FDD
   
Key fingerprint = AE6B 1BDA 122B 23B4 265B  1274 B826 A333 0E57 2FDD

--
To unsubscribe from this list: send the line "unsubscribe linux-rdma" in
the body of a message to [email protected]
More majordomo info at  http://vger.kernel.org/majordomo-info.html