linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues
@ 2016-12-20 13:55 Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 1/4] staging: emxx_udc: Fix CamelCase function name Afonso Bordado
                   ` (3 more replies)
  0 siblings, 4 replies; 5+ messages in thread
From: Afonso Bordado @ 2016-12-20 13:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Fix checkpatch.pl issues with CamelCase.
Improves readability by removing temporary variables.

Afonso Bordado (4):
  staging: emxx_udc: Fix CamelCase function name
  staging: emxx_udc: Rename CamelCase variable
  staging: emxx_udc: Remove unecessary temporary variable
  staging: emxx_udc: Fix CamelCase variable name

 drivers/staging/emxx_udc/emxx_udc.c | 26 ++++++++++----------------
 1 file changed, 10 insertions(+), 16 deletions(-)

-- 
2.9.3

^ permalink raw reply	[flat|nested] 5+ messages in thread

* [PATCH v3 1/4] staging: emxx_udc: Fix CamelCase function name
  2016-12-20 13:55 [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues Afonso Bordado
@ 2016-12-20 13:55 ` Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 2/4] staging: emxx_udc: Rename CamelCase variable Afonso Bordado
                   ` (2 subsequent siblings)
  3 siblings, 0 replies; 5+ messages in thread
From: Afonso Bordado @ 2016-12-20 13:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Change EP0_out_PIO to use the kernel convention.

Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
---
 drivers/staging/emxx_udc/emxx_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 3f42fa8..51ad04b 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -553,7 +553,7 @@ static void _nbu2ss_dma_unmap_single(
 
 /*-------------------------------------------------------------------------*/
 /* Endpoint 0 OUT Transfer (PIO) */
-static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)
+static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)
 {
 	u32		i;
 	int		nret   = 0;
@@ -758,7 +758,7 @@ static int _nbu2ss_ep0_out_transfer(
 		pBuffer = (u8 *)req->req.buf;
 		pBuffer += req->req.actual;
 
-		result = EP0_out_PIO(udc, pBuffer
+		result = ep0_out_pio(udc, pBuffer
 					, min(iRemainSize, iRecvLength));
 		if (result < 0)
 			return result;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 2/4] staging: emxx_udc: Rename CamelCase variable
  2016-12-20 13:55 [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 1/4] staging: emxx_udc: Fix CamelCase function name Afonso Bordado
@ 2016-12-20 13:55 ` Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 3/4] staging: emxx_udc: Remove unecessary temporary variable Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 4/4] staging: emxx_udc: Fix CamelCase variable name Afonso Bordado
  3 siblings, 0 replies; 5+ messages in thread
From: Afonso Bordado @ 2016-12-20 13:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

The new name complies with the kernel styling guidelines and is more descriptive.

Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
---
 drivers/staging/emxx_udc/emxx_udc.c | 12 ++++--------
 1 file changed, 4 insertions(+), 8 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 51ad04b..0963533 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -557,21 +557,17 @@ static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)
 {
 	u32		i;
 	int		nret   = 0;
-	u32		iWordLength = 0;
+	u32 numreads = length / sizeof(u32);
 	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
 
 	/*------------------------------------------------------------*/
-	/* Read Length */
-	iWordLength = length / sizeof(u32);
-
-	/*------------------------------------------------------------*/
 	/* PIO Read */
-	if (iWordLength) {
-		for (i = 0; i < iWordLength; i++) {
+	if (numreads) {
+		for (i = 0; i < numreads; i++) {
 			pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
 			pBuf32++;
 		}
-		nret = iWordLength * sizeof(u32);
+		nret = numreads * sizeof(u32);
 	}
 
 	return nret;
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 3/4] staging: emxx_udc: Remove unecessary temporary variable
  2016-12-20 13:55 [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 1/4] staging: emxx_udc: Fix CamelCase function name Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 2/4] staging: emxx_udc: Rename CamelCase variable Afonso Bordado
@ 2016-12-20 13:55 ` Afonso Bordado
  2016-12-20 13:55 ` [PATCH v3 4/4] staging: emxx_udc: Fix CamelCase variable name Afonso Bordado
  3 siblings, 0 replies; 5+ messages in thread
From: Afonso Bordado @ 2016-12-20 13:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

This improves code readability.

Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
---
 drivers/staging/emxx_udc/emxx_udc.c | 16 +++++++---------
 1 file changed, 7 insertions(+), 9 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 0963533..45808ed 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -556,21 +556,19 @@ static void _nbu2ss_dma_unmap_single(
 static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)
 {
 	u32		i;
-	int		nret   = 0;
 	u32 numreads = length / sizeof(u32);
 	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
 
-	/*------------------------------------------------------------*/
+	if (!numreads)
+		return 0;
+
 	/* PIO Read */
-	if (numreads) {
-		for (i = 0; i < numreads; i++) {
-			pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
-			pBuf32++;
-		}
-		nret = numreads * sizeof(u32);
+	for (i = 0; i < numreads; i++) {
+		pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
+		pBuf32++;
 	}
 
-	return nret;
+	return  numreads * sizeof(u32);
 }
 
 /*-------------------------------------------------------------------------*/
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

* [PATCH v3 4/4] staging: emxx_udc: Fix CamelCase variable name
  2016-12-20 13:55 [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues Afonso Bordado
                   ` (2 preceding siblings ...)
  2016-12-20 13:55 ` [PATCH v3 3/4] staging: emxx_udc: Remove unecessary temporary variable Afonso Bordado
@ 2016-12-20 13:55 ` Afonso Bordado
  3 siblings, 0 replies; 5+ messages in thread
From: Afonso Bordado @ 2016-12-20 13:55 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Changes from CamelCase to a kernel format

Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
---
 drivers/staging/emxx_udc/emxx_udc.c | 8 ++++----
 1 file changed, 4 insertions(+), 4 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 45808ed..c19ce17 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -553,19 +553,19 @@ static void _nbu2ss_dma_unmap_single(
 
 /*-------------------------------------------------------------------------*/
 /* Endpoint 0 OUT Transfer (PIO) */
-static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)
+static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length)
 {
 	u32		i;
 	u32 numreads = length / sizeof(u32);
-	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
+	union usb_reg_access *buf32 = (union usb_reg_access *)buf;
 
 	if (!numreads)
 		return 0;
 
 	/* PIO Read */
 	for (i = 0; i < numreads; i++) {
-		pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
-		pBuf32++;
+		buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
+		buf32++;
 	}
 
 	return  numreads * sizeof(u32);
-- 
2.9.3

^ permalink raw reply related	[flat|nested] 5+ messages in thread

end of thread, other threads:[~2016-12-20 13:58 UTC | newest]

Thread overview: 5+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20 13:55 [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues Afonso Bordado
2016-12-20 13:55 ` [PATCH v3 1/4] staging: emxx_udc: Fix CamelCase function name Afonso Bordado
2016-12-20 13:55 ` [PATCH v3 2/4] staging: emxx_udc: Rename CamelCase variable Afonso Bordado
2016-12-20 13:55 ` [PATCH v3 3/4] staging: emxx_udc: Remove unecessary temporary variable Afonso Bordado
2016-12-20 13:55 ` [PATCH v3 4/4] staging: emxx_udc: Fix CamelCase variable name Afonso Bordado

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).