Browse Source

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>
Thomas Gleixner 14 years ago
parent
commit
bd15141226
6 changed files with 39 additions and 6 deletions
  1. 7 1
      include/linux/irq.h
  2. 4 0
      kernel/irq/Kconfig
  3. 7 1
      kernel/irq/chip.c
  4. 7 2
      kernel/irq/handle.c
  5. 10 0
      kernel/irq/internals.h
  6. 4 2
      kernel/irq/spurious.c

+ 7 - 1
include/linux/irq.h

@@ -155,6 +155,7 @@ struct irq_data {
  */
  */
 struct irq_chip {
 struct irq_chip {
 	const char	*name;
 	const char	*name;
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
 	unsigned int	(*startup)(unsigned int irq);
 	unsigned int	(*startup)(unsigned int irq);
 	void		(*shutdown)(unsigned int irq);
 	void		(*shutdown)(unsigned int irq);
 	void		(*enable)(unsigned int irq);
 	void		(*enable)(unsigned int irq);
@@ -175,7 +176,7 @@ struct irq_chip {
 
 
 	void		(*bus_lock)(unsigned int irq);
 	void		(*bus_lock)(unsigned int irq);
 	void		(*bus_sync_unlock)(unsigned int irq);
 	void		(*bus_sync_unlock)(unsigned int irq);
-
+#endif
 	unsigned int	(*irq_startup)(struct irq_data *data);
 	unsigned int	(*irq_startup)(struct irq_data *data);
 	void		(*irq_shutdown)(struct irq_data *data);
 	void		(*irq_shutdown)(struct irq_data *data);
 	void		(*irq_enable)(struct irq_data *data);
 	void		(*irq_enable)(struct irq_data *data);
@@ -225,6 +226,9 @@ struct irq_2_iommu;
  */
  */
 struct irq_desc {
 struct irq_desc {
 
 
+#ifdef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
+	struct irq_data		irq_data;
+#else
 	/*
 	/*
 	 * This union will go away, once we fixed the direct access to
 	 * This union will go away, once we fixed the direct access to
 	 * irq_desc all over the place. The direct fields are a 1:1
 	 * irq_desc all over the place. The direct fields are a 1:1
@@ -247,6 +251,8 @@ struct irq_desc {
 #endif
 #endif
 		};
 		};
 	};
 	};
+#endif
+
 	struct timer_rand_state *timer_rand_state;
 	struct timer_rand_state *timer_rand_state;
 	unsigned int            *kstat_irqs;
 	unsigned int            *kstat_irqs;
 	irq_flow_handler_t	handle_irq;
 	irq_flow_handler_t	handle_irq;

+ 4 - 0
kernel/irq/Kconfig

@@ -12,6 +12,10 @@ config GENERIC_HARDIRQS
 config GENERIC_HARDIRQS_NO__DO_IRQ
 config GENERIC_HARDIRQS_NO__DO_IRQ
        def_bool y
        def_bool y
 
 
+# Select this to disable the deprecated stuff
+config GENERIC_HARDIRQS_NO_DEPRECATED
+       def_bool n
+
 # Options selectable by the architecture code
 # Options selectable by the architecture code
 config HAVE_SPARSE_IRQ
 config HAVE_SPARSE_IRQ
        def_bool n
        def_bool n

+ 7 - 1
kernel/irq/chip.c

@@ -324,6 +324,7 @@ static void default_shutdown(struct irq_data *data)
 	desc->status |= IRQ_MASKED;
 	desc->status |= IRQ_MASKED;
 }
 }
 
 
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
 /* Temporary migration helpers */
 /* Temporary migration helpers */
 static void compat_irq_mask(struct irq_data *data)
 static void compat_irq_mask(struct irq_data *data)
 {
 {
@@ -400,12 +401,14 @@ static void compat_bus_sync_unlock(struct irq_data *data)
 {
 {
 	data->chip->bus_sync_unlock(data->irq);
 	data->chip->bus_sync_unlock(data->irq);
 }
 }
+#endif
 
 
 /*
 /*
  * Fixup enable/disable function pointers
  * Fixup enable/disable function pointers
  */
  */
 void irq_chip_set_defaults(struct irq_chip *chip)
 void irq_chip_set_defaults(struct irq_chip *chip)
 {
 {
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
 	/*
 	/*
 	 * Compat fixup functions need to be before we set the
 	 * Compat fixup functions need to be before we set the
 	 * defaults for enable/disable/startup/shutdown
 	 * defaults for enable/disable/startup/shutdown
@@ -418,7 +421,7 @@ void irq_chip_set_defaults(struct irq_chip *chip)
 		chip->irq_shutdown = compat_irq_shutdown;
 		chip->irq_shutdown = compat_irq_shutdown;
 	if (chip->startup)
 	if (chip->startup)
 		chip->irq_startup = compat_irq_startup;
 		chip->irq_startup = compat_irq_startup;
-
+#endif
 	/*
 	/*
 	 * The real defaults
 	 * The real defaults
 	 */
 	 */
@@ -437,6 +440,8 @@ void irq_chip_set_defaults(struct irq_chip *chip)
 	if (!chip->irq_shutdown)
 	if (!chip->irq_shutdown)
 		chip->irq_shutdown = chip->irq_disable != default_disable ?
 		chip->irq_shutdown = chip->irq_disable != default_disable ?
 			chip->irq_disable : default_shutdown;
 			chip->irq_disable : default_shutdown;
+
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
 	if (!chip->end)
 	if (!chip->end)
 		chip->end = dummy_irq_chip.end;
 		chip->end = dummy_irq_chip.end;
 
 
@@ -465,6 +470,7 @@ void irq_chip_set_defaults(struct irq_chip *chip)
 		chip->irq_set_wake = compat_irq_set_wake;
 		chip->irq_set_wake = compat_irq_set_wake;
 	if (chip->retrigger)
 	if (chip->retrigger)
 		chip->irq_retrigger = compat_irq_retrigger;
 		chip->irq_retrigger = compat_irq_retrigger;
+#endif
 }
 }
 
 
 static inline void mask_ack_irq(struct irq_desc *desc)
 static inline void mask_ack_irq(struct irq_desc *desc)

+ 7 - 2
kernel/irq/handle.c

@@ -309,7 +309,12 @@ static unsigned int noop_ret(struct irq_data *data)
 	return 0;
 	return 0;
 }
 }
 
 
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
 static void compat_noop(unsigned int irq) { }
 static void compat_noop(unsigned int irq) { }
+#define END_INIT .end = compat_noop
+#else
+#define END_INIT
+#endif
 
 
 /*
 /*
  * Generic no controller implementation
  * Generic no controller implementation
@@ -321,7 +326,7 @@ struct irq_chip no_irq_chip = {
 	.irq_enable	= noop,
 	.irq_enable	= noop,
 	.irq_disable	= noop,
 	.irq_disable	= noop,
 	.irq_ack	= ack_bad,
 	.irq_ack	= ack_bad,
-	.end		= compat_noop,
+	END_INIT
 };
 };
 
 
 /*
 /*
@@ -337,7 +342,7 @@ struct irq_chip dummy_irq_chip = {
 	.irq_ack	= noop,
 	.irq_ack	= noop,
 	.irq_mask	= noop,
 	.irq_mask	= noop,
 	.irq_unmask	= noop,
 	.irq_unmask	= noop,
-	.end		= compat_noop,
+	END_INIT
 };
 };
 
 
 /*
 /*

+ 10 - 0
kernel/irq/internals.h

@@ -42,6 +42,16 @@ extern int irq_select_affinity_usr(unsigned int irq);
 
 
 extern void irq_set_thread_affinity(struct irq_desc *desc);
 extern void irq_set_thread_affinity(struct irq_desc *desc);
 
 
+#ifndef CONFIG_GENERIC_HARDIRQS_NO_DEPRECATED
+static inline void irq_end(unsigned int irq, struct irq_desc *desc)
+{
+	if (desc->irq_data.chip && desc->irq_data.chip->end)
+		desc->irq_data.chip->end(irq);
+}
+#else
+static inline void irq_end(unsigned int irq, struct irq_desc *desc) { }
+#endif
+
 /* Inline functions for support of irq chips on slow busses */
 /* Inline functions for support of irq chips on slow busses */
 static inline void chip_bus_lock(struct irq_desc *desc)
 static inline void chip_bus_lock(struct irq_desc *desc)
 {
 {

+ 4 - 2
kernel/irq/spurious.c

@@ -14,6 +14,8 @@
 #include <linux/moduleparam.h>
 #include <linux/moduleparam.h>
 #include <linux/timer.h>
 #include <linux/timer.h>
 
 
+#include "internals.h"
+
 static int irqfixup __read_mostly;
 static int irqfixup __read_mostly;
 
 
 #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
 #define POLL_SPURIOUS_IRQ_INTERVAL (HZ/10)
@@ -78,8 +80,8 @@ static int try_one_irq(int irq, struct irq_desc *desc)
 	 * If we did actual work for the real IRQ line we must let the
 	 * If we did actual work for the real IRQ line we must let the
 	 * IRQ controller clean up too
 	 * IRQ controller clean up too
 	 */
 	 */
-	if (work && desc->irq_data.chip && desc->irq_data.chip->end)
-		desc->irq_data.chip->end(irq);
+	if (work)
+		irq_end(irq, desc);
 	raw_spin_unlock(&desc->lock);
 	raw_spin_unlock(&desc->lock);
 
 
 	return ok;
 	return ok;