Skip to contentSkip to conversation

sched: Replace 'unsigned' with 'unsigned int'

PATCH NAK Fabio M. De Francesco 2 participants 2 messages Apr 29, 2021 Scheduler

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 sched: Replace 'unsigned' with 'unsigned int'

Replaced 'unsigned' with 'unsigned int' because the second is preferred. Detected by checkpatch.pl.

---
 kernel/sched/core.c     |  4 ++--
 kernel/sched/fair.c     |  6 +++---
 kernel/sched/sched.h    |  6 +++---
 kernel/sched/wait.c     |  8 ++++----
 kernel/sched/wait_bit.c | 12 ++++++------
 5 files changed, 18 insertions(+), 18 deletions(-)
kernel/sched/core.c +2 -2
index 1a9983da4408..383e47a2f0df 100644
@@ -4342,7 +4342,7 @@ asmlinkage __visible void __sched preempt_schedule_irq(void)
 	exception_exit(prev_state);
 }
 
-int default_wake_function(wait_queue_entry_t *curr, unsigned mode, int wake_flags,
+int default_wake_function(wait_queue_entry_t *curr, unsigned int mode, int wake_flags,
 			  void *key)
 {
 	return try_to_wake_up(curr->private, mode, wake_flags);
@@ -5479,7 +5479,7 @@ long sched_setaffinity(pid_t pid, const struct cpumask *in_mask)
 	return retval;
 }
 
-static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned len,
+static int get_user_cpu_mask(unsigned long __user *user_mask_ptr, unsigned int len,
 			     struct cpumask *new_mask)
 {
 	if (len < cpumask_size())
kernel/sched/fair.c +3 -3
index c1217bfe5e81..203e2ff5b935 100644
@@ -5945,15 +5945,15 @@ static int select_idle_sibling(struct task_struct *p, int prev, int target)
 		return target;
 
 	i = select_idle_core(p, sd, target);
-	if ((unsigned)i < nr_cpumask_bits)
+	if ((unsigned int)i < nr_cpumask_bits)
 		return i;
 
 	i = select_idle_cpu(p, sd, target);
-	if ((unsigned)i < nr_cpumask_bits)
+	if ((unsigned int)i < nr_cpumask_bits)
 		return i;
 
 	i = select_idle_smt(p, target);
-	if ((unsigned)i < nr_cpumask_bits)
+	if ((unsigned int)i < nr_cpumask_bits)
 		return i;
 
 	return target;
kernel/sched/sched.h +3 -3
index 9ea647835fd6..395e109bbadb 100644
@@ -1910,9 +1910,9 @@ static inline int sched_tick_offload_init(void) { return 0; }
 static inline void sched_update_tick_dependency(struct rq *rq) { }
 #endif
 
-static inline void add_nr_running(struct rq *rq, unsigned count)
+static inline void add_nr_running(struct rq *rq, unsigned int count)
 {
-	unsigned prev_nr = rq->nr_running;
+	unsigned int prev_nr = rq->nr_running;
 
 	rq->nr_running = prev_nr + count;
 
@@ -1926,7 +1926,7 @@ static inline void add_nr_running(struct rq *rq, unsigned count)
 	sched_update_tick_dependency(rq);
 }
 
-static inline void sub_nr_running(struct rq *rq, unsigned count)
+static inline void sub_nr_running(struct rq *rq, unsigned int count)
 {
 	rq->nr_running -= count;
 	/* Check if we still need preemption */
kernel/sched/wait.c +4 -4
index ba059fbfc53a..b44b9a519d60 100644
@@ -84,7 +84,7 @@ static int __wake_up_common(struct wait_queue_head *wq_head, unsigned int mode,
 		return nr_exclusive;
 
 	list_for_each_entry_safe_from(curr, next, &wq_head->head, entry) {
-		unsigned flags = curr->flags;
+		unsigned int flags = curr->flags;
 		int ret;
 
 		if (flags & WQ_FLAG_BOOKMARK)
@@ -384,7 +384,7 @@ void finish_wait(struct wait_queue_head *wq_head, struct wait_queue_entry *wq_en
 }
 EXPORT_SYMBOL(finish_wait);
 
-int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key)
+int autoremove_wake_function(struct wait_queue_entry *wq_entry, unsigned int mode, int sync, void *key)
 {
 	int ret = default_wake_function(wq_entry, mode, sync, key);
 
@@ -420,7 +420,7 @@ static inline bool is_kthread_should_stop(void)
  * }						smp_mb(); // C
  * remove_wait_queue(&wq_head, &wait);		wq_entry->flags |= WQ_FLAG_WOKEN;
  */
-long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout)
+long wait_woken(struct wait_queue_entry *wq_entry, unsigned int mode, long timeout)
 {
 	/*
 	 * The below executes an smp_mb(), which matches with the full barrier
@@ -445,7 +445,7 @@ long wait_woken(struct wait_queue_entry *wq_entry, unsigned mode, long timeout)
 }
 EXPORT_SYMBOL(wait_woken);
 
-int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *key)
+int woken_wake_function(struct wait_queue_entry *wq_entry, unsigned int mode, int sync, void *key)
 {
 	/* Pairs with the smp_store_mb() in wait_woken(). */
 	smp_mb(); /* C */
kernel/sched/wait_bit.c +6 -6
index 02ce292b9bc0..80c5d07ac77d 100644
@@ -18,7 +18,7 @@ wait_queue_head_t *bit_waitqueue(void *word, int bit)
 }
 EXPORT_SYMBOL(bit_waitqueue);
 
-int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned mode, int sync, void *arg)
+int wake_bit_function(struct wait_queue_entry *wq_entry, unsigned int mode, int sync, void *arg)
 {
 	struct wait_bit_key *key = arg;
 	struct wait_bit_queue_entry *wait_bit = container_of(wq_entry, struct wait_bit_queue_entry, wq_entry);
@@ -39,7 +39,7 @@ EXPORT_SYMBOL(wake_bit_function);
  */
 int __sched
 __wait_on_bit(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry,
-	      wait_bit_action_f *action, unsigned mode)
+	      wait_bit_action_f *action, unsigned int mode)
 {
 	int ret = 0;
 
@@ -56,7 +56,7 @@ __wait_on_bit(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_
 EXPORT_SYMBOL(__wait_on_bit);
 
 int __sched out_of_line_wait_on_bit(void *word, int bit,
-				    wait_bit_action_f *action, unsigned mode)
+				    wait_bit_action_f *action, unsigned int mode)
 {
 	struct wait_queue_head *wq_head = bit_waitqueue(word, bit);
 	DEFINE_WAIT_BIT(wq_entry, word, bit);
@@ -67,7 +67,7 @@ EXPORT_SYMBOL(out_of_line_wait_on_bit);
 
 int __sched out_of_line_wait_on_bit_timeout(
 	void *word, int bit, wait_bit_action_f *action,
-	unsigned mode, unsigned long timeout)
+	unsigned int mode, unsigned long timeout)
 {
 	struct wait_queue_head *wq_head = bit_waitqueue(word, bit);
 	DEFINE_WAIT_BIT(wq_entry, word, bit);
@@ -80,7 +80,7 @@ EXPORT_SYMBOL_GPL(out_of_line_wait_on_bit_timeout);
 
 int __sched
 __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue_entry *wbq_entry,
-			wait_bit_action_f *action, unsigned mode)
+			wait_bit_action_f *action, unsigned int mode)
 {
 	int ret = 0;
 
@@ -109,7 +109,7 @@ __wait_on_bit_lock(struct wait_queue_head *wq_head, struct wait_bit_queue_entry
 EXPORT_SYMBOL(__wait_on_bit_lock);
 
 int __sched out_of_line_wait_on_bit_lock(void *word, int bit,
-					 wait_bit_action_f *action, unsigned mode)
+					 wait_bit_action_f *action, unsigned int mode)
 {
 	struct wait_queue_head *wq_head = bit_waitqueue(word, bit);
 	DEFINE_WAIT_BIT(wq_entry, word, bit);
Signature · 1 line
2.31.1
reviewer NAK
#1 lore raw
Quoted 2 lines · On Thu, 29 Apr 2021 14:24:54 +0200 "Fabio M. De Francesco"…

Replaced 'unsigned' with 'unsigned int' because the second is preferred. Detected by checkpatch.pl.

Please do not fix existing code because of "preferred" coding style from checkpatch.pl. It causes unnecessary churn, and a waste of time applying it.

"unsigned" is just as good as "unsigned int" , and honestly, that's what I prefer.

NACK.

-- Steve