aboutsummaryrefslogtreecommitdiff
path: root/drivers/tty/serial
diff options
context:
space:
mode:
authorDaniel Thompson <daniel.thompson@linaro.org>2018-01-01 13:03:36 +0000
committerDaniel Thompson <daniel.thompson@linaro.org>2018-01-01 13:03:36 +0000
commit9a384e838082553e0d0ba04f4b3fd2d9876ae9e9 (patch)
tree62e7d619088c4eae3a900d73c0255a5e0443c500 /drivers/tty/serial
parentc2a96701e4334830534f442528ca5f95df97951a (diff)
kgdb: Add request_irq() to the io ops table for kgdboc
Signed-off-by: Daniel Thompson <daniel.thompson@linaro.org>
Diffstat (limited to 'drivers/tty/serial')
-rw-r--r--drivers/tty/serial/kgdboc.c36
1 files changed, 36 insertions, 0 deletions
diff --git a/drivers/tty/serial/kgdboc.c b/drivers/tty/serial/kgdboc.c
index a260cde743e2..d6ef160a40a9 100644
--- a/drivers/tty/serial/kgdboc.c
+++ b/drivers/tty/serial/kgdboc.c
@@ -20,6 +20,7 @@
#include <linux/vt_kern.h>
#include <linux/input.h>
#include <linux/module.h>
+#include <linux/interrupt.h>
#define MAX_CONFIG_LEN 40
@@ -304,12 +305,47 @@ static void kgdboc_post_exp_handler(void)
kgdboc_restore_input();
}
+static int kgdb_tty_irq;
+
+static int kgdboc_request_irq(irq_handler_t fn, unsigned long irqflags,
+ void *dev_id)
+{
+ int irq, res;
+
+ /* Better to avoid double allocation in the tty driver! */
+ if (kgdb_tty_irq)
+ return 0;
+
+ if (!kgdb_tty_driver->ops->poll_get_irq)
+ return -ENODEV;
+
+ irq =
+ kgdb_tty_driver->ops->poll_get_irq(kgdb_tty_driver, kgdb_tty_line);
+ if (irq <= 0)
+ return irq ? irq : -ENODEV;
+
+ /*
+ * TODO: The poll_get_irq() API is bogus because we do
+ * not
+ * have any way to undo things on failure to
+ * request
+ * the IRQ.
+ */
+ res = request_irq(irq, fn, irqflags, "kgdboc", dev_id);
+ if (res)
+ return res;
+
+ kgdb_tty_irq = irq;
+ return 0;
+}
+
static struct kgdb_io kgdboc_io_ops = {
.name = "kgdboc",
.read_char = kgdboc_get_char,
.write_char = kgdboc_put_char,
.pre_exception = kgdboc_pre_exp_handler,
.post_exception = kgdboc_post_exp_handler,
+ .request_irq = kgdboc_request_irq,
};
#ifdef CONFIG_KGDB_SERIAL_CONSOLE