summaryrefslogtreecommitdiffstats
path: root/drivers/staging/lustre
diff options
context:
space:
mode:
authorBhumika Goyal2016-03-06 15:56:58 +0100
committerGreg Kroah-Hartman2016-03-12 07:09:09 +0100
commit8f5b1435a13b30c9439095abf0bb37d326515d95 (patch)
tree410e778f6cbb42ec7d75ee973ae6e03b54cf1b66 /drivers/staging/lustre
parentStaging: lustre: lnet: Use list_first_entry_or_null (diff)
downloadkernel-qcow2-linux-8f5b1435a13b30c9439095abf0bb37d326515d95.tar.gz
kernel-qcow2-linux-8f5b1435a13b30c9439095abf0bb37d326515d95.tar.xz
kernel-qcow2-linux-8f5b1435a13b30c9439095abf0bb37d326515d95.zip
Staging: lustre: Use list_{next/prev}_entry instead of list_entry
This patch replace list_entry with list_{next/prev}_entry as it makes the code more clear to read. Done using coccinelle: @@ expression e1; identifier e3; type t; @@ ( - list_entry(e1->e3.next,t,e3) + list_next_entry(e1,e3) | - list_entry(e1->e3.prev,t,e3) + list_prev_entry(e1,e3) ) Signed-off-by: Bhumika Goyal <bhumirks@gmail.com> Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'drivers/staging/lustre')
-rw-r--r--drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c3
-rw-r--r--drivers/staging/lustre/lustre/ldlm/ldlm_lock.c7
2 files changed, 3 insertions, 7 deletions
diff --git a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
index 976a07288428..4499b1be4406 100644
--- a/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
+++ b/drivers/staging/lustre/lnet/klnds/socklnd/socklnd_proto.c
@@ -60,8 +60,7 @@ ksocknal_next_tx_carrier(ksock_conn_t *conn)
/* no more packets queued */
conn->ksnc_tx_carrier = NULL;
} else {
- conn->ksnc_tx_carrier = list_entry(tx->tx_list.next,
- ksock_tx_t, tx_list);
+ conn->ksnc_tx_carrier = list_next_entry(tx, tx_list);
LASSERT(conn->ksnc_tx_carrier->tx_msg.ksm_type == tx->tx_msg.ksm_type);
}
}
diff --git a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
index 488523d02d21..ecd65a7a3dc9 100644
--- a/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
+++ b/drivers/staging/lustre/lustre/ldlm/ldlm_lock.c
@@ -890,8 +890,7 @@ static void search_granted_lock(struct list_head *queue,
list_for_each(tmp, queue) {
lock = list_entry(tmp, struct ldlm_lock, l_res_link);
- mode_end = list_entry(lock->l_sl_mode.prev,
- struct ldlm_lock, l_sl_mode);
+ mode_end = list_prev_entry(lock, l_sl_mode);
if (lock->l_req_mode != req->l_req_mode) {
/* jump to last lock of mode group */
@@ -911,9 +910,7 @@ static void search_granted_lock(struct list_head *queue,
if (lock->l_resource->lr_type == LDLM_IBITS) {
for (;;) {
policy_end =
- list_entry(lock->l_sl_policy.prev,
- struct ldlm_lock,
- l_sl_policy);
+ list_prev_entry(lock, l_sl_policy);
if (lock->l_policy_data.l_inodebits.bits ==
req->l_policy_data.l_inodebits.bits) {