Skip to contentSkip to conversation

rename variables in wilc1000 driver

PATCH New Chaehyun Lim 1 participant 28 messages Jan 21, 2016 Staging

lore
Share & tools
lore
#0 lore raw

v2 cover rename variables in wilc1000 driver

V2:
A 18/27 patch of series has a wrong name as tail_msg, which is should be changed to pstrTailMsg. I fixed it in V2.

Chaehyun Lim (27):
staging: wilc1000: rename struct __Message_struct
staging: wilc1000: rename pvBuffer in struct message
staging: wilc1000: rename u32Length in struct message
staging: wilc1000: rename pstrNext in struct message
staging: wilc1000: rename struct WILC_MsgQueueHandle
staging: wilc1000: rename hSem in struct message_queue
staging: wilc1000: rename strCriticalSection in struct message_queue
staging: wilc1000: rename bExiting in struct message_queue
staging: wilc1000: rename u32ReceiversCount in struct message_queue
staging: wilc1000: rename pstrMessageList in struct message_queue
staging: wilc1000: rename pHandle in wilc_mq_create
staging: wilc1000: rename pHandle in wilc_mq_destroy
staging: wilc1000: rename pstrMessge in wilc_mq_destroy
staging: wilc1000: rename pHandle in wilc_mq_send
staging: wilc1000: rename pvSendBuffer in wilc_mq_send
staging: wilc1000: rename u32SendBufferSize in wilc_mq_send
staging: wilc1000: rename pstrMessage in wilc_mq_send
staging: wilc1000: rename pstrTailMsg in wilc_mq_send
staging: wilc1000: fix return error code
staging: wilc1000: rename pHandle in wilc_mq_recv
staging: wilc1000: rename pvRecvBuffer in wilc_mq_recv
staging: wilc1000: rename u32RecvBufferSize in wilc_mq_recv
staging: wilc1000: rename pu32ReceivedLength in wilc_mq_recv
staging: wilc1000: rename pstrMessage in wilc_mq_recv
staging: wilc1000: fix coding style of kmalloc usage
staging: wilc1000: fix logical continuations
staging: wilc1000: remove over-commenting

 drivers/staging/wilc1000/host_interface.c |   2 +-
 drivers/staging/wilc1000/wilc_msgqueue.c  | 135 +++++++++++++++---------------
 drivers/staging/wilc1000/wilc_msgqueue.h  | 107 +++++------------------
 3 files changed, 87 insertions(+), 157 deletions(-)
Signature · 1 line
2.7.0
#1 lore raw

PATCH v2 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
index abc780c..9b78fcd 100644
@@ -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
index d7e0328..1a7c652 100644
@@ -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.7.0
#2 lore raw

PATCH v2 2/27 staging: wilc1000: rename pvBuffer in struct message

In reply to Chaehyun Lim

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
index 9b78fcd..a4e612d 100644
@@ -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
index 1a7c652..848ed82 100644
@@ -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.7.0
#3 lore raw

PATCH v2 3/27 staging: wilc1000: rename u32Length in struct message

In reply to Chaehyun Lim

This 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
index a4e612d..0e66a64 100644
@@ -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
index 848ed82..b0ccd1d 100644
@@ -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.7.0
#4 lore raw

PATCH v2 4/27 staging: wilc1000: rename pstrNext in struct message

In reply to Chaehyun Lim

