Changeset da1bafb in mainline for kernel/generic/src/console/chardev.c


Ignore:
Timestamp:
2010-05-24T18:57:31Z (14 years ago)
Author:
Martin Decky <martin@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
0095368
Parents:
666f492
Message:

major code revision

  • replace spinlocks taken with interrupts disabled with irq_spinlocks
  • change spacing (not indendation) to be tab-size independent
  • use unsigned integer types where appropriate (especially bit flags)
  • visual separation
  • remove argument names in function prototypes
  • string changes
  • correct some formating directives
  • replace various cryptic single-character variables (t, a, m, c, b, etc.) with proper identifiers (thread, task, timeout, as, itm, itc, etc.)
  • unify some assembler constructs
  • unused page table levels are now optimized out in compile time
  • replace several ints (with boolean semantics) with bools
  • use specifically sized types instead of generic types where appropriate (size_t, uint32_t, btree_key_t)
  • improve comments
  • split asserts with conjuction into multiple independent asserts
File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/console/chardev.c

    r666f492 rda1bafb  
    5252        indev->name = name;
    5353        waitq_initialize(&indev->wq);
    54         spinlock_initialize(&indev->lock, "indev");
     54        irq_spinlock_initialize(&indev->lock, "chardev.indev.lock");
    5555        indev->counter = 0;
    5656        indev->index = 0;
     
    6868        ASSERT(indev);
    6969       
    70         spinlock_lock(&indev->lock);
     70        irq_spinlock_lock(&indev->lock, true);
    7171        if (indev->counter == INDEV_BUFLEN - 1) {
    7272                /* Buffer full */
    73                 spinlock_unlock(&indev->lock);
     73                irq_spinlock_unlock(&indev->lock, true);
    7474                return;
    7575        }
     
    8181        indev->index = indev->index % INDEV_BUFLEN;
    8282        waitq_wakeup(&indev->wq, WAKEUP_FIRST);
    83         spinlock_unlock(&indev->lock);
     83        irq_spinlock_unlock(&indev->lock, true);
    8484}
    8585
     
    114114       
    115115        waitq_sleep(&indev->wq);
    116         ipl_t ipl = interrupts_disable();
    117         spinlock_lock(&indev->lock);
     116        irq_spinlock_lock(&indev->lock, true);
    118117        wchar_t ch = indev->buffer[(indev->index - indev->counter) % INDEV_BUFLEN];
    119118        indev->counter--;
    120         spinlock_unlock(&indev->lock);
    121         interrupts_restore(ipl);
     119        irq_spinlock_unlock(&indev->lock, true);
    122120       
    123121        return ch;
     
    134132{
    135133        outdev->name = name;
    136         spinlock_initialize(&outdev->lock, "outdev");
     134        spinlock_initialize(&outdev->lock, "chardev.outdev.lock");
    137135        link_initialize(&outdev->link);
    138136        list_initialize(&outdev->list);
Note: See TracChangeset for help on using the changeset viewer.