Skip to contentSkip to conversation

rcu: fix sparse warning about rcu_batches_completed_preempt() being non-static

PATCH New Pranith Kumar 2 participants 11 messages Jul 8, 2014 1 message not in the archive

Subsystems (2)
lore
Share & tools
lore

A message that is not in the archive (sent off-list or not yet received): [email protected]

#1 lore raw

PATCH 1/9 rcu: fix sparse warning about rcu_batches_completed_preempt() being non-static

fix sparse warning about rcu_batches_completed_preempt() being non-static by marking it as static

---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 637a8a9..1a4ab26 100644
@@ -134,7 +134,7 @@ static void __init rcu_bootup_announce(void)
  * Return the number of RCU-preempt batches processed thus far
  * for debug and statistics.
  */
-long rcu_batches_completed_preempt(void)
+static long rcu_batches_completed_preempt(void)
 {
 	return rcu_preempt_state.completed;
 }
Signature · 1 line
1.9.1
#2 lore raw

PATCH 2/9 rcu: use bool type for return value in rcu_is_watching()

In reply to a message not in the archive

use a bool type for return in rcu_is_watching()

---
 kernel/rcu/tree.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree.c +1 -1
index dac6d20..dff3d5b 100644
@@ -819,7 +819,7 @@ bool notrace __rcu_is_watching(void)
  */
 bool notrace rcu_is_watching(void)
 {
-	int ret;
+	bool ret;
 
 	preempt_disable();
 	ret = __rcu_is_watching();
Signature · 1 line
1.9.1
#3 lore raw

PATCH 3/9 rcu: Fix a sparse warning about boost_mutex being non-static

In reply to a message not in the archive

fix a sparse warning about boost_mutex being non-static by marking it as static

---
 kernel/rcu/rcutorture.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/rcutorture.c +1 -1
index 7fa34f8..5ec0452 100644
@@ -182,7 +182,7 @@ static u64 notrace rcu_trace_clock_local(void)
 #endif /* #else #ifdef CONFIG_RCU_TRACE */
 
 static unsigned long boost_starttime;	/* jiffies of next boost test start. */
-DEFINE_MUTEX(boost_mutex);		/* protect setting boost_starttime */
+static DEFINE_MUTEX(boost_mutex);	/* protect setting boost_starttime */
 					/*  and boost task create/destroy. */
 static atomic_t barrier_cbs_count;	/* Barrier callbacks registered. */
 static bool barrier_phase;		/* Test phase. */
Signature · 1 line
1.9.1
#4 lore raw

PATCH 4/9 rcu: return bool type for rcu_try_advance_all_cbs()

In reply to a message not in the archive

return a bool type instead of 0 in rcu_try_advance_all_cbs()

---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 1a4ab26..6c1feee 100644
@@ -1625,7 +1625,7 @@ static bool __maybe_unused rcu_try_advance_all_cbs(void)
 
 	/* Exit early if we advanced recently. */
 	if (jiffies == rdtp->last_advance_all)
-		return 0;
+		return false;
 	rdtp->last_advance_all = jiffies;
 
 	for_each_rcu_flavor(rsp) {
Signature · 1 line
1.9.1
#5 lore raw

PATCH 5/9 rcu: use true/false for return in __call_rcu_nocb()

In reply to a message not in the archive

return true/false instead of 0/1 in __call_rcu_nocb() as this returns a bool type

---
 kernel/rcu/tree_plugin.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/tree_plugin.h +2 -2
index 6c1feee..9f119f4 100644
@@ -2132,7 +2132,7 @@ static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp,
 {
 
 	if (!rcu_is_nocb_cpu(rdp->cpu))
-		return 0;
+		return false;
 	__call_rcu_nocb_enqueue(rdp, rhp, &rhp->next, 1, lazy, flags);
 	if (__is_kfree_rcu_offset((unsigned long)rhp->func))
 		trace_rcu_kfree_callback(rdp->rsp->name, rhp,
@@ -2143,7 +2143,7 @@ static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp,
 		trace_rcu_callback(rdp->rsp->name, rhp,
 				   -atomic_long_read(&rdp->nocb_q_count_lazy),
 				   -atomic_long_read(&rdp->nocb_q_count));
-	return 1;
+	return true;
 }
 
 /*
Signature · 1 line
1.9.1
#6 lore raw

PATCH 6/9 rcu: use true/false for return in rcu_nocb_adopt_orphan_cbs()

In reply to a message not in the archive

return true/false in rcu_nocb_adopt_orphan_cbs() instead of 0/1 as this function has return type of bool

---
 kernel/rcu/tree_plugin.h | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
kernel/rcu/tree_plugin.h +2 -2
index 9f119f4..86a3565 100644
@@ -2159,7 +2159,7 @@ static bool __maybe_unused rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,
 
 	/* If this is not a no-CBs CPU, tell the caller to do it the old way. */
 	if (!rcu_is_nocb_cpu(smp_processor_id()))
-		return 0;
+		return false;
 	rsp->qlen = 0;
 	rsp->qlen_lazy = 0;
 
@@ -2178,7 +2178,7 @@ static bool __maybe_unused rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,
 		rsp->orphan_nxtlist = NULL;
 		rsp->orphan_nxttail = &rsp->orphan_nxtlist;
 	}
-	return 1;
+	return true;
 }
 
 /*
Signature · 1 line
1.9.1
#7 lore raw

PATCH 7/9 rcu: use false for return in __call_rcu_nocb()

In reply to a message not in the archive

return false instead of 0 in __call_rcu_nocb() as this has bool as return type

---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 86a3565..5c21f4b 100644
@@ -2382,7 +2382,7 @@ static void rcu_init_one_nocb(struct rcu_node *rnp)
 static bool __call_rcu_nocb(struct rcu_data *rdp, struct rcu_head *rhp,
 			    bool lazy, unsigned long flags)
 {
-	return 0;
+	return false;
 }
 
 static bool __maybe_unused rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,
Signature · 1 line
1.9.1
#8 lore raw

PATCH 8/9 rcu: return false instead of 0 in rcu_nocb_adopt_orphan_cbs()

In reply to a message not in the archive

return false instead of 0 in rcu_nocb_adopt_orphan_cbs() as this has bool as return type

---
 kernel/rcu/tree_plugin.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
kernel/rcu/tree_plugin.h +1 -1
index 5c21f4b..9a4dc07 100644
@@ -2389,7 +2389,7 @@ static bool __maybe_unused rcu_nocb_adopt_orphan_cbs(struct rcu_state *rsp,
 						     struct rcu_data *rdp,
 						     unsigned long flags)
 {
-	return 0;
+	return false;
 }
 
 static void __init rcu_boot_init_nocb_percpu_data(struct rcu_data *rdp)
Signature · 1 line
1.9.1
#9 lore raw

PATCH 9/9 rcu: return bool type in rcu_lockdep_current_cpu_online()

In reply to a message not in the archive

return true instead of 1 in rcu_lockdep_current_cpu_online() as this has bool as return type

---
 include/linux/rcupdate.h | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
include/linux/rcupdate.h +1 -1
index e8c55d8..2ed25c6 100644
@@ -349,7 +349,7 @@ bool rcu_lockdep_current_cpu_online(void);
 #else /* #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
 static inline bool rcu_lockdep_current_cpu_online(void)
 {
-	return 1;
+	return true;
 }
 #endif /* #else #if defined(CONFIG_HOTPLUG_CPU) && defined(CONFIG_PROVE_RCU) */
 
Signature · 1 line
1.9.1
#10 lore raw

Re: [PATCH 0/9] rcu: trivial sparse and return type fixes for rcu

In reply to a message not in the archive

This patch series contains trivial fixes for sparse warnings and using bool types where appropriate instead of 0/1.

I can probably merge the return type changes into one commit if you think that is appropriate.

Pranith Kumar (9):
rcu: fix sparse warning about rcu_batches_completed_preempt(
) being
non-static
rcu: use bool type for return value in rcu_is_watching()
rcu: Fix a sparse warning about boost_mutex being non-static
rcu: return bool type in rcu_lockdep_current_cpu_online()
rcu: return bool type for rcu_try_advance_all_cbs()
rcu: use true/false for return in __call_rcu_nocb()
rcu: use true/false for return in rcu_nocb_adopt_orphan_cbs()
rcu: use false for return in __call_rcu_nocb()
rcu: use bool return type in rcu_nocb_adopt_orphan_cbs()

 include/linux/rcupdate.h |  2 +-
 kernel/rcu/rcutorture.c  |  2 +-
 kernel/rcu/tree.c        |  2 +-
 kernel/rcu/tree_plugin.h | 16 ++++++++--------
 4 files changed, 11 insertions(+), 11 deletions(-)
#11 lore raw

Re: [PATCH 0/9] rcu: trivial sparse and return type fixes for rcu

Quoted 5 lines · Pranith Kumar

This patch series contains trivial fixes for sparse warnings and using bool types where appropriate instead of 0/1.

I can probably merge the return type changes into one commit if you think that is appropriate.

Queued for 3.18, with the exception of 3/9, which I fixed up and queued the earlier version. I guess I should have waited a few minutes longer. ;-)

Thanx, Paul

Quoted 19 lines

Pranith Kumar (9):
rcu: fix sparse warning about rcu_batches_completed_preempt(
) being
non-static
rcu: use bool type for return value in rcu_is_watching()
rcu: Fix a sparse warning about boost_mutex being non-static
rcu: return bool type in rcu_lockdep_current_cpu_online()
rcu: return bool type for rcu_try_advance_all_cbs()
rcu: use true/false for return in __call_rcu_nocb()
rcu: use true/false for return in rcu_nocb_adopt_orphan_cbs()
rcu: use false for return in __call_rcu_nocb()
rcu: use bool return type in rcu_nocb_adopt_orphan_cbs()

 include/linux/rcupdate.h |  2 +-
 kernel/rcu/rcutorture.c  |  2 +-
 kernel/rcu/tree.c        |  2 +-
 kernel/rcu/tree_plugin.h | 16 ++++++++--------
 4 files changed, 11 insertions(+), 11 deletions(-)