提交 8a1ec21e 编写于 作者: A Alan Cox 提交者: David S. Miller

tty: Flags should be accessed via the foo_bit interfaces

We have various drivers that poke around directly and we need to clean this
up before it causes problems.
Signed-off-by: NAlan Cox <alan@redhat.com>
Signed-off-by: NDavid S. Miller <davem@davemloft.net>
上级 098401a6
...@@ -191,7 +191,7 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t ...@@ -191,7 +191,7 @@ static int irtty_do_write(struct sir_dev *dev, const unsigned char *ptr, size_t
tty = priv->tty; tty = priv->tty;
if (!tty->ops->write) if (!tty->ops->write)
return 0; return 0;
tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); set_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
writelen = tty_write_room(tty); writelen = tty_write_room(tty);
if (writelen > len) if (writelen > len)
writelen = len; writelen = len;
...@@ -263,8 +263,7 @@ static void irtty_write_wakeup(struct tty_struct *tty) ...@@ -263,8 +263,7 @@ static void irtty_write_wakeup(struct tty_struct *tty)
IRDA_ASSERT(priv != NULL, return;); IRDA_ASSERT(priv != NULL, return;);
IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;); IRDA_ASSERT(priv->magic == IRTTY_MAGIC, return;);
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
if (priv->dev) if (priv->dev)
sirdev_write_complete(priv->dev); sirdev_write_complete(priv->dev);
} }
...@@ -522,7 +521,7 @@ static void irtty_close(struct tty_struct *tty) ...@@ -522,7 +521,7 @@ static void irtty_close(struct tty_struct *tty)
/* Stop tty */ /* Stop tty */
irtty_stop_receiver(tty, TRUE); irtty_stop_receiver(tty, TRUE);
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
if (tty->ops->stop) if (tty->ops->stop)
tty->ops->stop(tty); tty->ops->stop(tty);
......
...@@ -401,7 +401,7 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len) ...@@ -401,7 +401,7 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
* if we did not request it before write operation. * if we did not request it before write operation.
* 14 Oct 1994 Dmitry Gorodchanin. * 14 Oct 1994 Dmitry Gorodchanin.
*/ */
sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); actual = sl->tty->ops->write(sl->tty, sl->xbuff, count);
#ifdef SL_CHECK_TRANSMIT #ifdef SL_CHECK_TRANSMIT
sl->dev->trans_start = jiffies; sl->dev->trans_start = jiffies;
...@@ -431,7 +431,7 @@ static void slip_write_wakeup(struct tty_struct *tty) ...@@ -431,7 +431,7 @@ static void slip_write_wakeup(struct tty_struct *tty)
/* Now serial buffer is almost free & we can start /* Now serial buffer is almost free & we can start
* transmission of another packet */ * transmission of another packet */
sl->tx_packets++; sl->tx_packets++;
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
sl_unlock(sl); sl_unlock(sl);
return; return;
} }
...@@ -464,7 +464,7 @@ static void sl_tx_timeout(struct net_device *dev) ...@@ -464,7 +464,7 @@ static void sl_tx_timeout(struct net_device *dev)
(tty_chars_in_buffer(sl->tty) || sl->xleft) ? (tty_chars_in_buffer(sl->tty) || sl->xleft) ?
"bad line quality" : "driver error"); "bad line quality" : "driver error");
sl->xleft = 0; sl->xleft = 0;
sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
sl_unlock(sl); sl_unlock(sl);
#endif #endif
} }
...@@ -514,10 +514,9 @@ sl_close(struct net_device *dev) ...@@ -514,10 +514,9 @@ sl_close(struct net_device *dev)
struct slip *sl = netdev_priv(dev); struct slip *sl = netdev_priv(dev);
spin_lock_bh(&sl->lock); spin_lock_bh(&sl->lock);
if (sl->tty) { if (sl->tty)
/* TTY discipline is running. */ /* TTY discipline is running. */
sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
}
netif_stop_queue(dev); netif_stop_queue(dev);
sl->rcount = 0; sl->rcount = 0;
sl->xleft = 0; sl->xleft = 0;
......
...@@ -242,7 +242,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len) ...@@ -242,7 +242,7 @@ static void x25_asy_encaps(struct x25_asy *sl, unsigned char *icp, int len)
* if we did not request it before write operation. * if we did not request it before write operation.
* 14 Oct 1994 Dmitry Gorodchanin. * 14 Oct 1994 Dmitry Gorodchanin.
*/ */
sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); set_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
actual = sl->tty->ops->write(sl->tty, sl->xbuff, count); actual = sl->tty->ops->write(sl->tty, sl->xbuff, count);
sl->xleft = count - actual; sl->xleft = count - actual;
sl->xhead = sl->xbuff + actual; sl->xhead = sl->xbuff + actual;
...@@ -267,7 +267,7 @@ static void x25_asy_write_wakeup(struct tty_struct *tty) ...@@ -267,7 +267,7 @@ static void x25_asy_write_wakeup(struct tty_struct *tty)
/* Now serial buffer is almost free & we can start /* Now serial buffer is almost free & we can start
* transmission of another packet */ * transmission of another packet */
sl->stats.tx_packets++; sl->stats.tx_packets++;
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
x25_asy_unlock(sl); x25_asy_unlock(sl);
return; return;
} }
...@@ -290,7 +290,7 @@ static void x25_asy_timeout(struct net_device *dev) ...@@ -290,7 +290,7 @@ static void x25_asy_timeout(struct net_device *dev)
(tty_chars_in_buffer(sl->tty) || sl->xleft) ? (tty_chars_in_buffer(sl->tty) || sl->xleft) ?
"bad line quality" : "driver error"); "bad line quality" : "driver error");
sl->xleft = 0; sl->xleft = 0;
sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
x25_asy_unlock(sl); x25_asy_unlock(sl);
} }
spin_unlock(&sl->lock); spin_unlock(&sl->lock);
...@@ -500,7 +500,7 @@ static int x25_asy_close(struct net_device *dev) ...@@ -500,7 +500,7 @@ static int x25_asy_close(struct net_device *dev)
spin_lock(&sl->lock); spin_lock(&sl->lock);
if (sl->tty) if (sl->tty)
sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &sl->tty->flags);
netif_stop_queue(dev); netif_stop_queue(dev);
sl->rcount = 0; sl->rcount = 0;
......
...@@ -1252,7 +1252,7 @@ static void strip_write_some_more(struct tty_struct *tty) ...@@ -1252,7 +1252,7 @@ static void strip_write_some_more(struct tty_struct *tty)
#endif #endif
} else { /* Else start transmission of another packet */ } else { /* Else start transmission of another packet */
tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &tty->flags);
strip_unlock(strip_info); strip_unlock(strip_info);
} }
} }
...@@ -1455,8 +1455,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb) ...@@ -1455,8 +1455,7 @@ static void strip_send(struct strip *strip_info, struct sk_buff *skb)
*/ */
strip_info->tx_head = strip_info->tx_buff; strip_info->tx_head = strip_info->tx_buff;
strip_info->tx_left = ptr - strip_info->tx_buff; strip_info->tx_left = ptr - strip_info->tx_buff;
strip_info->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); set_bit(TTY_DO_WRITE_WAKEUP, &strip_info->tty->flags);
/* /*
* 4. Debugging check to make sure we're not overflowing the buffer. * 4. Debugging check to make sure we're not overflowing the buffer.
*/ */
...@@ -2454,8 +2453,7 @@ static int strip_close_low(struct net_device *dev) ...@@ -2454,8 +2453,7 @@ static int strip_close_low(struct net_device *dev)
if (strip_info->tty == NULL) if (strip_info->tty == NULL)
return -EBUSY; return -EBUSY;
strip_info->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); clear_bit(TTY_DO_WRITE_WAKEUP, &strip_info->tty->flags);
netif_stop_queue(dev); netif_stop_queue(dev);
/* /*
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册