PageRenderTime 14ms CodeModel.GetById 12ms app.highlight 1ms RepoModel.GetById 0ms app.codeStats 0ms

/arch/blackfin/kernel/exception.c

https://bitbucket.org/thekraven/iscream_thunderc-2.6.35
C | 45 lines | 26 code | 13 blank | 6 comment | 6 complexity | eebae36049cd8392f6e4093833bb1b2f MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
 1/* Basic functions for adding/removing custom exception handlers
 2 *
 3 * Copyright 2004-2009 Analog Devices Inc.
 4 *
 5 * Licensed under the GPL-2 or later
 6 */
 7
 8#include <linux/module.h>
 9#include <asm/irq_handler.h>
10
11int bfin_request_exception(unsigned int exception, void (*handler)(void))
12{
13	void (*curr_handler)(void);
14
15	if (exception > 0x3F)
16		return -EINVAL;
17
18	curr_handler = ex_table[exception];
19
20	if (curr_handler != ex_replaceable)
21		return -EBUSY;
22
23	ex_table[exception] = handler;
24
25	return 0;
26}
27EXPORT_SYMBOL(bfin_request_exception);
28
29int bfin_free_exception(unsigned int exception, void (*handler)(void))
30{
31	void (*curr_handler)(void);
32
33	if (exception > 0x3F)
34		return -EINVAL;
35
36	curr_handler = ex_table[exception];
37
38	if (curr_handler != handler)
39		return -EBUSY;
40
41	ex_table[exception] = ex_replaceable;
42
43	return 0;
44}
45EXPORT_SYMBOL(bfin_free_exception);