Staging: emxx_udc: Fix checkpatch.pl warnings
v4 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 not prefered.
Changes in v4:
- Patchset broken into smaller patches
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 micro ERR with pr_err
Staging: emxx_udc: Replace custom printk micro ERR with dev_err
Staging: emxx_udc: Remove custom printk micro ERR
Staging: emxx_udc: Clean dev_err() logging
drivers/staging/emxx_udc/emxx_udc.c | 140 ++++++++++++++++++------------------ drivers/staging/emxx_udc/emxx_udc.h | 27 ++++--- 2 files changed, 83 insertions(+), 84 deletions(-)
Signature · 1 line
1.9.1
PATCH v4 2/6 Staging: emxx_udc: Remove volatile from union usb_regs_access
This patch removes volatile from union usb_regs_access, to fix checkpatch.pl warning:
WARNING: Use of volatile is usually wrong
--- 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
PATCH v4 3/6 Staging: emxx_udc: Replace custom printk micro ERR with pr_err
In reply to Haneen MohammedThis patch removes half custom printk micros ERR and replace it withpr_err. pr_err used because no appropriate dev variable were found. Issue addressed by checkpathc.pl.
--- 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
PATCH v4 4/6 Staging: emxx_udc: Replace custom printk micro ERR with dev_err
In reply to Haneen MohammedThis patch removes the other half of ERR micros that uses "printk(KERN_ERR" and replace them with dev_err, to fix issue addressed by checkpatch.pl.
--- drivers/staging/emxx_udc/emxx_udc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +12 -12
@@ -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 ; } };
@@ -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 ; }
@@ -2778,7 +2778,7 @@ static int nbu2ss_ep_queue( }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
@@ -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
PATCH v4 5/6 Staging: emxx_udc: Remove custom printk micro ERR
In reply to Haneen MohammedThis patch removes custom printk micro ERR. All the calls to this micro were replaced by de_err and pr_err.
--- 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 v4 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.
--- drivers/staging/emxx_udc/emxx_udc.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +5 -5
@@ -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
@@ -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
PATCH v4 1/6 Staging: emxx_udc: Fix do not add new typedefs
In reply to Haneen MohammedThis patch fixes the following checkpatch.pl warning:"do not add new typedefs".
Remove typedefs keyword and rename identifiers appropriately. Update related files.
---
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
Re: [Outreachy kernel] [PATCH v4 1/6] Staging: emxx_udc: Fix do not add new typedefs
Review
Quoted 2 lines
(quoted diff) +1
-1- USB_REG_ACCESS *pBuf32 = (USB_REG_ACCESS *)pBuf; + volatile union usb_reg_access *pBuf32 = (volatile union usb_reg_access *)pBuf;
This, and other lines like it, exceed 80 characters. Since pBuf is already a pointer type, is the cast actually needed? I would guess that even with the volatile, it is not, but I am not sure.
julia
Re: [Outreachy kernel] [PATCH v4 5/6] Staging: emxx_udc: Remove custom printk micro ERR
In reply to Haneen MohammedQuoted 1 line · Haneen Mohammed
This patch removes custom printk micro ERR. All the calls to this micro were replaced by
de_errandpr_err.
micro -> macro
Quoted 27 lines
Signed-off-by Haneen Mohammed <[email protected]>--- 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 · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/d0975ddfd74bef068fbf73f3d4089253ba1d1614.1424645872.git.hamohammed.sa%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH v4 4/6] Staging: emxx_udc: Replace custom printk micro ERR with dev_err
In reply to Haneen MohammedQuoted 3 lines · Haneen Mohammed
This patch removes the other half of ERR micros that uses "printk(KERN_ERR" and replace them with
dev_err, to fix issue addressed by checkpatch.pl.
micro -> macro here too
julia
Quoted 121 lines
Signed-off-by Haneen Mohammed <[email protected]>--- drivers/staging/emxx_udc/emxx_udc.c | 24 ++++++++++++------------ 1 file changed, 12 insertions(+), 12 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +12
-12@@ -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 ; } };@@ -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 ; }@@ -2778,7 +2778,7 @@ static int nbu2ss_ep_queue( }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 @@ -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 · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/65ad55db16d7829286383d9e37ad6f5456388918.1424645872.git.hamohammed.sa%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH v4 3/6] Staging: emxx_udc: Replace custom printk micro ERR with pr_err
In reply to Haneen MohammedQuoted 2 lines · Haneen Mohammed
This patch removes half custom printk micros ERR and replace it with
pr_err.pr_errused because no appropriate dev variable were found. Issue addressed by checkpathc.pl.
micro -> macro
drivers/staging/emxx_udc/emxx_udc.c static void _nbu2ss_dump_register(struct nbu2ss_udc *udc)
Quoted 10 lines
Signed-off-by Haneen Mohammed <[email protected]>--- drivers/staging/emxx_udc/emxx_udc.c | 56 ++++++++++++++++++------------------- 1 file changed, 28 insertions(+), 28 deletions(-)drivers/staging/emxx_udc/emxx_udc.c +0
-0@@ -115,7 +115,7 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc)
The following code appears to be in the function _nbu2ss_dump_register, which has a parameter of type nbu2ss_udc. This parameter has a field struct device *dev; that you can use for dev_err. This seems to apply in some other cases here.
Quoted 9 lines
drivers/staging/emxx_udc/emxx_udc.c +1
-1pr_info ("=== %s()\n" , __func__);if (udc ==NULL ) { -ERR ("%s udc == NULL\n" , __func__); +pr_err ("udc: %s udc == NULL\n" , __func__);return ; }
drivers/staging/emxx_udc/emxx_udc.c static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) · line 2261
Quoted 5 lines
drivers/staging/emxx_udc/emxx_udc.c +1
-1@@ -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__);
You can't use dev_err here because udc is null. Something else to watch out for.
julia
Quoted 214 lines
drivers/staging/emxx_udc/emxx_udc.c +26
-26return -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 · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/3f24e6248385205c51c93dfdd43f3b3f9caec152.1424645871.git.hamohammed.sa%40gmail.com. For more options, visit https://groups.google.com/d/optout.
Re: [Outreachy kernel] [PATCH v4 2/6] Staging: emxx_udc: Remove volatile from union usb_regs_access
In reply to Haneen MohammedQuoted 3 lines · Haneen Mohammed
This patch removes volatile from union
usb_regs_access, to fix checkpatch.pl warning:
WARNING: Use of volatile is usually wrong
You need a justification for why it is wrong in this case.
julia
Quoted 113 lines
Signed-off-by Haneen Mohammed <[email protected]>--- 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 · 8 lines
1.9.1 -- You received this message because you are subscribed to the Google Groups "outreachy-kernel" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. To view this discussion on the web visit https://groups.google.com/d/msgid/outreachy-kernel/05cc0b9434eecf49b6b4b4a15c86e2516cb5827c.1424645871.git.hamohammed.sa%40gmail.com. For more options, visit https://groups.google.com/d/optout.