Skip to contentSkip to conversation

s390/cio: use DEFINE_SPINLOCK() for spinlock

PATCH In review Shixin Liu 2 participants 4 messages Mar 29, 2021

Subsystems (2)
lore
Share & tools
lore

Shixin Liu

author
#0 lore raw

PATCH 1/2 s390/cio: use DEFINE_SPINLOCK() for spinlock

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

---
 drivers/s390/cio/css.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/cio/css.c +1 -2
index 253ab4e7a415..f01ef6325039 100644
@@ -651,13 +651,12 @@ static void css_sch_todo(struct work_struct *work)
 }
 
 static struct idset *slow_subchannel_set;
-static spinlock_t slow_subchannel_lock;
+static DEFINE_SPINLOCK(slow_subchannel_lock);
 static wait_queue_head_t css_eval_wq;
 static atomic_t css_eval_scheduled;
 
 static int __init slow_subchannel_init(void)
 {
-	spin_lock_init(&slow_subchannel_lock);
 	atomic_set(&css_eval_scheduled, 0);
 	init_waitqueue_head(&css_eval_wq);
 	slow_subchannel_set = idset_sch_new();
Signature · 1 line
2.25.1
author
#1 lore raw

PATCH 2/2 s390/cio: use DECLARE_WAIT_QUEUE_HEAD() for wait_queue

wait_queue_head_t can be initialized automatically with DECLARE_WAIT_QUEUE_HEAD() rather than explicitly calling init_waitqueue_head().

---
 drivers/s390/cio/css.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/cio/css.c +1 -2
index f01ef6325039..a974943c27da 100644
@@ -652,13 +652,12 @@ static void css_sch_todo(struct work_struct *work)
 
 static struct idset *slow_subchannel_set;
 static DEFINE_SPINLOCK(slow_subchannel_lock);
-static wait_queue_head_t css_eval_wq;
+static DECLARE_WAIT_QUEUE_HEAD(css_eval_wq);
 static atomic_t css_eval_scheduled;
 
 static int __init slow_subchannel_init(void)
 {
 	atomic_set(&css_eval_scheduled, 0);
-	init_waitqueue_head(&css_eval_wq);
 	slow_subchannel_set = idset_sch_new();
 	if (!slow_subchannel_set) {
 		CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
Signature · 1 line
2.25.1
maintainer Acked-by on v1 2/2
#2 lore raw

Re: [PATCH -next 2/2] s390/cio: use DECLARE_WAIT_QUEUE_HEAD() for wait_queue

For both the patches,

I will correct the description, and Heiko/Vasily will pick this up and will be part of the s390-tree patchset.

Quoted 2 lines · Shixin Liu

wait_queue_head_t can be initialized automatically with DECLARE_WAIT_QUEUE_HEAD() rather than explicitly calling init_waitqueue_head().

A minor checkpatch WARNING. I will modify this.

Quoted 25 lines
---
  drivers/s390/cio/css.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/cio/css.c +1 -2
index f01ef6325039..a974943c27da 100644
@@ -652,13 +652,12 @@ static void css_sch_todo(struct work_struct *work)
 
  static struct idset *slow_subchannel_set;
  static DEFINE_SPINLOCK(slow_subchannel_lock);
-static wait_queue_head_t css_eval_wq;
+static DECLARE_WAIT_QUEUE_HEAD(css_eval_wq);
  static atomic_t css_eval_scheduled;
 
  static int __init slow_subchannel_init(void)
  {
  	atomic_set(&css_eval_scheduled, 0);
-	init_waitqueue_head(&css_eval_wq);
  	slow_subchannel_set = idset_sch_new();
  	if (!slow_subchannel_set) {
  		CIO_MSG_EVENT(0, "could not allocate slow subchannel set\n");
maintainer Acked-by on v1 1/2
#3 lore raw
In reply to Shixin Liu

Thank you.

Quoted 2 lines · Shixin Liu

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

static spinlock

Quoted 25 lines
---
  drivers/s390/cio/css.c | 3 +--
  1 file changed, 1 insertion(+), 2 deletions(-)
drivers/s390/cio/css.c +1 -2
index 253ab4e7a415..f01ef6325039 100644
@@ -651,13 +651,12 @@ static void css_sch_todo(struct work_struct *work)
  }
 
  static struct idset *slow_subchannel_set;
-static spinlock_t slow_subchannel_lock;
+static DEFINE_SPINLOCK(slow_subchannel_lock);
  static wait_queue_head_t css_eval_wq;
  static atomic_t css_eval_scheduled;
 
  static int __init slow_subchannel_init(void)
  {
-	spin_lock_init(&slow_subchannel_lock);
  	atomic_set(&css_eval_scheduled, 0);
  	init_waitqueue_head(&css_eval_wq);
  	slow_subchannel_set = idset_sch_new();