diff options
author | Simon Glass | 2020-09-12 12:28:49 -0600 |
---|---|---|
committer | Tom Rini | 2020-10-10 16:50:11 -0400 |
commit | 3d03ab6361a4a2b60e84da46c547b8ace01a60eb (patch) | |
tree | b7cab1ed0489fd262afc76cf6ec72606c9dc51c5 /include/log.h | |
parent | bd180db2cc73c7dc00076b0517978a8cdd557519 (diff) |
log: Add a way to enable/disable a log device
At present all log devices are enabled by default. Add a function to allow
devices to be disabled or enabled at runtime.
Signed-off-by: Simon Glass <sjg@chromium.org>
Diffstat (limited to 'include/log.h')
-rw-r--r-- | include/log.h | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/include/log.h b/include/log.h index d28bc1ef0e4..4acc087b2e9 100644 --- a/include/log.h +++ b/include/log.h @@ -388,6 +388,10 @@ struct log_filter { #define LOG_DRIVER(_name) \ ll_entry_declare(struct log_driver, _name, log_driver) +/* Get a pointer to a given driver */ +#define LOG_GET_DRIVER(__name) \ + ll_entry_get(struct log_driver, __name, log_driver) + /** * log_get_cat_name() - Get the name of a category * @@ -465,6 +469,19 @@ int log_add_filter(const char *drv_name, enum log_category_t cat_list[], */ int log_remove_filter(const char *drv_name, int filter_num); +/** + * log_device_set_enable() - Enable or disable a log device + * + * Devices are referenced by their driver, so use LOG_GET_DRIVER(name) to pass + * the driver to this function. For example if the driver is declared with + * LOG_DRIVER(wibble) then pass LOG_GET_DRIVER(wibble) here. + * + * @drv: Driver of device to enable + * @enable: true to enable, false to disable + * @return 0 if OK, -ENOENT if the driver was not found + */ +int log_device_set_enable(struct log_driver *drv, bool enable); + #if CONFIG_IS_ENABLED(LOG) /** * log_init() - Set up the log system ready for use |