staging: wilc1000: rename struct __Message_struct
PATCH 1/27 staging: wilc1000: rename struct __Message_struct
This patch renames typedef from struct __Message_struct and renames it to struct message.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 10 +++++----- drivers/staging/wilc1000/wilc_msgqueue.h | 8 ++++---- 2 files changed, 9 insertions(+), 9 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +5 -5
@@ -38,7 +38,7 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle) }while (pHandle->pstrMessageList) { -Message *pstrMessge = pHandle->pstrMessageList->pstrNext; +struct message *pstrMessge = pHandle->pstrMessageList->pstrNext;kfree (pHandle->pstrMessageList); pHandle->pstrMessageList = pstrMessge;
@@ -57,7 +57,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, const void *pvSendBuffer, u32 u32SendBufferSize) { unsigned long flags; -Message *pstrMessage =NULL ; +struct message *pstrMessage =NULL ;if ((!pHandle) || (u32SendBufferSize ==0 ) || (!pvSendBuffer)) {PRINT_ER ("pHandle or pvSendBuffer is null\n" );
@@ -70,7 +70,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, }/* construct a new message */ - pstrMessage =kmalloc (sizeof (Message),GFP_ATOMIC ); + pstrMessage =kmalloc (sizeof (struct message ),GFP_ATOMIC );if (!pstrMessage)return -ENOMEM ;
@@ -89,7 +89,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,if (!pHandle->pstrMessageList) { pHandle->pstrMessageList = pstrMessage; }else { -Message *pstrTailMsg = pHandle->pstrMessageList; +struct message *pstrTailMsg = pHandle->pstrMessageList;while (pstrTailMsg->pstrNext) pstrTailMsg = pstrTailMsg->pstrNext;
@@ -114,7 +114,7 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle, void *pvRecvBuffer, u32 u32RecvBufferSize, u32 *pu32ReceivedLength) { - Message *pstrMessage; + struct message *pstrMessage;unsigned long flags; if ((!pHandle) || (u32RecvBufferSize == 0)
drivers/staging/wilc1000/wilc_msgqueue.h +4 -4
@@ -13,18 +13,18 @@#include <linux/semaphore.h> /* Message Queue type is a structure */ -typedef struct __Message_struct { +struct message {void *pvBuffer;u32 u32Length; -struct __Message_struct *pstrNext; -}Message ; +struct message *pstrNext; +};typedef struct __MessageQueue_struct {struct semaphore hSem;spinlock_t strCriticalSection;bool bExiting;u32 u32ReceiversCount; -Message *pstrMessageList; +struct message *pstrMessageList; }WILC_MsgQueueHandle ;/*!
Signature · 1 line
2.6.4
PATCH 2/27 staging: wilc1000: rename pvBuffer in struct message
This patch renames pvBuffer to buf to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 10 +++++----- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +5 -5
@@ -76,9 +76,9 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, pstrMessage->u32Length = u32SendBufferSize; pstrMessage->pstrNext =NULL ; - pstrMessage->pvBuffer =kmemdup (pvSendBuffer, u32SendBufferSize, -GFP_ATOMIC ); -if (!pstrMessage->pvBuffer) { + pstrMessage->buf =kmemdup (pvSendBuffer, u32SendBufferSize, +GFP_ATOMIC ); +if (!pstrMessage->buf) {kfree (pstrMessage);return -ENOMEM ; }
@@ -151,12 +151,12 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,/* consume the message */ pHandle->u32ReceiversCount--; -memcpy (pvRecvBuffer, pstrMessage->pvBuffer, pstrMessage->u32Length); +memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->u32Length); *pu32ReceivedLength = pstrMessage->u32Length; pHandle->pstrMessageList = pstrMessage->pstrNext; -kfree (pstrMessage->pvBuffer); +kfree (pstrMessage->buf);kfree (pstrMessage);spin_unlock_irqrestore (&pHandle->strCriticalSection, flags);
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -14,7 +14,7 @@/* Message Queue type is a structure */ struct message { -void *pvBuffer; +void *buf;u32 u32Length;struct message *pstrNext; };
Signature · 1 line
2.6.4
PATCH 3/27 staging: wilc1000: rename u32Length in struct message
In reply to Chaehyun LimThis patch renames u32Length to len to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -74,7 +74,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,if (!pstrMessage)return -ENOMEM ; - pstrMessage->u32Length = u32SendBufferSize; + pstrMessage->len = u32SendBufferSize; pstrMessage->pstrNext =NULL ; pstrMessage->buf =kmemdup (pvSendBuffer, u32SendBufferSize,GFP_ATOMIC );
@@ -142,7 +142,7 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,return -EFAULT ; }/* check buffer size */ -if (u32RecvBufferSize < pstrMessage->u32Length) { +if (u32RecvBufferSize < pstrMessage->len) {spin_unlock_irqrestore (&pHandle->strCriticalSection, flags);up (&pHandle->hSem);PRINT_ER ("u32RecvBufferSize overflow\n" );
@@ -151,8 +151,8 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,/* consume the message */ pHandle->u32ReceiversCount--; -memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->u32Length); - *pu32ReceivedLength = pstrMessage->u32Length; +memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->len); + *pu32ReceivedLength = pstrMessage->len; pHandle->pstrMessageList = pstrMessage->pstrNext;
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -15,7 +15,7 @@/* Message Queue type is a structure */ struct message {void *buf; -u32 u32Length; +u32 len;struct message *pstrNext; };
Signature · 1 line
2.6.4
PATCH 4/27 staging: wilc1000: rename pstrNext in struct message
In reply to Chaehyun LimThis patch renames pstrNext to next to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 12 ++++++------ drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +6 -6
@@ -38,7 +38,7 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle) }while (pHandle->pstrMessageList) { -struct message *pstrMessge = pHandle->pstrMessageList->pstrNext; +struct message *pstrMessge = pHandle->pstrMessageList->next;kfree (pHandle->pstrMessageList); pHandle->pstrMessageList = pstrMessge;
@@ -75,7 +75,7 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,return -ENOMEM ; pstrMessage->len = u32SendBufferSize; - pstrMessage->pstrNext =NULL ; + pstrMessage->next =NULL ; pstrMessage->buf =kmemdup (pvSendBuffer, u32SendBufferSize,GFP_ATOMIC );if (!pstrMessage->buf) {
@@ -91,10 +91,10 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle, }else {struct message *pstrTailMsg = pHandle->pstrMessageList; -while (pstrTailMsg->pstrNext) - pstrTailMsg = pstrTailMsg->pstrNext; +while (pstrTailMsg->next) + pstrTailMsg = pstrTailMsg->next; - pstrTailMsg->pstrNext = pstrMessage; + pstrTailMsg->next = pstrMessage; }spin_unlock_irqrestore (&pHandle->strCriticalSection, flags);
@@ -154,7 +154,7 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->len); *pu32ReceivedLength = pstrMessage->len; - pHandle->pstrMessageList = pstrMessage->pstrNext; + pHandle->pstrMessageList = pstrMessage->next;kfree (pstrMessage->buf);kfree (pstrMessage);
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -16,7 +16,7 @@struct message {void *buf;u32 len; -struct message *pstrNext; +struct message *next; }; typedef struct __MessageQueue_struct {
Signature · 1 line
2.6.4
PATCH 5/27 staging: wilc1000: rename struct WILC_MsgQueueHandle
In reply to Chaehyun LimThis patch removes typedef from struct WILC_MsgQueueHandle and renames it to struct message_queue.
--- drivers/staging/wilc1000/host_interface.c | 2 +- drivers/staging/wilc1000/wilc_msgqueue.c | 14 +++++++------- drivers/staging/wilc1000/wilc_msgqueue.h | 18 +++++++++--------- 3 files changed, 17 insertions(+), 17 deletions(-)
drivers/staging/wilc1000/host_interface.c +1 -1
@@ -229,7 +229,7 @@ struct host_if_drv *terminated_handle;bool wilc_optaining_ip;static u8 P2P_LISTEN_STATE ;static struct task_struct *hif_thread_handler; -static WILC_MsgQueueHandle hif_msg_q; +static struct message_queue hif_msg_q;static struct semaphore hif_sema_thread;static struct semaphore hif_sema_driver;static struct semaphore hif_sema_wait_response;
drivers/staging/wilc1000/wilc_msgqueue.c +7 -7
@@ -11,7 +11,7 @@* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_create (WILC_MsgQueueHandle *pHandle) +int wilc_mq_create (struct message_queue *pHandle) {spin_lock_init (&pHandle->strCriticalSection);sema_init (&pHandle->hSem,0 );
@@ -27,7 +27,7 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle)* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_destroy (WILC_MsgQueueHandle *pHandle) +int wilc_mq_destroy (struct message_queue *pHandle) { pHandle->bExiting = true;
@@ -53,8 +53,8 @@ int wilc_mq_destroy(WILC_MsgQueueHandle *pHandle)* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_send (WILC_MsgQueueHandle *pHandle, -const void *pvSendBuffer,u32 u32SendBufferSize) +int wilc_mq_send (struct message_queue *pHandle, +const void *pvSendBuffer,u32 u32SendBufferSize) {unsigned long flags;struct message *pstrMessage =NULL ;
@@ -110,9 +110,9 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_recv (WILC_MsgQueueHandle *pHandle, -void *pvRecvBuffer,u32 u32RecvBufferSize, -u32 *pu32ReceivedLength) +int wilc_mq_recv (struct message_queue *pHandle, +void *pvRecvBuffer,u32 u32RecvBufferSize, +u32 *pu32ReceivedLength) {struct message *pstrMessage;unsigned long flags;
drivers/staging/wilc1000/wilc_msgqueue.h +9 -9
@@ -19,13 +19,13 @@ struct message {struct message *next; }; -typedef struct __MessageQueue_struct { +struct message_queue {struct semaphore hSem;spinlock_t strCriticalSection;bool bExiting;u32 u32ReceiversCount;struct message *pstrMessageList; -}WILC_MsgQueueHandle ; +};/*! * @brief Creates a new Message queue
@@ -40,7 +40,7 @@ typedef struct __MessageQueue_struct {* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_create (WILC_MsgQueueHandle *pHandle); +int wilc_mq_create (struct message_queue *pHandle);/*! * @brief Sends a message
@@ -57,8 +57,8 @@ int wilc_mq_create(WILC_MsgQueueHandle *pHandle);* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_send (WILC_MsgQueueHandle *pHandle, -const void *pvSendBuffer,u32 u32SendBufferSize); +int wilc_mq_send (struct message_queue *pHandle, +const void *pvSendBuffer,u32 u32SendBufferSize);/*! * @brief Receives a message
@@ -76,9 +76,9 @@ int wilc_mq_send(WILC_MsgQueueHandle *pHandle,* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_recv (WILC_MsgQueueHandle *pHandle, -void *pvRecvBuffer,u32 u32RecvBufferSize, -u32 *pu32ReceivedLength); +int wilc_mq_recv (struct message_queue *pHandle, +void *pvRecvBuffer,u32 u32RecvBufferSize, +u32 *pu32ReceivedLength);/*! * @brief Destroys an existing Message queue
@@ -89,6 +89,6 @@ int wilc_mq_recv(WILC_MsgQueueHandle *pHandle,* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_destroy (WILC_MsgQueueHandle *pHandle); +int wilc_mq_destroy (struct message_queue *pHandle);#endif
Signature · 1 line
2.6.4
PATCH 6/27 staging: wilc1000: rename hSem in struct message_queue
In reply to Chaehyun LimThis patch renames hSem to sem to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 10 +++++----- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +5 -5
@@ -14,7 +14,7 @@int wilc_mq_create (struct message_queue *pHandle) {spin_lock_init (&pHandle->strCriticalSection); -sema_init (&pHandle->hSem,0 ); +sema_init (&pHandle->sem,0 ); pHandle->pstrMessageList =NULL ; pHandle->u32ReceiversCount =0 ; pHandle->bExiting = false;
@@ -33,7 +33,7 @@ int wilc_mq_destroy(struct message_queue *pHandle)/* Release any waiting receiver thread. */ while (pHandle->u32ReceiversCount >0 ) { -up (&pHandle->hSem); +up (&pHandle->sem); pHandle->u32ReceiversCount--; }
@@ -99,7 +99,7 @@ int wilc_mq_send(struct message_queue *pHandle,spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); -up (&pHandle->hSem); +up (&pHandle->sem);return 0 ; }
@@ -132,7 +132,7 @@ int wilc_mq_recv(struct message_queue *pHandle, pHandle->u32ReceiversCount++;spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); -down (&pHandle->hSem); +down (&pHandle->sem);spin_lock_irqsave (&pHandle->strCriticalSection, flags); pstrMessage = pHandle->pstrMessageList;
@@ -144,7 +144,7 @@ int wilc_mq_recv(struct message_queue *pHandle,/* check buffer size */ if (u32RecvBufferSize < pstrMessage->len) {spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); -up (&pHandle->hSem); +up (&pHandle->sem);PRINT_ER ("u32RecvBufferSize overflow\n" );return -EOVERFLOW ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -20,7 +20,7 @@ struct message { };struct message_queue { -struct semaphore hSem; +struct semaphore sem;spinlock_t strCriticalSection;bool bExiting;u32 u32ReceiversCount;
Signature · 1 line
2.6.4
PATCH 7/27 staging: wilc1000: rename strCriticalSection in struct message_queue
In reply to Chaehyun LimThis patch renames strCriticalSection to lock to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 18 +++++++++--------- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +9 -9
@@ -13,7 +13,7 @@*/ int wilc_mq_create (struct message_queue *pHandle) { -spin_lock_init (&pHandle->strCriticalSection); +spin_lock_init (&pHandle->lock);sema_init (&pHandle->sem,0 ); pHandle->pstrMessageList =NULL ; pHandle->u32ReceiversCount =0 ;
@@ -83,7 +83,7 @@ int wilc_mq_send(struct message_queue *pHandle,return -ENOMEM ; } -spin_lock_irqsave (&pHandle->strCriticalSection, flags); +spin_lock_irqsave (&pHandle->lock, flags);/* add it to the message queue */ if (!pHandle->pstrMessageList) {
@@ -97,7 +97,7 @@ int wilc_mq_send(struct message_queue *pHandle, pstrTailMsg->next = pstrMessage; } -spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); +spin_unlock_irqrestore (&pHandle->lock, flags);up (&pHandle->sem);
@@ -128,22 +128,22 @@ int wilc_mq_recv(struct message_queue *pHandle,return -EFAULT ; } -spin_lock_irqsave (&pHandle->strCriticalSection, flags); +spin_lock_irqsave (&pHandle->lock, flags); pHandle->u32ReceiversCount++; -spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); +spin_unlock_irqrestore (&pHandle->lock, flags);down (&pHandle->sem); -spin_lock_irqsave (&pHandle->strCriticalSection, flags); +spin_lock_irqsave (&pHandle->lock, flags); pstrMessage = pHandle->pstrMessageList;if (!pstrMessage) { -spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); +spin_unlock_irqrestore (&pHandle->lock, flags);PRINT_ER ("pstrMessage is null\n" );return -EFAULT ; }/* check buffer size */ if (u32RecvBufferSize < pstrMessage->len) { -spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); +spin_unlock_irqrestore (&pHandle->lock, flags);up (&pHandle->sem);PRINT_ER ("u32RecvBufferSize overflow\n" );return -EOVERFLOW ;
@@ -159,7 +159,7 @@ int wilc_mq_recv(struct message_queue *pHandle,kfree (pstrMessage->buf);kfree (pstrMessage); -spin_unlock_irqrestore (&pHandle->strCriticalSection, flags); +spin_unlock_irqrestore (&pHandle->lock, flags);return 0 ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -21,7 +21,7 @@ struct message {struct message_queue {struct semaphore sem; -spinlock_t strCriticalSection; +spinlock_t lock;bool bExiting;u32 u32ReceiversCount;struct message *pstrMessageList;
Signature · 1 line
2.6.4
PATCH 8/27 staging: wilc1000: rename bExiting in struct message_queue
In reply to Chaehyun LimThis patch renames bExiting to exiting to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -17,7 +17,7 @@ int wilc_mq_create(struct message_queue *pHandle)sema_init (&pHandle->sem,0 ); pHandle->pstrMessageList =NULL ; pHandle->u32ReceiversCount =0 ; - pHandle->bExiting = false; + pHandle->exiting = false;return 0 ; }
@@ -29,7 +29,7 @@ int wilc_mq_create(struct message_queue *pHandle)*/ int wilc_mq_destroy (struct message_queue *pHandle) { - pHandle->bExiting = true; + pHandle->exiting = true;/* Release any waiting receiver thread. */ while (pHandle->u32ReceiversCount >0 ) {
@@ -64,7 +64,7 @@ int wilc_mq_send(struct message_queue *pHandle,return -EFAULT ; } -if (pHandle->bExiting) { +if (pHandle->exiting) {PRINT_ER ("pHandle fail\n" );return -EFAULT ; }
@@ -123,7 +123,7 @@ int wilc_mq_recv(struct message_queue *pHandle,return -EINVAL ; } -if (pHandle->bExiting) { +if (pHandle->exiting) {PRINT_ER ("pHandle fail\n" );return -EFAULT ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -22,7 +22,7 @@ struct message {struct message_queue {struct semaphore sem;spinlock_t lock; -bool bExiting; +bool exiting;u32 u32ReceiversCount;struct message *pstrMessageList; };
Signature · 1 line
2.6.4
PATCH 9/27 staging: wilc1000: rename u32ReceiversCount in struct message_queue
In reply to Chaehyun LimThis patch renames u32ReceiversCount to recv_count to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 10 +++++----- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 6 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +5 -5
@@ -16,7 +16,7 @@ int wilc_mq_create(struct message_queue *pHandle)spin_lock_init (&pHandle->lock);sema_init (&pHandle->sem,0 ); pHandle->pstrMessageList =NULL ; - pHandle->u32ReceiversCount =0 ; + pHandle->recv_count =0 ; pHandle->exiting = false;return 0 ; }
@@ -32,9 +32,9 @@ int wilc_mq_destroy(struct message_queue *pHandle) pHandle->exiting = true;/* Release any waiting receiver thread. */ -while (pHandle->u32ReceiversCount >0 ) { +while (pHandle->recv_count >0 ) {up (&pHandle->sem); - pHandle->u32ReceiversCount--; + pHandle->recv_count--; }while (pHandle->pstrMessageList) {
@@ -129,7 +129,7 @@ int wilc_mq_recv(struct message_queue *pHandle, }spin_lock_irqsave (&pHandle->lock, flags); - pHandle->u32ReceiversCount++; + pHandle->recv_count++;spin_unlock_irqrestore (&pHandle->lock, flags);down (&pHandle->sem);
@@ -150,7 +150,7 @@ int wilc_mq_recv(struct message_queue *pHandle, }/* consume the message */ - pHandle->u32ReceiversCount--; + pHandle->recv_count--;memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->len); *pu32ReceivedLength = pstrMessage->len;
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -23,7 +23,7 @@ struct message_queue {struct semaphore sem;spinlock_t lock;bool exiting; -u32 u32ReceiversCount; +u32 recv_count;struct message *pstrMessageList; };
Signature · 1 line
2.6.4
PATCH 10/27 staging: wilc1000: rename pstrMessageList in struct message_queue
In reply to Chaehyun LimThis patch renames pstrMessageList to msg_list to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 20 ++++++++++---------- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 11 insertions(+), 11 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +10 -10
@@ -15,7 +15,7 @@ int wilc_mq_create(struct message_queue *pHandle) {spin_lock_init (&pHandle->lock);sema_init (&pHandle->sem,0 ); - pHandle->pstrMessageList =NULL ; + pHandle->msg_list =NULL ; pHandle->recv_count =0 ; pHandle->exiting = false;return 0 ;
@@ -37,11 +37,11 @@ int wilc_mq_destroy(struct message_queue *pHandle) pHandle->recv_count--; } -while (pHandle->pstrMessageList) { -struct message *pstrMessge = pHandle->pstrMessageList->next; +while (pHandle->msg_list) { +struct message *pstrMessge = pHandle->msg_list->next; -kfree (pHandle->pstrMessageList); - pHandle->pstrMessageList = pstrMessge; +kfree (pHandle->msg_list); + pHandle->msg_list = pstrMessge; }return 0 ;
@@ -86,10 +86,10 @@ int wilc_mq_send(struct message_queue *pHandle,spin_lock_irqsave (&pHandle->lock, flags);/* add it to the message queue */ -if (!pHandle->pstrMessageList) { - pHandle->pstrMessageList = pstrMessage; +if (!pHandle->msg_list) { + pHandle->msg_list = pstrMessage; }else { -struct message *pstrTailMsg = pHandle->pstrMessageList; +struct message *pstrTailMsg = pHandle->msg_list;while (pstrTailMsg->next) pstrTailMsg = pstrTailMsg->next;
@@ -135,7 +135,7 @@ int wilc_mq_recv(struct message_queue *pHandle,down (&pHandle->sem);spin_lock_irqsave (&pHandle->lock, flags); - pstrMessage = pHandle->pstrMessageList; + pstrMessage = pHandle->msg_list;if (!pstrMessage) {spin_unlock_irqrestore (&pHandle->lock, flags);PRINT_ER ("pstrMessage is null\n" );
@@ -154,7 +154,7 @@ int wilc_mq_recv(struct message_queue *pHandle,memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->len); *pu32ReceivedLength = pstrMessage->len; - pHandle->pstrMessageList = pstrMessage->next; + pHandle->msg_list = pstrMessage->next;kfree (pstrMessage->buf);kfree (pstrMessage);
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -24,7 +24,7 @@ struct message_queue {spinlock_t lock;bool exiting;u32 recv_count; -struct message *pstrMessageList; +struct message *msg_list; };/*!
Signature · 1 line
2.6.4
PATCH 11/27 staging: wilc1000: rename pHandle in wilc_mq_create
In reply to Chaehyun LimThis patch renames pHandle to mq to avoid camelcase
--- drivers/staging/wilc1000/wilc_msgqueue.c | 12 ++++++------ drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 7 insertions(+), 7 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +6 -6
@@ -11,13 +11,13 @@* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_create (struct message_queue *pHandle) +int wilc_mq_create (struct message_queue *mq) { -spin_lock_init (&pHandle->lock); -sema_init (&pHandle->sem,0 ); - pHandle->msg_list =NULL ; - pHandle->recv_count =0 ; - pHandle->exiting = false; +spin_lock_init (&mq->lock); +sema_init (&mq->sem,0 ); + mq->msg_list =NULL ; + mq->recv_count =0 ; + mq->exiting = false;return 0 ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -40,7 +40,7 @@ struct message_queue {* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_create (struct message_queue *pHandle); +int wilc_mq_create (struct message_queue *mq);/*! * @brief Sends a message
Signature · 1 line
2.6.4
PATCH 12/27 staging: wilc1000: rename pHandle in wilc_mq_destroy
In reply to Chaehyun LimThis patch renames pHandle to mq to avoid camelcase
--- drivers/staging/wilc1000/wilc_msgqueue.c | 18 +++++++++--------- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 10 insertions(+), 10 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +9 -9
@@ -27,21 +27,21 @@ int wilc_mq_create(struct message_queue *mq)* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_destroy (struct message_queue *pHandle) +int wilc_mq_destroy (struct message_queue *mq) { - pHandle->exiting = true; + mq->exiting = true;/* Release any waiting receiver thread. */ -while (pHandle->recv_count >0 ) { -up (&pHandle->sem); - pHandle->recv_count--; +while (mq->recv_count >0 ) { +up (&mq->sem); + mq->recv_count--; } -while (pHandle->msg_list) { -struct message *pstrMessge = pHandle->msg_list->next; +while (mq->msg_list) { +struct message *pstrMessge = mq->msg_list->next; -kfree (pHandle->msg_list); - pHandle->msg_list = pstrMessge; +kfree (mq->msg_list); + mq->msg_list = pstrMessge; }return 0 ;
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -89,6 +89,6 @@ int wilc_mq_recv(struct message_queue *pHandle,* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_destroy (struct message_queue *pHandle); +int wilc_mq_destroy (struct message_queue *mq);#endif
Signature · 1 line
2.6.4
PATCH 13/27 staging: wilc1000: rename pstrMessge in wilc_mq_destroy
In reply to Chaehyun LimThis patch renames pstrMessge to msg to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +2 -2
@@ -38,10 +38,10 @@ int wilc_mq_destroy(struct message_queue *mq) }while (mq->msg_list) { -struct message *pstrMessge = mq->msg_list->next; +struct message *msg = mq->msg_list->next;kfree (mq->msg_list); - mq->msg_list = pstrMessge; + mq->msg_list = msg; }return 0 ;
Signature · 1 line
2.6.4
PATCH 14/27 staging: wilc1000: rename pHandle in wilc_mq_send
In reply to Chaehyun LimThis patch renames pHandle to mq to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 22 +++++++++++----------- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 12 insertions(+), 12 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +11 -11
@@ -53,19 +53,19 @@ int wilc_mq_destroy(struct message_queue *mq)* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_send (struct message_queue *pHandle, +int wilc_mq_send (struct message_queue *mq,const void *pvSendBuffer,u32 u32SendBufferSize) {unsigned long flags;struct message *pstrMessage =NULL ; -if ((!pHandle) || (u32SendBufferSize ==0 ) || (!pvSendBuffer)) { -PRINT_ER ("pHandle or pvSendBuffer is null\n" ); +if ((!mq) || (u32SendBufferSize ==0 ) || (!pvSendBuffer)) { +PRINT_ER ("mq or pvSendBuffer is null\n" );return -EFAULT ; } -if (pHandle->exiting) { -PRINT_ER ("pHandle fail\n" ); +if (mq->exiting) { +PRINT_ER ("mq fail\n" );return -EFAULT ; }
@@ -83,13 +83,13 @@ int wilc_mq_send(struct message_queue *pHandle,return -ENOMEM ; } -spin_lock_irqsave (&pHandle->lock, flags); +spin_lock_irqsave (&mq->lock, flags);/* add it to the message queue */ -if (!pHandle->msg_list) { - pHandle->msg_list = pstrMessage; +if (!mq->msg_list) { + mq->msg_list = pstrMessage; }else { -struct message *pstrTailMsg = pHandle->msg_list; +struct message *pstrTailMsg = mq->msg_list;while (pstrTailMsg->next) pstrTailMsg = pstrTailMsg->next;
@@ -97,9 +97,9 @@ int wilc_mq_send(struct message_queue *pHandle, pstrTailMsg->next = pstrMessage; } -spin_unlock_irqrestore (&pHandle->lock, flags); +spin_unlock_irqrestore (&mq->lock, flags); -up (&pHandle->sem); +up (&mq->sem);return 0 ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -57,7 +57,7 @@ int wilc_mq_create(struct message_queue *mq);* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_send (struct message_queue *pHandle, +int wilc_mq_send (struct message_queue *mq,const void *pvSendBuffer,u32 u32SendBufferSize);/*!
Signature · 1 line
2.6.4
PATCH 15/27 staging: wilc1000: rename pvSendBuffer in wilc_mq_send
In reply to Chaehyun LimThis patch renames pvSendBuffer to send_buf to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -54,13 +54,13 @@ int wilc_mq_destroy(struct message_queue *mq)* @version 1.0 */ int wilc_mq_send (struct message_queue *mq, -const void *pvSendBuffer,u32 u32SendBufferSize) +const void *send_buf,u32 u32SendBufferSize) {unsigned long flags;struct message *pstrMessage =NULL ; -if ((!mq) || (u32SendBufferSize ==0 ) || (!pvSendBuffer)) { -PRINT_ER ("mq or pvSendBuffer is null\n" ); +if ((!mq) || (u32SendBufferSize ==0 ) || (!send_buf)) { +PRINT_ER ("mq or send_buf is null\n" );return -EFAULT ; }
@@ -76,7 +76,7 @@ int wilc_mq_send(struct message_queue *mq, pstrMessage->len = u32SendBufferSize; pstrMessage->next =NULL ; - pstrMessage->buf =kmemdup (pvSendBuffer, u32SendBufferSize, + pstrMessage->buf =kmemdup (send_buf, u32SendBufferSize,GFP_ATOMIC );if (!pstrMessage->buf) {kfree (pstrMessage);
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -58,7 +58,7 @@ int wilc_mq_create(struct message_queue *mq);* @version 1.0 */ int wilc_mq_send (struct message_queue *mq, -const void *pvSendBuffer,u32 u32SendBufferSize); +const void *send_buf,u32 u32SendBufferSize);/*! * @brief Receives a message
Signature · 1 line
2.6.4
PATCH 16/27 staging: wilc1000: rename u32SendBufferSize in wilc_mq_send
In reply to Chaehyun LimThis patch renames u32SendBufferSize to send_buf_size to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -54,12 +54,12 @@ int wilc_mq_destroy(struct message_queue *mq)* @version 1.0 */ int wilc_mq_send (struct message_queue *mq, -const void *send_buf,u32 u32SendBufferSize) +const void *send_buf,u32 send_buf_size) {unsigned long flags;struct message *pstrMessage =NULL ; -if ((!mq) || (u32SendBufferSize ==0 ) || (!send_buf)) { +if ((!mq) || (send_buf_size ==0 ) || (!send_buf)) {PRINT_ER ("mq or send_buf is null\n" );return -EFAULT ; }
@@ -74,9 +74,9 @@ int wilc_mq_send(struct message_queue *mq,if (!pstrMessage)return -ENOMEM ; - pstrMessage->len = u32SendBufferSize; + pstrMessage->len = send_buf_size; pstrMessage->next =NULL ; - pstrMessage->buf =kmemdup (send_buf, u32SendBufferSize, + pstrMessage->buf =kmemdup (send_buf, send_buf_size,GFP_ATOMIC );if (!pstrMessage->buf) {kfree (pstrMessage);
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -58,7 +58,7 @@ int wilc_mq_create(struct message_queue *mq);* @version 1.0 */ int wilc_mq_send (struct message_queue *mq, -const void *send_buf,u32 u32SendBufferSize); +const void *send_buf,u32 send_buf_size);/*! * @brief Receives a message
Signature · 1 line
2.6.4
PATCH 17/27 staging: wilc1000: rename pstrMessage in wilc_mq_send
In reply to Chaehyun LimThis patch renames pstrMessage to new_msg to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 21 ++++++++++----------- 1 file changed, 10 insertions(+), 11 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +10 -11
@@ -57,7 +57,7 @@ int wilc_mq_send(struct message_queue *mq, const void *send_buf, u32 send_buf_size) { unsigned long flags; -struct message *pstrMessage =NULL ; +struct message *new_msg =NULL ;if ((!mq) || (send_buf_size ==0 ) || (!send_buf)) {PRINT_ER ("mq or send_buf is null\n" );
@@ -70,16 +70,15 @@ int wilc_mq_send(struct message_queue *mq, }/* construct a new message */ - pstrMessage =kmalloc (sizeof (struct message ),GFP_ATOMIC ); -if (!pstrMessage) + new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); +if (!new_msg)return -ENOMEM ; - pstrMessage->len = send_buf_size; - pstrMessage->next =NULL ; - pstrMessage->buf =kmemdup (send_buf, send_buf_size, -GFP_ATOMIC ); -if (!pstrMessage->buf) { -kfree (pstrMessage); + new_msg->len = send_buf_size; + new_msg->next =NULL ; + new_msg->buf =kmemdup (send_buf, send_buf_size,GFP_ATOMIC ); +if (!new_msg->buf) { +kfree (new_msg);return -ENOMEM ; }
@@ -87,14 +86,14 @@ int wilc_mq_send(struct message_queue *mq,/* add it to the message queue */ if (!mq->msg_list) { - mq->msg_list = pstrMessage; + mq->msg_list = new_msg; }else {struct message *pstrTailMsg = mq->msg_list;while (pstrTailMsg->next) pstrTailMsg = pstrTailMsg->next; - pstrTailMsg->next = pstrMessage; + pstrTailMsg->next = new_msg; }spin_unlock_irqrestore (&mq->lock, flags);
Signature · 1 line
2.6.4
PATCH 18/27 staging: wilc1000: rename tail_msg in wilc_mq_send
In reply to Chaehyun LimThis patch renames pstrTailMsg to tail_msg to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -88,12 +88,12 @@ int wilc_mq_send(struct message_queue *mq,if (!mq->msg_list) { mq->msg_list = new_msg; }else { -struct message *pstrTailMsg = mq->msg_list; +struct message *tail_msg = mq->msg_list; -while (pstrTailMsg->next) - pstrTailMsg = pstrTailMsg->next; +while (tail_msg->next) + tail_msg = tail_msg->next; - pstrTailMsg->next = new_msg; + tail_msg->next = new_msg; }spin_unlock_irqrestore (&mq->lock, flags);
Signature · 1 line
2.6.4
PATCH 19/27 staging: wilc1000: fix return error code
In reply to Chaehyun LimThree argument are checked at the beginning of wilc_mq_send whether they are valid arguments or not. It is correct to use return error code as -EINVAL, not -EFAULT.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/wilc_msgqueue.c +1 -1
@@ -61,7 +61,7 @@ int wilc_mq_send(struct message_queue *mq,if ((!mq) || (send_buf_size ==0 ) || (!send_buf)) {PRINT_ER ("mq or send_buf is null\n" ); -return -EFAULT ; +return -EINVAL ; }if (mq->exiting) {
Signature · 1 line
2.6.4
PATCH 20/27 staging: wilc1000: rename pHandle in wilc_mq_recv
In reply to Chaehyun LimThis patch renames pHandle to mq to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 34 ++++++++++++++++---------------- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 18 insertions(+), 18 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +17 -17
@@ -109,56 +109,56 @@ int wilc_mq_send(struct message_queue *mq,* @note copied from FLO glue implementatuion * @version 1.0 */ -int wilc_mq_recv (struct message_queue *pHandle, +int wilc_mq_recv (struct message_queue *mq,void *pvRecvBuffer,u32 u32RecvBufferSize,u32 *pu32ReceivedLength) {struct message *pstrMessage;unsigned long flags; -if ((!pHandle) || (u32RecvBufferSize ==0 ) +if ((!mq) || (u32RecvBufferSize ==0 ) || (!pvRecvBuffer) || (!pu32ReceivedLength)) { -PRINT_ER ("pHandle or pvRecvBuffer is null\n" ); +PRINT_ER ("mq or pvRecvBuffer is null\n" );return -EINVAL ; } -if (pHandle->exiting) { -PRINT_ER ("pHandle fail\n" ); +if (mq->exiting) { +PRINT_ER ("mq fail\n" );return -EFAULT ; } -spin_lock_irqsave (&pHandle->lock, flags); - pHandle->recv_count++; -spin_unlock_irqrestore (&pHandle->lock, flags); +spin_lock_irqsave (&mq->lock, flags); + mq->recv_count++; +spin_unlock_irqrestore (&mq->lock, flags); -down (&pHandle->sem); -spin_lock_irqsave (&pHandle->lock, flags); +down (&mq->sem); +spin_lock_irqsave (&mq->lock, flags); - pstrMessage = pHandle->msg_list; + pstrMessage = mq->msg_list;if (!pstrMessage) { -spin_unlock_irqrestore (&pHandle->lock, flags); +spin_unlock_irqrestore (&mq->lock, flags);PRINT_ER ("pstrMessage is null\n" );return -EFAULT ; }/* check buffer size */ if (u32RecvBufferSize < pstrMessage->len) { -spin_unlock_irqrestore (&pHandle->lock, flags); -up (&pHandle->sem); +spin_unlock_irqrestore (&mq->lock, flags); +up (&mq->sem);PRINT_ER ("u32RecvBufferSize overflow\n" );return -EOVERFLOW ; }/* consume the message */ - pHandle->recv_count--; + mq->recv_count--;memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->len); *pu32ReceivedLength = pstrMessage->len; - pHandle->msg_list = pstrMessage->next; + mq->msg_list = pstrMessage->next;kfree (pstrMessage->buf);kfree (pstrMessage); -spin_unlock_irqrestore (&pHandle->lock, flags); +spin_unlock_irqrestore (&mq->lock, flags);return 0 ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -76,7 +76,7 @@ int wilc_mq_send(struct message_queue *mq,* @date 30 Aug 2010 * @version 1.0 */ -int wilc_mq_recv (struct message_queue *pHandle, +int wilc_mq_recv (struct message_queue *mq,void *pvRecvBuffer,u32 u32RecvBufferSize,u32 *pu32ReceivedLength);
Signature · 1 line
2.6.4
PATCH 21/27 staging: wilc1000: rename pvRecvBuffer in wilc_mq_recv
In reply to Chaehyun LimThis patch renames pvRecvBuffer to recv_buf to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -110,15 +110,15 @@ int wilc_mq_send(struct message_queue *mq,* @version 1.0 */ int wilc_mq_recv (struct message_queue *mq, -void *pvRecvBuffer,u32 u32RecvBufferSize, +void *recv_buf,u32 u32RecvBufferSize,u32 *pu32ReceivedLength) {struct message *pstrMessage;unsigned long flags;if ((!mq) || (u32RecvBufferSize ==0 ) - || (!pvRecvBuffer) || (!pu32ReceivedLength)) { -PRINT_ER ("mq or pvRecvBuffer is null\n" ); + || (!recv_buf) || (!pu32ReceivedLength)) { +PRINT_ER ("mq or recv_buf is null\n" );return -EINVAL ; }
@@ -150,7 +150,7 @@ int wilc_mq_recv(struct message_queue *mq,/* consume the message */ mq->recv_count--; -memcpy (pvRecvBuffer, pstrMessage->buf, pstrMessage->len); +memcpy (recv_buf, pstrMessage->buf, pstrMessage->len); *pu32ReceivedLength = pstrMessage->len; mq->msg_list = pstrMessage->next;
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -77,7 +77,7 @@ int wilc_mq_send(struct message_queue *mq,* @version 1.0 */ int wilc_mq_recv (struct message_queue *mq, -void *pvRecvBuffer,u32 u32RecvBufferSize, +void *recv_buf,u32 u32RecvBufferSize,u32 *pu32ReceivedLength);/*!
Signature · 1 line
2.6.4
PATCH 22/27 staging: wilc1000: rename u32RecvBufferSize in wilc_mq_recv
In reply to Chaehyun LimThis patch renames u32RecvBufferSize to recv_buf_size to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 8 ++++---- drivers/staging/wilc1000/wilc_msgqueue.h | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +4 -4
@@ -110,13 +110,13 @@ int wilc_mq_send(struct message_queue *mq,* @version 1.0 */ int wilc_mq_recv (struct message_queue *mq, -void *recv_buf,u32 u32RecvBufferSize, +void *recv_buf,u32 recv_buf_size,u32 *pu32ReceivedLength) {struct message *pstrMessage;unsigned long flags; -if ((!mq) || (u32RecvBufferSize ==0 ) +if ((!mq) || (recv_buf_size ==0 ) || (!recv_buf) || (!pu32ReceivedLength)) {PRINT_ER ("mq or recv_buf is null\n" );return -EINVAL ;
@@ -141,10 +141,10 @@ int wilc_mq_recv(struct message_queue *mq,return -EFAULT ; }/* check buffer size */ -if (u32RecvBufferSize < pstrMessage->len) { +if (recv_buf_size < pstrMessage->len) {spin_unlock_irqrestore (&mq->lock, flags);up (&mq->sem); -PRINT_ER ("u32RecvBufferSize overflow\n" ); +PRINT_ER ("recv_buf_size overflow\n" );return -EOVERFLOW ; }
drivers/staging/wilc1000/wilc_msgqueue.h +1 -1
@@ -77,7 +77,7 @@ int wilc_mq_send(struct message_queue *mq,* @version 1.0 */ int wilc_mq_recv (struct message_queue *mq, -void *recv_buf,u32 u32RecvBufferSize, +void *recv_buf,u32 recv_buf_size,u32 *pu32ReceivedLength);/*!
Signature · 1 line
2.6.4
PATCH 23/27 staging: wilc1000: rename pu32ReceivedLength in wilc_mq_recv
In reply to Chaehyun LimThis patch renames pu32ReceivedLength to recv_len to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 7 +++---- drivers/staging/wilc1000/wilc_msgqueue.h | 3 +-- 2 files changed, 4 insertions(+), 6 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +3 -4
@@ -110,14 +110,13 @@ int wilc_mq_send(struct message_queue *mq,* @version 1.0 */ int wilc_mq_recv (struct message_queue *mq, -void *recv_buf,u32 recv_buf_size, -u32 *pu32ReceivedLength) +void *recv_buf,u32 recv_buf_size,u32 *recv_len) {struct message *pstrMessage;unsigned long flags;if ((!mq) || (recv_buf_size ==0 ) - || (!recv_buf) || (!pu32ReceivedLength)) { + || (!recv_buf) || (!recv_len)) {PRINT_ER ("mq or recv_buf is null\n" );return -EINVAL ; }
@@ -151,7 +150,7 @@ int wilc_mq_recv(struct message_queue *mq,/* consume the message */ mq->recv_count--;memcpy (recv_buf, pstrMessage->buf, pstrMessage->len); - *pu32ReceivedLength = pstrMessage->len; + *recv_len = pstrMessage->len; mq->msg_list = pstrMessage->next;
drivers/staging/wilc1000/wilc_msgqueue.h +1 -2
@@ -77,8 +77,7 @@ int wilc_mq_send(struct message_queue *mq,* @version 1.0 */ int wilc_mq_recv (struct message_queue *mq, -void *recv_buf,u32 recv_buf_size, -u32 *pu32ReceivedLength); +void *recv_buf,u32 recv_buf_size,u32 *recv_len);/*! * @brief Destroys an existing Message queue
Signature · 1 line
2.6.4
PATCH 24/27 staging: wilc1000: rename pstrMessage in wilc_mq_recv
In reply to Chaehyun LimThis patch renames pstrMessage to msg to avoid camelcase.
--- drivers/staging/wilc1000/wilc_msgqueue.c | 20 ++++++++++---------- 1 file changed, 10 insertions(+), 10 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +10 -10
@@ -112,7 +112,7 @@ int wilc_mq_send(struct message_queue *mq,int wilc_mq_recv (struct message_queue *mq,void *recv_buf,u32 recv_buf_size,u32 *recv_len) { -struct message *pstrMessage; +struct message *msg;unsigned long flags; if ((!mq) || (recv_buf_size == 0)
@@ -133,14 +133,14 @@ int wilc_mq_recv(struct message_queue *mq,down (&mq->sem);spin_lock_irqsave (&mq->lock, flags); - pstrMessage = mq->msg_list; -if (!pstrMessage) { + msg = mq->msg_list; +if (!msg) {spin_unlock_irqrestore (&mq->lock, flags); -PRINT_ER ("pstrMessage is null\n" ); +PRINT_ER ("msg is null\n" );return -EFAULT ; }/* check buffer size */ -if (recv_buf_size < pstrMessage->len) { +if (recv_buf_size < msg->len) {spin_unlock_irqrestore (&mq->lock, flags);up (&mq->sem);PRINT_ER ("recv_buf_size overflow\n" );
@@ -149,13 +149,13 @@ int wilc_mq_recv(struct message_queue *mq,/* consume the message */ mq->recv_count--; -memcpy (recv_buf, pstrMessage->buf, pstrMessage->len); - *recv_len = pstrMessage->len; +memcpy (recv_buf, msg->buf, msg->len); + *recv_len = msg->len; - mq->msg_list = pstrMessage->next; + mq->msg_list = msg->next; -kfree (pstrMessage->buf); -kfree (pstrMessage); +kfree (msg->buf); +kfree (msg);spin_unlock_irqrestore (&mq->lock, flags);
Signature · 1 line
2.6.4
PATCH 25/27 staging: wilc1000: fix coding style of kmalloc usage
In reply to Chaehyun LimThis patch fixes coding style of kmalloc usage found by checkpatch.
CHECK: Prefer kmalloc(sizeof(*new_msg)...) over kmalloc(sizeof(struct message)...)
--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/wilc1000/wilc_msgqueue.c +1 -1
@@ -70,7 +70,7 @@ int wilc_mq_send(struct message_queue *mq, }/* construct a new message */ - new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); + new_msg =kmalloc (sizeof (*new_msg),GFP_ATOMIC );if (!new_msg)return -ENOMEM ;
Signature · 1 line
2.6.4
Re: [PATCH 25/27] staging: wilc1000: fix coding style of kmalloc usage
Quoted 13 lines · Chaehyun Lim
This patch fixes coding style of kmalloc usage found by checkpatch.
CHECK: Prefer kmalloc(sizeof(*new_msg)...) over kmalloc(sizeof(struct message)...)Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/wilc_msgqueue.c +0
-0
drivers/staging/wilc1000/wilc_msgqueue.c int wilc_mq_send(struct message_queue *mq, · line 73
Quoted 5 lines
drivers/staging/wilc1000/wilc_msgqueue.c +1
-1@@ -70,7 +70,7 @@ int wilc_mq_send(struct message_queue *mq, }/* construct a new message */ - new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); + new_msg =kmalloc (sizeof (*new_msg),GFP_ATOMIC );
This checkpatch error was introduced by 1/27 patch of this series. Maybe it will be better to fix it in that one.
regards
sudip
Re: [PATCH 25/27] staging: wilc1000: fix coding style of kmalloc usage
Quoted 16 lines · Sudip Mukherjee
Quoted 15 lines · Chaehyun Lim
This patch fixes coding style of kmalloc usage found by checkpatch.
CHECK: Prefer kmalloc(sizeof(*new_msg)...) over kmalloc(sizeof(struct message)...)Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/wilc_msgqueue.c +0
-0@@ -70,7 +70,7 @@ int wilc_mq_send(struct message_queue *mq, }
Quoted 6 lines
drivers/staging/wilc1000/wilc_msgqueue.c int wilc_mq_send(struct message_queue *mq, · line 73
Quoted 3 lines
drivers/staging/wilc1000/wilc_msgqueue.c +1
-1/* construct a new message */ - new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); + new_msg =kmalloc (sizeof (*new_msg),GFP_ATOMIC );This checkpatch error was introduced by 1/27 patch of this series. Maybe it will be better to fix it in that one.
The warning was introduced there but the issue went back further it's just that checkpatch didn't detect it because of other issues. This seems fine.
regards,
dan carpenter
Re: [PATCH 25/27] staging: wilc1000: fix coding style of kmalloc usage
Quoted 24 lines · Dan Carpenter
Quoted 16 lines · Sudip Mukherjee
Quoted 15 lines · Chaehyun Lim
This patch fixes coding style of kmalloc usage found by checkpatch.
CHECK: Prefer kmalloc(sizeof(*new_msg)...) over kmalloc(sizeof(struct message)...)Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/wilc_msgqueue.c +0
-0@@ -70,7 +70,7 @@ int wilc_mq_send(struct message_queue *mq, }Quoted 6 lines
drivers/staging/wilc1000/wilc_msgqueue.c int wilc_mq_send(struct message_queue *mq, · line 73
Quoted 3 lines
drivers/staging/wilc1000/wilc_msgqueue.c +1
-1/* construct a new message */ - new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); + new_msg =kmalloc (sizeof (*new_msg),GFP_ATOMIC );This checkpatch error was introduced by 1/27 patch of this series. Maybe it will be better to fix it in that one.
Quoted 3 lines
The warning was introduced there but the issue went back further it's just that checkpatch didn't detect it because of other issues. This seems fine.
I appreciate for all comment. I will resend it after applying Sudip's review.
regards,
Chaehyun Lim
Quoted 4 lines
regards,
dan carpenter
Re: [PATCH 25/27] staging: wilc1000: fix coding style of kmalloc usage
Quoted 25 lines · Chaehyun Lim
Quoted 24 lines · Dan Carpenter
Quoted 22 lines · Sudip Mukherjee
Quoted 13 lines · Chaehyun Lim
This patch fixes coding style of kmalloc usage found by checkpatch.
CHECK: Prefer kmalloc(sizeof(*new_msg)...) over kmalloc(sizeof(struct message)...)Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/wilc_msgqueue.c +0
-0drivers/staging/wilc1000/wilc_msgqueue.c int wilc_mq_send(struct message_queue *mq, · line 73
Quoted 5 lines
drivers/staging/wilc1000/wilc_msgqueue.c +1
-1@@ -70,7 +70,7 @@ int wilc_mq_send(struct message_queue *mq, }/* construct a new message */ - new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); + new_msg =kmalloc (sizeof (*new_msg),GFP_ATOMIC );This checkpatch error was introduced by 1/27 patch of this series. Maybe it will be better to fix it in that one.
Quoted 6 lines
Quoted 3 lines
The warning was introduced there but the issue went back further it's just that checkpatch didn't detect it because of other issues. This seems fine.
I appreciate for all comment. I will resend it after applying Sudip's review.
That's fine too, but the original way is more correct because it only fixes one thing at a time and is easier to review.
regards,
dan carpenter
Re: [PATCH 25/27] staging: wilc1000: fix coding style of kmalloc usage
Quoted 30 lines · Dan Carpenter
Quoted 29 lines · Chaehyun Lim
Quoted 27 lines · Dan Carpenter
Quoted 16 lines · Sudip Mukherjee
Quoted 15 lines · Chaehyun Lim
This patch fixes coding style of kmalloc usage found by checkpatch.
CHECK: Prefer kmalloc(sizeof(*new_msg)...) over kmalloc(sizeof(struct message)...)Signed-off-by Chaehyun Lim <[email protected]>--- drivers/staging/wilc1000/wilc_msgqueue.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)drivers/staging/wilc1000/wilc_msgqueue.c +0
-0@@ -70,7 +70,7 @@ int wilc_mq_send(struct message_queue *mq, }Quoted 6 lines
drivers/staging/wilc1000/wilc_msgqueue.c int wilc_mq_send(struct message_queue *mq, · line 73
Quoted 3 lines
drivers/staging/wilc1000/wilc_msgqueue.c +1
-1/* construct a new message */ - new_msg =kmalloc (sizeof (struct message ),GFP_ATOMIC ); + new_msg =kmalloc (sizeof (*new_msg),GFP_ATOMIC );This checkpatch error was introduced by 1/27 patch of this series. Maybe it will be better to fix it in that one.
The warning was introduced there but the issue went back further it's just that checkpatch didn't detect it because of other issues. This seems fine.
Quoted 6 lines
Quoted 2 lines
I appreciate for all comment. I will resend it after applying Sudip's review.
That's fine too, but the original way is more correct because it only fixes one thing at a time and is easier to review.
I will keep the original way, even 1/27 patch was introduced a new checkpatch warning.
I agree that one patch should be changed one thing.
But I need to resend again because I find a wrong variable name at commit title.
regards
Chaehyun Lim
Quoted 3 lines
regards,
dan carpenter
PATCH 26/27 staging: wilc1000: fix logical continuations
In reply to Chaehyun LimThis patch fixes logical continuations found by checkpatch
CHECK: Logical continuations should be on the previous line
--- drivers/staging/wilc1000/wilc_msgqueue.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.c +1 -2
@@ -115,8 +115,7 @@ int wilc_mq_recv(struct message_queue *mq,struct message *msg;unsigned long flags; -if ((!mq) || (recv_buf_size ==0 ) - || (!recv_buf) || (!recv_len)) { +if ((!mq) || (recv_buf_size ==0 ) || (!recv_buf) || (!recv_len)) {PRINT_ER ("mq or recv_buf is null\n" );return -EINVAL ; }
Signature · 1 line
2.6.4
PATCH 27/27 staging: wilc1000: remove over-commenting
In reply to Chaehyun LimThere are over-commenting in wilc_msgqueue.h file. This comment is not explain exactly what codes do and make checkpatch warning about "line over 80 charcters". If necessary, comment will be added later with preferred coding style.
--- drivers/staging/wilc1000/wilc_msgqueue.h | 66 -------------------------------- 1 file changed, 66 deletions(-)
drivers/staging/wilc1000/wilc_msgqueue.h +0 -66
@@ -1,18 +1,8 @@ #ifndef __WILC_MSG_QUEUE_H__ #define __WILC_MSG_QUEUE_H__ -/*! - * @file wilc_msgqueue.h - * @brief Message Queue OS wrapper functionality - * @author syounan - * @sa wilc_oswrapper.h top level OS wrapper file - * @date 30 Aug 2010 - * @version 1.0 - */ - #include <linux/semaphore.h> -/* Message Queue type is a structure */ struct message { void *buf; u32 len;
@@ -27,67 +17,11 @@ struct message_queue { struct message *msg_list; }; -/*! -* @brief Creates a new Message queue -* @details Creates a new Message queue, if the feature -* CONFIG_WILC_MSG_QUEUE_IPC_NAME is enabled and pstrAttrs->pcName -* is not Null, then this message queue can be used for IPC with -* any other message queue having the same name in the system -* @param[in,out] pHandle handle to the message queue object -* @param[in] pstrAttrs Optional attributes, NULL for default -* @return Error code indicating success/failure -* @author syounan -* @date 30 Aug 2010 -* @version 1.0 -*/ int wilc_mq_create (struct message_queue *mq); - -/*! -* @brief Sends a message -* @details Sends a message, this API will block until the message is -* actually sent or until it is timedout (as long as the feature -* CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout -* is not set to WILC_OS_INFINITY), zero timeout is a valid value -* @param[in] pHandle handle to the message queue object -* @param[in] pvSendBuffer pointer to the data to send -* @param[in] u32SendBufferSize the size of the data to send -* @param[in] pstrAttrs Optional attributes, NULL for default -* @return Error code indicating success/failure -* @author syounan -* @date 30 Aug 2010 -* @version 1.0 -*/ int wilc_mq_send (struct message_queue *mq,const void *send_buf,u32 send_buf_size); - -/*! -* @brief Receives a message -* @details Receives a message, this API will block until a message is -* received or until it is timedout (as long as the feature -* CONFIG_WILC_MSG_QUEUE_TIMEOUT is enabled and pstrAttrs->u32Timeout -* is not set to WILC_OS_INFINITY), zero timeout is a valid value -* @param[in] pHandle handle to the message queue object -* @param[out] pvRecvBuffer pointer to a buffer to fill with the received message -* @param[in] u32RecvBufferSize the size of the receive buffer -* @param[out] pu32ReceivedLength the length of received data -* @param[in] pstrAttrs Optional attributes, NULL for default -* @return Error code indicating success/failure -* @author syounan -* @date 30 Aug 2010 -* @version 1.0 -*/ int wilc_mq_recv (struct message_queue *mq,void *recv_buf,u32 recv_buf_size,u32 *recv_len); - -/*! -* @brief Destroys an existing Message queue -* @param[in] pHandle handle to the message queue object -* @param[in] pstrAttrs Optional attributes, NULL for default -* @return Error code indicating success/failure -* @author syounan -* @date 30 Aug 2010 -* @version 1.0 -*/ int wilc_mq_destroy (struct message_queue *mq);#endif
Signature · 1 line
2.6.4