linux-kernel.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
* [PATCH] staging: emxx_udc: Fix CamelCase styling issue
@ 2016-12-18 16:46 Afonso Bordado
  2016-12-18 17:40 ` Joe Perches
  2016-12-19 11:52 ` Dan Carpenter
  0 siblings, 2 replies; 4+ messages in thread
From: Afonso Bordado @ 2016-12-18 16:46 UTC (permalink / raw)
  To: gregkh; +Cc: devel, linux-kernel

Converts from CamelCase to the recommended style.

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

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index 3f42fa8..cf5cdd8 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -553,25 +553,25 @@ 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 *p_buf, u32 length)
 {
 	u32		i;
 	int		nret   = 0;
-	u32		iWordLength = 0;
-	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
+	u32		i_word_length = 0;
+	union usb_reg_access *p_buf32 = (union usb_reg_access *)p_buf;
 
 	/*------------------------------------------------------------*/
 	/* Read Length */
-	iWordLength = length / sizeof(u32);
+	i_word_length = length / sizeof(u32);
 
 	/*------------------------------------------------------------*/
 	/* PIO Read */
-	if (iWordLength) {
-		for (i = 0; i < iWordLength; i++) {
-			pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
-			pBuf32++;
+	if (i_word_length) {
+		for (i = 0; i < i_word_length; i++) {
+			p_buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
+			p_buf32++;
 		}
-		nret = iWordLength * sizeof(u32);
+		nret = i_word_length * sizeof(u32);
 	}
 
 	return nret;
-- 
2.9.3

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

* Re: [PATCH] staging: emxx_udc: Fix CamelCase styling issue
  2016-12-18 16:46 [PATCH] staging: emxx_udc: Fix CamelCase styling issue Afonso Bordado
@ 2016-12-18 17:40 ` Joe Perches
  2016-12-18 19:24   ` Afonso Bordado
  2016-12-19 11:52 ` Dan Carpenter
  1 sibling, 1 reply; 4+ messages in thread
From: Joe Perches @ 2016-12-18 17:40 UTC (permalink / raw)
  To: Afonso Bordado, gregkh; +Cc: devel, linux-kernel

On Sun, 2016-12-18 at 16:46 +0000, Afonso Bordado wrote:
> Converts from CamelCase to the recommended style.
> 
> Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
> ---
>  drivers/staging/emxx_udc/emxx_udc.c | 18 +++++++++---------
>  1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
> index 3f42fa8..cf5cdd8 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.c
> +++ b/drivers/staging/emxx_udc/emxx_udc.c
> @@ -553,25 +553,25 @@ 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 *p_buf, u32 length)
>  {
>  	u32		i;
>  	int		nret   = 0;
> -	u32		iWordLength = 0;
> -	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
> +	u32		i_word_length = 0;
> +	union usb_reg_access *p_buf32 = (union usb_reg_access *)p_buf;
>  
>  	/*------------------------------------------------------------*/
>  	/* Read Length */
> -	iWordLength = length / sizeof(u32);
> +	i_word_length = length / sizeof(u32);
>  
>  	/*------------------------------------------------------------*/
>  	/* PIO Read */
> -	if (iWordLength) {
> -		for (i = 0; i < iWordLength; i++) {
> -			pBuf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
> -			pBuf32++;
> +	if (i_word_length) {
> +		for (i = 0; i < i_word_length; i++) {
> +			p_buf32->dw = _nbu2ss_readl(&udc->p_regs->EP0_READ);
> +			p_buf32++;
>  		}
> -		nret = iWordLength * sizeof(u32);
> +		nret = i_word_length * sizeof(u32);
>  	}
>  
>  	return nret;

Instead of merely converting Hungarian CamelCase to lowercase
with underscores where word transitions occurred, try reading
the code and making sense of what it does to perhaps find a
better variable name instead.  Maybe eliminate the variable
altogether.

iWordLength could be reads or numreads

btw: what happens if length is not a multiple of sizeof(u32)?

nret is more commonly ret
p_buf is also not common linux naming, buf is more common.

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

* Re: [PATCH] staging: emxx_udc: Fix CamelCase styling issue
  2016-12-18 17:40 ` Joe Perches
@ 2016-12-18 19:24   ` Afonso Bordado
  0 siblings, 0 replies; 4+ messages in thread
From: Afonso Bordado @ 2016-12-18 19:24 UTC (permalink / raw)
  To: Joe Perches; +Cc: gregkh, devel, linux-kernel

> Instead of merely converting Hungarian CamelCase to lowercase
> with underscores where word transitions occurred, try reading
> the code and making sense of what it does to perhaps find a
> better variable name instead.  Maybe eliminate the variable
> altogether.
>
> iWordLength could be reads or numreads

Ok!

> btw: what happens if length is not a multiple of sizeof(u32)?

Reading over the code (something I should have done the first time)
it seems that it rounds down, not doing the full transfer, and EP0_out_OverBytes
handles the remaining transfer.

Since EP0_out_OverBytes is only called once and for this purpose would it be
perferable to do that on EP0_out_PIO?

> nret is more commonly ret
> p_buf is also not common linux naming, buf is more common.

Ok!

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

* Re: [PATCH] staging: emxx_udc: Fix CamelCase styling issue
  2016-12-18 16:46 [PATCH] staging: emxx_udc: Fix CamelCase styling issue Afonso Bordado
  2016-12-18 17:40 ` Joe Perches
@ 2016-12-19 11:52 ` Dan Carpenter
  1 sibling, 0 replies; 4+ messages in thread
From: Dan Carpenter @ 2016-12-19 11:52 UTC (permalink / raw)
  To: Afonso Bordado; +Cc: gregkh, devel, linux-kernel

On Sun, Dec 18, 2016 at 04:46:50PM +0000, Afonso Bordado wrote:
> Converts from CamelCase to the recommended style.
> 
> Signed-off-by: Afonso Bordado <afonsobordado@az8.co>
> ---
> drivers/staging/emxx_udc/emxx_udc.c | 18 +++++++++---------
> 1 file changed, 9 insertions(+), 9 deletions(-)
> 
> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
> index 3f42fa8..cf5cdd8 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.c
> +++ b/drivers/staging/emxx_udc/emxx_udc.c
> @@ -553,25 +553,25 @@ 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 *p_buf, u32 length)
> {
> 	u32		i;
> 	int		nret   = 0;
> -	u32		iWordLength = 0;
> -	union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
> +	u32		i_word_length = 0;
> +	union usb_reg_access *p_buf32 = (union usb_reg_access *)p_buf;

Remove the i_ and the p_ from the new name.  We don't do that in the
linux kernel.

regards,
dan carpenter

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

end of thread, other threads:[~2016-12-19 11:52 UTC | newest]

Thread overview: 4+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2016-12-18 16:46 [PATCH] staging: emxx_udc: Fix CamelCase styling issue Afonso Bordado
2016-12-18 17:40 ` Joe Perches
2016-12-18 19:24   ` Afonso Bordado
2016-12-19 11:52 ` Dan Carpenter

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).