Commit f67af594 authored by Umang Jain's avatar Umang Jain Committed by Greg Kroah-Hartman

staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug

Convert(and rename) vchiq_log_info() custom logging wrapping based on
printk to use dynamic debug. The wrapper is now renamed to
vchiq_log_debug() since most of the usage is around printing debug
information. The log category is dictated by enum vchiq_log_category
which will become the part of the debug string format that will be
logged to dynamic debug (for grep).

All the vchiq_log_info() calls are adjusted to use the
modified wrapper vchiq_log_debug().

The existing custom logging for vchiq_log_info() also tries
to log trace messages using SRVTRACE_LEVEL. This is simply
moved to use the vchiq_log_debug() directly.
Signed-off-by: default avatarUmang Jain <umang.jain@ideasonboard.com>
Link: https://lore.kernel.org/r/20231024114428.443528-6-umang.jain@ideasonboard.comSigned-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent 0b120863
...@@ -314,7 +314,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, ...@@ -314,7 +314,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf,
type == PAGELIST_READ, pages); type == PAGELIST_READ, pages);
if (actual_pages != num_pages) { if (actual_pages != num_pages) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"%s - only %d/%d pages locked", "%s - only %d/%d pages locked",
__func__, actual_pages, num_pages); __func__, actual_pages, num_pages);
...@@ -559,7 +559,7 @@ static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state ...@@ -559,7 +559,7 @@ static int vchiq_platform_init(struct platform_device *pdev, struct vchiq_state
return -ENXIO; return -ENXIO;
} }
vchiq_log_info(vchiq_arm_log_level, "vchiq_init - done (slots %pK, phys %pad)", vchiq_log_debug(&pdev->dev, VCHIQ_ARM, "vchiq_init - done (slots %pK, phys %pad)",
vchiq_slot_zero, &slot_phys); vchiq_slot_zero, &slot_phys);
vchiq_call_connected_callbacks(); vchiq_call_connected_callbacks();
...@@ -730,7 +730,8 @@ void free_bulk_waiter(struct vchiq_instance *instance) ...@@ -730,7 +730,8 @@ void free_bulk_waiter(struct vchiq_instance *instance)
list_for_each_entry_safe(waiter, next, list_for_each_entry_safe(waiter, next,
&instance->bulk_waiter_list, list) { &instance->bulk_waiter_list, list) {
list_del(&waiter->list); list_del(&waiter->list);
vchiq_log_info(vchiq_arm_log_level, "bulk_waiter - cleaned up %pK for pid %d", vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"bulk_waiter - cleaned up %pK for pid %d",
waiter, waiter->pid); waiter, waiter->pid);
kfree(waiter); kfree(waiter);
} }
...@@ -991,7 +992,8 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl ...@@ -991,7 +992,8 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl
mutex_lock(&instance->bulk_waiter_list_mutex); mutex_lock(&instance->bulk_waiter_list_mutex);
list_add(&waiter->list, &instance->bulk_waiter_list); list_add(&waiter->list, &instance->bulk_waiter_list);
mutex_unlock(&instance->bulk_waiter_list_mutex); mutex_unlock(&instance->bulk_waiter_list_mutex);
vchiq_log_info(vchiq_arm_log_level, "saved bulk_waiter %pK for pid %d", waiter, vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"saved bulk_waiter %pK for pid %d", waiter,
current->pid); current->pid);
} }
...@@ -1015,10 +1017,12 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1015,10 +1017,12 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
vchiq_log_trace(vchiq_arm_log_level, "%s - completion queue full", __func__); vchiq_log_trace(vchiq_arm_log_level, "%s - completion queue full", __func__);
DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT); DEBUG_COUNT(COMPLETION_QUEUE_FULL_COUNT);
if (wait_for_completion_interruptible(&instance->remove_event)) { if (wait_for_completion_interruptible(&instance->remove_event)) {
vchiq_log_info(vchiq_arm_log_level, "service_callback interrupted"); vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"service_callback interrupted");
return -EAGAIN; return -EAGAIN;
} else if (instance->closing) { } else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "service_callback closing"); vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"service_callback closing");
return 0; return 0;
} }
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
...@@ -1120,7 +1124,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1120,7 +1124,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
instance->completion_remove) < 0) { instance->completion_remove) < 0) {
int status; int status;
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"Inserting extra MESSAGE_AVAILABLE"); "Inserting extra MESSAGE_AVAILABLE");
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
status = add_completion(instance, reason, NULL, user_service, status = add_completion(instance, reason, NULL, user_service,
...@@ -1134,12 +1138,14 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason, ...@@ -1134,12 +1138,14 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
if (wait_for_completion_interruptible(&user_service->remove_event)) { if (wait_for_completion_interruptible(&user_service->remove_event)) {
vchiq_log_info(vchiq_arm_log_level, "%s interrupted", __func__); vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"%s interrupted", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service); vchiq_service_put(service);
return -EAGAIN; return -EAGAIN;
} else if (instance->closing) { } else if (instance->closing) {
vchiq_log_info(vchiq_arm_log_level, "%s closing", __func__); vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"%s closing", __func__);
DEBUG_TRACE(SERVICE_CALLBACK_LINE); DEBUG_TRACE(SERVICE_CALLBACK_LINE);
vchiq_service_put(service); vchiq_service_put(service);
return -EINVAL; return -EINVAL;
...@@ -1748,7 +1754,7 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state, ...@@ -1748,7 +1754,7 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state,
struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state); struct vchiq_arm_state *arm_state = vchiq_platform_get_arm_state(state);
char threadname[16]; char threadname[16];
vchiq_log_info(vchiq_susp_log_level, "%d: %s->%s", state->id, vchiq_log_debug(state->dev, VCHIQ_SUSPEND, "%d: %s->%s", state->id,
get_conn_state_name(oldstate), get_conn_state_name(newstate)); get_conn_state_name(oldstate), get_conn_state_name(newstate));
if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED) if (state->conn_state != VCHIQ_CONNSTATE_CONNECTED)
return; return;
...@@ -1814,7 +1820,7 @@ static int vchiq_probe(struct platform_device *pdev) ...@@ -1814,7 +1820,7 @@ static int vchiq_probe(struct platform_device *pdev)
vchiq_debugfs_init(); vchiq_debugfs_init();
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(&pdev->dev, VCHIQ_ARM,
"vchiq: platform initialised - version %d (min %d)", "vchiq: platform initialised - version %d (min %d)",
VCHIQ_VERSION, VCHIQ_VERSION_MIN); VCHIQ_VERSION, VCHIQ_VERSION_MIN);
......
...@@ -69,10 +69,9 @@ static inline const char *log_category_str(enum vchiq_log_category c) ...@@ -69,10 +69,9 @@ static inline const char *log_category_str(enum vchiq_log_category c)
#define vchiq_log_warning(dev, cat, fmt, ...) \ #define vchiq_log_warning(dev, cat, fmt, ...) \
do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0) do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
#endif #endif
#ifndef vchiq_log_info #ifndef vchiq_log_debug
#define vchiq_log_info(cat, fmt, ...) \ #define vchiq_log_debug(dev, cat, fmt, ...) \
do { if (cat >= VCHIQ_LOG_INFO) \ do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
printk(VCHIQ_LOG_PREFIX fmt "\n", ##__VA_ARGS__); } while (0)
#endif #endif
#ifndef vchiq_log_trace #ifndef vchiq_log_trace
#define vchiq_log_trace(cat, fmt, ...) \ #define vchiq_log_trace(cat, fmt, ...) \
......
...@@ -47,7 +47,7 @@ user_service_free(void *userdata) ...@@ -47,7 +47,7 @@ user_service_free(void *userdata)
static void close_delivered(struct user_service *user_service) static void close_delivered(struct user_service *user_service)
{ {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(user_service->service->state->dev, VCHIQ_ARM,
"%s(handle=%x)", "%s(handle=%x)",
__func__, user_service->service->handle); __func__, user_service->service->handle);
...@@ -235,7 +235,7 @@ static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance, ...@@ -235,7 +235,7 @@ static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance,
spin_unlock(&msg_queue_spinlock); spin_unlock(&msg_queue_spinlock);
DEBUG_TRACE(DEQUEUE_MESSAGE_LINE); DEBUG_TRACE(DEQUEUE_MESSAGE_LINE);
if (wait_for_completion_interruptible(&user_service->insert_event)) { if (wait_for_completion_interruptible(&user_service->insert_event)) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(service->state->dev, VCHIQ_ARM,
"DEQUEUE_MESSAGE interrupted"); "DEQUEUE_MESSAGE interrupted");
ret = -EINTR; ret = -EINTR;
break; break;
...@@ -323,7 +323,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, ...@@ -323,7 +323,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
ret = -ESRCH; ret = -ESRCH;
goto out; goto out;
} }
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(service->state->dev, VCHIQ_ARM,
"found bulk_waiter %pK for pid %d", waiter, current->pid); "found bulk_waiter %pK for pid %d", waiter, current->pid);
userdata = &waiter->bulk_waiter; userdata = &waiter->bulk_waiter;
} else { } else {
...@@ -355,7 +355,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, ...@@ -355,7 +355,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,
mutex_lock(&instance->bulk_waiter_list_mutex); mutex_lock(&instance->bulk_waiter_list_mutex);
list_add(&waiter->list, &instance->bulk_waiter_list); list_add(&waiter->list, &instance->bulk_waiter_list);
mutex_unlock(&instance->bulk_waiter_list_mutex); mutex_unlock(&instance->bulk_waiter_list_mutex);
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(service->state->dev, VCHIQ_ARM,
"saved bulk_waiter %pK for pid %d", waiter, current->pid); "saved bulk_waiter %pK for pid %d", waiter, current->pid);
ret = put_user(mode_waiting, mode); ret = put_user(mode_waiting, mode);
...@@ -455,7 +455,7 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, ...@@ -455,7 +455,7 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance,
mutex_lock(&instance->completion_mutex); mutex_lock(&instance->completion_mutex);
if (rc) { if (rc) {
DEBUG_TRACE(AWAIT_COMPLETION_LINE); DEBUG_TRACE(AWAIT_COMPLETION_LINE);
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
"AWAIT_COMPLETION interrupted"); "AWAIT_COMPLETION interrupted");
ret = -EINTR; ret = -EINTR;
goto out; goto out;
...@@ -868,16 +868,17 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) ...@@ -868,16 +868,17 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)
ret = -EINTR; ret = -EINTR;
} }
if (!status && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK)) if (!status && (ret < 0) && (ret != -EINTR) && (ret != -EWOULDBLOCK)) {
vchiq_log_info(vchiq_arm_log_level, vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
" ioctl instance %pK, cmd %s -> status %d, %ld", " ioctl instance %pK, cmd %s -> status %d, %ld",
instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ?
ioctl_names[_IOC_NR(cmd)] : "<invalid>", status, ret); ioctl_names[_IOC_NR(cmd)] : "<invalid>", status, ret);
else } else {
vchiq_log_trace(vchiq_arm_log_level, vchiq_log_trace(vchiq_arm_log_level,
" ioctl instance %pK, cmd %s -> status %d, %ld", " ioctl instance %pK, cmd %s -> status %d, %ld",
instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ? instance, (_IOC_NR(cmd) <= VCHIQ_IOC_MAX) ?
ioctl_names[_IOC_NR(cmd)] : "<invalid>", status, ret); ioctl_names[_IOC_NR(cmd)] : "<invalid>", status, ret);
}
return ret; return ret;
} }
...@@ -1170,7 +1171,7 @@ static int vchiq_open(struct inode *inode, struct file *file) ...@@ -1170,7 +1171,7 @@ static int vchiq_open(struct inode *inode, struct file *file)
struct vchiq_state *state = vchiq_get_state(); struct vchiq_state *state = vchiq_get_state();
struct vchiq_instance *instance; struct vchiq_instance *instance;
vchiq_log_info(vchiq_arm_log_level, "vchiq_open"); vchiq_log_debug(state->dev, VCHIQ_ARM, "vchiq_open");
if (!state) { if (!state) {
vchiq_log_error(state->dev, VCHIQ_ARM, vchiq_log_error(state->dev, VCHIQ_ARM,
...@@ -1206,7 +1207,7 @@ static int vchiq_release(struct inode *inode, struct file *file) ...@@ -1206,7 +1207,7 @@ static int vchiq_release(struct inode *inode, struct file *file)
int ret = 0; int ret = 0;
int i; int i;
vchiq_log_info(vchiq_arm_log_level, "%s: instance=%lx", __func__, vchiq_log_debug(state->dev, VCHIQ_ARM, "%s: instance=%lx", __func__,
(unsigned long)instance); (unsigned long)instance);
if (!state) { if (!state) {
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment