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


Ignore:
Timestamp:
2017-08-20T16:45:01Z (7 years ago)
Author:
Jakub Jermar <jakub@…>
Branches:
lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
Children:
e68765e
Parents:
e7ac23d0
Message:

Fix terminology around capabilities, capability handles and kernel objects

File:
1 edited

Legend:

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

    re7ac23d0 r3f74275  
    8484#include <print.h>
    8585#include <macros.h>
    86 #include <kobject/kobject.h>
     86#include <cap/cap.h>
    8787
    8888static void ranges_unmap(irq_pio_range_t *ranges, size_t rangecount)
     
    298298 * @param ucode   Uspace pointer to top-half pseudocode.
    299299 *
    300  * @return  IRQ capability.
     300 * @return  IRQ capability handle.
    301301 * @return  Negative error code.
    302302 *
     
    324324         * Allocate and populate the IRQ kernel object.
    325325         */
    326         int cap = kobject_alloc(TASK);
    327         if (cap < 0)
    328                 return cap;
    329         kobject_t *kobj = kobject_get_current(cap, KOBJECT_TYPE_ALLOCATED);
    330         assert(kobj);
    331         kobj->type = KOBJECT_TYPE_IRQ;
    332 
    333         irq_t *irq = &kobj->irq;
     326        int handle = cap_alloc(TASK);
     327        if (handle < 0)
     328                return handle;
     329        cap_t *cap = cap_get_current(handle, CAP_TYPE_ALLOCATED);
     330        assert(cap);
     331        cap->type = CAP_TYPE_IRQ;
     332
     333        irq_t *irq = &cap->irq;
    334334        irq_initialize(irq);
    335335        irq->inr = inr;
     
    357357        irq_spinlock_unlock(&irq_uspace_hash_table_lock, true);
    358358       
    359         return cap;
     359        return handle;
    360360}
    361361
    362362/** Unsubscribe task from IRQ notification.
    363363 *
    364  * @param box      Answerbox associated with the notification.
    365  * @param irq_cap  IRQ capability.
     364 * @param box     Answerbox associated with the notification.
     365 * @param handle  IRQ capability handle.
    366366 *
    367367 * @return EOK on success or a negative error code.
    368368 *
    369369 */
    370 int ipc_irq_unsubscribe(answerbox_t *box, int irq_cap)
    371 {
    372         kobject_t *kobj = kobject_get_current(irq_cap, KOBJECT_TYPE_IRQ);
    373         if (!kobj)
     370int ipc_irq_unsubscribe(answerbox_t *box, int handle)
     371{
     372        cap_t *cap = cap_get_current(handle, CAP_TYPE_IRQ);
     373        if (!cap)
    374374                return ENOENT;
    375         irq_t *irq = &kobj->irq;
     375        irq_t *irq = &cap->irq;
    376376
    377377        irq_spinlock_lock(&irq_uspace_hash_table_lock, true);
     
    394394        code_free(irq->notif_cfg.code);
    395395       
    396         /* Free up the IRQ kernel object. */
    397         kobject_free(TASK, irq_cap);
     396        /* Free up the IRQ capability and the underlying kernel object. */
     397        cap_free(TASK, handle);
    398398       
    399399        return EOK;
Note: See TracChangeset for help on using the changeset viewer.