/* The routine cancels a pending sndbuf work, calls hvc_iucv_send() to flush any buffered terminal output data and waits for completion.  */
static void flush_sndbuf_sync(struct hvc_iucv_private *priv)
/* The routine cancels a pending sndbuf work, calls hvc_iucv_send() to flush any buffered terminal output data and waits for completion.  */
static void flush_sndbuf_sync(struct hvc_iucv_private *priv)
{
	int sync_wait;
	cancel_delayed_work_sync(&priv->sndbuf_work);
	spin_lock_bh(&priv->lock);
	hvc_iucv_send(priv);
	sync_wait = !list_empty(&priv->tty_outqueue);
	spin_unlock_bh(&priv->lock);
	if (sync_wait)
		wait_event_timeout(priv->sndbuf_waitq,
				   tty_outqueue_empty(priv), HZ/10);
}