~ubuntu-branches/ubuntu/precise/linux-ti-omap4/precise

« back to all changes in this revision

Viewing changes to drivers/tty/tty_buffer.c

  • Committer: Bazaar Package Importer
  • Author(s): Paolo Pisati
  • Date: 2011-06-29 15:23:51 UTC
  • mfrom: (26.1.1 natty-proposed)
  • Revision ID: james.westby@ubuntu.com-20110629152351-xs96tm303d95rpbk
Tags: 3.0.0-1200.2
* Rebased against 3.0.0-6.7
* BSP from TI based on 3.0.0

Show diffs side-by-side

added added

removed removed

Lines of Context:
322
322
        if (tty->buf.tail != NULL)
323
323
                tty->buf.tail->commit = tty->buf.tail->used;
324
324
        spin_unlock_irqrestore(&tty->buf.lock, flags);
325
 
        schedule_delayed_work(&tty->buf.work, 1);
 
325
        schedule_work(&tty->buf.work);
326
326
}
327
327
EXPORT_SYMBOL(tty_schedule_flip);
328
328
 
402
402
static void flush_to_ldisc(struct work_struct *work)
403
403
{
404
404
        struct tty_struct *tty =
405
 
                container_of(work, struct tty_struct, buf.work.work);
 
405
                container_of(work, struct tty_struct, buf.work);
406
406
        unsigned long   flags;
407
407
        struct tty_ldisc *disc;
408
408
 
413
413
        spin_lock_irqsave(&tty->buf.lock, flags);
414
414
 
415
415
        if (!test_and_set_bit(TTY_FLUSHING, &tty->flags)) {
416
 
                struct tty_buffer *head, *tail = tty->buf.tail;
417
 
                int seen_tail = 0;
 
416
                struct tty_buffer *head;
418
417
                while ((head = tty->buf.head) != NULL) {
419
418
                        int count;
420
419
                        char *char_buf;
424
423
                        if (!count) {
425
424
                                if (head->next == NULL)
426
425
                                        break;
427
 
                                /*
428
 
                                  There's a possibility tty might get new buffer
429
 
                                  added during the unlock window below. We could
430
 
                                  end up spinning in here forever hogging the CPU
431
 
                                  completely. To avoid this let's have a rest each
432
 
                                  time we processed the tail buffer.
433
 
                                */
434
 
                                if (tail == head)
435
 
                                        seen_tail = 1;
436
426
                                tty->buf.head = head->next;
437
427
                                tty_buffer_free(tty, head);
438
428
                                continue;
442
432
                           line discipline as we want to empty the queue */
443
433
                        if (test_bit(TTY_FLUSHPENDING, &tty->flags))
444
434
                                break;
445
 
                        if (!tty->receive_room || seen_tail) {
446
 
                                schedule_delayed_work(&tty->buf.work, 1);
 
435
                        if (!tty->receive_room)
447
436
                                break;
448
 
                        }
449
437
                        if (count > tty->receive_room)
450
438
                                count = tty->receive_room;
451
439
                        char_buf = head->char_buf_ptr + head->read;
481
469
 */
482
470
void tty_flush_to_ldisc(struct tty_struct *tty)
483
471
{
484
 
        flush_delayed_work(&tty->buf.work);
 
472
        flush_work(&tty->buf.work);
485
473
}
486
474
 
487
475
/**
506
494
        spin_unlock_irqrestore(&tty->buf.lock, flags);
507
495
 
508
496
        if (tty->low_latency)
509
 
                flush_to_ldisc(&tty->buf.work.work);
 
497
                flush_to_ldisc(&tty->buf.work);
510
498
        else
511
 
                schedule_delayed_work(&tty->buf.work, 1);
 
499
                schedule_work(&tty->buf.work);
512
500
}
513
501
EXPORT_SYMBOL(tty_flip_buffer_push);
514
502
 
529
517
        tty->buf.tail = NULL;
530
518
        tty->buf.free = NULL;
531
519
        tty->buf.memory_used = 0;
532
 
        INIT_DELAYED_WORK(&tty->buf.work, flush_to_ldisc);
 
520
        INIT_WORK(&tty->buf.work, flush_to_ldisc);
533
521
}
534
522