}
/**
+ * tty_ldisc_flush_works - flush all works of a tty
+ * @tty: tty device to flush works for
+ *
+ * Sync flush all works belonging to @tty.
+ */
+static void tty_ldisc_flush_works(struct tty_struct *tty)
+{
+ flush_work_sync(&tty->hangup_work);
+ flush_work_sync(&tty->SAK_work);
+ flush_delayed_work_sync(&tty->buf.work);
+}
+
+/**
* tty_ldisc_wait_idle - wait for the ldisc to become idle
* @tty: tty to wait for
*
mutex_unlock(&tty->ldisc_mutex);
- flush_scheduled_work();
+ tty_ldisc_flush_works(tty);
retval = tty_ldisc_wait_idle(tty);
tty_unlock();
tty_ldisc_halt(tty);
- flush_scheduled_work();
+ tty_ldisc_flush_works(tty);
tty_lock();
mutex_lock(&tty->ldisc_mutex);