Skip to contentSkip to conversation

staging: lustre: lnet: Use list_entry() rather than container_of()

PATCH New Janani Ravichandran 1 participant 1 message Feb 28, 2016 Staging

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 staging: lustre: lnet: Use list_entry() rather than container_of()

Use list_entry() rather than container_of() for nodes of doubly linked lists.
Semantic patch used:

@a exists@
identifier var;
struct list_head *ptr;
@@

var =
- container_of
+ list_entry
(ptr, ...);

---
 drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/lustre/lnet/klnds/o2iblnd/o2iblnd_cb.c +1 -1
index 0608431..866e2bf 100644
@@ -113,7 +113,7 @@ kiblnd_get_idle_tx(lnet_ni_t *ni, lnet_nid_t target)
 	node = kiblnd_pool_alloc_node(&tps->tps_poolset);
 	if (!node)
 		return NULL;
-	tx = container_of(node, kib_tx_t, tx_list);
+	tx = list_entry(node, kib_tx_t, tx_list);
 
 	LASSERT(!tx->tx_nwrq);
 	LASSERT(!tx->tx_queued);
Signature · 1 line
2.5.0