Changeset 3f74275 in mainline for kernel/generic/src/ipc/irq.c
- Timestamp:
- 2017-08-20T16:45:01Z (7 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- e68765e
- Parents:
- e7ac23d0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/irq.c
re7ac23d0 r3f74275 84 84 #include <print.h> 85 85 #include <macros.h> 86 #include < kobject/kobject.h>86 #include <cap/cap.h> 87 87 88 88 static void ranges_unmap(irq_pio_range_t *ranges, size_t rangecount) … … 298 298 * @param ucode Uspace pointer to top-half pseudocode. 299 299 * 300 * @return IRQ capability .300 * @return IRQ capability handle. 301 301 * @return Negative error code. 302 302 * … … 324 324 * Allocate and populate the IRQ kernel object. 325 325 */ 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; 334 334 irq_initialize(irq); 335 335 irq->inr = inr; … … 357 357 irq_spinlock_unlock(&irq_uspace_hash_table_lock, true); 358 358 359 return cap;359 return handle; 360 360 } 361 361 362 362 /** Unsubscribe task from IRQ notification. 363 363 * 364 * @param box 365 * @param irq_cap IRQ capability.364 * @param box Answerbox associated with the notification. 365 * @param handle IRQ capability handle. 366 366 * 367 367 * @return EOK on success or a negative error code. 368 368 * 369 369 */ 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)370 int ipc_irq_unsubscribe(answerbox_t *box, int handle) 371 { 372 cap_t *cap = cap_get_current(handle, CAP_TYPE_IRQ); 373 if (!cap) 374 374 return ENOENT; 375 irq_t *irq = & kobj->irq;375 irq_t *irq = &cap->irq; 376 376 377 377 irq_spinlock_lock(&irq_uspace_hash_table_lock, true); … … 394 394 code_free(irq->notif_cfg.code); 395 395 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); 398 398 399 399 return EOK;
Note:
See TracChangeset
for help on using the changeset viewer.