DM: add init/deinit function for mevent

Current, mevent cleanup path has issue. There are possible
following calling sequence happen when reboot/poweroff UOS:
 1. mevent_dispatch() calls mevent_destroy
 2. do_close_post calls some virtual device deinit to delete
    mevent.

This patch introduce mevent init/deinit to make sure:
 1. mevent init
 2. mevent_add is called when init virtual device
 3. mevent_del is called when deinit virtual device
 4. mevent deinit

Signed-off-by: Yin Fengwei <fengwei.yin@intel.com>
Reviewed-by: Zhao Yakui <yakui.zhao@intel.com>
Acked-by: Anthony Xu <anthony.xu@intel.com>
This commit is contained in:
Yin Fengwei
2018-04-10 16:43:26 +08:00
committed by Jack Ren
parent c8116fc7c9
commit db46df940e
3 changed files with 35 additions and 10 deletions

View File

@@ -49,6 +49,8 @@ int mevent_delete_close(struct mevent *evp);
int mevent_notify(void);
void mevent_dispatch(void);
int mevent_init(void);
void mevent_deinit(void);
#define list_foreach_safe(var, head, field, tvar) \
for ((var) = LIST_FIRST((head)); \