12345678910111213141516171819202122232425262728293031323334353637383940414243444546 |
- /*
- TODO: get handler running multiple times on some existing interrupt from /proc/interrupts.
- */
- #include <linux/interrupt.h>
- #include <linux/jiffies.h>
- #include <linux/kernel.h>
- #include <linux/module.h>
- MODULE_LICENSE("GPL");
- /**
- * Return value from kernel docs:*
- *
- * enum irqreturn
- * @IRQ_NON interrupt was not from this device or was not handled
- * @IRQ_HANDLED interrupt was handled by this device
- * @IRQ_WAKE_THREAD handler requests to wake the handler thread
- */
- static irqreturn_t handler(int i, void *v)
- {
- pr_info("handler %llu\n", (unsigned long long)jiffies);
- return IRQ_HANDLED;
- }
- static int myinit(void)
- {
- irqreturn_t r;
- r = request_irq(
- 1,
- handler,
- IRQF_SHARED,
- "myirqhandler0",
- 0
- );
- pr_info("request_irq %llu\n", (unsigned long long)r);
- return 0;
- }
- static void myexit(void)
- {
- }
- module_init(myinit)
- module_exit(myexit)
|