aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--drivers/tty/serial/kgdb_nmi.c23
1 files changed, 8 insertions, 15 deletions
diff --git a/drivers/tty/serial/kgdb_nmi.c b/drivers/tty/serial/kgdb_nmi.c
index 195b1fad2ff9..ff70921aaa66 100644
--- a/drivers/tty/serial/kgdb_nmi.c
+++ b/drivers/tty/serial/kgdb_nmi.c
@@ -24,7 +24,7 @@
#include <linux/tty_flip.h>
#include <linux/serial_core.h>
#include <linux/interrupt.h>
-#include <linux/hrtimer.h>
+#include <linux/irq_work.h>
#include <linux/tick.h>
#include <linux/kfifo.h>
#include <linux/kgdb.h>
@@ -129,7 +129,7 @@ static struct console kgdb_nmi_console = {
struct kgdb_nmi_tty_priv {
struct tty_port port;
- struct timer_list timer;
+ struct irq_work work;
STRUCT_KFIFO(char, KGDB_NMI_FIFO_SIZE) fifo;
};
@@ -150,6 +150,7 @@ static void kgdb_tty_recv(int ch)
*/
priv = container_of(kgdb_nmi_port, struct kgdb_nmi_tty_priv, port);
kfifo_in(&priv->fifo, &c, 1);
+ irq_work_queue(&priv->work);
}
static int kgdb_nmi_poll_one_knock(void)
@@ -224,18 +225,12 @@ bool kgdb_nmi_poll_knock(void)
return true;
}
-/*
- * The tasklet is cheap, it does not cause wakeups when reschedules itself,
- * instead it waits for the next tick.
- */
-static void kgdb_nmi_tty_receiver(unsigned long data)
+static void kgdb_nmi_tty_receiver(struct irq_work *work)
{
- struct kgdb_nmi_tty_priv *priv = (void *)data;
+ struct kgdb_nmi_tty_priv *priv =
+ container_of(work, struct kgdb_nmi_tty_priv, work);
char ch;
- priv->timer.expires = jiffies + (HZ/100);
- add_timer(&priv->timer);
-
if (likely(!atomic_read(&kgdb_nmi_num_readers) ||
!kfifo_len(&priv->fifo)))
return;
@@ -251,8 +246,6 @@ static int kgdb_nmi_tty_activate(struct tty_port *port, struct tty_struct *tty)
container_of(port, struct kgdb_nmi_tty_priv, port);
kgdb_nmi_port = port;
- priv->timer.expires = jiffies + (HZ/100);
- add_timer(&priv->timer);
return 0;
}
@@ -262,7 +255,6 @@ static void kgdb_nmi_tty_shutdown(struct tty_port *port)
struct kgdb_nmi_tty_priv *priv =
container_of(port, struct kgdb_nmi_tty_priv, port);
- del_timer(&priv->timer);
kgdb_nmi_port = NULL;
}
@@ -281,7 +273,8 @@ static int kgdb_nmi_tty_install(struct tty_driver *drv, struct tty_struct *tty)
return -ENOMEM;
INIT_KFIFO(priv->fifo);
- setup_timer(&priv->timer, kgdb_nmi_tty_receiver, (unsigned long)priv);
+ init_irq_work(&priv->work, kgdb_nmi_tty_receiver);
+ priv->work.flags = IRQ_WORK_LAZY;
tty_port_init(&priv->port);
priv->port.ops = &kgdb_nmi_tty_port_ops;
tty->driver_data = priv;