diff options
author | Rusty Russell <rusty@rustcorp.com.au> | 2015-08-04 00:32:55 -0400 |
---|---|---|
committer | Thomas Gleixner <tglx@linutronix.de> | 2015-08-05 18:14:58 -0400 |
commit | 27a6f41c1a20a3339f456647a21e45fca5b82b62 (patch) | |
tree | 65ffa340b425a3572cd575c99e4cecba1423783f /arch/x86/lguest | |
parent | b7edaca4e825fd5d7a6ddce3548cc1f7a7337cf8 (diff) |
x86/lguest: Clean up lguest_setup_irq
We make it static and hoist it higher in the file for the next patch.
We also give a nice panic if it fails during boot.
Signed-off-by: Rusty Russell <rusty@rustcorp.com.au>
Link: http://lkml.kernel.org/r/1438662776-4823-1-git-send-email-rusty@rustcorp.com.au
Signed-off-by: Thomas Gleixner <tglx@linutronix.de>
Diffstat (limited to 'arch/x86/lguest')
-rw-r--r-- | arch/x86/lguest/boot.c | 43 |
1 files changed, 22 insertions, 21 deletions
diff --git a/arch/x86/lguest/boot.c b/arch/x86/lguest/boot.c index f2dc08c003eb..d933a11ceba6 100644 --- a/arch/x86/lguest/boot.c +++ b/arch/x86/lguest/boot.c | |||
@@ -835,6 +835,26 @@ static struct irq_chip lguest_irq_controller = { | |||
835 | .irq_unmask = enable_lguest_irq, | 835 | .irq_unmask = enable_lguest_irq, |
836 | }; | 836 | }; |
837 | 837 | ||
838 | /* | ||
839 | * Interrupt descriptors are allocated as-needed, but low-numbered ones are | ||
840 | * reserved by the generic x86 code. So we ignore irq_alloc_desc_at if it | ||
841 | * tells us the irq is already used: other errors (ie. ENOMEM) we take | ||
842 | * seriously. | ||
843 | */ | ||
844 | static int lguest_setup_irq(unsigned int irq) | ||
845 | { | ||
846 | int err; | ||
847 | |||
848 | /* Returns -ve error or vector number. */ | ||
849 | err = irq_alloc_desc_at(irq, 0); | ||
850 | if (err < 0 && err != -EEXIST) | ||
851 | return err; | ||
852 | |||
853 | irq_set_chip_and_handler_name(irq, &lguest_irq_controller, | ||
854 | handle_level_irq, "level"); | ||
855 | return 0; | ||
856 | } | ||
857 | |||
838 | static int lguest_enable_irq(struct pci_dev *dev) | 858 | static int lguest_enable_irq(struct pci_dev *dev) |
839 | { | 859 | { |
840 | u8 line = 0; | 860 | u8 line = 0; |
@@ -879,26 +899,6 @@ static void __init lguest_init_IRQ(void) | |||
879 | } | 899 | } |
880 | 900 | ||
881 | /* | 901 | /* |
882 | * Interrupt descriptors are allocated as-needed, but low-numbered ones are | ||
883 | * reserved by the generic x86 code. So we ignore irq_alloc_desc_at if it | ||
884 | * tells us the irq is already used: other errors (ie. ENOMEM) we take | ||
885 | * seriously. | ||
886 | */ | ||
887 | int lguest_setup_irq(unsigned int irq) | ||
888 | { | ||
889 | int err; | ||
890 | |||
891 | /* Returns -ve error or vector number. */ | ||
892 | err = irq_alloc_desc_at(irq, 0); | ||
893 | if (err < 0 && err != -EEXIST) | ||
894 | return err; | ||
895 | |||
896 | irq_set_chip_and_handler_name(irq, &lguest_irq_controller, | ||
897 | handle_level_irq, "level"); | ||
898 | return 0; | ||
899 | } | ||
900 | |||
901 | /* | ||
902 | * Time. | 902 | * Time. |
903 | * | 903 | * |
904 | * It would be far better for everyone if the Guest had its own clock, but | 904 | * It would be far better for everyone if the Guest had its own clock, but |
@@ -1040,7 +1040,8 @@ static void lguest_time_irq(unsigned int irq, struct irq_desc *desc) | |||
1040 | static void lguest_time_init(void) | 1040 | static void lguest_time_init(void) |
1041 | { | 1041 | { |
1042 | /* Set up the timer interrupt (0) to go to our simple timer routine */ | 1042 | /* Set up the timer interrupt (0) to go to our simple timer routine */ |
1043 | lguest_setup_irq(0); | 1043 | if (lguest_setup_irq(0) != 0) |
1044 | panic("Could not set up timer irq"); | ||
1044 | irq_set_handler(0, lguest_time_irq); | 1045 | irq_set_handler(0, lguest_time_irq); |
1045 | 1046 | ||
1046 | clocksource_register_hz(&lguest_clock, NSEC_PER_SEC); | 1047 | clocksource_register_hz(&lguest_clock, NSEC_PER_SEC); |