This 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
index 0e66a64..4d79a31 100644
@@ -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
index b0ccd1d..ec503c3 100644
@@ -16,7 +16,7 @@
 struct message {
 	void *buf;
 	u32 len;
-	struct message *pstrNext;
+	struct message *next;
 };
 
 typedef struct __MessageQueue_struct {
Signature · 1 line
2.7.0
#5 lore raw

PATCH v2 5/27 staging: wilc1000: rename struct WILC_MsgQueueHandle

In reply to Chaehyun Lim

This 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
index 5fac516..98627a6 100644
@@ -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
index 4d79a31..907bae1 100644
@@ -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
index ec503c3..111be46 100644
@@ -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.7.0
#6 lore raw

PATCH v2 6/27 staging: wilc1000: rename hSem in struct message_queue

In reply to Chaehyun Lim

This 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
index 907bae1..b996c47 100644
@@ -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
index 111be46..3ea4068 100644
@@ -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.7.0
#7 lore raw

PATCH v2 7/27 staging: wilc1000: rename strCriticalSection in struct message_queue

In reply to Chaehyun Lim

This 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
index b996c47..67bf147 100644
@@ -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
index 3ea4068..6cdebbf 100644
@@ -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.7.0
#8 lore raw

PATCH v2 8/27 staging: wilc1000: rename bExiting in struct message_queue

In reply to Chaehyun Lim

This 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
index 67bf147..47ba256 100644
@@ -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
index 6cdebbf..2c21b3e 100644
@@ -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.7.0
#9 lore raw

PATCH v2 9/27 staging: wilc1000: rename u32ReceiversCount in struct message_queue

In reply to Chaehyun Lim

This 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
index 47ba256..363e003 100644
@@ -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
index 2c21b3e..dcf54ea 100644
@@ -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.7.0
#10 lore raw

PATCH v2 10/27 staging: wilc1000: rename pstrMessageList in struct message_queue

In reply to Chaehyun Lim

This 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
index 363e003..d13c9a7 100644
@@ -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
index dcf54ea..7e7ec06 100644
@@ -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.7.0
#11 lore raw

PATCH v2 11/27 staging: wilc1000: rename pHandle in wilc_mq_create

In reply to Chaehyun Lim

This 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
index d13c9a7..453fa19 100644
@@ -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
index 7e7ec06..bfd2347 100644
@@ -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.7.0
#12 lore raw

PATCH v2 12/27 staging: wilc1000: rename pHandle in wilc_mq_destroy

In reply to Chaehyun Lim

This 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
index 453fa19..103fcfd 100644
@@ -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
index bfd2347..b91822e 100644
@@ -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.7.0
#13 lore raw

PATCH v2 13/27 staging: wilc1000: rename pstrMessge in wilc_mq_destroy

In reply to Chaehyun Lim

This 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
index 103fcfd..a01420a 100644
@@ -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.7.0
#14 lore raw

PATCH v2 14/27 staging: wilc1000: rename pHandle in wilc_mq_send

In reply to Chaehyun Lim

This 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
index a01420a..71ce1f5 100644
@@ -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
index b91822e..e6cdc10 100644
@@ -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.7.0
#15 lore raw

PATCH v2 15/27 staging: wilc1000: rename pvSendBuffer in wilc_mq_send

In reply to Chaehyun Lim

This 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
index 71ce1f5..5feb87c 100644
@@ -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
index e6cdc10..3adee90 100644
@@ -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.7.0
#16 lore raw

PATCH v2 16/27 staging: wilc1000: rename u32SendBufferSize in wilc_mq_send

In reply to Chaehyun Lim

This 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
index 5feb87c..8e37cff0 100644
@@ -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
index 3adee90..70e1be1 100644
@@ -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.7.0
#17 lore raw

PATCH v2 17/27 staging: wilc1000: rename pstrMessage in wilc_mq_send

In reply to Chaehyun Lim

This 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
index 8e37cff0..9a80fe6 100644
@@ -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.7.0
#18 lore raw

PATCH v2 18/27 staging: wilc1000: rename pstrTailMsg in wilc_mq_send

In reply to Chaehyun Lim

This 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
index 9a80fe6..764723f 100644
@@ -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.7.0
#19 lore raw

PATCH v2 19/27 staging: wilc1000: fix return error code

In reply to Chaehyun Lim

Three 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
index 764723f..361ca8f 100644
@@ -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.7.0
#20 lore raw

PATCH v2 20/27 staging: wilc1000: rename pHandle in wilc_mq_recv

In reply to Chaehyun Lim

This 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
index 361ca8f..d2df179 100644
@@ -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
index 70e1be1..0c1eead 100644
@@ -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.7.0
#21 lore raw

PATCH v2 21/27 staging: wilc1000: rename pvRecvBuffer in wilc_mq_recv

In reply to Chaehyun Lim

This 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
index d2df179..b836b2e 100644
@@ -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
index 0c1eead..81b51dd 100644
@@ -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.7.0
#22 lore raw

PATCH v2 22/27 staging: wilc1000: rename u32RecvBufferSize in wilc_mq_recv

In reply to Chaehyun Lim

This 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
index b836b2e..c86bd7c 100644
@@ -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
index 81b51dd..3804b3b 100644
@@ -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.7.0
#23 lore raw

PATCH v2 23/27 staging: wilc1000: rename pu32ReceivedLength in wilc_mq_recv

In reply to Chaehyun Lim

This 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
index c86bd7c..5601de8 100644
@@ -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
index 3804b3b..4f79ead 100644
@@ -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.7.0
#24 lore raw

PATCH v2 24/27 staging: wilc1000: rename pstrMessage in wilc_mq_recv

In reply to Chaehyun Lim

This 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
index 5601de8..7107715 100644
@@ -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.7.0
#25 lore raw

PATCH v2 25/27 staging: wilc1000: fix coding style of kmalloc usage

In reply to Chaehyun Lim

This 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
index 7107715..c7a60f4 100644
@@ -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.7.0
#26 lore raw

PATCH v2 26/27 staging: wilc1000: fix logical continuations

In reply to Chaehyun Lim

This 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
index c7a60f4..4493ca9 100644
@@ -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.7.0
#27 lore raw

PATCH v2 27/27 staging: wilc1000: remove over-commenting

In reply to Chaehyun Lim

There 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
index 4f79ead..ddd09843 100644
@@ -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.7.0