summaryrefslogtreecommitdiffstats
path: root/drivers/tty/hvc/hvc_irq.c
diff options
context:
space:
mode:
authorGreg Kroah-Hartman <gregkh@suse.de>2011-01-13 21:03:00 +0100
committerGreg Kroah-Hartman <gregkh@suse.de>2011-01-13 21:03:00 +0100
commit728674a7e466628df2aeec6d11a2ae1ef968fb67 (patch)
tree83d2e44d05b257ab03230f5c95e0d6843f0ed2f9 /drivers/tty/hvc/hvc_irq.c
parentMerge branch 'x86-olpc-for-linus' of git://git.kernel.org/pub/scm/linux/kerne... (diff)
downloadlinux-728674a7e466628df2aeec6d11a2ae1ef968fb67.tar.xz
linux-728674a7e466628df2aeec6d11a2ae1ef968fb67.zip
tty: move hvc drivers to drivers/tty/hvc/
As requested by Arnd Bergmann, the hvc drivers are now moved to the drivers/tty/hvc/ directory. The virtio_console.c driver was also moved, as it required the hvc_console.h file to be able to be built, and it really is a hvc driver. Cc: Arnd Bergmann <arnd@arndb.de> Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
Diffstat (limited to 'drivers/tty/hvc/hvc_irq.c')
-rw-r--r--drivers/tty/hvc/hvc_irq.c49
1 files changed, 49 insertions, 0 deletions
diff --git a/drivers/tty/hvc/hvc_irq.c b/drivers/tty/hvc/hvc_irq.c
new file mode 100644
index 000000000000..2623e177e8d6
--- /dev/null
+++ b/drivers/tty/hvc/hvc_irq.c
@@ -0,0 +1,49 @@
+/*
+ * Copyright IBM Corp. 2001,2008
+ *
+ * This file contains the IRQ specific code for hvc_console
+ *
+ */
+
+#include <linux/interrupt.h>
+
+#include "hvc_console.h"
+
+static irqreturn_t hvc_handle_interrupt(int irq, void *dev_instance)
+{
+ /* if hvc_poll request a repoll, then kick the hvcd thread */
+ if (hvc_poll(dev_instance))
+ hvc_kick();
+ return IRQ_HANDLED;
+}
+
+/*
+ * For IRQ based systems these callbacks can be used
+ */
+int notifier_add_irq(struct hvc_struct *hp, int irq)
+{
+ int rc;
+
+ if (!irq) {
+ hp->irq_requested = 0;
+ return 0;
+ }
+ rc = request_irq(irq, hvc_handle_interrupt, IRQF_DISABLED,
+ "hvc_console", hp);
+ if (!rc)
+ hp->irq_requested = 1;
+ return rc;
+}
+
+void notifier_del_irq(struct hvc_struct *hp, int irq)
+{
+ if (!hp->irq_requested)
+ return;
+ free_irq(irq, hp);
+ hp->irq_requested = 0;
+}
+
+void notifier_hangup_irq(struct hvc_struct *hp, int irq)
+{
+ notifier_del_irq(hp, irq);
+}