Changeset c1f68b0 in mainline for kernel/generic/src/ipc/irq.c


Ignore:
Timestamp:
2017-10-28T11:40:41Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
eca820c
Parents:
15d9fe6
Message:

Use recursive mutex to protect task_t::cap_info

This makes it possible to use the mutex-protected capability APIs even
inside caps_apply_to_kobject_type() callbacks. Now there is no need to
provide eg. cap_unpublish_locked() and cap_free_locked(). Likewise,
ipc_irq_unsubscribe() can be used when the task's cap_info is already
locked by the current thread inside of a callback.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • kernel/generic/src/ipc/irq.c

    r15d9fe6 rc1f68b0  
    271271}
    272272
     273static void irq_hash_out(irq_t *irq)
     274{
     275        irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
     276        irq_spinlock_lock(&irq->lock, false);
     277       
     278        if (irq->notif_cfg.hashed_in) {
     279                /* Remove the IRQ from the uspace IRQ hash table. */
     280                hash_table_remove_item(&irq_uspace_hash_table, &irq->link);
     281                irq->notif_cfg.hashed_in = false;
     282        }
     283
     284        irq_spinlock_unlock(&irq->lock, false);
     285        irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
     286}
     287
    273288static void irq_destroy(void *arg)
    274289{
    275290        irq_t *irq = (irq_t *) arg;
     291
     292        irq_hash_out(irq);
    276293
    277294        /* Free up the IRQ code and associated structures. */
     
    373390        assert(kobj->irq->notif_cfg.answerbox == box);
    374391
    375         irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
    376         irq_spinlock_lock(&kobj->irq->lock, false);
    377        
    378         if (kobj->irq->notif_cfg.hashed_in) {
    379                 /* Remove the IRQ from the uspace IRQ hash table. */
    380                 hash_table_remove_item(&irq_uspace_hash_table,
    381                     &kobj->irq->link);
    382                 kobj->irq->notif_cfg.hashed_in = false;
    383         }
    384 
    385         irq_spinlock_unlock(&kobj->irq->lock, false);
    386         irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
     392        irq_hash_out(kobj->irq);
    387393
    388394        kobject_put(kobj);
Note: See TracChangeset for help on using the changeset viewer.