[PATCH -next] qed: Use DEFINE_SPINLOCK() for spinlock

Subsystems: networking drivers, qlogic ql4xxx ethernet driver, the rest

STALE3688d

2 messages, 2 authors, 2016-08-02 · open the first message on its own page

[PATCH -next] qed: Use DEFINE_SPINLOCK() for spinlock

From: Wei Yongjun <hidden>
Date: 2016-08-02 13:49:57

spinlock can be initialized automatically with DEFINE_SPINLOCK()
rather than explicitly calling spin_lock_init().

Signed-off-by: Wei Yongjun <redacted>
---
 drivers/net/ethernet/qlogic/qed/qed_dev.c | 8 +-------
 1 file changed, 1 insertion(+), 7 deletions(-)
diff --git a/drivers/net/ethernet/qlogic/qed/qed_dev.c b/drivers/net/ethernet/qlogic/qed/qed_dev.c
index 0b47ab5..cc623d2 100644
--- a/drivers/net/ethernet/qlogic/qed/qed_dev.c
+++ b/drivers/net/ethernet/qlogic/qed/qed_dev.c
@@ -35,8 +35,7 @@
 #include "qed_sriov.h"
 #include "qed_vf.h"
 
-static spinlock_t qm_lock;
-static bool qm_lock_init = false;
+static DEFINE_SPINLOCK(qm_lock);
 
 /* API common to all protocols */
 enum BAR_ID {
@@ -1003,11 +1002,6 @@ int qed_hw_init(struct qed_dev *cdev,
 		p_hwfn->first_on_engine = (load_code ==
 					   FW_MSG_CODE_DRV_LOAD_ENGINE);
 
-		if (!qm_lock_init) {
-			spin_lock_init(&qm_lock);
-			qm_lock_init = true;
-		}
-
 		switch (load_code) {
 		case FW_MSG_CODE_DRV_LOAD_ENGINE:
 			rc = qed_hw_init_common(p_hwfn, p_hwfn->p_main_ptt,

RE: [PATCH -next] qed: Use DEFINE_SPINLOCK() for spinlock

From: Yuval Mintz <hidden>
Date: 2016-08-02 14:38:52

spinlock can be initialized automatically with DEFINE_SPINLOCK() rather than
explicitly calling spin_lock_init().

Signed-off-by: Wei Yongjun <redacted>
Seems reasonable, although afaik net-next is still closed.
Thanks.

Acked-by: Yuval Mintz <redacted>
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help