PageRenderTime 76ms CodeModel.GetById 20ms app.highlight 33ms RepoModel.GetById 20ms app.codeStats 0ms

/arch/arm/mach-fsm/subsystem-fatal-8x60.c

https://bitbucket.org/sammyz/iscream_thunderc-2.6.35-rebase
C | 62 lines | 33 code | 13 blank | 16 comment | 0 complexity | a643cfbcbc69829a2f80fc8c48606c46 MD5 | raw file
Possible License(s): GPL-2.0, LGPL-2.0, AGPL-1.0
 1/* Copyright (c) 2010, Code Aurora Forum. All rights reserved.
 2 *
 3 * This program is free software; you can redistribute it and/or modify
 4 * it under the terms of the GNU General Public License version 2 and
 5 * only version 2 as published by the Free Software Foundation.
 6 *
 7 * This program is distributed in the hope that it will be useful,
 8 * but WITHOUT ANY WARRANTY; without even the implied warranty of
 9 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
10 * GNU General Public License for more details.
11 *
12 * You should have received a copy of the GNU General Public License
13 * along with this program; if not, write to the Free Software
14 * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
15 * 02110-1301, USA.
16 */
17
18#include <linux/kernel.h>
19#include <linux/interrupt.h>
20#include <linux/reboot.h>
21#include <linux/workqueue.h>
22
23#include <mach/irqs.h>
24
25static void modem_fatal_fn(struct work_struct *work)
26{
27	printk(KERN_CRIT "Watchdog bite received from modem! Rebooting.\n");
28
29	lock_kernel();
30	kernel_restart(NULL);
31	unlock_kernel();
32}
33
34static DECLARE_WORK(modem_fatal_work, modem_fatal_fn);
35
36static irqreturn_t modem_wdog_bite_irq(int irq, void *dev_id)
37{
38	int ret;
39
40	ret = schedule_work(&modem_fatal_work);
41	disable_irq_nosync(MARM_WDOG_EXPIRED);
42
43	return IRQ_HANDLED;
44}
45
46static void __exit subsystem_fatal_exit(void)
47{
48	free_irq(MARM_WDOG_EXPIRED, NULL);
49}
50
51static int __init subsystem_fatal_init(void)
52{
53	int ret;
54
55	ret = request_irq(MARM_WDOG_EXPIRED, modem_wdog_bite_irq,
56			  IRQF_TRIGGER_RISING, "modem_wdog", NULL);
57
58	return ret;
59}
60
61module_init(subsystem_fatal_init);
62module_exit(subsystem_fatal_exit);