Subversion Repositories HelenOS

Compare Revisions

Ignore whitespace Rev 2455 → Rev 2456

/branches/rcu/kernel/genarch/src/kbd/ns16550.c
51,6 → 51,7
#include <arch/interrupt.h>
#include <sysinfo/sysinfo.h>
#include <synch/spinlock.h>
#include <synch/rcu.h>
 
#define LSR_DATA_READY 0x01
 
86,9 → 87,9
while (ns16550_lsr_read(&ns16550) & LSR_DATA_READY)
(void) ns16550_rbr_read(&ns16550);
 
spinlock_lock(&ns16550_irq.lock);
ns16550_irq.notif_cfg.notify = false;
spinlock_unlock(&ns16550_irq.lock);
//rcu_read_lock() is not needed, ints are disabled
//rcu: atomic update doesn't need reallocation
rcu_dereference_pointer(ns16550_irq.notif_cfg).notify = false;
interrupts_restore(ipl);
}
 
96,9 → 97,10
void ns16550_release(void)
{
ipl_t ipl = interrupts_disable();
//rcu: atomic update doesn't need reallocation
spinlock_lock(&ns16550_irq.lock);
if (ns16550_irq.notif_cfg.answerbox)
ns16550_irq.notif_cfg.notify = true;
if (rcu_dereference_pointer(ns16550_irq.notif_cfg).answerbox)
rcu_dereference_pointer(ns16550_irq.notif_cfg).notify = true;
spinlock_unlock(&ns16550_irq.lock);
interrupts_restore(ipl);
}
183,7 → 185,7
spinlock_lock(&ns16550_irq.lock);
 
if (ns16550_lsr_read(&ns16550) & LSR_DATA_READY) {
if (ns16550_irq.notif_cfg.notify && ns16550_irq.notif_cfg.answerbox) {
if (rcu_dereference_pointer(ns16550_irq.notif_cfg).notify && rcu_dereference_pointer(ns16550_irq.notif_cfg).answerbox) {
/*
* Send IPC notification.
*/