Skip to content

Commit 1ccb4e6

Browse files
committed
genirq: Wrap the remaning IRQ_* flags
Use wrappers to keep them away from the core code. Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
1 parent 876dbd4 commit 1ccb4e6

5 files changed

Lines changed: 70 additions & 12 deletions

File tree

‎kernel/irq/autoprobe.c‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ unsigned long probe_irq_on(void)
4545
*/
4646
for_each_irq_desc_reverse(i, desc) {
4747
raw_spin_lock_irq(&desc->lock);
48-
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
48+
if (!desc->action && irq_settings_can_probe(desc)) {
4949
/*
5050
* An old-style architecture might still have
5151
* the handle_bad_irq handler there:
@@ -74,7 +74,7 @@ unsigned long probe_irq_on(void)
7474
*/
7575
for_each_irq_desc_reverse(i, desc) {
7676
raw_spin_lock_irq(&desc->lock);
77-
if (!desc->action && !(desc->status & IRQ_NOPROBE)) {
77+
if (!desc->action && irq_settings_can_probe(desc)) {
7878
desc->istate |= IRQS_AUTODETECT | IRQS_WAITING;
7979
if (irq_startup(desc)) {
8080
irq_compat_set_pending(desc);

‎kernel/irq/chip.c‎

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -674,7 +674,8 @@ __set_irq_handler(unsigned int irq, irq_flow_handler_t handle, int is_chained,
674674
desc->name = name;
675675

676676
if (handle != handle_bad_irq && is_chained) {
677-
desc->status |= IRQ_NOREQUEST | IRQ_NOPROBE;
677+
irq_settings_set_noprobe(desc);
678+
irq_settings_set_norequest(desc);
678679
irq_startup(desc);
679680
}
680681
raw_spin_unlock_irqrestore(&desc->lock, flags);

‎kernel/irq/manage.c‎

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ void irq_set_thread_affinity(struct irq_desc *desc)
103103
#ifdef CONFIG_GENERIC_PENDING_IRQ
104104
static inline bool irq_can_move_pcntxt(struct irq_desc *desc)
105105
{
106-
return desc->status & IRQ_MOVE_PCNTXT;
106+
return irq_settings_can_move_pcntxt(desc);
107107
}
108108
static inline bool irq_move_pending(struct irq_desc *desc)
109109
{
@@ -411,7 +411,7 @@ void __enable_irq(struct irq_desc *desc, unsigned int irq, bool resume)
411411
if (desc->istate & IRQS_SUSPENDED)
412412
goto err_out;
413413
/* Prevent probing on this irq: */
414-
desc->status |= IRQ_NOPROBE;
414+
irq_settings_set_noprobe(desc);
415415
irq_enable(desc);
416416
check_irq_resend(desc, irq);
417417
/* fall-through */
@@ -526,7 +526,7 @@ int can_request_irq(unsigned int irq, unsigned long irqflags)
526526
if (!desc)
527527
return 0;
528528

529-
if (desc->status & IRQ_NOREQUEST)
529+
if (!irq_settings_can_request(desc))
530530
return 0;
531531

532532
raw_spin_lock_irqsave(&desc->lock, flags);
@@ -820,7 +820,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
820820
* Check whether the interrupt nests into another interrupt
821821
* thread.
822822
*/
823-
nested = desc->status & IRQ_NESTED_THREAD;
823+
nested = irq_settings_is_nested_thread(desc);
824824
if (nested) {
825825
if (!new->thread_fn)
826826
return -EINVAL;
@@ -917,7 +917,7 @@ __setup_irq(unsigned int irq, struct irq_desc *desc, struct irqaction *new)
917917
if (new->flags & IRQF_ONESHOT)
918918
desc->istate |= IRQS_ONESHOT;
919919

920-
if (!(desc->status & IRQ_NOAUTOEN))
920+
if (irq_settings_can_autoenable(desc))
921921
irq_startup(desc);
922922
else
923923
/* Undo nested disables: */
@@ -1217,7 +1217,7 @@ int request_threaded_irq(unsigned int irq, irq_handler_t handler,
12171217
if (!desc)
12181218
return -EINVAL;
12191219

1220-
if (desc->status & IRQ_NOREQUEST)
1220+
if (!irq_settings_can_request(desc))
12211221
return -EINVAL;
12221222

12231223
if (!handler) {
@@ -1292,7 +1292,7 @@ int request_any_context_irq(unsigned int irq, irq_handler_t handler,
12921292
if (!desc)
12931293
return -EINVAL;
12941294

1295-
if (desc->status & IRQ_NESTED_THREAD) {
1295+
if (irq_settings_is_nested_thread(desc)) {
12961296
ret = request_threaded_irq(irq, NULL, handler,
12971297
flags, name, dev_id);
12981298
return !ret ? IRQC_IS_NESTED : ret;

‎kernel/irq/settings.h‎

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,12 @@ enum {
66
_IRQ_DEFAULT_INIT_FLAGS = IRQ_DEFAULT_INIT_FLAGS,
77
_IRQ_PER_CPU = IRQ_PER_CPU,
88
_IRQ_LEVEL = IRQ_LEVEL,
9+
_IRQ_NOPROBE = IRQ_NOPROBE,
10+
_IRQ_NOREQUEST = IRQ_NOREQUEST,
11+
_IRQ_NOAUTOEN = IRQ_NOAUTOEN,
12+
_IRQ_MOVE_PCNTXT = IRQ_MOVE_PCNTXT,
913
_IRQ_NO_BALANCING = IRQ_NO_BALANCING,
14+
_IRQ_NESTED_THREAD = IRQ_NESTED_THREAD,
1015
_IRQF_MODIFY_MASK = IRQF_MODIFY_MASK,
1116
};
1217

@@ -34,6 +39,14 @@ enum {
3439
#define IRQ_AFFINITY_SET GOT_YOU_MORON
3540
#undef IRQ_LEVEL
3641
#define IRQ_LEVEL GOT_YOU_MORON
42+
#undef IRQ_NOPROBE
43+
#define IRQ_NOPROBE GOT_YOU_MORON
44+
#undef IRQ_NOREQUEST
45+
#define IRQ_NOREQUEST GOT_YOU_MORON
46+
#undef IRQ_NOAUTOEN
47+
#define IRQ_NOAUTOEN GOT_YOU_MORON
48+
#undef IRQ_NESTED_THREAD
49+
#define IRQ_NESTED_THREAD GOT_YOU_MORON
3750
#undef IRQF_MODIFY_MASK
3851
#define IRQF_MODIFY_MASK GOT_YOU_MORON
3952

@@ -90,3 +103,48 @@ static inline void irq_settings_set_level(struct irq_desc *desc)
90103
{
91104
desc->status |= _IRQ_LEVEL;
92105
}
106+
107+
static inline bool irq_settings_can_request(struct irq_desc *desc)
108+
{
109+
return !(desc->status & _IRQ_NOREQUEST);
110+
}
111+
112+
static inline void irq_settings_clr_norequest(struct irq_desc *desc)
113+
{
114+
desc->status &= ~_IRQ_NOREQUEST;
115+
}
116+
117+
static inline void irq_settings_set_norequest(struct irq_desc *desc)
118+
{
119+
desc->status |= _IRQ_NOREQUEST;
120+
}
121+
122+
static inline bool irq_settings_can_probe(struct irq_desc *desc)
123+
{
124+
return !(desc->status & _IRQ_NOPROBE);
125+
}
126+
127+
static inline void irq_settings_clr_noprobe(struct irq_desc *desc)
128+
{
129+
desc->status &= ~_IRQ_NOPROBE;
130+
}
131+
132+
static inline void irq_settings_set_noprobe(struct irq_desc *desc)
133+
{
134+
desc->status |= _IRQ_NOPROBE;
135+
}
136+
137+
static inline bool irq_settings_can_move_pcntxt(struct irq_desc *desc)
138+
{
139+
return desc->status & _IRQ_MOVE_PCNTXT;
140+
}
141+
142+
static inline bool irq_settings_can_autoenable(struct irq_desc *desc)
143+
{
144+
return !(desc->status & _IRQ_NOAUTOEN);
145+
}
146+
147+
static inline bool irq_settings_is_nested_thread(struct irq_desc *desc)
148+
{
149+
return desc->status & _IRQ_NESTED_THREAD;
150+
}

‎kernel/irq/spurious.c‎

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,8 +68,7 @@ static int try_one_irq(int irq, struct irq_desc *desc, bool force)
6868
raw_spin_lock(&desc->lock);
6969

7070
/* PER_CPU and nested thread interrupts are never polled */
71-
if (irq_settings_is_per_cpu(desc) ||
72-
(desc->status & IRQ_NESTED_THREAD))
71+
if (irq_settings_is_per_cpu(desc) || irq_settings_is_nested_thread(desc))
7372
goto out;
7473

7574
/*

0 commit comments

Comments
 (0)