staging: usbip: bugfix add number of packets for isochronous frames
[linux-2.6/linux-acpi-2.6/ibm-acpi-2.6.git] / arch / blackfin / kernel / exception.c
blob9208b5fd51864713ad8394a3035e6e2a3c287dcf
1 /* Basic functions for adding/removing custom exception handlers
3 * Copyright 2004-2009 Analog Devices Inc.
5 * Licensed under the GPL-2 or later
6 */
8 #include <linux/module.h>
9 #include <asm/irq_handler.h>
11 int bfin_request_exception(unsigned int exception, void (*handler)(void))
13 void (*curr_handler)(void);
15 if (exception > 0x3F)
16 return -EINVAL;
18 curr_handler = ex_table[exception];
20 if (curr_handler != ex_replaceable)
21 return -EBUSY;
23 ex_table[exception] = handler;
25 return 0;
27 EXPORT_SYMBOL(bfin_request_exception);
29 int bfin_free_exception(unsigned int exception, void (*handler)(void))
31 void (*curr_handler)(void);
33 if (exception > 0x3F)
34 return -EINVAL;
36 curr_handler = ex_table[exception];
38 if (curr_handler != handler)
39 return -EBUSY;
41 ex_table[exception] = ex_replaceable;
43 return 0;
45 EXPORT_SYMBOL(bfin_free_exception);