public inbox for linux-kernel@vger.kernel.org
 help / color / mirror / Atom feed
* [PATCH] qib: qib_qp: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
@ 2014-08-26 14:33 Andreea-Cristina Bernat
  2014-09-19 12:53 ` Marciniszyn, Mike
  0 siblings, 1 reply; 2+ messages in thread
From: Andreea-Cristina Bernat @ 2014-08-26 14:33 UTC (permalink / raw)
  To: infinipath, roland, sean.hefty, hal.rosenstock, linux-rdma,
	linux-kernel
  Cc: paulmck

According to RCU_INIT_POINTER()'s block comment 3.a, it can be used if
"3.   The referenced data structure has already been exposed to readers either
at compile time or via rcu_assign_pointer() -and-
 a.   You have not made -any- reader-visible changes to this structure since
then".

This case fulfills the conditions above because between the
rcu_dereference_protected() call and the rcu_assign_pointer() call there is no
update of that value.
Therefore, this patch makes the replacement.

The following Coccinelle semantic patch was used:
@@
@@

- rcu_assign_pointer
+ RCU_INIT_POINTER
  (...,
(
 rtnl_dereference(...)
|
 rcu_dereference_protected(...)
) )

Signed-off-by: Andreea-Cristina Bernat <bernat.ada@gmail.com>
---
 drivers/infiniband/hw/qib/qib_qp.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/drivers/infiniband/hw/qib/qib_qp.c b/drivers/infiniband/hw/qib/qib_qp.c
index 17daf42..cb0c680 100644
--- a/drivers/infiniband/hw/qib/qib_qp.c
+++ b/drivers/infiniband/hw/qib/qib_qp.c
@@ -269,7 +269,7 @@ static void remove_qp(struct qib_ibdev *dev, struct qib_qp *qp)
 				lockdep_is_held(&dev->qpt_lock))) != NULL;
 				qpp = &q->next)
 			if (q == qp) {
-				rcu_assign_pointer(*qpp,
+				RCU_INIT_POINTER(*qpp,
 					rcu_dereference_protected(qp->next,
 					 lockdep_is_held(&dev->qpt_lock)));
 				removed = 1;
-- 
1.9.1


^ permalink raw reply related	[flat|nested] 2+ messages in thread

* RE: [PATCH] qib: qib_qp: Replace rcu_assign_pointer() with RCU_INIT_POINTER()
  2014-08-26 14:33 [PATCH] qib: qib_qp: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Andreea-Cristina Bernat
@ 2014-09-19 12:53 ` Marciniszyn, Mike
  0 siblings, 0 replies; 2+ messages in thread
From: Marciniszyn, Mike @ 2014-09-19 12:53 UTC (permalink / raw)
  To: Andreea-Cristina Bernat
  Cc: paulmck@linux.vnet.ibm.com, roland@kernel.org,
	hal.rosenstock@gmail.com, Hefty, Sean, linux-rdma@vger.kernel.org,
	linux-kernel@vger.kernel.org

> Subject: [PATCH] qib: qib_qp: Replace rcu_assign_pointer() with
> RCU_INIT_POINTER()
>

Why not consolidate this with http://marc.info/?l=linux-rdma&m=140836578119485&w=2 so there is just one patch?

Mike

^ permalink raw reply	[flat|nested] 2+ messages in thread

end of thread, other threads:[~2014-09-19 12:53 UTC | newest]

Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2014-08-26 14:33 [PATCH] qib: qib_qp: Replace rcu_assign_pointer() with RCU_INIT_POINTER() Andreea-Cristina Bernat
2014-09-19 12:53 ` Marciniszyn, Mike

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox