linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH v2] staging: emxx_udc: Fix styling issues
@ 2016-12-20  9:48 Afonso Bordado
  2016-12-20 10:03 ` Greg KH
  0 siblings, 1 reply; 3+ messages in thread
From: Afonso Bordado @ 2016-12-20  9:48 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Fix CamelCase styling issues with EP0_out_PIO
Remove unecessary temporary variables

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

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 3f42fa8..b0fbd10 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -553,28 +553,23 @@ 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;
-	int		nret   = 0;
-	u32		iWordLength = 0;
-	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
-
-	/*------------------------------------------------------------*/
+	u32 i;
 	/* Read Length */
-	iWordLength = length / sizeof(u32);
+	u32 numreads = length / sizeof(u32);
+	union usb_reg_access *buf32 = (union usb_reg_access *)buf;
+
+	if (!numreads)
+		return 0;
 
-	/*------------------------------------------------------------*/
 	/* PIO Read */
-	if (iWordLength) {
-		for (i = 0; i < iWordLength; i++) {
-			pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
-			pBuf32++;
-		}
-		nret = iWordLength * sizeof(u32);
+	for (i = 0; i < numreads; i++) {
+		buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
+		buf32++;
 	}
 
-	return nret;
+	return numreads * sizeof(u32);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -758,7 +753,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


_______________________________________________
devel mailing list
devel@linuxdriverproject.org
http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel

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

* Re: [PATCH v2] staging: emxx_udc: Fix styling issues
  2016-12-20  9:48 [PATCH v2] staging: emxx_udc: Fix styling issues Afonso Bordado
@ 2016-12-20 10:03 ` Greg KH
  0 siblings, 0 replies; 3+ messages in thread
From: Greg KH @ 2016-12-20 10:03 UTC (permalink / raw)
  To: Afonso Bordado; +Cc: devel, linux-kernel

On Tue, Dec 20, 2016 at 09:48:48AM +0000, Afonso Bordado wrote:
> Fix CamelCase styling issues with EP0_out_PIO
> Remove unecessary temporary variables

Only do one-thing-per-patch please.

thanks,

gre gk-h

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

* [PATCH v2] staging: emxx_udc: Fix styling issues
@ 2016-12-18 22:02 Afonso Bordado
  0 siblings, 0 replies; 3+ messages in thread
From: Afonso Bordado @ 2016-12-18 22:02 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Fix CamelCase styling issues with EP0_out_PIO
Remove unecessary temporary variables

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

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 3f42fa8..b0fbd10 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -553,28 +553,23 @@ 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;
-	int		nret   = 0;
-	u32		iWordLength = 0;
-	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
-
-	/*------------------------------------------------------------*/
+	u32 i;
 	/* Read Length */
-	iWordLength = length / sizeof(u32);
+	u32 numreads = length / sizeof(u32);
+	union usb_reg_access *buf32 = (union usb_reg_access *)buf;
+
+	if (!numreads)
+		return 0;
 
-	/*------------------------------------------------------------*/
 	/* PIO Read */
-	if (iWordLength) {
-		for (i = 0; i < iWordLength; i++) {
-			pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
-			pBuf32++;
-		}
-		nret = iWordLength * sizeof(u32);
+	for (i = 0; i < numreads; i++) {
+		buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
+		buf32++;
 	}
 
-	return nret;
+	return numreads * sizeof(u32);
 }
 
 /*-------------------------------------------------------------------------*/
@@ -758,7 +753,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] 3+ messages in thread

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

Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-20  9:48 [PATCH v2] staging: emxx_udc: Fix styling issues Afonso Bordado
2016-12-20 10:03 ` Greg KH
  -- strict thread matches above, loose matches on Subject: below --
2016-12-18 22:02 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).