/* * perf_hooks.c * * Copyright (C) 2016 Wang Nan * Copyright (C) 2016 Huawei Inc. */ #include #include #include #include #include "util/util.h" #include "util/debug.h" #include "util/perf-hooks.h" static sigjmp_buf jmpbuf; static const struct perf_hook_desc *current_perf_hook; void perf_hooks__invoke(const struct perf_hook_desc *desc) { if (!(desc && desc->p_hook_func && *desc->p_hook_func)) return; if (sigsetjmp(jmpbuf, 1)) { pr_warning("Fatal error (SEGFAULT) in perf hook '%s'\n", desc->hook_name); *(current_perf_hook->p_hook_func) = NULL; } else { current_perf_hook = desc; (**desc->p_hook_func)(desc->hook_ctx); } current_perf_hook = NULL; } void perf_hooks__recover(void) { if (current_perf_hook) siglongjmp(jmpbuf, 1); } #define PERF_HOOK(name) \ perf_hook_func_t __perf_hook_func_##name = NULL; \ struct perf_hook_desc __perf_hook_desc_##name = \ {.hook_name = #name, \ .p_hook_func = &__perf_hook_func_##name, \ .hook_ctx = NULL}; #include "perf-hooks-list.h" #undef PERF_HOOK #define PERF_HOOK(name) \ &__perf_hook_desc_##name, static struct perf_hook_desc *perf_hooks[] = { #include "perf-hooks-list.h" }; #undef PERF_HOOK int perf_hooks__set_hook(const char *hook_name, perf_hook_func_t hook_func, void *hook_ctx) { unsigned int i; for (i = 0; i < ARRAY_SIZE(perf_hooks); i++) { if (strcmp(hook_name, perf_hooks[i]->hook_name) != 0) continue; if (*(perf_hooks[i]->p_hook_func)) pr_warning("Overwrite existing hook: %s\n", hook_name); *(perf_hooks[i]->p_hook_func) = hook_func; perf_hooks[i]->hook_ctx = hook_ctx; return 0; } return -ENOENT; } perf_hook_func_t perf_hooks__get_hook(const char *hook_name) { unsigned int i; for (i = 0; i < ARRAY_SIZE(perf_hooks); i++) { if (strcmp(hook_name, perf_hooks[i]->hook_name) != 0) continue; return *(perf_hooks[i]->p_hook_func); } return ERR_PTR(-ENOENT); } context.h?id=d07830db1bdb254e4b50d366010b219286b8c937'>commitdiff
diff options
context:
space:
mode:
authorMarcel J.E. Mol <marcel@mesa.nl>2017-01-30 19:26:40 +0100
committerJohan Hovold <johan@kernel.org>2017-01-31 17:27:04 +0100
commitd07830db1bdb254e4b50d366010b219286b8c937 (patch)
tree354d7fca237fa3d7e7e63c2196eaa4e1086838ea /include/uapi/asm-generic/ucontext.h
parent5d03a2fd2292e71936c4235885c35ccc3c94695b (diff)
USB: serial: pl2303: add ATEN device ID
Seems that ATEN serial-to-usb devices using pl2303 exist with different device ids. This patch adds a missing device ID so it is recognised by the driver. Signed-off-by: Marcel J.E. Mol <marcel@mesa.nl> Cc: stable <stable@vger.kernel.org> Signed-off-by: Johan Hovold <johan@kernel.org>
Diffstat (limited to 'include/uapi/asm-generic/ucontext.h')