aboutsummaryrefslogtreecommitdiffstats
path: root/drivers/char
diff options
context:
space:
mode:
Diffstat (limited to 'drivers/char')
-rw-r--r--drivers/char/tty_io.c22
1 files changed, 16 insertions, 6 deletions
diff --git a/drivers/char/tty_io.c b/drivers/char/tty_io.c
index 98b126c2ded8..6f58cacec341 100644
--- a/drivers/char/tty_io.c
+++ b/drivers/char/tty_io.c
@@ -351,10 +351,10 @@ int tty_buffer_request_room(struct tty_struct *tty, size_t size)
351 spin_unlock_irqrestore(&tty->buf.lock, flags); 351 spin_unlock_irqrestore(&tty->buf.lock, flags);
352 return size; 352 return size;
353} 353}
354
355EXPORT_SYMBOL_GPL(tty_buffer_request_room); 354EXPORT_SYMBOL_GPL(tty_buffer_request_room);
356 355
357int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, size_t size) 356int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars,
357 size_t size)
358{ 358{
359 int copied = 0; 359 int copied = 0;
360 do { 360 do {
@@ -368,17 +368,16 @@ int tty_insert_flip_string(struct tty_struct *tty, const unsigned char *chars, s
368 tb->used += space; 368 tb->used += space;
369 copied += space; 369 copied += space;
370 chars += space; 370 chars += space;
371/* printk("Flip insert %d.\n", space); */
372 } 371 }
373 /* There is a small chance that we need to split the data over 372 /* There is a small chance that we need to split the data over
374 several buffers. If this is the case we must loop */ 373 several buffers. If this is the case we must loop */
375 while (unlikely(size > copied)); 374 while (unlikely(size > copied));
376 return copied; 375 return copied;
377} 376}
378
379EXPORT_SYMBOL(tty_insert_flip_string); 377EXPORT_SYMBOL(tty_insert_flip_string);
380 378
381int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *chars, const char *flags, size_t size) 379int tty_insert_flip_string_flags(struct tty_struct *tty,
380 const unsigned char *chars, const char *flags, size_t size)
382{ 381{
383 int copied = 0; 382 int copied = 0;
384 do { 383 do {
@@ -399,9 +398,20 @@ int tty_insert_flip_string_flags(struct tty_struct *tty, const unsigned char *ch
399 while (unlikely(size > copied)); 398 while (unlikely(size > copied));
400 return copied; 399 return copied;
401} 400}
402
403EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags); 401EXPORT_SYMBOL_GPL(tty_insert_flip_string_flags);
404 402
403void tty_schedule_flip(struct tty_struct *tty)
404{
405 unsigned long flags;
406 spin_lock_irqsave(&tty->buf.lock, flags);
407 if (tty->buf.tail != NULL) {
408 tty->buf.tail->active = 0;
409 tty->buf.tail->commit = tty->buf.tail->used;
410 }
411 spin_unlock_irqrestore(&tty->buf.lock, flags);
412 schedule_delayed_work(&tty->buf.work, 1);
413}
414EXPORT_SYMBOL(tty_schedule_flip);
405 415
406/* 416/*
407 * Prepare a block of space in the buffer for data. Returns the length 417 * Prepare a block of space in the buffer for data. Returns the length