staging: vc04_services: checkpatch cleanups
Subsystems (2)
cover staging: vc04_services: checkpatch cleanups
This patchset fixes various issues found by checkpatch.
Amarjargal Gundjalam (3):
staging: vc04_services: fix block comment style
staging: vc04_services: fix quoted string split across lines
staging: vc04_services: fix missing a blank line after declarations
.../interface/vchiq_arm/vchiq_arm.c | 192 ++++++------ .../interface/vchiq_arm/vchiq_arm.h | 27 +- .../interface/vchiq_arm/vchiq_cfg.h | 6 +- .../interface/vchiq_arm/vchiq_connected.c | 3 +- .../interface/vchiq_arm/vchiq_core.c | 277 ++++++++++-------- .../interface/vchiq_arm/vchiq_core.h | 55 ++-- .../interface/vchiq_arm/vchiq_debugfs.c | 8 +- .../interface/vchiq_arm/vchiq_ioctl.h | 1 + 8 files changed, 317 insertions(+), 252 deletions(-)
Signature · 1 line
2.25.1
PATCH 1/3 staging: vc04_services: fix block comment style
Fix block comments to adhere to the kernel coding style.
--- .../interface/vchiq_arm/vchiq_arm.c | 174 +++++++------- .../interface/vchiq_arm/vchiq_arm.h | 27 ++- .../interface/vchiq_arm/vchiq_cfg.h | 6 +- .../interface/vchiq_arm/vchiq_core.c | 222 +++++++++++------- .../interface/vchiq_arm/vchiq_core.h | 55 +++-- .../interface/vchiq_arm/vchiq_debugfs.c | 8 +- 6 files changed, 289 insertions(+), 203 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +94 -80
@@ -156,7 +156,8 @@ enum vchiq_status vchiq_initialise(struct vchiq_instance **instance_out)vchiq_log_trace (vchiq_core_log_level,"%s called" , __func__); -/* VideoCore may not be ready due to boot up timing. +/* +* VideoCore may not be ready due to boot up timing. * It may never be ready if kernel and firmware are mismatched,so don't * block forever. */
@@ -460,9 +461,9 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data,/* FIXME: why compare a dma address to a pointer? */ if ((bulk->data != (dma_addr_t )(uintptr_t )data) || (bulk->size != size)) { -/* This is not a retry of the previous one. -* Cancel the signal when the transfer -* completes. +/* +* This is not a retry of the previous one. +* Cancel the signal when the transfer completes. */ spin_lock (&bulk_waiter_spinlock); bulk->userdata =NULL ;
@@ -486,9 +487,7 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data,struct vchiq_bulk *bulk = waiter->bulk_waiter.bulk;if (bulk) { -/* Cancel the signal when the transfer -* completes. -*/ +/* Cancel the signal when the transfer completes. */ spin_lock (&bulk_waiter_spinlock); bulk->userdata =NULL ;spin_unlock (&bulk_waiter_spinlock);
@@ -507,10 +506,10 @@ vchiq_blocking_bulk_transfer(unsigned int handle, void *data,return status; }/**************************************************************************** -* -* add_completion -* -***************************************************************************/ +* +* add_completion +* +***************************************************************************/ static enum vchiq_status add_completion(struct vchiq_instance *instance, enum vchiq_reason reason,
@@ -551,15 +550,19 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason, completion->bulk_userdata = bulk_userdata;if (reason ==VCHIQ_SERVICE_CLOSED ) { -/* Take an extra reference, to be held until -this CLOSED notification is delivered. */ +/* +* Take an extra reference, to be held until +* this CLOSED notification is delivered. +*/ lock_service (user_service->service);if (instance->use_close_delivered) user_service->close_pending =1 ; } -/* A write barrier is needed here to ensure that the entire completion -record is written out before the insert point. */ +/* +* A write barrier is needed here to ensure that the entire completion +* record is written out before the insert point. +*/ wmb ();if (reason ==VCHIQ_MESSAGE_AVAILABLE )
@@ -574,20 +577,21 @@ add_completion(struct vchiq_instance *instance, enum vchiq_reason reason, }/**************************************************************************** -* -* service_callback -* -***************************************************************************/ +* +* service_callback +* +***************************************************************************/ static enum vchiq_status service_callback (enum vchiq_reason reason,struct vchiq_header *header,unsigned int handle,void *bulk_userdata) { -/* How do we ensure the callback goes to the right client? -** The service_user data points to a user_service record -** containing the original callback and the user state structure, which -** contains a circular buffer for completion records. -*/ +/* +* How do we ensure the callback goes to the right client? +* The service_user data points to a user_service record +* containing the original callback and the user state structure, which +* contains a circular buffer for completion records. +*/ struct user_service *user_service;struct vchiq_service *service;struct vchiq_instance *instance;
@@ -622,9 +626,10 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,DEBUG_COUNT (MSG_QUEUE_FULL_COUNT );vchiq_log_trace (vchiq_arm_log_level,"service_callback - msg queue full" ); -/* If there is no MESSAGE_AVAILABLE in the completion -** queue, add one -*/ +/* +* If there is no MESSAGE_AVAILABLE in the completion +* queue, add one +*/ if ((user_service->message_available_pos - instance->completion_remove) <0 ) {enum vchiq_status status;
@@ -661,10 +666,11 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header, (MSG_QUEUE_SIZE - 1)] = header; user_service->msg_insert++; -/* If there is a thread waiting in DEQUEUE_MESSAGE, or if -** there is a MESSAGE_AVAILABLE in the completion queue then -** bypass the completion queue. -*/ +/* +* If there is a thread waiting in DEQUEUE_MESSAGE, or if +* there is a MESSAGE_AVAILABLE in the completion queue then +* bypass the completion queue. +*/ if (((user_service->message_available_pos - instance->completion_remove) >=0 ) || user_service->dequeue_pending) {
@@ -687,10 +693,10 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header, }/**************************************************************************** -* -* user_service_free -* -***************************************************************************/ +* +* user_service_free +* +***************************************************************************/ static void user_service_free (void *userdata) {
@@ -698,10 +704,10 @@ user_service_free(void *userdata) }/**************************************************************************** -* -* close_delivered -* -***************************************************************************/ +* +* close_delivered +* +***************************************************************************/ static void close_delivered (struct user_service *user_service) { vchiq_log_info(vchiq_arm_log_level,
@@ -1012,8 +1018,7 @@ static int vchiq_irq_queue_bulk_tx_rx(struct vchiq_instance *instance,if ((status !=VCHIQ_RETRY ) ||fatal_signal_pending (current) || !waiter->bulk_waiter.bulk) {if (waiter->bulk_waiter.bulk) { -/* Cancel the signal when the transfer -** completes. */ +/* Cancel the signal when the transfer completes. */ spin_lock (&bulk_waiter_spinlock); waiter->bulk_waiter.bulk->userdata =NULL ;spin_unlock (&bulk_waiter_spinlock);
@@ -1179,8 +1184,7 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance,break ; }if (msgbufcount <=0 ) -/* Stall here for lack of a -** buffer for the message. */ +/* Stall here for lack of a buffer for the message. */ break ;/* Get the pointer from user space */ msgbufcount--;
@@ -1198,12 +1202,10 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance,break ; } -/* Now it has been copied, the message -** can be released. */ +/* Now it has been copied, the message can be released. */ vchiq_release_message (service->handle, header); -/* The completion must point to the -** msgbuf. */ +/* The completion must point to the msgbuf. */ user_completion.header = msgbuf; }
@@ -1246,10 +1248,10 @@ static int vchiq_ioc_await_completion(struct vchiq_instance *instance, }/**************************************************************************** -* -* vchiq_ioctl -* -***************************************************************************/ +* +* vchiq_ioctl +* +***************************************************************************/ static long vchiq_ioctl (struct file *file,unsigned int cmd,unsigned long arg) {
@@ -1347,8 +1349,10 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) user_service = service->base.userdata; -/* close_pending is false on first entry, and when the -wait in vchiq_close_service has been interrupted. */ +/* +* close_pending is false on first entry, and when the +* wait in vchiq_close_service has been interrupted. +*/ if (!user_service->close_pending) { status = (cmd ==VCHIQ_IOC_CLOSE_SERVICE ) ? vchiq_close_service(service->handle) :
@@ -1357,9 +1361,11 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)break ; } -/* close_pending is true once the underlying service -has been closed until the client library calls the -CLOSE_DELIVERED ioctl, signalling close_event. */ +/* +* close_pending is true once the underlying service +* has been closed until the client library calls the +* CLOSE_DELIVERED ioctl, signalling close_event. +*/ if (user_service->close_pending &&wait_for_completion_interruptible ( &user_service->close_event))
@@ -2001,10 +2007,10 @@ static int vchiq_release(struct inode *inode, struct file *file) }/**************************************************************************** -* -* vchiq_dump -* -***************************************************************************/ +* +* vchiq_dump +* +***************************************************************************/ int vchiq_dump (void *dump_context,const char *str,int len) {
@@ -2048,10 +2054,10 @@ int vchiq_dump(void *dump_context, const char *str, int len) }/**************************************************************************** -* -* vchiq_dump_platform_instance_state -* -***************************************************************************/ +* +* vchiq_dump_platform_instance_state +* +***************************************************************************/ int vchiq_dump_platform_instances (void *dump_context) {
@@ -2060,8 +2066,10 @@ int vchiq_dump_platform_instances(void *dump_context)int len;int i; -/* There is no list of instances, so instead scan all services, -marking those that have been dumped. */ +/* +* There is no list of instances, so instead scan all services, +* marking those that have been dumped. +*/ rcu_read_lock ();for (i =0 ; i < state->unused_service; i++) {
@@ -2114,10 +2122,10 @@ int vchiq_dump_platform_instances(void *dump_context) }/**************************************************************************** -* -* vchiq_dump_platform_service_state -* -***************************************************************************/ +* +* vchiq_dump_platform_service_state +* +***************************************************************************/ int vchiq_dump_platform_service_state (void *dump_context,struct vchiq_service *service)
@@ -2145,10 +2153,10 @@ int vchiq_dump_platform_service_state(void *dump_context, }/**************************************************************************** -* -* vchiq_read -* -***************************************************************************/ +* +* vchiq_read +* +***************************************************************************/ static ssize_t vchiq_read(struct file *file, char __user *buf,
@@ -2260,13 +2268,17 @@ vchiq_keepalive_thread_func(void *v)continue ; } -/* read and clear counters. Do release_count then use_count to -* prevent getting more releases than uses */ +/* +* read and clear counters. Do release_count then use_count to +* prevent getting more releases than uses +*/ rc =atomic_xchg (&arm_state->ka_release_count,0 ); uc =atomic_xchg (&arm_state->ka_use_count,0 ); -/* Call use/release service the requisite number of times. -* Process use before release so use counts don't go negative */ +/* +* Call use/release service the requisite number of times. +* Process use before release so use counts don't go negative +*/ while (uc--) {atomic_inc (&arm_state->ka_use_ack_count); status =vchiq_use_service (ka_handle);
@@ -2539,8 +2551,10 @@ vchiq_dump_service_use_state(struct vchiq_state *state)struct vchiq_arm_state *arm_state =vchiq_platform_get_arm_state (state);struct service_data_struct *service_data;int i, found =0 ; -/* If there's more than 64 services, only dump ones with -* non-zero counts */ +/* +* If there's more than 64 services, only dump ones with +* non-zero counts +*/ int only_nonzero =0 ;static const char *nz ="<-- preventing suspend" ;
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.h +15 -12
@@ -31,22 +31,25 @@ struct vchiq_arm_state {struct vchiq_state *state; -/* Global use count for videocore. -** This is equal to the sum of the use counts for all services. When -** this hits zero the videocore suspend procedure will be initiated. -*/ +/* +* Global use count for videocore. +* This is equal to the sum of the use counts for all services. When +* this hits zero the videocore suspend procedure will be initiated. +*/ int videocore_use_count; -/* Use count to track requests from videocore peer. -** This use count is not associated with a service, so needs to be -** tracked separately with the state. -*/ +/* +* Use count to track requests from videocore peer. +* This use count is not associated with a service, so needs to be +* tracked separately with the state. +*/ int peer_use_count; -/* Flag to indicate that the first vchiq connect has made it through. -** This means that both sides should be fully ready, and we should -** be able to suspend after this point. -*/ +/* +* Flag to indicate that the first vchiq connect has made it through. +* This means that both sides should be fully ready, and we should +* be able to suspend after this point. +*/ int first_connect; };
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_cfg.h +4 -2
@@ -7,8 +7,10 @@#define VCHIQ_MAGIC VCHIQ_MAKE_FOURCC('V', 'C', 'H', 'I')/* The version of VCHIQ - change with any non-trivial change */ #define VCHIQ_VERSION 8 -/* The minimum compatible version - update to match VCHIQ_VERSION with any -** incompatible change */ +/* +* The minimum compatible version - update to match VCHIQ_VERSION with any +* incompatible change +*/ #define VCHIQ_VERSION_MIN 3/* The version that introduced the VCHIQ_IOC_LIB_VERSION ioctl */
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +138 -84
442 lines not on this page · raw message
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.h +34 -21
101 lines not on this page · raw message
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_debugfs.c +4 -4
@@ -12,10 +12,10 @@#ifdef CONFIG_DEBUG_FS /**************************************************************************** -* -* log category entries -* -***************************************************************************/ +* +* log category entries +* +***************************************************************************/ #define DEBUGFS_WRITE_BUF_SIZE 256#define VCHIQ_LOG_ERROR_STR "error"
Signature · 1 line
2.25.1
PATCH 2/3 staging: vc04_services: fix quoted string split across lines
In reply to Amarjargal GundjalamFix checkpatch warning "fix quoted string split across lines".
--- .../interface/vchiq_arm/vchiq_arm.c | 15 ++--- .../interface/vchiq_arm/vchiq_connected.c | 3 +- .../interface/vchiq_arm/vchiq_core.c | 55 ++++++------------- 3 files changed, 24 insertions(+), 49 deletions(-)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +5 -10
@@ -610,8 +610,7 @@ service_callback(enum vchiq_reason reason, struct vchiq_header *header,return VCHIQ_SUCCESS ; vchiq_log_trace(vchiq_arm_log_level, - "%s - service %lx(%d,%p), reason %d, header %lx, " - "instance %lx, bulk_userdata %lx", + "%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,
@@ -1300,8 +1299,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg) rc =mutex_lock_killable (&instance->state->mutex);if (rc) {vchiq_log_error (vchiq_arm_log_level, -"vchiq: connect: could not lock mutex for " -"state %d: %d" , +"vchiq: connect: could not lock mutex for state %d: %d" , instance->state->id, rc); ret = -EINTR ;break ;
@@ -1384,8 +1382,7 @@ vchiq_ioctl(struct file *file, unsigned int cmd, unsigned long arg)vchiq_release_service_internal (service);if (status !=VCHIQ_SUCCESS ) { vchiq_log_error(vchiq_susp_log_level, - "%s: cmd %s returned error %d for " - "service %c%c%c%c:%03d", + "%s: cmd %s returned error %d for service %c%c%c%c:%03d", __func__, (cmd == VCHIQ_IOC_USE_SERVICE) ? "VCHIQ_IOC_USE_SERVICE" :
@@ -2347,8 +2344,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 (vchiq_susp_log_level,"%s null service " -"ptr" , __func__); +vchiq_log_error (vchiq_susp_log_level,"%s null service ptr" , __func__); ret =VCHIQ_ERROR ; goto out; }
@@ -2643,8 +2639,7 @@ vchiq_check_service(struct vchiq_service *service)if (ret ==VCHIQ_ERROR ) {vchiq_log_error (vchiq_susp_log_level, -"%s ERROR - %c%c%c%c:%d service count %d, " -"state count %d" , __func__, +"%s ERROR - %c%c%c%c:%d service count %d, state count %d" , __func__,VCHIQ_FOURCC_AS_4CHARS (service->base.fourcc), service->client_id, service->service_use_count, arm_state->videocore_use_count);
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_connected.c +1 -2
@@ -43,8 +43,7 @@ void vchiq_add_connected_callback(VCHIQ_CONNECTED_CALLBACK_T callback)else {if (g_num_deferred_callbacks >=MAX_CALLBACKS )vchiq_log_error (vchiq_core_log_level, -"There already %d callback registered - " -"please increase MAX_CALLBACKS" , +"There already %d callback registered - please increase MAX_CALLBACKS" , g_num_deferred_callbacks);else { g_deferred_callback[g_num_deferred_callbacks] =
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_core.c +18 -37
153 lines not on this page · raw message
Signature · 1 line
2.25.1
PATCH 3/3 staging: vc04_services: fix missing a blank line after declarations
In reply to Amarjargal GundjalamFix checkpatch warning "missing a blank line after declarations".
--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +++ .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 1 + 2 files changed, 4 insertions(+)
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +3 -0
@@ -1056,10 +1056,12 @@ static inline int vchiq_get_user_ptr(void __user **buf, void __user *ubuf, int iif (in_compat_syscall ()) {compat_uptr_t ptr32;compat_uptr_t __user *uptr = ubuf; + ret =get_user (ptr32, uptr + index); *buf =compat_ptr (ptr32); }else {uintptr_t ptr,__user *uptr = ubuf; + ret =get_user (ptr, uptr + index); *buf = (void __user *)ptr; }
@@ -1832,6 +1834,7 @@ static long vchiq_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { void __user *argp = compat_ptr(arg); +switch (cmd) {case VCHIQ_IOC_CREATE_SERVICE32 :return vchiq_compat_ioctl_create_service (file, cmd, argp);
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +1 -0
@@ -54,6 +54,7 @@ struct vchiq_await_completion {struct vchiq_completion_data __user *buf;unsigned int msgbufsize;unsigned int msgbufcount;/* IN/OUT */ +void *__user *msgbufs; };
Signature · 1 line
2.25.1
Greg KH
maintainerRe: [PATCH 3/3] staging: vc04_services: fix missing a blank line after declarations
Quoted 38 lines · Amarjargal Gundjalam
Fix checkpatch warning "missing a blank line after declarations".
Signed-off-by Amarjargal Gundjalam <[email protected]>--- drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c | 3 +++ .../staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h | 1 + 2 files changed, 4 insertions(+)drivers/staging/vc04_services/interface/vchiq_arm/vchiq_arm.c +3
-0@@ -1056,10 +1056,12 @@ static inline int vchiq_get_user_ptr(void __user **buf, void __user *ubuf, int iif (in_compat_syscall ()) {compat_uptr_t ptr32;compat_uptr_t __user *uptr = ubuf; + ret =get_user (ptr32, uptr + index); *buf =compat_ptr (ptr32); }else {uintptr_t ptr,__user *uptr = ubuf; + ret =get_user (ptr, uptr + index); *buf = (void __user *)ptr; }@@ -1832,6 +1834,7 @@ static long vchiq_compat_ioctl(struct file *file, unsigned int cmd, unsigned long arg) { void __user *argp = compat_ptr(arg); +switch (cmd) {case VCHIQ_IOC_CREATE_SERVICE32 :return vchiq_compat_ioctl_create_service (file, cmd, argp);drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +0
-0
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h struct vchiq_await_completion { · line 60
Quoted 7 lines
drivers/staging/vc04_services/interface/vchiq_arm/vchiq_ioctl.h +1
-0@@ -54,6 +54,7 @@ struct vchiq_await_completion {struct vchiq_completion_data __user *buf;unsigned int msgbufsize;unsigned int msgbufcount;/* IN/OUT */ +void *__user *msgbufs; };
This last chunk doesn't need to be made, checkpatch is incorrect there.
thanks,
greg k-h