aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/net/slip.c
diff options
context:
space:
mode:
authorAlan Cox <alan@lxorguk.ukuu.org.uk>2008-04-30 03:54:13 -0400
committerLinus Torvalds <torvalds@linux-foundation.org>2008-04-30 11:29:47 -0400
commitf34d7a5b7010b82fe97da95496b9971435530062 (patch)
tree87e2abec1e33ed4fe5e63ee2fd000bc2ad745e57 /drivers/net/slip.c
parent251b8dd7eee30fda089a1dc088abf4fc9a0dee9c (diff)
tty: The big operations rework
- Operations are now a shared const function block as with most other Linux objects - Introduce wrappers for some optional functions to get consistent behaviour - Wrap put_char which used to be patched by the tty layer - Document which functions are needed/optional - Make put_char report success/fail - Cache the driver->ops pointer in the tty as tty->ops - Remove various surplus lock calls we no longer need - Remove proc_write method as noted by Alexey Dobriyan - Introduce some missing sanity checks where certain driver/ldisc combinations would oops as they didn't check needed methods were present [akpm@linux-foundation.org: fix fs/compat_ioctl.c build] [akpm@linux-foundation.org: fix isicom] [akpm@linux-foundation.org: fix arch/ia64/hp/sim/simserial.c build] [akpm@linux-foundation.org: fix kgdb] Signed-off-by: Alan Cox <alan@redhat.com> Acked-by: Greg Kroah-Hartman <gregkh@suse.de> Cc: Jason Wessel <jason.wessel@windriver.com> Signed-off-by: Andrew Morton <akpm@linux-foundation.org> Signed-off-by: Linus Torvalds <torvalds@linux-foundation.org>
Diffstat (limited to 'drivers/net/slip.c')
-rw-r--r--drivers/net/slip.c13
1 files changed, 8 insertions, 5 deletions
diff --git a/drivers/net/slip.c b/drivers/net/slip.c
index 5a55ede352f4..84af68fdb6c2 100644
--- a/drivers/net/slip.c
+++ b/drivers/net/slip.c
@@ -396,14 +396,14 @@ static void sl_encaps(struct slip *sl, unsigned char *icp, int len)
396 396
397 /* Order of next two lines is *very* important. 397 /* Order of next two lines is *very* important.
398 * When we are sending a little amount of data, 398 * When we are sending a little amount of data,
399 * the transfer may be completed inside driver.write() 399 * the transfer may be completed inside the ops->write()
400 * routine, because it's running with interrupts enabled. 400 * routine, because it's running with interrupts enabled.
401 * In this case we *never* got WRITE_WAKEUP event, 401 * In this case we *never* got WRITE_WAKEUP event,
402 * if we did not request it before write operation. 402 * if we did not request it before write operation.
403 * 14 Oct 1994 Dmitry Gorodchanin. 403 * 14 Oct 1994 Dmitry Gorodchanin.
404 */ 404 */
405 sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP); 405 sl->tty->flags |= (1 << TTY_DO_WRITE_WAKEUP);
406 actual = sl->tty->driver->write(sl->tty, sl->xbuff, count); 406 actual = sl->tty->ops->write(sl->tty, sl->xbuff, count);
407#ifdef SL_CHECK_TRANSMIT 407#ifdef SL_CHECK_TRANSMIT
408 sl->dev->trans_start = jiffies; 408 sl->dev->trans_start = jiffies;
409#endif 409#endif
@@ -437,7 +437,7 @@ static void slip_write_wakeup(struct tty_struct *tty)
437 return; 437 return;
438 } 438 }
439 439
440 actual = tty->driver->write(tty, sl->xhead, sl->xleft); 440 actual = tty->ops->write(tty, sl->xhead, sl->xleft);
441 sl->xleft -= actual; 441 sl->xleft -= actual;
442 sl->xhead += actual; 442 sl->xhead += actual;
443} 443}
@@ -462,7 +462,7 @@ static void sl_tx_timeout(struct net_device *dev)
462 } 462 }
463 printk(KERN_WARNING "%s: transmit timed out, %s?\n", 463 printk(KERN_WARNING "%s: transmit timed out, %s?\n",
464 dev->name, 464 dev->name,
465 (sl->tty->driver->chars_in_buffer(sl->tty) || sl->xleft) ? 465 (tty_chars_in_buffer(sl->tty) || sl->xleft) ?
466 "bad line quality" : "driver error"); 466 "bad line quality" : "driver error");
467 sl->xleft = 0; 467 sl->xleft = 0;
468 sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP); 468 sl->tty->flags &= ~(1 << TTY_DO_WRITE_WAKEUP);
@@ -830,6 +830,9 @@ static int slip_open(struct tty_struct *tty)
830 if (!capable(CAP_NET_ADMIN)) 830 if (!capable(CAP_NET_ADMIN))
831 return -EPERM; 831 return -EPERM;
832 832
833 if (tty->ops->write == NULL)
834 return -EOPNOTSUPP;
835
833 /* RTnetlink lock is misused here to serialize concurrent 836 /* RTnetlink lock is misused here to serialize concurrent
834 opens of slip channels. There are better ways, but it is 837 opens of slip channels. There are better ways, but it is
835 the simplest one. 838 the simplest one.
@@ -1432,7 +1435,7 @@ static void sl_outfill(unsigned long sls)
1432 /* put END into tty queue. Is it right ??? */ 1435 /* put END into tty queue. Is it right ??? */
1433 if (!netif_queue_stopped(sl->dev)) { 1436 if (!netif_queue_stopped(sl->dev)) {
1434 /* if device busy no outfill */ 1437 /* if device busy no outfill */
1435 sl->tty->driver->write(sl->tty, &s, 1); 1438 sl->tty->ops->write(sl->tty, &s, 1);
1436 } 1439 }
1437 } else 1440 } else
1438 set_bit(SLF_OUTWAIT, &sl->flags); 1441 set_bit(SLF_OUTWAIT, &sl->flags);