Skip to content

Commit ce85b4f

Browse files
JoePerchestorvalds
authored andcommitted
softirq: use const char * const for softirq_to_name, whitespace neatening
Reduce data size a little. Reduce checkpatch noise. $ size kernel/softirq.o* text data bss dec hex filename 11554 6013 4008 21575 5447 kernel/softirq.o.new 11474 6093 4008 21575 5447 kernel/softirq.o.old Signed-off-by: Joe Perches <joe@perches.com> Cc: Frederic Weisbecker <fweisbec@gmail.com> Cc: Ingo Molnar <mingo@elte.hu> Cc: Thomas Gleixner <tglx@linutronix.de> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
1 parent 4032276 commit ce85b4f

2 files changed

Lines changed: 10 additions & 17 deletions

File tree

‎include/linux/interrupt.h‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -360,7 +360,7 @@ enum
360360
/* map softirq index to softirq name. update 'softirq_to_name' in
361361
* kernel/softirq.c when adding a new softirq.
362362
*/
363-
extern char *softirq_to_name[NR_SOFTIRQS];
363+
extern const char * const softirq_to_name[NR_SOFTIRQS];
364364

365365
/* softirq mask and active fields moved to irq_cpustat_t in
366366
* asm/hardirq.h to get better cache usage. KAO

‎kernel/softirq.c‎

Lines changed: 9 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ static struct softirq_action softirq_vec[NR_SOFTIRQS] __cacheline_aligned_in_smp
5656

5757
DEFINE_PER_CPU(struct task_struct *, ksoftirqd);
5858

59-
char *softirq_to_name[NR_SOFTIRQS] = {
59+
const char * const softirq_to_name[NR_SOFTIRQS] = {
6060
"HI", "TIMER", "NET_TX", "NET_RX", "BLOCK", "BLOCK_IOPOLL",
6161
"TASKLET", "SCHED", "HRTIMER", "RCU"
6262
};
@@ -138,7 +138,6 @@ void _local_bh_enable(void)
138138
WARN_ON_ONCE(in_irq());
139139
__local_bh_enable(SOFTIRQ_DISABLE_OFFSET);
140140
}
141-
142141
EXPORT_SYMBOL(_local_bh_enable);
143142

144143
void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
@@ -155,7 +154,7 @@ void __local_bh_enable_ip(unsigned long ip, unsigned int cnt)
155154
/*
156155
* Keep preemption disabled until we are done with
157156
* softirq processing:
158-
*/
157+
*/
159158
preempt_count_sub(cnt - 1);
160159

161160
if (unlikely(!in_interrupt() && local_softirq_pending())) {
@@ -436,8 +435,7 @@ void open_softirq(int nr, void (*action)(struct softirq_action *))
436435
/*
437436
* Tasklets
438437
*/
439-
struct tasklet_head
440-
{
438+
struct tasklet_head {
441439
struct tasklet_struct *head;
442440
struct tasklet_struct **tail;
443441
};
@@ -456,7 +454,6 @@ void __tasklet_schedule(struct tasklet_struct *t)
456454
raise_softirq_irqoff(TASKLET_SOFTIRQ);
457455
local_irq_restore(flags);
458456
}
459-
460457
EXPORT_SYMBOL(__tasklet_schedule);
461458

462459
void __tasklet_hi_schedule(struct tasklet_struct *t)
@@ -470,7 +467,6 @@ void __tasklet_hi_schedule(struct tasklet_struct *t)
470467
raise_softirq_irqoff(HI_SOFTIRQ);
471468
local_irq_restore(flags);
472469
}
473-
474470
EXPORT_SYMBOL(__tasklet_hi_schedule);
475471

476472
void __tasklet_hi_schedule_first(struct tasklet_struct *t)
@@ -481,7 +477,6 @@ void __tasklet_hi_schedule_first(struct tasklet_struct *t)
481477
__this_cpu_write(tasklet_hi_vec.head, t);
482478
__raise_softirq_irqoff(HI_SOFTIRQ);
483479
}
484-
485480
EXPORT_SYMBOL(__tasklet_hi_schedule_first);
486481

487482
static void tasklet_action(struct softirq_action *a)
@@ -501,7 +496,8 @@ static void tasklet_action(struct softirq_action *a)
501496

502497
if (tasklet_trylock(t)) {
503498
if (!atomic_read(&t->count)) {
504-
if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
499+
if (!test_and_clear_bit(TASKLET_STATE_SCHED,
500+
&t->state))
505501
BUG();
506502
t->func(t->data);
507503
tasklet_unlock(t);
@@ -536,7 +532,8 @@ static void tasklet_hi_action(struct softirq_action *a)
536532

537533
if (tasklet_trylock(t)) {
538534
if (!atomic_read(&t->count)) {
539-
if (!test_and_clear_bit(TASKLET_STATE_SCHED, &t->state))
535+
if (!test_and_clear_bit(TASKLET_STATE_SCHED,
536+
&t->state))
540537
BUG();
541538
t->func(t->data);
542539
tasklet_unlock(t);
@@ -554,7 +551,6 @@ static void tasklet_hi_action(struct softirq_action *a)
554551
}
555552
}
556553

557-
558554
void tasklet_init(struct tasklet_struct *t,
559555
void (*func)(unsigned long), unsigned long data)
560556
{
@@ -564,7 +560,6 @@ void tasklet_init(struct tasklet_struct *t,
564560
t->func = func;
565561
t->data = data;
566562
}
567-
568563
EXPORT_SYMBOL(tasklet_init);
569564

570565
void tasklet_kill(struct tasklet_struct *t)
@@ -580,7 +575,6 @@ void tasklet_kill(struct tasklet_struct *t)
580575
tasklet_unlock_wait(t);
581576
clear_bit(TASKLET_STATE_SCHED, &t->state);
582577
}
583-
584578
EXPORT_SYMBOL(tasklet_kill);
585579

586580
/*
@@ -730,9 +724,8 @@ static void takeover_tasklets(unsigned int cpu)
730724
}
731725
#endif /* CONFIG_HOTPLUG_CPU */
732726

733-
static int cpu_callback(struct notifier_block *nfb,
734-
unsigned long action,
735-
void *hcpu)
727+
static int cpu_callback(struct notifier_block *nfb, unsigned long action,
728+
void *hcpu)
736729
{
737730
switch (action) {
738731
#ifdef CONFIG_HOTPLUG_CPU

0 commit comments

Comments
 (0)