Changeset b14e35f2 in mainline for kernel/generic/src/ipc/irq.c
- Timestamp:
- 2006-10-17T21:20:00Z (18 years ago)
- Branches:
- lfn, master, serial, ticket/834-toolchain-update, topic/msim-upgrade, topic/simplify-dev-export
- Children:
- fb8335c
- Parents:
- 4874c2d
- File:
-
- 1 edited
Legend:
- Unmodified
- Added
- Removed
-
kernel/generic/src/ipc/irq.c
r4874c2d rb14e35f2 177 177 if (irq) { 178 178 if (irq->notif_cfg.answerbox == box) { 179 code_free(irq->notif_cfg.code); 179 180 irq->notif_cfg.notify = false; 180 181 irq->notif_cfg.answerbox = NULL; … … 182 183 irq->notif_cfg.method = 0; 183 184 irq->notif_cfg.counter = 0; 184 code_free(irq->notif_cfg.code); 185 186 spinlock_lock(&box->irq_lock); 187 list_remove(&irq->notif_cfg.link); 188 spinlock_unlock(&box->irq_lock); 189 185 190 spinlock_unlock(&irq->lock); 186 191 } … … 199 204 * @return EBADMEM, ENOENT or EEXISTS on failure or 0 on success. 200 205 */ 201 int 202 ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) 206 int ipc_irq_register(answerbox_t *box, inr_t inr, devno_t devno, unative_t method, irq_code_t *ucode) 203 207 { 204 208 ipl_t ipl; … … 233 237 irq->notif_cfg.code = code; 234 238 irq->notif_cfg.counter = 0; 239 240 spinlock_lock(&box->irq_lock); 241 list_append(&irq->notif_cfg.link, &box->irq_head); 242 spinlock_unlock(&box->irq_lock); 243 235 244 spinlock_unlock(&irq->lock); 236 245 interrupts_restore(ipl); … … 311 320 /** Disconnect all IRQ notifications from an answerbox. 312 321 * 322 * This function is effective because the answerbox contains 323 * list of all irq_t structures that are registered to 324 * send notifications to it. 325 * 313 326 * @param box Answerbox for which we want to carry out the cleanup. 314 327 */ 315 328 void ipc_irq_cleanup(answerbox_t *box) 316 329 { 317 /* TODO */ 330 ipl_t ipl; 331 332 loop: 333 ipl = interrupts_disable(); 334 spinlock_lock(&box->irq_lock); 335 336 while (box->irq_head.next != &box->irq_head) { 337 link_t *cur = box->irq_head.next; 338 irq_t *irq; 339 340 irq = list_get_instance(cur, irq_t, notif_cfg.link); 341 if (!spinlock_trylock(&irq->lock)) { 342 /* 343 * Avoid deadlock by trying again. 344 */ 345 spinlock_unlock(&box->irq_lock); 346 interrupts_restore(ipl); 347 goto loop; 348 } 349 350 ASSERT(irq->notif_cfg.answerbox == box); 351 352 list_remove(&irq->notif_cfg.link); 353 354 /* 355 * Don't forget to free any top-half pseudocode. 356 */ 357 code_free(irq->notif_cfg.code); 358 359 irq->notif_cfg.notify = false; 360 irq->notif_cfg.answerbox = NULL; 361 irq->notif_cfg.code = NULL; 362 irq->notif_cfg.method = 0; 363 irq->notif_cfg.counter = 0; 364 365 spinlock_unlock(&irq->lock); 366 } 367 368 spinlock_unlock(&box->irq_lock); 369 interrupts_restore(ipl); 318 370 } 319 371
Note:
See TracChangeset
for help on using the changeset viewer.