Changeset 9e87562 in mainline for kernel/generic/src/ipc/irq.c
- Timestamp:
- 2017-09-18T20:52:12Z (8 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- 6abfd250
- Parents:
- e5f5ce0
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/irq.c
re5f5ce0 r9e87562 314 314 } 315 315 316 cap_t *cap = cap_get_current(handle, CAP_TYPE_ALLOCATED);317 assert(cap);318 319 316 irq_initialize(irq); 320 317 irq->inr = inr; … … 327 324 irq->notif_cfg.counter = 0; 328 325 329 cap->kobject = (void *) irq;330 331 326 /* 332 * Insert the IRQ structure into the uspace IRQ hash table and retype 333 * the capability. By retyping the capability inside the critical 334 * section, we make sure another thread cannot attempt to unregister the 335 * IRQ before it is inserted into the hash table. 327 * Insert the IRQ structure into the uspace IRQ hash table. 336 328 */ 337 329 irq_spinlock_lock(&irq_uspace_hash_table_lock, true); 338 330 irq_spinlock_lock(&irq->lock, false); 339 331 340 cap->type = CAP_TYPE_IRQ;341 332 hash_table_insert(&irq_uspace_hash_table, key, &irq->link); 342 333 343 334 irq_spinlock_unlock(&irq->lock, false); 344 335 irq_spinlock_unlock(&irq_uspace_hash_table_lock, true); 336 337 cap_publish(TASK, handle, CAP_TYPE_IRQ, irq); 345 338 346 339 return handle; … … 357 350 int ipc_irq_unsubscribe(answerbox_t *box, int handle) 358 351 { 359 irq_spinlock_lock(&TASK->lock, true); 360 cap_t *cap = cap_get_current(handle, CAP_TYPE_IRQ); 361 if (!cap) { 362 irq_spinlock_unlock(&TASK->lock, true); 352 cap_t *cap = cap_unpublish(TASK, handle, CAP_TYPE_IRQ); 353 if (!cap) 363 354 return ENOENT; 364 }365 /* Make sure only one thread can win the race to unsubscribe. */366 cap->type = CAP_TYPE_ALLOCATED;367 irq_spinlock_unlock(&TASK->lock, true);368 355 369 356 irq_t *irq = (irq_t *) cap->kobject;
Note:
See TracChangeset
for help on using the changeset viewer.