Skip to content

Commit bd15141

Browse files
committed
genirq: Provide config option to disable deprecated code
This option covers now the old chip functions and the irq_desc data fields which are moving to struct irq_data. More stuff will follow. Pretty handy for testing a conversion, whether something broke or not. Signed-off-by: Thomas Gleixner <tglx@linutronix.de> Reviewed-by: Ingo Molnar <mingo@elte.hu>
1 parent 21e2b8c commit bd15141

6 files changed

Lines changed: 39 additions & 6 deletions

File tree

‎include/linux/irq.h‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,7 @@ struct irq_data {
155155
*/
156156
struct irq_chip {
157157
const char *name;
158+
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
158159
unsigned int (*startup)(unsigned int irq);
159160
void (*shutdown)(unsigned int irq);
160161
void (*enable)(unsigned int irq);
@@ -175,7 +176,7 @@ struct irq_chip {
175176

176177
void (*bus_lock)(unsigned int irq);
177178
void (*bus_sync_unlock)(unsigned int irq);
178-
179+
#endif
179180
unsigned int (*irq_startup)(struct irq_data *data);
180181
void (*irq_shutdown)(struct irq_data *data);
181182
void (*irq_enable)(struct irq_data *data);
@@ -225,6 +226,9 @@ struct irq_2_iommu;
225226
*/
226227
struct irq_desc {
227228

229+
#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
230+
struct irq_data irq_data;
231+
#else
228232
/*
229233
* This union will go away, once we fixed the direct access to
230234
* irq_desc all over the place. The direct fields are a 1:1
@@ -247,6 +251,8 @@ struct irq_desc {
247251
#endif
248252
};
249253
};
254+
#endif
255+
250256
struct timer_rand_state *timer_rand_state;
251257
unsigned int *kstat_irqs;
252258
irq_flow_handler_t handle_irq;

‎kernel/irq/Kconfig‎

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,10 @@ config GENERIC_HARDIRQS
1212
config GENERIC_HARDIRQS_NO__DO_IRQ
1313
def_bool y
1414

15+
# Select this to disable the deprecated stuff
16+
config GENERIC_HARDIRQS_NO_DEPRECATED
17+
def_bool n
18+
1519
# Options selectable by the architecture code
1620
config HAVE_SPARSE_IRQ
1721
def_bool n

‎kernel/irq/chip.c‎

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -324,6 +324,7 @@ static void default_shutdown(struct irq_data *data)
324324
desc->status |= IRQ_MASKED;
325325
}
326326

327+
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
327328
/* Temporary migration helpers */
328329
static void compat_irq_mask(struct irq_data *data)
329330
{
@@ -400,12 +401,14 @@ static void compat_bus_sync_unlock(struct irq_data *data)
400401
{
401402
data->chip->bus_sync_unlock(data->irq);
402403
}
404+
#endif
403405

404406
/*
405407
* Fixup enable/disable function pointers
406408
*/
407409
void irq_chip_set_defaults(struct irq_chip *chip)
408410
{
411+
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
409412
/*
410413
* Compat fixup functions need to be before we set the
411414
* defaults for enable/disable/startup/shutdown
@@ -418,7 +421,7 @@ void irq_chip_set_defaults(struct irq_chip *chip)
418421
chip->irq_shutdown = compat_irq_shutdown;
419422
if (chip->startup)
420423
chip->irq_startup = compat_irq_startup;
421-
424+
#endif
422425
/*
423426
* The real defaults
424427
*/
@@ -437,6 +440,8 @@ void irq_chip_set_defaults(struct irq_chip *chip)
437440
if (!chip->irq_shutdown)
438441
chip->irq_shutdown = chip->irq_disable != default_disable ?
439442
chip->irq_disable : default_shutdown;
443+
444+
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
440445
if (!chip->end)
441446
chip->end = dummy_irq_chip.end;
442447

@@ -465,6 +470,7 @@ void irq_chip_set_defaults(struct irq_chip *chip)
465470
chip->irq_set_wake = compat_irq_set_wake;
466471
if (chip->retrigger)
467472
chip->irq_retrigger = compat_irq_retrigger;
473+
#endif
468474
}
469475

470476
static inline void mask_ack_irq(struct irq_desc *desc)

‎kernel/irq/handle.c‎

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,12 @@ static unsigned int noop_ret(struct irq_data *data)
309309
return 0;
310310
}
311311

312+
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
312313
static void compat_noop(unsigned int irq) { }
314+
#define END_INIT .end = compat_noop
315+
#else
316+
#define END_INIT
317+
#endif
313318

314319
/*
315320
* Generic no controller implementation
@@ -321,7 +326,7 @@ struct irq_chip no_irq_chip = {
321326
.irq_enable = noop,
322327
.irq_disable = noop,
323328
.irq_ack = ack_bad,
324-
.end = compat_noop,
329+
END_INIT
325330
};
326331

327332
/*
@@ -337,7 +342,7 @@ struct irq_chip dummy_irq_chip = {
337342
.irq_ack = noop,
338343
.irq_mask = noop,
339344
.irq_unmask = noop,
340-
.end = compat_noop,
345+
END_INIT
341346
};
342347

343348
/*

‎kernel/irq/internals.h‎

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,16 @@ extern int irq_select_affinity_usr(unsigned int irq);
4242

4343
extern void irq_set_thread_affinity(struct irq_desc *desc);
4444

45+
#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
46+
static inline void irq_end(unsigned int irq, struct irq_desc *desc)
47+
{
48+
if (desc->irq_data.chip && desc->irq_data.chip->end)
49+
desc->irq_data.chip->end(irq);
50+
}
51+
#else
52+
static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
53+
#endif
54+
4555
/* Inline functions for support of irq chips on slow busses */
4656
static inline void chip_bus_lock(struct irq_desc *desc)
4757
{

‎kernel/irq/spurious.c‎

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,8 @@
1414
#include <linux/moduleparam.h>
1515
#include <linux/timer.h>
1616

17+
#include "internals.h"
18+
1719
static int irqfixup __read_mostly;
1820

1921
#define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
@@ -78,8 +80,8 @@ static int try_one_irq(int irq, struct irq_desc *desc)
7880
* If we did actual work for the real IRQ line we must let the
7981
* IRQ controller clean up too
8082
*/
81-
if (work && desc->irq_data.chip && desc->irq_data.chip->end)
82-
desc->irq_data.chip->end(irq);
83+
if (work)
84+
irq_end(irq, desc);
8385
raw_spin_unlock(&desc->lock);
8486

8587
return ok;

0 commit comments

Comments
 (0)