]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
microblaze: intc: Registering interrupt should return value
authorMichal Simek <monstr@monstr.eu>
Fri, 29 Jun 2012 12:21:52 +0000 (14:21 +0200)
committerMichal Simek <monstr@monstr.eu>
Tue, 11 Sep 2012 07:24:57 +0000 (09:24 +0200)
Return value to find out if un/registration was succesful.

Signed-off-by: Michal Simek <monstr@monstr.eu>
arch/microblaze/cpu/interrupts.c
arch/microblaze/include/asm/microblaze_intc.h

index ee67082188cf78094ea8c5e0a7847223c22eb6f6..08f6bad90a7b41a792735d20afb8a89121a6a0be 100644 (file)
@@ -91,14 +91,13 @@ static void disable_one_interrupt(int irq)
 #endif
 }
 
-/* adding new handler for interrupt */
-void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void *arg)
+int install_interrupt_handler(int irq, interrupt_handler_t *hdlr, void *arg)
 {
        struct irq_action *act;
        /* irq out of range */
        if ((irq < 0) || (irq > irq_no)) {
                puts ("IRQ out of range\n");
-               return;
+               return -1;
        }
        act = &vecs[irq];
        if (hdlr) {             /* enable */
@@ -106,11 +105,14 @@ void install_interrupt_handler (int irq, interrupt_handler_t * hdlr, void *arg)
                act->arg = arg;
                act->count = 0;
                enable_one_interrupt (irq);
-       } else {                /* disable */
-               act->handler = (interrupt_handler_t *) def_hdlr;
-               act->arg = (void *)irq;
-               disable_one_interrupt (irq);
+               return 0;
        }
+
+       /* Disable */
+       act->handler = (interrupt_handler_t *) def_hdlr;
+       act->arg = (void *)irq;
+       disable_one_interrupt(irq);
+       return 1;
 }
 
 /* initialization interrupt controller - hardware */
index 6142b9c99523e11d7d197ca13e64c355076dcdc2..e9640f54376a075210b504bc6e1c7bbd9805db60 100644 (file)
@@ -39,7 +39,16 @@ struct irq_action {
        int count; /* number of interrupt */
 };
 
-void install_interrupt_handler (int irq, interrupt_handler_t * hdlr,
+/**
+ * Register and unregister interrupt handler rutines
+ *
+ * @param irq  IRQ number
+ * @param hdlr Interrupt handler rutine
+ * @param arg  Pointer to argument which is passed to int. handler rutine
+ * @return     0 if registration pass, 1 if unregistration pass,
+ *             or an error code < 0 otherwise
+ */
+int install_interrupt_handler(int irq, interrupt_handler_t *hdlr,
                                       void *arg);
 
 int interrupts_init(void);