Skip to contentSkip to conversation

proc: enclose desc variable of show_stat() in CONFIG_SPARSE_IRQ

PATCH In review KOSAKI Motohiro 3 participants 4 messages Dec 16, 2008 Proc filesystem

lore
Share & tools
lore
#0 lore raw

PATCH 1/1 proc: enclose desc variable of show_stat() in CONFIG_SPARSE_IRQ

Applied after: linux-next.patch
==
commit 240d367b4e6c6e3c5075e034db14dba60a6f5fa7 moved desc usage point into #ifdef CONFIG_SPARSE_IRQ.
Then, variable declaration also shold be enclosed. otherwise following warning happend.

fs/proc/stat.c: In function 'show_stat':
fs/proc/stat.c:31: warning: unused variable 'desc'

---
 fs/proc/stat.c |    2 ++
 1 file changed, 2 insertions(+)
fs/proc/stat.c +2 -0
Index: b/fs/proc/stat.c
===================================================================
@@ -28,7 +28,9 @@ static int show_stat(struct seq_file *p,
 	u64 sum_softirq = 0;
 	struct timespec boottime;
 	unsigned int per_irq_sum;
+#ifdef CONFIG_SPARSE_IRQ
 	struct irq_desc *desc;
+#endif
 
 	user = nice = system = idle = iowait =
 		irq = softirq = steal = cputime64_zero;
#1 lore raw
Quoted 23 lines · On Tue, 16 Dec 2008 17:00:30 +0900 (JST) KOSAKI Motohiro…

Applied after: linux-next.patch
==
commit 240d367b4e6c6e3c5075e034db14dba60a6f5fa7 moved desc usage point into #ifdef CONFIG_SPARSE_IRQ.
Then, variable declaration also shold be enclosed. otherwise following warning happend.

fs/proc/stat.c: In function 'show_stat':
fs/proc/stat.c:31: warning: unused variable 'desc'

---
 fs/proc/stat.c |    2 ++
 1 file changed, 2 insertions(+)

Index: b/fs/proc/stat.c
===================================================================

fs/proc/stat.c static int show_stat(struct seq_file *p, · line 36

Quoted 9 lines
fs/proc/stat.c +2 -0
@@ -28,7 +28,9 @@ static int show_stat(struct seq_file *p,
 	u64 sum_softirq = 0;
 	struct timespec boottime;
 	unsigned int per_irq_sum;
+#ifdef CONFIG_SPARSE_IRQ
 	struct irq_desc *desc;
+#endif
 
 	user = nice = system = idle = iowait =
 		irq = softirq = steal = cputime64_zero;

This would be better, no?

fs/proc/stat.c renamed from fs/proc/stat.c~proc-enclose-desc-variable-of-show_stat-in-config_sparse_irq +2 -5
@@ -28,7 +28,6 @@ static int show_stat(struct seq_file *p,
 	u64 sum_softirq = 0;
 	struct timespec boottime;
 	unsigned int per_irq_sum;
-	struct irq_desc *desc;
 
 	user = nice = system = idle = iowait =
 		irq = softirq = steal = cputime64_zero;
@@ -48,8 +47,7 @@ static int show_stat(struct seq_file *p,
 		guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
 		for_each_irq_nr(j) {
 #ifdef CONFIG_SPARSE_IRQ
-			desc = irq_to_desc(j);
-			if (!desc)
+			if (!irq_to_desc(j))
 				continue;
 #endif
 			sum += kstat_irqs_cpu(j, i);
@@ -103,8 +101,7 @@ static int show_stat(struct seq_file *p,
 	for_each_irq_nr(j) {
 		per_irq_sum = 0;
 #ifdef CONFIG_SPARSE_IRQ
-		desc = irq_to_desc(j);
-		if (!desc) {
+		if (!irq_to_desc(j)) {
 			seq_printf(p, " %u", per_irq_sum);
 			continue;
 		}

_

#2 lore raw
Quoted 1 line

This would be better, no?

Agreed. sorry sending silly patch.

Quoted 32 lines
fs/proc/stat.c renamed from fs/proc/stat.c~proc-enclose-desc-variable-of-show_stat-in-config_sparse_irq +2 -5
@@ -28,7 +28,6 @@ static int show_stat(struct seq_file *p,
 	u64 sum_softirq = 0;
 	struct timespec boottime;
 	unsigned int per_irq_sum;
-	struct irq_desc *desc;
 
 	user = nice = system = idle = iowait =
 		irq = softirq = steal = cputime64_zero;
@@ -48,8 +47,7 @@ static int show_stat(struct seq_file *p,
 		guest = cputime64_add(guest, kstat_cpu(i).cpustat.guest);
 		for_each_irq_nr(j) {
 #ifdef CONFIG_SPARSE_IRQ
-			desc = irq_to_desc(j);
-			if (!desc)
+			if (!irq_to_desc(j))
 				continue;
 #endif
 			sum += kstat_irqs_cpu(j, i);
@@ -103,8 +101,7 @@ static int show_stat(struct seq_file *p,
 	for_each_irq_nr(j) {
 		per_irq_sum = 0;
 #ifdef CONFIG_SPARSE_IRQ
-		desc = irq_to_desc(j);
-		if (!desc) {
+		if (!irq_to_desc(j)) {
 			seq_printf(p, " %u", per_irq_sum);
 			continue;
 		}

_

#3 lore raw
Quoted 3 lines · KOSAKI Motohiro
Quoted 1 line

This would be better, no?

Agreed. sorry sending silly patch.

it wasnt silly - i've applied Andrew's tweaked variant of your fix to tip/irq/sparseirq, thanks guys!

Ingo