| 354 | } |
| 355 | |
| 356 | int |
| 357 | rte_dev_event_monitor_stop(void) |
| 358 | { |
| 359 | int ret = 0; |
| 360 | |
| 361 | rte_rwlock_write_lock(&monitor_lock); |
| 362 | |
| 363 | if (!monitor_refcount) { |
| 364 | RTE_LOG(ERR, EAL, "device event monitor already stopped\n"); |
| 365 | goto exit; |
| 366 | } |
| 367 | |
| 368 | if (monitor_refcount > 1) { |
| 369 | monitor_refcount--; |
| 370 | goto exit; |
| 371 | } |
| 372 | |
| 373 | ret = rte_intr_callback_unregister(intr_handle, dev_uev_handler, |
| 374 | (void *)-1); |
| 375 | if (ret < 0) { |
| 376 | RTE_LOG(ERR, EAL, "fail to unregister uevent callback.\n"); |
| 377 | goto exit; |
| 378 | } |
| 379 | |
| 380 | close(rte_intr_fd_get(intr_handle)); |
| 381 | rte_intr_instance_free(intr_handle); |
| 382 | intr_handle = NULL; |
| 383 | ret = 0; |
| 384 | |
| 385 | monitor_refcount--; |
| 386 | |
| 387 | exit: |
| 388 | rte_rwlock_write_unlock(&monitor_lock); |
| 389 | |
| 390 | return ret; |
| 391 | } |
| 392 | |
| 393 | int |
| 394 | dev_sigbus_handler_register(void) |