Staging: emxx_udc: Fix checkpatch.pl warnings
v5 cover Staging: emxx_udc: Fix checkpatch.pl warnings
This patchset fixes the following coding style issues found by checkpatch.pl:
Do not add new typedefs.
Use of volatile is usually wrong.
printk(KERNEL_ERR not prefered.
Changes in v5:
- Fix spelling mistakes
- Justify the removal of volatile
- Replaced pr_err with dev_err when possible
Changes in v4:
- Patchset broken into smaller pathces
Changes in v3:
- Create patchset from two patches
Changes in v2:
- First patch reversion
Haneen Mohammed (6):
Staging: emxx_udc: Fix do not add new typedefs
Staging: emxx_udc: Remove volatile from union usb_regs_access
Staging: emxx_udc: Replace custom printk macro ERR with pr_err
Staging: emxx_udc: Replace custom printk macro ERR with dev_err
Staging: emxx_udc: Remove custom printk macro ERR
Staging: emxx_udc: Clean dev_err() logging
drivers/staging/emxx_udc/emxx_udc.c | 142 ++++++++++++++++++------------------ drivers/staging/emxx_udc/emxx_udc.h | 27 ++++--- 2 files changed, 84 insertions(+), 85 deletions(-)
Signature · 1 line
1.9.1
PATCH v5 1/6 Staging: emxx_udc: Fix do not add new typedefs
This patch fixes the following checkpatch.pl warning:"do not add new typedefs".
Remove typedefs keyword and rename identifiers appropriately. Update related files.
---
v5: Nothing
v4: Replace struct with volatile union for usb_reg_access.
v3: Remove all typedefs and create patchset from emxx_udc.
v2: Remove typedefs appropriately and change related file.
drivers/staging/emxx_udc/emxx_udc.c | 60 ++++++++++++++++++------------------- drivers/staging/emxx_udc/emxx_udc.h | 26 ++++++++-------- 2 files changed, 43 insertions(+), 43 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +30 -30
@@ -201,7 +201,7 @@ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc)u32 num, buf_type;u32 data, last_ram_adr, use_ram_size; -PT_EP_REGS p_ep_regs; +struct ep_regs *p_ep_regs; last_ram_adr = (D_RAM_SIZE_CTRL /sizeof (u32)) *2 ; use_ram_size =0 ;
@@ -394,7 +394,7 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) {u32 num;u32 data; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (udc->vbus_active ==0 )return ;/* VBUS OFF */
@@ -425,7 +425,7 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)/* Abort DMA */ static void _nbu2ss_ep_dma_abort (struct nbu2ss_udc *udc,struct nbu2ss_ep *ep) { -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;_nbu2ss_bitclr (&preg->EP_DCR[ep->epnum-1 ].EP_DCR1, DCR1_EPn_REQEN);mdelay (DMA_DISABLE_TIME );/* DCR1_EPn_REQEN Clear */
@@ -443,7 +443,7 @@ static void _nbu2ss_ep_in_end( {u32 data;u32 num; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (length >=sizeof (u32))return ;
@@ -567,7 +567,7 @@ static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)u32 i;int nret =0 ;u32 iWordLength =0 ; -USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; +volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;/*------------------------------------------------------------*/ /* Read Length */
@@ -592,8 +592,8 @@ static int EP0_out_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) {u32 i;u32 iReadSize =0 ; -USB_REG_ACCESS Temp32; -USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; +volatile union usb_reg_access Temp32; +volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;if ((0 < length) && (length <sizeof (u32))) { Temp32.dw =_nbu2ss_readl (&udc->p_regs->EP0_READ);
@@ -613,7 +613,7 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)u32 iMaxLength =EP0_PACKETSIZE ;u32 iWordLength =0 ;u32 iWriteLength =0 ; -USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; +volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;/*------------------------------------------------------------*/ /* Transfer Length */
@@ -638,8 +638,8 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)static int EP0_in_OverBytes (struct nbu2ss_udc *udc,u8 *pBuf,u32 iRemainSize) {u32 i; -USB_REG_ACCESS Temp32; -USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; +volatile union usb_reg_access Temp32; +volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;if ((0 < iRemainSize) && (iRemainSize <sizeof (u32))) {for (i =0 ; i < iRemainSize ; i++)
@@ -840,7 +840,7 @@ static int _nbu2ss_out_dma(u32 burst =1 ;u32 data;int result = -EINVAL ; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (req->dma_flag)return 1 ;/* DMA is forwarded */
@@ -900,10 +900,10 @@ static int _nbu2ss_epn_out_pio(u32 i;u32 data;u32 iWordLength; -USB_REG_ACCESS Temp32; -USB_REG_ACCESS *pBuf32; +volatile union usb_reg_access Temp32; +volatile union usb_reg_access *pBuf32;int result =0 ; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (req->dma_flag)return 1 ;/* DMA is forwarded */
@@ -912,7 +912,7 @@ static int _nbu2ss_epn_out_pio(return 0 ; pBuffer = (u8 *)req->req.buf; - pBuf32 = (USB_REG_ACCESS *)(pBuffer + req->req.actual); + pBuf32 = (volatile union usb_reg_access *)(pBuffer + req->req.actual); iWordLength = length /sizeof (u32);if (iWordLength >0 ) {
@@ -988,7 +988,7 @@ static int _nbu2ss_epn_out_transfer(u32 num;u32 iRecvLength;int result =1 ; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (ep->epnum ==0 )return -EINVAL ;
@@ -1051,7 +1051,7 @@ static int _nbu2ss_in_dma(u32 iWriteLength;u32 data;int result = -EINVAL ; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (req->dma_flag)return 1 ;/* DMA is forwarded */
@@ -1123,17 +1123,17 @@ static int _nbu2ss_epn_in_pio(u32 i;u32 data;u32 iWordLength; -USB_REG_ACCESS Temp32; -USB_REG_ACCESS *pBuf32 =NULL ; +volatile union usb_reg_access Temp32; +volatile union usb_reg_access *pBuf32 =NULL ;int result =0 ; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (req->dma_flag)return 1 ;/* DMA is forwarded */ if (length >0 ) { pBuffer = (u8 *)req->req.buf; - pBuf32 = (USB_REG_ACCESS *)(pBuffer + req->req.actual); + pBuf32 = (volatile union usb_reg_access *)(pBuffer + req->req.actual); iWordLength = length /sizeof (u32);if (iWordLength >0 ) {
@@ -1347,7 +1347,7 @@ static void _nbu2ss_set_endpoint_stall(u8 num, epnum;u32 data;struct nbu2ss_ep *ep; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if ((ep_adrs ==0 ) || (ep_adrs ==0x80 )) {if (bstall) {
@@ -1471,7 +1471,7 @@ static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) {u8 epnum;u32 data =0 , bit_data; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs; epnum = ep_adrs & ~USB_ENDPOINT_DIR_MASK ;if (epnum ==0 ) {
@@ -1566,7 +1566,7 @@ static void _nbu2ss_epn_set_stall(u32 regdata;int limit_cnt =0 ; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (ep->direct ==USB_DIR_IN ) { for (limit_cnt = 0
@@ -1994,7 +1994,7 @@ static inline void _nbu2ss_epn_in_int(int result =0 ;u32 status; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (req->dma_flag)return ;/* DMA is forwarded */
@@ -2090,7 +2090,7 @@ static inline void _nbu2ss_epn_out_dma_int(u32 num;u32 dmacnt, ep_dmacnt;u32 mpkt; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs; num = ep->epnum -1 ;
@@ -2293,7 +2293,7 @@ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on)/*-------------------------------------------------------------------------*/ static void _nbu2ss_fifo_flush (struct nbu2ss_udc *udc,struct nbu2ss_ep *ep) { -PT_FC_REGS p = udc->p_regs; +struct fc_regs *p = udc->p_regs;if (udc->vbus_active ==0 )return ;
@@ -2536,7 +2536,7 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc)u32 epnum, int_bit;struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (gpio_get_value (VBUS_VALUE ) ==0 ) {_nbu2ss_writel (&preg->USB_INT_STA, ~USB_INT_STA_RW );
@@ -2944,7 +2944,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep)struct nbu2ss_ep *ep;struct nbu2ss_udc *udc;unsigned long flags; -PT_FC_REGS preg; +struct fc_regs *preg;/* INFO("=== %s()\n", __func__); */
@@ -3341,7 +3341,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) 0, driver_name, udc);/* IO Memory */ - udc->p_regs = (PT_FC_REGS )mmio_base; + udc->p_regs = (struct fc_regs *)mmio_base;/* USB Function Controller Interrupt */ if (status !=0 ) {
drivers/staging/emxx_udc/emxx_udc.h +13 -13
@@ -474,8 +474,8 @@/*===========================================================================*/ /* Struct */ -/*------- T_EP_REGS */ -typedef struct _T_EP_REGS { +/*------- ep_regs */ +struct ep_regs {u32 EP_CONTROL;/* EP Control */ u32 EP_STATUS;/* EP Status */ u32 EP_INT_ENA;/* EP Interrupt Enable */
@@ -484,18 +484,18 @@ typedef struct _T_EP_REGS {u32 EP_LEN_DCNT ;/* EP Length & DMA count */ u32 EP_READ ;/* EP Read */ u32 EP_WRITE ;/* EP Write */ -}T_EP_REGS , *PT_EP_REGS ; +}; -/*------- T_EP_DCR */ -typedef struct _T_EP_DCR { +/*------- ep_dcr */ +struct ep_dcr {u32 EP_DCR1;/* EP_DCR1 */ u32 EP_DCR2;/* EP_DCR2 */ u32 EP_TADR;/* EP_TADR */ u32 Reserved;/* Reserved */ -}T_EP_DCR , *PT_EP_DCR ; +};/*------- Function Registers */ -typedef struct _T_FC_REGS { +struct fc_regs {u32 USB_CONTROL;/* (0x0000) USB Control */ u32 USB_STATUS;/* (0x0004) USB Status */ u32 USB_ADDRESS;/* (0x0008) USB Address */
@@ -513,7 +513,7 @@ typedef struct _T_FC_REGS {u32 EP0_READ ;/* (0x0038) EP0 Read */ u32 EP0_WRITE ;/* (0x003C) EP0 Write */ -T_EP_REGS EP_REGS [REG_EP_NUM ];/* Endpoint Register */ +struct ep_regs EP_REGS [REG_EP_NUM ];/* Endpoint Register */ u8 Reserved220[0x1000 -0x220 ];/* (0x0220:0x0FFF) Reserved */
@@ -531,11 +531,11 @@ typedef struct _T_FC_REGS {u8 Reserved1028[0x110 -0x28 ];/* (0x1028:0x110F) Reserved */ -T_EP_DCR EP_DCR [REG_EP_NUM ];/* */ +struct ep_dcr EP_DCR [REG_EP_NUM ];/* */ u8 Reserved1200[0x1000 -0x200 ];/* Reserved */ -} __attribute__ ((aligned(32))) T_FC_REGS, *PT_FC_REGS; +} __attribute__ ((aligned(32)));
@@ -632,16 +632,16 @@ struct nbu2ss_udc {u32 curr_config;/* Current Configuration Number */ -PT_FC_REGS p_regs; +struct fc_regs *p_regs; };/* USB register access structure */ -typedef volatile union { +volatile union usb_reg_access {struct {unsigned char DATA[4 ]; } byte;unsigned int dw; -}USB_REG_ACCESS ; +};/*-------------------------------------------------------------------------*/ #define ERR(stuff...) printk(KERN_ERR "udc: " stuff)
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v5 1/6] Staging: emxx_udc: Fix do not add new typedefs
Quoted 66 lines · Haneen Mohammed
This patch fixes the following checkpatch.pl warning:"do not add new typedefs".
Remove typedefs keyword and rename identifiers appropriately. Update related files.Signed-off-by Haneen Mohammed <[email protected]>---
v5: Nothing
v4: Replace struct with volatile union forusb_reg_access.
v3: Remove all typedefs and create patchset fromemxx_udc.
v2: Remove typedefs appropriately and change related file.drivers/staging/emxx_udc/emxx_udc.c | 60 ++++++++++++++++++------------------- drivers/staging/emxx_udc/emxx_udc.h | 26 ++++++++-------- 2 files changed, 43 insertions(+), 43 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +5
-5@@ -201,7 +201,7 @@ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc)u32 num, buf_type;u32 data, last_ram_adr, use_ram_size; -PT_EP_REGS p_ep_regs; +struct ep_regs *p_ep_regs; last_ram_adr = (D_RAM_SIZE_CTRL /sizeof (u32)) *2 ; use_ram_size =0 ;@@ -394,7 +394,7 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) {u32 num;u32 data; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (udc->vbus_active ==0 )return ;/* VBUS OFF */ @@ -425,7 +425,7 @@ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)/* Abort DMA */ static void _nbu2ss_ep_dma_abort (struct nbu2ss_udc *udc,struct nbu2ss_ep *ep) { -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;_nbu2ss_bitclr (&preg->EP_DCR[ep->epnum-1 ].EP_DCR1, DCR1_EPn_REQEN);mdelay (DMA_DISABLE_TIME );/* DCR1_EPn_REQEN Clear */ @@ -443,7 +443,7 @@ static void _nbu2ss_ep_in_end( {u32 data;u32 num; -PT_FC_REGS preg = udc->p_regs; +struct fc_regs *preg = udc->p_regs;if (length >=sizeof (u32))return ;@@ -567,7 +567,7 @@ static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)u32 i;int nret =0 ;u32 iWordLength =0 ; -USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; +volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;/*------------------------------------------------------------*/ /* Read Length */
drivers/staging/emxx_udc/emxx_udc.c static int EP0_out_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) · line 596
Quoted 7 lines
drivers/staging/emxx_udc/emxx_udc.c +2
-2@@ -592,8 +592,8 @@ static int EP0_out_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) {u32 i;u32 iReadSize =0 ; -USB_REG_ACCESS Temp32; -USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; +volatile union usb_reg_access Temp32; +volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;
volatile is almost never needed in the kernel, and in these places it's wrong, so please don't add it here, or in any of these cases.
thanks,
greg k-h
PATCH v5 2/6 Staging: emxx_udc: Remove volatile from union usb_regs_access
In reply to Haneen Mohammedvolatile applies to a concrete variable definition, else it is useless. This patch removes volatile from union usb_regs_access:
- to address compiler warning: "useless type qualifier"
- and fix checkpatch.pl warning about using volatiles:
"WARNING: Use of volatile is usually wrong"
---
v5: Justify the removal of volatile
drivers/staging/emxx_udc/emxx_udc.c | 24 ++++++++++++------------ drivers/staging/emxx_udc/emxx_udc.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +12 -12
@@ -567,7 +567,7 @@ static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)u32 i;int nret =0 ;u32 iWordLength =0 ; -volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf; +union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;/*------------------------------------------------------------*/ /* Read Length */
@@ -592,8 +592,8 @@ static int EP0_out_OverBytes(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) {u32 i;u32 iReadSize =0 ; -volatile union usb_reg_access Temp32; -volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf; +union usb_reg_access Temp32; +union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;if ((0 < length) && (length <sizeof (u32))) { Temp32.dw =_nbu2ss_readl (&udc->p_regs->EP0_READ);
@@ -613,7 +613,7 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)u32 iMaxLength =EP0_PACKETSIZE ;u32 iWordLength =0 ;u32 iWriteLength =0 ; -volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf; +union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;/*------------------------------------------------------------*/ /* Transfer Length */
@@ -638,8 +638,8 @@ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)static int EP0_in_OverBytes (struct nbu2ss_udc *udc,u8 *pBuf,u32 iRemainSize) {u32 i; -volatile union usb_reg_access Temp32; -volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf; +union usb_reg_access Temp32; +union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;if ((0 < iRemainSize) && (iRemainSize <sizeof (u32))) {for (i =0 ; i < iRemainSize ; i++)
@@ -900,8 +900,8 @@ static int _nbu2ss_epn_out_pio(u32 i;u32 data;u32 iWordLength; -volatile union usb_reg_access Temp32; -volatile union usb_reg_access *pBuf32; +union usb_reg_access Temp32; +union usb_reg_access *pBuf32;int result =0 ;struct fc_regs *preg = udc->p_regs;
@@ -912,7 +912,7 @@ static int _nbu2ss_epn_out_pio(return 0 ; pBuffer = (u8 *)req->req.buf; - pBuf32 = (volatile union usb_reg_access *)(pBuffer + req->req.actual); + pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual); iWordLength = length /sizeof (u32);if (iWordLength >0 ) {
@@ -1123,8 +1123,8 @@ static int _nbu2ss_epn_in_pio(u32 i;u32 data;u32 iWordLength; -volatile union usb_reg_access Temp32; -volatile union usb_reg_access *pBuf32 =NULL ; +union usb_reg_access Temp32; +union usb_reg_access *pBuf32 =NULL ;int result =0 ;struct fc_regs *preg = udc->p_regs;
@@ -1133,7 +1133,7 @@ static int _nbu2ss_epn_in_pio(if (length >0 ) { pBuffer = (u8 *)req->req.buf; - pBuf32 = (volatile union usb_reg_access *)(pBuffer + req->req.actual); + pBuf32 = (union usb_reg_access *)(pBuffer + req->req.actual); iWordLength = length /sizeof (u32);if (iWordLength >0 ) {
drivers/staging/emxx_udc/emxx_udc.h +1 -1
@@ -636,7 +636,7 @@ struct nbu2ss_udc { };/* USB register access structure */ -volatile union usb_reg_access { +union usb_reg_access {struct {unsigned char DATA[4 ]; } byte;
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v5 2/6] Staging: emxx_udc: Remove volatile from union usb_regs_access
Quoted 19 lines · Haneen Mohammed
volatile applies to a concrete variable definition, else it is useless. This patch removes volatile from union
usb_regs_access:
- to address compiler warning: "useless type qualifier"
- and fix checkpatch.pl warning about using volatiles:
"WARNING: Use of volatile is usually wrong"Signed-off-by Haneen Mohammed <[email protected]>---
v5: Justify the removal of volatiledrivers/staging/emxx_udc/emxx_udc.c | 24 ++++++++++++------------ drivers/staging/emxx_udc/emxx_udc.h | 2 +- 2 files changed, 13 insertions(+), 13 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +0
-0
drivers/staging/emxx_udc/emxx_udc.c static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length) · line 570
Quoted 5 lines
drivers/staging/emxx_udc/emxx_udc.c +1
-1@@ -567,7 +567,7 @@ static int EP0_out_PIO(struct nbu2ss_udc *udc, u8 *pBuf, u32 length)u32 i;int nret =0 ;u32 iWordLength =0 ; -volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf; +union usb_reg_access *pBuf32 = (union usb_reg_access *)pBuf;
Just merge this with the previous patch please.
thanks,
greg k-h
PATCH v5 3/6 Staging: emxx_udc: Replace custom printk macro ERR with pr_err
In reply to Haneen MohammedThis patch removes half custom printk macros ERR and replace it with pr_err. Issue addressed by checkpathc.pl.
---
v5: Fix spelling mistakes
drivers/staging/emxx_udc/emxx_udc.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +28 -28
@@ -115,7 +115,7 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc)pr_info ("=== %s()\n" , __func__);if (udc ==NULL ) { -ERR ("%s udc == NULL\n" , __func__); +pr_err ("udc: %s udc == NULL\n" , __func__);return ; }
@@ -2258,7 +2258,7 @@ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on)u32 reg_dt;if (!udc) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; }
@@ -2612,13 +2612,13 @@ static int nbu2ss_ep_enable(struct nbu2ss_udc *udc;if ((_ep ==NULL ) || (desc ==NULL )) { -ERR (" *** %s, bad param\n" , __func__); +pr_err ("udc: *** %s, bad param\n" , __func__);return -EINVAL ; } ep = container_of(_ep, struct nbu2ss_ep, ep);if ((ep ==NULL ) || (ep->udc ==NULL )) { -ERR (" *** %s, ep == NULL !!\n" , __func__); +pr_err ("udc: *** %s, ep == NULL !!\n" , __func__);return -EINVAL ; }
@@ -2626,7 +2626,7 @@ static int nbu2ss_ep_enable(if ((ep_type ==USB_ENDPOINT_XFER_CONTROL ) || (ep_type ==USB_ENDPOINT_XFER_ISOC )) { -ERR (" *** %s, bat bmAttributes\n" , __func__); +pr_err ("udc: *** %s, bat bmAttributes\n" , __func__);return -EINVAL ; }
@@ -2672,13 +2672,13 @@ static int nbu2ss_ep_disable(struct usb_ep *_ep)unsigned long flags;if (_ep ==NULL ) { -ERR (" *** %s, bad param\n" , __func__); +pr_err ("udc: *** %s, bad param\n" , __func__);return -EINVAL ; } ep = container_of(_ep, struct nbu2ss_ep, ep);if ((ep ==NULL ) || (ep->udc ==NULL )) { -ERR (" *** %s, ep == NULL !!\n" , __func__); +pr_err ("udc: *** %s, ep == NULL !!\n" , __func__);return -EINVAL ; }
@@ -2742,10 +2742,10 @@ static int nbu2ss_ep_queue(/* catch various bogus parameters */ if ((_ep ==NULL ) || (_req ==NULL )) {if (_ep ==NULL ) -ERR ("*** %s --- _ep == NULL\n" , __func__); +pr_err ("udc: *** %s --- _ep == NULL\n" , __func__);if (_req ==NULL ) -ERR ("*** %s --- _req == NULL\n" , __func__); +pr_err ("udc: *** %s --- _req == NULL\n" , __func__);return -EINVAL ; }
@@ -2756,13 +2756,13 @@ static int nbu2ss_ep_queue( || !list_empty(&req->queue))) {if (!_req->complete) -ERR ("*** %s --- !_req->complete\n" , __func__); +pr_err ("udc: *** %s --- !_req->complete\n" , __func__);if (!_req->buf) -ERR ("*** %s --- !_req->buf\n" , __func__); +pr_err ("udc: *** %s --- !_req->buf\n" , __func__);if (!list_empty (&req->queue)) -ERR ("*** %s --- !list_empty(&req->queue)\n" , __func__); +pr_err ("udc: *** %s --- !list_empty(&req->queue)\n" , __func__);return -EINVAL ; }
@@ -2849,13 +2849,13 @@ static int nbu2ss_ep_dequeue(/* catch various bogus parameters */ if ((_ep ==NULL ) || (_req ==NULL )) { -/* ERR("%s, bad param(1)\n", __func__); */ +/* pr_err("udc: %s, bad param(1)\n", __func__); */ return -EINVAL ; } ep = container_of(_ep, struct nbu2ss_ep, ep);if (!ep) { -ERR ("%s, ep == NULL !!\n" , __func__); +pr_err ("udc: %s, ep == NULL !!\n" , __func__);return -EINVAL ; }
@@ -2895,19 +2895,19 @@ static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value)/* INFO("=== %s()\n", __func__); */ if (!_ep) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; } ep = container_of(_ep, struct nbu2ss_ep, ep);if (!ep) { -ERR ("%s, bad ep\n" , __func__); +pr_err ("udc: %s, bad ep\n" , __func__);return -EINVAL ; } udc = ep->udc;if (!udc) { -ERR (" *** %s, bad udc\n" , __func__); +pr_err ("udc: *** %s, bad udc\n" , __func__);return -EINVAL ; }
@@ -2949,19 +2949,19 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep)/* INFO("=== %s()\n", __func__); */ if (!_ep) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; } ep = container_of(_ep, struct nbu2ss_ep, ep);if (!ep) { -ERR ("%s, bad ep\n" , __func__); +pr_err ("udc: %s, bad ep\n" , __func__);return -EINVAL ; } udc = ep->udc;if (!udc) { -ERR ("%s, bad udc\n" , __func__); +pr_err ("udc: %s, bad udc\n" , __func__);return -EINVAL ; }
@@ -2997,19 +2997,19 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep)/* INFO("=== %s()\n", __func__); */ if (!_ep) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return ; } ep = container_of(_ep, struct nbu2ss_ep, ep);if (!_ep) { -ERR ("%s, bad ep\n" , __func__); +pr_err ("udc: %s, bad ep\n" , __func__);return ; } udc = ep->udc;if (!udc) { -ERR ("%s, bad udc\n" , __func__); +pr_err ("udc: %s, bad udc\n" , __func__);return ; }
@@ -3053,7 +3053,7 @@ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget)/* INFO("=== %s()\n", __func__); */ if (pgadget ==NULL ) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; }
@@ -3083,7 +3083,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget)/* INFO("=== %s()\n", __func__); */ if (pgadget ==NULL ) { -ERR ("%s, bad param\n" , __func__); +pr_err ("%s, bad param\n" , __func__);return -EINVAL ; }
@@ -3123,7 +3123,7 @@ static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget,/* INFO("=== %s()\n", __func__); */ if (pgadget ==NULL ) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; }
@@ -3152,7 +3152,7 @@ static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned mA)/* INFO("=== %s()\n", __func__); */ if (pgadget ==NULL ) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; }
@@ -3174,7 +3174,7 @@ static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on)/* INFO("=== %s()\n", __func__); */ if (pgadget ==NULL ) { -ERR ("%s, bad param\n" , __func__); +pr_err ("udc: %s, bad param\n" , __func__);return -EINVAL ; }
Signature · 1 line
1.9.1
A message that is not in the archive (sent off-list or not yet received): [email protected]
Re: [Outreachy kernel] [PATCH v5 3/6] Staging: emxx_udc: Replace custom printk macro ERR with pr_err
Quoted 25 lines · Greg KH
Quoted 15 lines · Haneen Mohammed
This patch removes half custom printk macros ERR and replace it with
pr_err. Issue addressed by checkpathc.pl.Signed-off-by Haneen Mohammed <[email protected]>---
v5: Fix spelling mistakesdrivers/staging/emxx_udc/emxx_udc.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +0
-0drivers/staging/emxx_udc/emxx_udc.c static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) · line 118
Quoted 5 lines
drivers/staging/emxx_udc/emxx_udc.c +1
-1@@ -115,7 +115,7 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc)pr_info ("=== %s()\n" , __func__);if (udc ==NULL ) { -ERR ("%s udc == NULL\n" , __func__); +pr_err ("udc: %s udc == NULL\n" , __func__);As this is a driver, you should be able to use
dev_err()for all of these statements. Please do that instead.
Quoted 3 lines
thanks,
greg k-h
I did my best to look for a struct device *dev to use it in dev_err()
but in these cases I couldn't. It was either not present or uninitialized yet, so I used pr_err instead. Would that be correct or is there another way of doing it?
And thank you for reviewing the patches!
Haneen
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v5 3/6] Staging: emxx_udc: Replace custom printk macro ERR with pr_err
Quoted 26 lines · Haneen Mohammed
Quoted 25 lines · Greg KH
Quoted 15 lines · Haneen Mohammed
This patch removes half custom printk macros ERR and replace it with
pr_err. Issue addressed by checkpathc.pl.Signed-off-by Haneen Mohammed <[email protected]>---
v5: Fix spelling mistakesdrivers/staging/emxx_udc/emxx_udc.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +0
-0drivers/staging/emxx_udc/emxx_udc.c static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) · line 118
Quoted 5 lines
drivers/staging/emxx_udc/emxx_udc.c +1
-1@@ -115,7 +115,7 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc)pr_info ("=== %s()\n" , __func__);if (udc ==NULL ) { -ERR ("%s udc == NULL\n" , __func__); +pr_err ("udc: %s udc == NULL\n" , __func__);As this is a driver, you should be able to use
dev_err()for all of these statements. Please do that instead.
Quoted 8 lines
Quoted 3 lines
thanks,
greg k-h
I did my best to look for a struct device *dev to use it in
dev_err()but in these cases I couldn't. It was either not present or uninitialized yet, so I usedpr_errinstead. Would that be correct or is there another way of doing it?
If you really don't have a way to get to a struct device, then yes, pr_err() is fine, but odds are it's somewhere in there.
If not, then document it in the changelog comments.
thanks,
greg k-h
PATCH v5 4/6 Staging: emxx_udc: Replace custom printk macro ERR with dev_err
In reply to Haneen MohammedThis patch removes the other half of ERR macros that uses "printk(KERN_ERR" and replace them with dev_err, to fix issue addressed by checkpatch.pl.
---
v5: Fix spelling mistakes
drivers/staging/emxx_udc/emxx_udc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +17 -17
@@ -808,7 +808,7 @@ static int _nbu2ss_ep0_out_transfer(return 0 ;/* Short Packet Transfer End */ if (req->req.actual > req->req.length) { -ERR (" *** Overrun Error\n" ); +dev_err (udc->dev," *** Overrun Error\n" );return -EOVERFLOW ; }
@@ -1026,8 +1026,8 @@ static int _nbu2ss_epn_out_transfer( }if (req->req.actual > req->req.length) { -ERR (" *** Overrun Error\n" ); -ERR (" *** actual = %d, length = %d\n" , +dev_err (udc->dev," *** Overrun Error\n" ); +dev_err (udc->dev," *** actual = %d, length = %d\n" , req->req.actual, req->req.length); result = -EOVERFLOW ; }
@@ -1638,7 +1638,7 @@ static int std_req_get_status(struct nbu2ss_udc *udc)_nbu2ss_ep0_in_transfer (udc, &udc->ep[0 ], &udc->ep0_req); }else { -ERR ("*** Error GET_STATUS\n" ); +dev_err (udc->dev,"*** Error GET_STATUS\n" ); }return result;
@@ -2350,7 +2350,7 @@ static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) waitcnt++;udelay (1 );/* 1us wait */ if (waitcnt ==EPC_PLL_LOCK_COUNT ) { -ERR ("*** Reset Cancel failed\n" ); +dev_err (udc->dev,"*** Reset Cancel failed\n" );return -EINVAL ; } };
@@ -2626,7 +2626,7 @@ static int nbu2ss_ep_enable(if ((ep_type ==USB_ENDPOINT_XFER_CONTROL ) || (ep_type ==USB_ENDPOINT_XFER_ISOC )) { -pr_err ("udc: *** %s, bat bmAttributes\n" , __func__); +dev_err (ep->udc->dev,"udc: *** %s, bat bmAttributes\n" , __func__);return -EINVAL ; }
@@ -2637,7 +2637,7 @@ static int nbu2ss_ep_enable(if ((udc->driver ==NULL ) || (udc->gadget.speed ==USB_SPEED_UNKNOWN )) { -ERR (" *** %s, udc !!\n" , __func__); +dev_err (udc->dev," *** %s, udc !!\n" , __func__);return -ESHUTDOWN ; }
@@ -2773,12 +2773,12 @@ static int nbu2ss_ep_queue(/* INFO("=== %s(ep%d), zero=%d\n", __func__, ep->epnum, _req->zero); */ if (udc->vbus_active ==0 ) { -pr_info ("Can't ep_queue (VBUS OFF)\n" ); +dev_info (udc->dev,"Can't ep_queue (VBUS OFF)\n" );return -ESHUTDOWN ; }if (unlikely (!udc->driver)) { -ERR ("%s, bogus device state %p\n" , __func__, udc->driver); +dev_err (udc->dev,"%s, bogus device state %p\n" , __func__, udc->driver);return -ESHUTDOWN ; }
@@ -2817,7 +2817,7 @@ static int nbu2ss_ep_queue( result =_nbu2ss_start_transfer (udc, ep, req, FALSE);if (result <0 ) { -ERR (" *** %s, result = %d\n" , __func__, result); +dev_err (udc->dev," *** %s, result = %d\n" , __func__, result);list_del (&req->queue); }else if ((ep->epnum >0 ) && (ep->direct ==USB_DIR_OUT )) {#ifdef USE_DMA
@@ -2907,7 +2907,7 @@ static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value) udc = ep->udc;if (!udc) { -pr_err ("udc: *** %s, bad udc\n" , __func__); +dev_err (ep->udc->dev,"udc: *** %s, bad udc\n" , __func__);return -EINVAL ; }
@@ -2961,7 +2961,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) udc = ep->udc;if (!udc) { -pr_err ("udc: %s, bad udc\n" , __func__); +dev_err (ep->udc->dev,"udc: %s, bad udc\n" , __func__);return -EINVAL ; }
@@ -3009,7 +3009,7 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) udc = ep->udc;if (!udc) { -pr_err ("udc: %s, bad udc\n" , __func__); +dev_err (ep->udc->dev,"udc: %s, bad udc\n" , __func__);return ; }
@@ -3059,7 +3059,7 @@ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) udc = container_of(pgadget, struct nbu2ss_udc, gadget);if (udc ==NULL ) { -ERR ("%s, udc == NULL\n" , __func__); +dev_err (&pgadget->dev,"%s, udc == NULL\n" , __func__);return -EINVAL ; }
@@ -3089,7 +3089,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) udc = container_of(pgadget, struct nbu2ss_udc, gadget);if (udc ==NULL ) { -ERR ("%s, udc == NULL\n" , __func__); +dev_err (&pgadget->dev,"%s, udc == NULL\n" , __func__);return -EINVAL ; }
@@ -3345,7 +3345,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev)/* USB Function Controller Interrupt */ if (status !=0 ) { -ERR ("request_irq(USB_UDC_IRQ_1) failed\n" ); +dev_err (udc->dev,"request_irq(USB_UDC_IRQ_1) failed\n" ); goto cleanup1; }
@@ -3365,7 +3365,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) udc);if (status !=0 ) { -ERR ("request_irq(INT_VBUS) failed\n" ); +dev_err (udc->dev,"request_irq(INT_VBUS) failed\n" ); goto cleanup1; }
Signature · 1 line
1.9.1
Greg KH
maintainerRe: [Outreachy kernel] [PATCH v5 4/6] Staging: emxx_udc: Replace custom printk macro ERR with dev_err
Quoted 15 lines · Haneen Mohammed
This patch removes the other half of ERR macros that uses "printk(KERN_ERR" and replace them with
dev_err, to fix issue addressed by checkpatch.pl.Signed-off-by Haneen Mohammed <[email protected]>---
v5: Fix spelling mistakesdrivers/staging/emxx_udc/emxx_udc.c | 34 +++++++++++++++++----------------- 1 file changed, 17 insertions(+), 17 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +0
-0
drivers/staging/emxx_udc/emxx_udc.c static int _nbu2ss_ep0_out_transfer( · line 813
Quoted 7 lines
drivers/staging/emxx_udc/emxx_udc.c +1
-1@@ -808,7 +808,7 @@ static int _nbu2ss_ep0_out_transfer(return 0 ;/* Short Packet Transfer End */ if (req->req.actual > req->req.length) { -ERR (" *** Overrun Error\n" ); +dev_err (udc->dev," *** Overrun Error\n" );return -EOVERFLOW ; }
As I didn't take your previous patches, this one doesn't apply. Please redo the whole series and resend.
thanks,
greg k-h
PATCH v5 5/6 Staging: emxx_udc: Remove custom printk macro ERR
In reply to Haneen MohammedThis patch removes custom printk macro ERR.
All the calls to this macro were replaced by de_err and pr_err.
---
v5: Fix spelling mistake
drivers/staging/emxx_udc/emxx_udc.h | 1 - 1 file changed, 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.h +0 -1
@@ -644,6 +644,5 @@ union usb_reg_access { };/*-------------------------------------------------------------------------*/ -#define ERR(stuff...) printk(KERN_ERR "udc: " stuff)#endif /* _LINUX_EMXX_H */
Signature · 1 line
1.9.1
PATCH v5 6/6 Staging: emxx_udc: Clean dev_err() logging
In reply to Haneen MohammedThis patch removes __func__ from dev_err.dev_err includes the function name in the log printout, so there is no need to include it manually.
---
v5: remove __func__ from replaced pr_err
drivers/staging/emxx_udc/emxx_udc.c | 18 +++++++++--------- 1 file changed, 9 insertions(+), 9 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +9 -9
@@ -2626,7 +2626,7 @@ static int nbu2ss_ep_enable(if ((ep_type ==USB_ENDPOINT_XFER_CONTROL ) || (ep_type ==USB_ENDPOINT_XFER_ISOC )) { -dev_err (ep->udc->dev,"udc: *** %s, bat bmAttributes\n" , __func__); +dev_err (ep->udc->dev,"bat bmAttributes\n" );return -EINVAL ; }
@@ -2637,7 +2637,7 @@ static int nbu2ss_ep_enable(if ((udc->driver ==NULL ) || (udc->gadget.speed ==USB_SPEED_UNKNOWN )) { -dev_err (udc->dev," *** %s, udc !!\n" , __func__); +dev_err (udc->dev,"udc !!\n" );return -ESHUTDOWN ; }
@@ -2778,7 +2778,7 @@ static int nbu2ss_ep_queue( }if (unlikely (!udc->driver)) { -dev_err (udc->dev,"%s, bogus device state %p\n" , __func__, udc->driver); +dev_err (udc->dev,"bogus device state %p\n" , udc->driver);return -ESHUTDOWN ; }
@@ -2817,7 +2817,7 @@ static int nbu2ss_ep_queue( result =_nbu2ss_start_transfer (udc, ep, req, FALSE);if (result <0 ) { -dev_err (udc->dev," *** %s, result = %d\n" , __func__, result); +dev_err (udc->dev,"result = %d\n" , result);list_del (&req->queue); }else if ((ep->epnum >0 ) && (ep->direct ==USB_DIR_OUT )) {#ifdef USE_DMA
@@ -2907,7 +2907,7 @@ static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value) udc = ep->udc;if (!udc) { -dev_err (ep->udc->dev,"udc: *** %s, bad udc\n" , __func__); +dev_err (ep->udc->dev,"bad udc\n" );return -EINVAL ; }
@@ -2961,7 +2961,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) udc = ep->udc;if (!udc) { -dev_err (ep->udc->dev,"udc: %s, bad udc\n" , __func__); +dev_err (ep->udc->dev,"bad udc\n" );return -EINVAL ; }
@@ -3009,7 +3009,7 @@ static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) udc = ep->udc;if (!udc) { -dev_err (ep->udc->dev,"udc: %s, bad udc\n" , __func__); +dev_err (ep->udc->dev,"bad udc\n" );return ; }
@@ -3059,7 +3059,7 @@ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) udc = container_of(pgadget, struct nbu2ss_udc, gadget);if (udc ==NULL ) { -dev_err (&pgadget->dev,"%s, udc == NULL\n" , __func__); +dev_err (&pgadget->dev,"udc == NULL\n" );return -EINVAL ; }
@@ -3089,7 +3089,7 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) udc = container_of(pgadget, struct nbu2ss_udc, gadget);if (udc ==NULL ) { -dev_err (&pgadget->dev,"%s, udc == NULL\n" , __func__); +dev_err (&pgadget->dev,"udc == NULL\n" );return -EINVAL ; }
Signature · 1 line
1.9.1