2016-12-20 13:55:33

by Afonso Bordado

[permalink] [raw]
Subject: [PATCH v3 0/4] staging: emxx_udc: Fix checkpatch.pl CamelCase issues

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



2016-12-20 13:55:31

by Afonso Bordado

[permalink] [raw]
Subject: [PATCH v3 1/4] staging: emxx_udc: Fix CamelCase function name

Change EP0_out_PIO to use the kernel convention.

Signed-off-by: Afonso Bordado <[email protected]>
---
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


2016-12-20 13:55:30

by Afonso Bordado

[permalink] [raw]
Subject: [PATCH v3 2/4] staging: emxx_udc: Rename CamelCase variable

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

Signed-off-by: Afonso Bordado <[email protected]>
---
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


2016-12-20 13:55:28

by Afonso Bordado

[permalink] [raw]
Subject: [PATCH v3 3/4] staging: emxx_udc: Remove unecessary temporary variable

This improves code readability.

Signed-off-by: Afonso Bordado <[email protected]>
---
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


2016-12-20 13:58:38

by Afonso Bordado

[permalink] [raw]
Subject: [PATCH v3 4/4] staging: emxx_udc: Fix CamelCase variable name

Changes from CamelCase to a kernel format

Signed-off-by: Afonso Bordado <[email protected]>
---
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