staging: vc04_services: Drop custom logging
Subsystems (3)
v2 cover staging: vc04_services: Drop custom logging
This series also removes the vchiq_log_* macro and makes use of dev_dbg() directly.
Patch 1/5 is fix. It prevents passing NULL to one of vchiq_log_error(). The function there in question, does not have any users as of now. However, it is going to be used by the vc-sm-cma and bcm2835-isp drivers (posted on list for review [1]). There was discussion on v1, whether I should drop and add the function later, however, didn't conclude.
Patch 2/5 removes vchiq_log_error() macro
Patch 3/5 removes vchiq_log_warning() macro
Patch 4/5 removes vchiq_log_trace() macro
Patch 5/5 removes vchiq_log_debug() macro
This completes the following TODO item:
``` * Cleanup logging mechanism The driver should probably be using the standard kernel logging mechanisms such as dev_info, dev_dbg, and friends. ```
[1]: https://lore.kernel.org/linux-media/[email protected]/
Changes in v2:
- Separate out one fixup patch from v1 (Patch 1/9)and send separately
- Drop usage of log_type() and log_category() helpers. Directly use dev_dbg() as suggested by Greg KH.
- Drop __func__ annotation from all logs. Dynamic debug has 'f' decorator flag which can be used instead of manual __func__
- Reword commit messages.
Umang Jain (5):
staging: vc04_services: Do not pass NULL to vchiq_log_error()
staging: vc04_services: Drop vchiq_log_error() in favour of dev_dbg
staging: vc04_services: Drop vchiq_log_warning() in favour of dev_dbg
staging: vc04_services: Drop vchiq_log_trace() in favour of dev_dbg
staging: vc04_services: Drop vchiq_log_debug() in favour of dev_dbg
drivers/staging/vc04_services/interface/TODO | 5 - .../interface/vchiq_arm/vchiq_arm.c | 176 ++++---- .../interface/vchiq_arm/vchiq_connected.c | 8 +- .../interface/vchiq_arm/vchiq_connected.h | 4 +- .../interface/vchiq_arm/vchiq_core.c | 402 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 38 -- .../interface/vchiq_arm/vchiq_dev.c | 92 ++-- 7 files changed, 315 insertions(+), 410 deletions(-)
Signature · 1 line
2.41.0
PATCH v2 1/5 staging: vc04_services: Do not pass NULL to vchiq_log_error()
vchiq_add_connected_callback() logs using vchiq_log_error() macro, but passes NULL instead of a struct device pointer. Fix it.
vchiq_add_connected_callback() is not used anywhere in the vc04_services as of now. It will be used when we add new drivers(VC shared memory and bcm2835-isp), hence it kept as it is for now.
--- .../vc04_services/interface/vchiq_arm/vchiq_connected.c | 4 ++-- .../vc04_services/interface/vchiq_arm/vchiq_connected.h | 4 +++- 2 files changed, 5 insertions(+), 3 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +2 -2
@@ -27,7 +27,7 @@ static void connected_init(void)* be made immediately, otherwise it will be deferred until * vchiq_call_connected_callbacks is called. */ -void vchiq_add_connected_callback (void (*callback)(void )) +void vchiq_add_connected_callback (struct vchiq_device *device,void (*callback)(void )) {connected_init ();
@@ -39,7 +39,7 @@ void vchiq_add_connected_callback(void (*callback)(void))callback (); }else {if (g_num_deferred_callbacks >=MAX_CALLBACKS ) { -vchiq_log_error (NULL ,VCHIQ_CORE , +vchiq_log_error (&device->dev,VCHIQ_CORE ,"There already %d callback registered - please increase MAX_CALLBACKS" , g_num_deferred_callbacks); }else {
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.h +3 -1
@@ -1,10 +1,12 @@/* SPDX-License-Identifier: GPL-2.0 OR BSD-3-Clause */ /* Copyright (c) 2010-2012 Broadcom. All rights reserved. */ +#include "vchiq_bus.h" +#ifndef VCHIQ_CONNECTED_H #define VCHIQ_CONNECTED_H -void vchiq_add_connected_callback (void (*callback)(void )); +void vchiq_add_connected_callback (struct vchiq_device *device,void (*callback)(void ));void vchiq_call_connected_callbacks (void );#endif /* VCHIQ_CONNECTED_H */
Signature · 1 line
2.41.0
PATCH v2 2/5 staging: vc04_services: Drop vchiq_log_error() in favour of dev_dbg
In reply to Umang JainDrop vchiq_log_error() macro which wraps dev_dbg(). Introduce the usage of dev_dbg() directly.
Meanwhile at it, drop the usage of __func__ from the logs. Dynamic debug supports this via the 'f' decorator flag.
--- .../interface/vchiq_arm/vchiq_arm.c | 49 ++++---- .../interface/vchiq_arm/vchiq_connected.c | 6 +- .../interface/vchiq_arm/vchiq_core.c | 112 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 4 - .../interface/vchiq_arm/vchiq_dev.c | 45 ++++--- 5 files changed, 99 insertions(+), 117 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +20 -29
@@ -683,8 +683,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out)usleep_range (500 ,600 ); }if (i ==VCHIQ_INIT_RETRIES ) { -vchiq_log_error (state->dev,VCHIQ_CORE ,"%s: videocore not initialized\n" , - __func__); +dev_dbg (state->dev,"core: error: videocore not initialized\n" ); ret = -ENOTCONN ; goto failed; }else if (i >0 ) {
@@ -694,8 +693,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out) instance =kzalloc (sizeof (*instance),GFP_KERNEL );if (!instance) { -vchiq_log_error (state->dev,VCHIQ_CORE , -"%s: error allocating vchiq instance\n" , __func__); +dev_dbg (state->dev,"core: error: Cannot allocate vchiq instance\n" ); ret = -ENOMEM ; goto failed; }
@@ -967,8 +965,7 @@ vchiq_blocking_bulk_transfer(struct vchiq_instance *instance, unsigned int handl }else { waiter =kzalloc (sizeof (*waiter),GFP_KERNEL );if (!waiter) { -vchiq_log_error (service->state->dev,VCHIQ_CORE , -"%s - out of memory" , __func__); +dev_dbg (service->state->dev,"core: error: Out of memory\n" );return -ENOMEM ; } }
@@ -1290,8 +1287,8 @@ vchiq_keepalive_vchiq_callback(struct vchiq_instance *instance,struct vchiq_header *header, unsigned int service_user, void *bulk_user) { - vchiq_log_error(instance->state->dev, VCHIQ_SUSPEND, - "%s callback reason %d", __func__, reason); + dev_dbg(instance->state->dev, "suspend: error: callback reason %d\n", +reason );return 0 ; }
@@ -1315,22 +1312,19 @@ vchiq_keepalive_thread_func(void *v) ret =vchiq_initialise (&instance);if (ret) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"%s vchiq_initialise failed %d" , __func__, ret); +dev_dbg (state->dev,"suspend: error: vchiq_initialise failed %d\n" , ret); goto exit; } status =vchiq_connect (instance);if (status) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"%s vchiq_connect failed %d" , __func__, status); +dev_dbg (state->dev,"suspend: error: vchiq_connect failed %d\n" , status); goto shutdown; } status =vchiq_add_service (instance, ¶ms, &ka_handle);if (status) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"%s vchiq_open_service failed %d" , __func__, status); +dev_dbg (state->dev,"suspend: error: vchiq_open_service failed %d\n" , status); goto shutdown; }
@@ -1338,8 +1332,7 @@ vchiq_keepalive_thread_func(void *v)long rc =0 , uc =0 ;if (wait_for_completion_interruptible (&arm_state->ka_evt)) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"%s interrupted" , __func__); +dev_dbg (state->dev,"suspend: error: interrupted\n" );flush_signals (current);continue ; }
@@ -1359,16 +1352,15 @@ vchiq_keepalive_thread_func(void *v)atomic_inc (&arm_state->ka_use_ack_count); status =vchiq_use_service (instance, ka_handle);if (status) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"%s vchiq_use_service error %d" , __func__, status); +dev_dbg (state->dev,"suspend: error: vchiq_use_service error %d\n" , + status); } }while (rc--) { status =vchiq_release_service (instance, ka_handle);if (status) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"%s vchiq_release_service error %d" , __func__, - status); +dev_dbg (state->dev,"suspend: error: vchiq_release_service error %d\n" , + status); } } }
@@ -1403,7 +1395,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, service->client_id); entity_uc = &service->service_use_count; }else { -vchiq_log_error (state->dev,VCHIQ_SUSPEND ,"%s null service ptr" , __func__); +dev_dbg (state->dev,"suspend: error: null service ptr\n" ); ret = -EINVAL ; goto out; }
@@ -1686,10 +1678,10 @@ vchiq_check_service(struct vchiq_service *service)read_unlock_bh (&arm_state->susp_res_lock);if (ret) { -vchiq_log_error (service->state->dev,VCHIQ_SUSPEND , -"%s ERROR - %p4cc:%d service count %d, state count %d" , __func__, - &service->base.fourcc, service->client_id, - service->service_use_count, arm_state->videocore_use_count); +dev_dbg (service->state->dev, +"suspend: error: %p4cc:%d service count %d, state count %d\n" , + &service->base.fourcc, service->client_id, service->service_use_count, + arm_state->videocore_use_count);vchiq_dump_service_use_state (service->state); } out:
@@ -1722,9 +1714,8 @@ void vchiq_platform_conn_state_changed(struct vchiq_state *state, (void *)state, threadname);if (IS_ERR (arm_state->ka_thread)) { -vchiq_log_error (state->dev,VCHIQ_SUSPEND , -"vchiq: FATAL: couldn't create thread %s" , - threadname); +dev_dbg (state->dev,"suspend: error: Couldn't create thread %s\n" , + threadname); }else {wake_up_process (arm_state->ka_thread); }
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +3 -3
@@ -39,9 +39,9 @@ void vchiq_add_connected_callback(struct vchiq_device *device, void (*callback)(callback (); }else {if (g_num_deferred_callbacks >=MAX_CALLBACKS ) { -vchiq_log_error (&device->dev,VCHIQ_CORE , -"There already %d callback registered - please increase MAX_CALLBACKS" , - g_num_deferred_callbacks); +dev_dbg (&device->dev, +"core: error: There already %d callback registered - please increase MAX_CALLBACKS\n" , + g_num_deferred_callbacks); }else { g_deferred_callback[g_num_deferred_callbacks] = callback;
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +54 -58
236 lines not on this page · raw message
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +0 -4
@@ -53,10 +53,6 @@ static inline const char *log_category_str(enum vchiq_log_category c)return strings[c]; }; -#ifndef vchiq_log_error -#define vchiq_log_error (dev, cat, fmt, ...) \ - do { dev_dbg(dev, "%s error: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0) -#endif #ifndef vchiq_log_warning#define vchiq_log_warning (dev, cat, fmt, ...) \ do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +22 -23
87 lines not on this page · raw message
Signature · 1 line
2.41.0
PATCH v2 3/5 staging: vc04_services: Drop vchiq_log_warning() in favour of dev_dbg
In reply to Umang JainDrop vchiq_log_warning() macro which wraps dev_dbg(). Introduce the usage of dev_dbg() directly.
Meanwhile at it, drop the usage of __func__ from the logs. Dynamic debug supports this via the 'f' decorator flag.
--- .../interface/vchiq_arm/vchiq_arm.c | 29 ++++++++---------- .../interface/vchiq_arm/vchiq_core.c | 30 +++++++++---------- .../interface/vchiq_arm/vchiq_core.h | 4 --- 3 files changed, 28 insertions(+), 35 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +13 -16
@@ -687,8 +687,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out) ret = -ENOTCONN ; goto failed; }else if (i >0 ) { -vchiq_log_warning (state->dev,VCHIQ_CORE , -"%s: videocore initialized after %d retries\n" , __func__, i); +dev_dbg (state->dev,"core: warn: videocore initialized after %d retries\n" , i); } instance =kzalloc (sizeof (*instance),GFP_KERNEL );
@@ -1643,20 +1642,19 @@ vchiq_dump_service_use_state(struct vchiq_state *state)read_unlock_bh (&arm_state->susp_res_lock);if (only_nonzero) -vchiq_log_warning (state->dev,VCHIQ_SUSPEND , -"Too many active services (%d). Only dumping up to first %d services with non-zero use-count" , - active_services, found); +dev_dbg (state->dev, +"suspend: warn: Too many active services (%d). Only dumping up to first %d services with non-zero use-count\n" , + active_services, found);for (i =0 ; i < found; i++) { -vchiq_log_warning (state->dev,VCHIQ_SUSPEND , -"%p4cc:%d service count %d %s" , - &service_data[i].fourcc, - service_data[i].clientid, service_data[i].use_count, - service_data[i].use_count ? nz :"" ); +dev_dbg (state->dev, +"suspend: warn: %p4cc:%d service count %d %s\n" , + &service_data[i].fourcc, + service_data[i].clientid, service_data[i].use_count, + service_data[i].use_count ? nz :"" ); } -vchiq_log_warning (state->dev,VCHIQ_SUSPEND ,"VCHIQ use count %d" , peer_count); -vchiq_log_warning (state->dev,VCHIQ_SUSPEND ,"Overall vchiq instance use count %d" , - vc_use_count); +dev_dbg (state->dev,"suspend: warn: VCHIQ use count %d\n" , peer_count); +dev_dbg (state->dev,"suspend: warn: Overall vchiq instance use count %d\n" , vc_use_count);kfree (service_data); }
@@ -1770,8 +1768,7 @@ static int vchiq_probe(struct platform_device *pdev)*/ err =vchiq_register_chrdev (&pdev->dev);if (err) { -vchiq_log_warning (&pdev->dev,VCHIQ_ARM , -"Failed to initialize vchiq cdev" ); +dev_dbg (&pdev->dev,"arm: warn: Failed to initialize vchiq cdev\n" ); goto error_exit; }
@@ -1781,7 +1778,7 @@ static int vchiq_probe(struct platform_device *pdev)return 0 ; failed_platform_init: -vchiq_log_warning (&pdev->dev,VCHIQ_ARM ,"could not initialize vchiq platform" ); +dev_dbg (&pdev->dev,"arm: warn: Could not initialize vchiq platform\n" ); error_exit:return err; }
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +15 -15
@@ -465,9 +465,9 @@ make_service_callback(struct vchiq_service *service, enum vchiq_reason reason, status = service->base.callback (service->instance, reason, header, service->handle, bulk_userdata);if (status && (status != -EAGAIN )) { -vchiq_log_warning (service->state->dev,VCHIQ_CORE , -"%d: ignoring ERROR from callback to service %x" , - service->state->id, service->handle); +dev_dbg (service->state->dev, +"core: warn: %d: ignoring ERROR from callback to service %x\n" , + service->state->id, service->handle); status =0 ; }
@@ -1609,10 +1609,10 @@ parse_message(struct vchiq_state *state, struct vchiq_header *header)vchiq_service_put (service); service =get_connected_service (state, remoteport);if (service) -vchiq_log_warning (state->dev,VCHIQ_CORE , -"%d: prs %s@%pK (%d->%d) - found connected service %d" , - state->id,msg_type_str (type), header, - remoteport, localport, service->localport); +dev_dbg (state->dev, +"core: warn: %d: prs %s@%pK (%d->%d) - found connected service %d\n" , + state->id,msg_type_str (type), header, + remoteport, localport, service->localport); }if (!service) {
@@ -2902,10 +2902,10 @@ vchiq_close_service(struct vchiq_instance *instance, unsigned int handle) (service->srvstate == VCHIQ_SRVSTATE_OPEN)) break; -vchiq_log_warning (service->state->dev,VCHIQ_CORE , -"%d: close_service:%d - waiting in state %s" , - service->state->id, service->localport, - srvstate_names[service->srvstate]); +dev_dbg (service->state->dev, +"core: warn: %d: close_service:%d - waiting in state %s\n" , + service->state->id, service->localport, + srvstate_names[service->srvstate]); } if (!status &&
@@ -2963,10 +2963,10 @@ vchiq_remove_service(struct vchiq_instance *instance, unsigned int handle) (service->srvstate == VCHIQ_SRVSTATE_OPEN)) break; -vchiq_log_warning (service->state->dev,VCHIQ_CORE , -"%d: remove_service:%d - waiting in state %s" , - service->state->id, service->localport, - srvstate_names[service->srvstate]); +dev_dbg (service->state->dev, +"core: warn: %d: remove_service:%d - waiting in state %s\n" , + service->state->id, service->localport, + srvstate_names[service->srvstate]); }if (!status && (service->srvstate !=VCHIQ_SRVSTATE_FREE ))
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +0 -4
@@ -53,10 +53,6 @@ static inline const char *log_category_str(enum vchiq_log_category c)return strings[c]; }; -#ifndef vchiq_log_warning -#define vchiq_log_warning (dev, cat, fmt, ...) \ - do { dev_dbg(dev, "%s warning: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0) -#endif #ifndef vchiq_log_debug#define vchiq_log_debug (dev, cat, fmt, ...) \ do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)
Signature · 1 line
2.41.0
PATCH v2 4/5 staging: vc04_services: Drop vchiq_log_trace() in favour of dev_dbg
In reply to Umang JainDrop vchiq_log_trace() macro which wraps dev_dbg(). Introduce the usage of dev_dbg() directly.
Meanwhile at it, drop the usage of __func__ from the logs. Dynamic debug supports this via the 'f' decorator flag.
--- .../interface/vchiq_arm/vchiq_arm.c | 53 ++++----- .../interface/vchiq_arm/vchiq_core.c | 101 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 4 - .../interface/vchiq_arm/vchiq_dev.c | 15 ++- 4 files changed, 78 insertions(+), 95 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +22 -31
@@ -255,8 +255,7 @@ create_pagelist(struct vchiq_instance *instance, char *buf, char __user *ubuf, pagelist =dma_alloc_coherent (instance->state->dev, pagelist_size, &dma_addr,GFP_KERNEL ); -vchiq_log_trace (instance->state->dev,VCHIQ_ARM , -"%s - %pK" , __func__, pagelist); +dev_dbg (instance->state->dev,"arm: trace: %pK\n" , pagelist);if (!pagelist)return NULL ;
@@ -407,8 +406,7 @@ free_pagelist(struct vchiq_instance *instance, struct vchiq_pagelist_info *pagelstruct page **pages = pagelistinfo->pages;unsigned int num_pages = pagelistinfo->num_pages; -vchiq_log_trace (instance->state->dev,VCHIQ_ARM , -"%s - %pK, %d" , __func__, pagelistinfo->pagelist, actual); +dev_dbg (instance->state->dev,"arm: trace: %pK, %d\n" , pagelistinfo->pagelist, actual);/* * NOTE: dma_unmap_sg must be called before the
@@ -707,8 +705,7 @@ int vchiq_initialise(struct vchiq_instance **instance_out) ret =0 ; failed: -vchiq_log_trace (state->dev,VCHIQ_CORE , -"%s(%p): returning %d" , __func__, instance, ret); +dev_dbg (state->dev,"core: trace: (%p): returning %d\n" , instance, ret);return ret; }
@@ -741,8 +738,7 @@ int vchiq_shutdown(struct vchiq_instance *instance)mutex_unlock (&state->mutex); -vchiq_log_trace (state->dev,VCHIQ_CORE , -"%s(%p): returning %d" , __func__, instance, status); +dev_dbg (state->dev,"core: trace: (%p): returning %d\n" , instance, status);free_bulk_waiter (instance);kfree (instance);
@@ -762,8 +758,8 @@ int vchiq_connect(struct vchiq_instance *instance)struct vchiq_state *state = instance->state;if (mutex_lock_killable (&state->mutex)) { -vchiq_log_trace (state->dev,VCHIQ_CORE , -"%s: call to mutex_lock failed" , __func__); +dev_dbg (state->dev, +"core: trace: call to mutex_lock failed\n" ); status = -EAGAIN ; goto failed; }
@@ -775,8 +771,7 @@ int vchiq_connect(struct vchiq_instance *instance)mutex_unlock (&state->mutex); failed: -vchiq_log_trace (state->dev,VCHIQ_CORE , -"%s(%p): returning %d" , __func__, instance, status); +dev_dbg (state->dev,"core: trace: (%p): returning %d\n" , instance, status);return status; }
@@ -807,8 +802,7 @@ vchiq_add_service(struct vchiq_instance *instance, status = -EINVAL ; } -vchiq_log_trace (state->dev,VCHIQ_CORE , -"%s(%p): returning %d" , __func__, instance, status); +dev_dbg (state->dev,"core: trace: (%p): returning %d\n" , instance, status);return status; }
@@ -839,8 +833,7 @@ vchiq_open_service(struct vchiq_instance *instance, } failed: -vchiq_log_trace (state->dev,VCHIQ_CORE , -"%s(%p): returning %d" , __func__, instance, status); +dev_dbg (state->dev,"core: trace: (%p): returning %d\n" , instance, status);return status; }
@@ -1009,8 +1002,7 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,while ((insert - instance->completion_remove) >=MAX_COMPLETIONS ) {/* Out of space - wait for the client */ DEBUG_TRACE (SERVICE_CALLBACK_LINE ); -vchiq_log_trace (instance->state->dev,VCHIQ_CORE , -"%s - completion queue full" , __func__); +dev_dbg (instance->state->dev,"core: trace: completion queue full\n" );DEBUG_COUNT (COMPLETION_QUEUE_FULL_COUNT );if (wait_for_completion_interruptible (&instance->remove_event)) { vchiq_log_debug(instance->state->dev, VCHIQ_ARM,
@@ -1098,11 +1090,11 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,vchiq_service_get (service);rcu_read_unlock (); -vchiq_log_trace (service->state->dev,VCHIQ_ARM , -"%s - service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx" , - __func__, (unsigned long )user_service, service->localport, - user_service->userdata, reason, (unsigned long )header, - (unsigned long )instance, (unsigned long )bulk_userdata); +dev_dbg (service->state->dev, +"arm: trace: service %lx(%d,%p), reason %d, header %lx, instance %lx, bulk_userdata %lx\n" , + (unsigned long )user_service, service->localport, + user_service->userdata, reason, (unsigned long )header, + (unsigned long )instance, (unsigned long )bulk_userdata);if (header && user_service->is_vchi) {spin_lock (&msg_queue_spinlock);
@@ -1111,8 +1103,7 @@ service_callback(struct vchiq_instance *instance, enum vchiq_reason reason,spin_unlock (&msg_queue_spinlock);DEBUG_TRACE (SERVICE_CALLBACK_LINE );DEBUG_COUNT (MSG_QUEUE_FULL_COUNT ); -vchiq_log_trace (service->state->dev,VCHIQ_ARM , -"%s - msg queue full" , __func__); +dev_dbg (service->state->dev,"arm: trace: msg queue full\n" );/* * If there is no MESSAGE_AVAILABLE in the completion * queue, add one
@@ -1403,8 +1394,8 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, local_uc = ++arm_state->videocore_use_count; ++(*entity_uc); -vchiq_log_trace (state->dev,VCHIQ_SUSPEND ,"%s %s count %d, state count %d" , - __func__, entity, *entity_uc, local_uc); +dev_dbg (state->dev,"suspend: trace: %s count %d, state count %d\n" , + entity, *entity_uc, local_uc);write_unlock_bh (&arm_state->susp_res_lock);
@@ -1423,7 +1414,7 @@ vchiq_use_internal(struct vchiq_state *state, struct vchiq_service *service, } out: -vchiq_log_trace (state->dev,VCHIQ_SUSPEND ,"%s exit %d" , __func__, ret); +dev_dbg (state->dev,"suspend: trace: exit %d\n" , ret);return ret; }
@@ -1461,14 +1452,14 @@ vchiq_release_internal(struct vchiq_state *state, struct vchiq_service *service) --arm_state->videocore_use_count; --(*entity_uc); -vchiq_log_trace (state->dev,VCHIQ_SUSPEND ,"%s %s count %d, state count %d" , - __func__, entity, *entity_uc, arm_state->videocore_use_count); +dev_dbg (state->dev,"suspend: trace: %s count %d, state count %d\n" , + entity, *entity_uc, arm_state->videocore_use_count); unlock:write_unlock_bh (&arm_state->susp_res_lock); out: -vchiq_log_trace (state->dev,VCHIQ_SUSPEND ,"%s exit %d" , __func__, ret); +dev_dbg (state->dev,"suspend: trace: exit %d\n" , ret);return ret; }
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +49 -52
195 lines not on this page · raw message
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +0 -4
@@ -57,10 +57,6 @@ static inline const char *log_category_str(enum vchiq_log_category c)#define vchiq_log_debug (dev, cat, fmt, ...) \ do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0)#endif -#ifndef vchiq_log_trace -#define vchiq_log_trace (dev, cat, fmt, ...) \ - do { dev_dbg(dev, "%s trace: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0) -#endif #define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1)#define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +7 -8
@@ -582,10 +582,9 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)long ret =0 ;int i, rc; -vchiq_log_trace (instance->state->dev,VCHIQ_ARM , -"%s - instance %pK, cmd %s, arg %lx" , __func__, instance, - ((_IOC_TYPE (cmd) ==VCHIQ_IOC_MAGIC ) && (_IOC_NR (cmd) <=VCHIQ_IOC_MAX )) ? - ioctl_names[_IOC_NR (cmd)] :"<invalid>" , arg); +dev_dbg (instance->state->dev,"arm: trace: instance %pK, cmd %s, arg %lx\n" , instance, + ((_IOC_TYPE (cmd) ==VCHIQ_IOC_MAGIC ) && (_IOC_NR (cmd) <=VCHIQ_IOC_MAX )) ? + ioctl_names[_IOC_NR (cmd)] :"<invalid>" , arg);switch (cmd) {case VCHIQ_IOC_SHUTDOWN :
@@ -873,10 +872,10 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) instance, (_IOC_NR (cmd) <=VCHIQ_IOC_MAX ) ? ioctl_names[_IOC_NR(cmd)] : "<invalid>", status, ret); }else { -vchiq_log_trace (instance->state->dev,VCHIQ_ARM , -" ioctl instance %pK, cmd %s -> status %d, %ld" , - instance, (_IOC_NR (cmd) <=VCHIQ_IOC_MAX ) ? - ioctl_names[_IOC_NR (cmd)] :"<invalid>" , status, ret); +dev_dbg (instance->state->dev, +"arm: trace: ioctl instance %pK, cmd %s -> status %d\n, %ld\n" , + instance, (_IOC_NR (cmd) <=VCHIQ_IOC_MAX ) ? + ioctl_names[_IOC_NR (cmd)] :"<invalid>" , status, ret); }return ret;
Signature · 1 line
2.41.0
PATCH v2 5/5 staging: vc04_services: Drop vchiq_log_debug() in favour of dev_dbg
In reply to Umang JainDrop vchiq_log_debug() macro which wraps dev_dbg(). Introduce the usage of dev_dbg() directly.
Meanwhile at it, drop the usage of __func__ from the logs. Dynamic debug supports this via the 'f' decorator flag.
Remove the entry from TODO regarding custom logging. VC04 is now aligned according to the standard kernel logging mechanisms.
--- drivers/staging/vc04_services/interface/TODO | 5 - .../interface/vchiq_arm/vchiq_arm.c | 45 +++-- .../interface/vchiq_arm/vchiq_core.c | 159 ++++++++---------- .../interface/vchiq_arm/vchiq_core.h | 26 --- .../interface/vchiq_arm/vchiq_dev.c | 32 ++-- 5 files changed, 106 insertions(+), 161 deletions(-)
drivers/staging/vc04_services/interface/TODO +0 -5
@@ -23,11 +23,6 @@ should properly handle a module unload. This also includes that all resources must be freed (kthreads, debugfs entries, ...) and global variables avoided. -* Cleanup logging mechanism - -The driver should probably be using the standard kernel logging mechanisms -such as dev_info, dev_dbg, and friends. - * Documentation A short top-down description of this driver's architecture (function of
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +19 -26
105 lines not on this page · raw message
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +73 -86
341 lines not on this page · raw message
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +0 -26
@@ -32,32 +32,6 @@#define VCHIQ_SLOT_SIZE 4096#define VCHIQ_MAX_MSG_SIZE (VCHIQ_SLOT_SIZE - sizeof(struct vchiq_header)) -enum vchiq_log_category { -VCHIQ_ARM , -VCHIQ_CORE , -VCHIQ_CORE_MSG , -VCHIQ_SYNC , -VCHIQ_SUSPEND , -}; - -static inline const char *log_category_str (enum vchiq_log_category c) -{ -static const char *const strings[] = { -"vchiq_arm" , -"vchiq_core" , -"vchiq_core_msg" , -"vchiq_sync" , -"vchiq_suspend" , - }; - -return strings[c]; -}; - -#ifndef vchiq_log_debug -#define vchiq_log_debug (dev, cat, fmt, ...) \ - do { dev_dbg(dev, "%s debug: " fmt, log_category_str(cat), ##__VA_ARGS__); } while (0) -#endif -#define VCHIQ_SLOT_MASK (VCHIQ_SLOT_SIZE - 1)#define VCHIQ_SLOT_QUEUE_MASK (VCHIQ_MAX_SLOTS_PER_SIDE - 1)#define VCHIQ_SLOT_ZERO_SLOTS DIV_ROUND_UP(sizeof(struct vchiq_slot_zero), \
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_dev.c +14 -18
@@ -47,9 +47,8 @@ user_service_free(void *userdata)static void close_delivered (struct user_service *user_service) { -vchiq_log_debug (user_service->service->state->dev,VCHIQ_ARM , -"%s(handle=%x)" , - __func__, user_service->service->handle); +dev_dbg (user_service->service->state->dev, +"arm: debug: (handle=%x)\n" , user_service->service->handle);if (user_service->close_pending) {/* Allow the underlying service to be culled */
@@ -235,8 +234,7 @@ static int vchiq_ioc_dequeue_message(struct vchiq_instance *instance,spin_unlock (&msg_queue_spinlock);DEBUG_TRACE (DEQUEUE_MESSAGE_LINE );if (wait_for_completion_interruptible (&user_service->insert_event)) { -vchiq_log_debug (service->state->dev,VCHIQ_ARM , -"DEQUEUE_MESSAGE interrupted" ); +dev_dbg (service->state->dev,"arm: debug: DEQUEUE_MESSAGE interrupted\n" ); ret = -EINTR ;break ; }
@@ -323,8 +321,8 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance, ret = -ESRCH ; goto out; } -vchiq_log_debug (service->state->dev,VCHIQ_ARM , -"found bulk_waiter %pK for pid %d" , waiter, current->pid); +dev_dbg (service->state->dev,"arm: debug: found bulk_waiter %pK for pid %d\n" , + waiter, current->pid); userdata = &waiter->bulk_waiter; }else { userdata = args->userdata;
@@ -355,8 +353,8 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,mutex_lock (&instance->bulk_waiter_list_mutex);list_add (&waiter->list, &instance->bulk_waiter_list);mutex_unlock (&instance->bulk_waiter_list_mutex); -vchiq_log_debug (service->state->dev,VCHIQ_ARM , -"saved bulk_waiter %pK for pid %d" , waiter, current->pid); +dev_dbg (service->state->dev,"arm: debug: saved bulk_waiter %pK for pid %d\n" , + waiter, current->pid); ret =put_user (mode_waiting, mode); }
@@ -455,8 +453,7 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance,mutex_lock (&instance->completion_mutex);if (rc) {DEBUG_TRACE (AWAIT_COMPLETION_LINE ); -vchiq_log_debug (instance->state->dev,VCHIQ_ARM , -"AWAIT_COMPLETION interrupted" ); +dev_dbg (instance->state->dev,"arm: debug: AWAIT_COMPLETION interrupted\n" ); ret = -EINTR ; goto out; }
@@ -867,10 +864,10 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) }if (!status && (ret <0 ) && (ret != -EINTR ) && (ret != -EWOULDBLOCK )) { -vchiq_log_debug (instance->state->dev,VCHIQ_ARM , -" ioctl instance %pK, cmd %s -> status %d, %ld" , - instance, (_IOC_NR (cmd) <=VCHIQ_IOC_MAX ) ? - ioctl_names[_IOC_NR (cmd)] :"<invalid>" , status, ret); +dev_dbg (instance->state->dev, +"arm: debug: ioctl instance %pK, cmd %s -> status %d, %ld\n" , + instance, (_IOC_NR (cmd) <=VCHIQ_IOC_MAX ) ? + ioctl_names[_IOC_NR (cmd)] :"<invalid>" , status, ret); }else { dev_dbg(instance->state->dev, "arm: trace: ioctl instance %pK, cmd %s -> status %d\n, %ld\n",
@@ -1169,7 +1166,7 @@ static int vchiq_open(struct inode *inode, struct file *file)struct vchiq_state *state =vchiq_get_state ();struct vchiq_instance *instance; -vchiq_log_debug (state->dev,VCHIQ_ARM ,"vchiq_open" ); +dev_dbg (state->dev,"arm: debug: vchiq open\n" );if (!state) {dev_dbg (state->dev,"arm: error: vchiq has no connection to VideoCore\n" );
@@ -1204,8 +1201,7 @@ static int vchiq_release(struct inode *inode, struct file *file)int ret =0 ;int i; -vchiq_log_debug (state->dev,VCHIQ_ARM ,"%s: instance=%lx" , __func__, - (unsigned long )instance); +dev_dbg (state->dev,"arm: debug: instance=%lx\n" , (unsigned long )instance);if (!state) { ret = -EPERM ;
Signature · 1 line
2.41.0
Hi Umang,
Am 28.11.23 um 21:19 schrieb Umang Jain:
Quoted 2 lines
This series also removes the vchiq_log_* macro and makes use of
dev_dbg()directly.
sorry, i didn't had the time to follow the logging discussion, but the following commits:
staging: vc04: Convert vchiq_log_error() to use dynamic debug
staging: vc04: Convert vchiq_log_warning() to use dynamic debug
staging: vc04: Convert(and rename) vchiq_log_info() to use dynamic debug
changed the logging behavior. I don't think it's intended to move everything to dev_dbg.
I would expected the following mapping:vchiq_log_error -> dev_errvchiq_log_warning -> dev_warnvchiq_log_info -> dev_info
Quoted 48 lines
Patch 1/5 is fix. It prevents passing NULL to one of
vchiq_log_error(). The function there in question, does not have any users as of now. However, it is going to be used by the vc-sm-cma and bcm2835-isp drivers (posted on list for review [1]). There was discussion on v1, whether I should drop and add the function later, however, didn't conclude.Patch 2/5 removes
vchiq_log_error()macro
Patch 3/5 removesvchiq_log_warning()macro
Patch 4/5 removesvchiq_log_trace()macro
Patch 5/5 removesvchiq_log_debug()macroThis completes the following TODO item:
``` * Cleanup logging mechanism The driver should probably be using the standard kernel logging mechanisms such as dev_info, dev_dbg, and friends. ```[1]: https://lore.kernel.org/linux-media/[email protected]/
Changes in v2:
- Separate out one fixup patch from v1 (Patch 1/9)and send separately
- Drop usage oflog_type()andlog_category()helpers. Directly usedev_dbg()as suggested by Greg KH.
- Drop__func__annotation from all logs. Dynamic debug has 'f' decorator flag which can be used instead of manual__func__
- Reword commit messages.Umang Jain (5):
staging:vc04_services: Do not pass NULL tovchiq_log_error()
staging:vc04_services: Dropvchiq_log_error()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_warning()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_trace()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_debug()in favour ofdev_dbgdrivers/staging/vc04_services/interface/TODO | 5 - .../interface/vchiq_arm/vchiq_arm.c | 176 ++++---- .../interface/vchiq_arm/vchiq_connected.c | 8 +- .../interface/vchiq_arm/vchiq_connected.h | 4 +- .../interface/vchiq_arm/vchiq_core.c | 402 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 38 -- .../interface/vchiq_arm/vchiq_dev.c | 92 ++-- 7 files changed, 315 insertions(+), 410 deletions(-)
Hi Stefan,
Quoted 12 lines · Stefan Wahren
Hi Umang,
Am 28.11.23 um 21:19 schrieb Umang Jain:
Quoted 2 lines
This series also removes the vchiq_log_* macro and makes use of
dev_dbg()directly.sorry, i didn't had the time to follow the logging discussion, but the following commits:
staging: vc04: Convert
vchiq_log_error()to use dynamic debug
staging: vc04: Convertvchiq_log_warning()to use dynamic debug
staging: vc04: Convert(and rename)vchiq_log_info()to use dynamic debug
Quoted 6 lines
changed the logging behavior. I don't think it's intended to move everything to
dev_dbg.I would expected the following mapping:
vchiq_log_error->dev_errvchiq_log_warning->dev_warn
For this I agree,
Quoted 1 line
vchiq_log_info->dev_info
However, I think vchiq_log_info and vchiq_log_debug should be moved to dev_dbg.
Otherwise, I think they'll spew a ton of information to dmesg by default.
Quoted 49 lines
Quoted 48 lines
Patch 1/5 is fix. It prevents passing NULL to one of
vchiq_log_error(). The function there in question, does not have any users as of now. However, it is going to be used by the vc-sm-cma and bcm2835-isp drivers (posted on list for review [1]). There was discussion on v1, whether I should drop and add the function later, however, didn't conclude.Patch 2/5 removes
vchiq_log_error()macro
Patch 3/5 removesvchiq_log_warning()macro
Patch 4/5 removesvchiq_log_trace()macro
Patch 5/5 removesvchiq_log_debug()macroThis completes the following TODO item:
``` * Cleanup logging mechanism The driver should probably be using the standard kernel logging mechanisms such as dev_info, dev_dbg, and friends. ```[1]: https://lore.kernel.org/linux-media/[email protected]/
Changes in v2:
- Separate out one fixup patch from v1 (Patch 1/9)and send separately
- Drop usage oflog_type()andlog_category()helpers. Directly usedev_dbg()as suggested by Greg KH.
- Drop__func__annotation from all logs. Dynamic debug has 'f' decorator flag which can be used instead of manual__func__
- Reword commit messages.Umang Jain (5):
staging:vc04_services: Do not pass NULL tovchiq_log_error()
staging:vc04_services: Dropvchiq_log_error()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_warning()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_trace()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_debug()in favour ofdev_dbgdrivers/staging/vc04_services/interface/TODO | 5 - .../interface/vchiq_arm/vchiq_arm.c | 176 ++++---- .../interface/vchiq_arm/vchiq_connected.c | 8 +- .../interface/vchiq_arm/vchiq_connected.h | 4 +- .../interface/vchiq_arm/vchiq_core.c | 402 +++++++++--------- .../interface/vchiq_arm/vchiq_core.h | 38 -- .../interface/vchiq_arm/vchiq_dev.c | 92 ++--
7 files changed, 315 insertions(+), 410 deletions(-)
Hi Umang,
Am 05.12.23 um 07:39 schrieb Umang Jain:
Quoted 23 lines
Hi Stefan,
Quoted 13 lines · Stefan Wahren
Hi Umang,
Am 28.11.23 um 21:19 schrieb Umang Jain:
Quoted 3 lines
This series also removes the vchiq_log_* macro and makes use of
dev_dbg()
directly.sorry, i didn't had the time to follow the logging discussion, but the following commits:
staging: vc04: Convert
vchiq_log_error()to use dynamic debug
staging: vc04: Convertvchiq_log_warning()to use dynamic debug
staging: vc04: Convert(and rename)vchiq_log_info()to use dynamic debugQuoted 6 lines
changed the logging behavior. I don't think it's intended to move everything to
dev_dbg.I would expected the following mapping:
vchiq_log_error->dev_errvchiq_log_warning->dev_warn
Quoted 7 lines
For this I agree,
Quoted 1 line
vchiq_log_info->dev_infoHowever, I think
vchiq_log_infoandvchiq_log_debugshould be moved todev_dbg.Otherwise, I think they'll spew a ton of information to dmesg by default.
generally i agree. Unfortunately we need to double check every log message, because some of them are unnecessary.
Quoted 59 lines
Quoted 42 lines
Quoted 42 lines
Patch 1/5 is fix. It prevents passing NULL to one of
vchiq_log_error(). The function there in question, does not have any users as of now. However, it is going to be used by the vc-sm-cma and bcm2835-isp drivers (posted on list for review [1]). There was discussion on v1, whether I should drop and add the function later, however, didn't conclude.Patch 2/5 removes
vchiq_log_error()macro
Patch 3/5 removesvchiq_log_warning()macro
Patch 4/5 removesvchiq_log_trace()macro
Patch 5/5 removesvchiq_log_debug()macroThis completes the following TODO item:
``` * Cleanup logging mechanism The driver should probably be using the standard kernel logging mechanisms such as dev_info, dev_dbg, and friends. ```[1]:
https://lore.kernel.org/linux-media/[email protected]/Changes in v2:
- Separate out one fixup patch from v1 (Patch 1/9)and send separately
- Drop usage oflog_type()andlog_category()helpers. Directly usedev_dbg()as suggested by Greg KH.
- Drop__func__annotation from all logs. Dynamic debug has 'f' decorator flag which can be used instead of manual__func__
- Reword commit messages.Umang Jain (5):
staging:vc04_services: Do not pass NULL tovchiq_log_error()
staging:vc04_services: Dropvchiq_log_error()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_warning()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_trace()in favour ofdev_dbg
staging:vc04_services: Dropvchiq_log_debug()in favour ofdev_dbgQuoted 11 lines
Quoted 10 lines
drivers/staging/vc04_services/interface/TODO | 5 - .../interface/vchiq_arm/vchiq_arm.c | 176 ++++---- .../interface/vchiq_arm/vchiq_connected.c | 8 +- .../interface/vchiq_arm/vchiq_connected.h | 4 +- .../interface/vchiq_arm/vchiq_core.c | 402
+++++++++---------
.../interface/vchiq_arm/vchiq_core.h | 38 -- .../interface/vchiq_arm/vchiq_dev.c | 92 ++--7 files changed, 315 insertions(+), 410 deletions(-)_______________________________________________
linux-arm-kernel mailing list
[email protected]
http://lists.infradead.org/mailman/listinfo/linux-arm-kernel