Back to home page

OSCL-LXR

 
 

    


0001 /* SPDX-License-Identifier: GPL-2.0 */
0002 /*
0003  * Copyright (C) 2019-2022 Red Hat, Inc. Daniel Bristot de Oliveira <bristot@kernel.org>
0004  *
0005  * Helper functions to facilitate the instrumentation of auto-generated
0006  * RV monitors create by dot2k.
0007  *
0008  * The dot2k tool is available at tools/verification/dot2/
0009  */
0010 
0011 #include <linux/ftrace.h>
0012 
0013 /*
0014  * rv_attach_trace_probe - check and attach a handler function to a tracepoint
0015  */
0016 #define rv_attach_trace_probe(monitor, tp, rv_handler)                  \
0017     do {                                        \
0018         check_trace_callback_type_##tp(rv_handler);             \
0019         WARN_ONCE(register_trace_##tp(rv_handler, NULL),            \
0020                 "fail attaching " #monitor " " #tp "handler");      \
0021     } while (0)
0022 
0023 /*
0024  * rv_detach_trace_probe - detach a handler function to a tracepoint
0025  */
0026 #define rv_detach_trace_probe(monitor, tp, rv_handler)                  \
0027     do {                                        \
0028         unregister_trace_##tp(rv_handler, NULL);                \
0029     } while (0)