Commit 24752783 authored by Chaehyun Lim's avatar Chaehyun Lim Committed by Greg Kroah-Hartman

staging: wilc1000: rename pHandle in wilc_mq_recv

This patch renames pHandle to mq to avoid camelcase.
Signed-off-by: default avatarChaehyun Lim <chaehyun.lim@gmail.com>
Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
parent dee1bf76
...@@ -109,56 +109,56 @@ int wilc_mq_send(struct message_queue *mq, ...@@ -109,56 +109,56 @@ int wilc_mq_send(struct message_queue *mq,
* @note copied from FLO glue implementatuion * @note copied from FLO glue implementatuion
* @version 1.0 * @version 1.0
*/ */
int wilc_mq_recv(struct message_queue *pHandle, int wilc_mq_recv(struct message_queue *mq,
void *pvRecvBuffer, u32 u32RecvBufferSize, void *pvRecvBuffer, u32 u32RecvBufferSize,
u32 *pu32ReceivedLength) u32 *pu32ReceivedLength)
{ {
struct message *pstrMessage; struct message *pstrMessage;
unsigned long flags; unsigned long flags;
if ((!pHandle) || (u32RecvBufferSize == 0) if ((!mq) || (u32RecvBufferSize == 0)
|| (!pvRecvBuffer) || (!pu32ReceivedLength)) { || (!pvRecvBuffer) || (!pu32ReceivedLength)) {
PRINT_ER("pHandle or pvRecvBuffer is null\n"); PRINT_ER("mq or pvRecvBuffer is null\n");
return -EINVAL; return -EINVAL;
} }
if (pHandle->exiting) { if (mq->exiting) {
PRINT_ER("pHandle fail\n"); PRINT_ER("mq fail\n");
return -EFAULT; return -EFAULT;
} }
spin_lock_irqsave(&pHandle->lock, flags); spin_lock_irqsave(&mq->lock, flags);
pHandle->recv_count++; mq->recv_count++;
spin_unlock_irqrestore(&pHandle->lock, flags); spin_unlock_irqrestore(&mq->lock, flags);
down(&pHandle->sem); down(&mq->sem);
spin_lock_irqsave(&pHandle->lock, flags); spin_lock_irqsave(&mq->lock, flags);
pstrMessage = pHandle->msg_list; pstrMessage = mq->msg_list;
if (!pstrMessage) { if (!pstrMessage) {
spin_unlock_irqrestore(&pHandle->lock, flags); spin_unlock_irqrestore(&mq->lock, flags);
PRINT_ER("pstrMessage is null\n"); PRINT_ER("pstrMessage is null\n");
return -EFAULT; return -EFAULT;
} }
/* check buffer size */ /* check buffer size */
if (u32RecvBufferSize < pstrMessage->len) { if (u32RecvBufferSize < pstrMessage->len) {
spin_unlock_irqrestore(&pHandle->lock, flags); spin_unlock_irqrestore(&mq->lock, flags);
up(&pHandle->sem); up(&mq->sem);
PRINT_ER("u32RecvBufferSize overflow\n"); PRINT_ER("u32RecvBufferSize overflow\n");
return -EOVERFLOW; return -EOVERFLOW;
} }
/* consume the message */ /* consume the message */
pHandle->recv_count--; mq->recv_count--;
memcpy(pvRecvBuffer, pstrMessage->buf, pstrMessage->len); memcpy(pvRecvBuffer, pstrMessage->buf, pstrMessage->len);
*pu32ReceivedLength = pstrMessage->len; *pu32ReceivedLength = pstrMessage->len;
pHandle->msg_list = pstrMessage->next; mq->msg_list = pstrMessage->next;
kfree(pstrMessage->buf); kfree(pstrMessage->buf);
kfree(pstrMessage); kfree(pstrMessage);
spin_unlock_irqrestore(&pHandle->lock, flags); spin_unlock_irqrestore(&mq->lock, flags);
return 0; return 0;
} }
...@@ -76,7 +76,7 @@ int wilc_mq_send(struct message_queue *mq, ...@@ -76,7 +76,7 @@ int wilc_mq_send(struct message_queue *mq,
* @date 30 Aug 2010 * @date 30 Aug 2010
* @version 1.0 * @version 1.0
*/ */
int wilc_mq_recv(struct message_queue *pHandle, int wilc_mq_recv(struct message_queue *mq,
void *pvRecvBuffer, u32 u32RecvBufferSize, void *pvRecvBuffer, u32 u32RecvBufferSize,
u32 *pu32ReceivedLength); u32 *pu32ReceivedLength);
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment