From: sepehrdad sh <sepehrdad.dev@xxxxxxxxx> Fixed and cleaned up checkpatch coding style errors. Signed-off-by: Sepehrdad Sh <sepehrdad.dev@xxxxxxxxx> --- drivers/staging/emxx_udc/emxx_udc.c | 309 +++++++++++++--------------- 1 file changed, 146 insertions(+), 163 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index 3e51476a7045..bc2b2f0ce21f 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -108,20 +108,20 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) dev_dbg(&udc->dev, "\n-USB REG-\n"); for (i = 0x0 ; i < USB_BASE_SIZE ; i += 16) { - reg_data = _nbu2ss_readl( - (u32 *)IO_ADDRESS(USB_BASE_ADDRESS + i)); + reg_data = _nbu2ss_readl((u32 *)IO_ADDRESS(USB_BASE_ADDRESS + + i)); dev_dbg(&udc->dev, "USB%04x =%08x", i, (int)reg_data); - reg_data = _nbu2ss_readl( - (u32 *)IO_ADDRESS(USB_BASE_ADDRESS + i + 4)); + reg_data = _nbu2ss_readl((u32 *)IO_ADDRESS(USB_BASE_ADDRESS + + i + 4)); dev_dbg(&udc->dev, " %08x", (int)reg_data); - reg_data = _nbu2ss_readl( - (u32 *)IO_ADDRESS(USB_BASE_ADDRESS + i + 8)); + reg_data = _nbu2ss_readl((u32 *)IO_ADDRESS(USB_BASE_ADDRESS + + i + 8)); dev_dbg(&udc->dev, " %08x", (int)reg_data); - reg_data = _nbu2ss_readl( - (u32 *)IO_ADDRESS(USB_BASE_ADDRESS + i + 12)); + reg_data = _nbu2ss_readl((u32 *)IO_ADDRESS(USB_BASE_ADDRESS + + i + 12)); dev_dbg(&udc->dev, " %08x\n", (int)reg_data); } @@ -161,10 +161,9 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req) /*-------------------------------------------------------------------------*/ /* Initialization usb_request */ -static void _nbu2ss_create_ep0_packet( - struct nbu2ss_udc *udc, - void *p_buf, - unsigned length +static void _nbu2ss_create_ep0_packet(struct nbu2ss_udc *udc, + void *p_buf, + unsigned length ) { udc->ep0_req.req.buf = p_buf; @@ -417,11 +416,10 @@ static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /*-------------------------------------------------------------------------*/ /* Start IN Transfer */ -static void _nbu2ss_ep_in_end( - struct nbu2ss_udc *udc, - u32 epnum, - u32 data32, - u32 length +static void _nbu2ss_ep_in_end(struct nbu2ss_udc *udc, + u32 epnum, + u32 data32, + u32 length ) { u32 data; @@ -460,44 +458,42 @@ static void _nbu2ss_ep_in_end( #ifdef USE_DMA /*-------------------------------------------------------------------------*/ -static void _nbu2ss_dma_map_single( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u8 direct +static void _nbu2ss_dma_map_single(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u8 direct ) { if (req->req.dma == DMA_ADDR_INVALID) { if (req->unaligned) { req->req.dma = ep->phys_buf; } else { - req->req.dma = dma_map_single( - udc->gadget.dev.parent, - req->req.buf, - req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE : DMA_FROM_DEVICE); + req->req.dma = dma_map_single(udc->gadget.dev.parent, + req->req.buf, + req->req.length, + (direct == USB_DIR_IN) + ? DMA_TO_DEVICE : + DMA_FROM_DEVICE); } req->mapped = 1; } else { if (!req->unaligned) - dma_sync_single_for_device( - udc->gadget.dev.parent, - req->req.dma, - req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE : DMA_FROM_DEVICE); + dma_sync_single_for_device(udc->gadget.dev.parent, + req->req.dma, + req->req.length, + (direct == USB_DIR_IN) + ? DMA_TO_DEVICE : + DMA_FROM_DEVICE); req->mapped = 0; } } /*-------------------------------------------------------------------------*/ -static void _nbu2ss_dma_unmap_single( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u8 direct +static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u8 direct ) { u8 data[4]; @@ -669,9 +665,8 @@ static int EP0_receive_NULL(struct nbu2ss_udc *udc, bool pid_flag) } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_ep0_in_transfer( - struct nbu2ss_udc *udc, - struct nbu2ss_req *req +static int _nbu2ss_ep0_in_transfer(struct nbu2ss_udc *udc, + struct nbu2ss_req *req ) { u8 *p_buffer; /* IN Data Buffer */ @@ -726,9 +721,8 @@ static int _nbu2ss_ep0_in_transfer( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_ep0_out_transfer( - struct nbu2ss_udc *udc, - struct nbu2ss_req *req +static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, + struct nbu2ss_req *req ) { u8 *p_buffer; @@ -803,11 +797,10 @@ static int _nbu2ss_ep0_out_transfer( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_out_dma( - struct nbu2ss_udc *udc, - struct nbu2ss_req *req, - u32 num, - u32 length +static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, + struct nbu2ss_req *req, + u32 num, + u32 length ) { dma_addr_t p_buffer; @@ -866,11 +859,10 @@ static int _nbu2ss_out_dma( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_out_pio( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u32 length +static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u32 length ) { u8 *p_buffer; @@ -925,11 +917,10 @@ static int _nbu2ss_epn_out_pio( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_out_data( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u32 data_size +static int _nbu2ss_epn_out_data(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u32 data_size ) { u32 num; @@ -955,10 +946,9 @@ static int _nbu2ss_epn_out_data( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_out_transfer( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req +static int _nbu2ss_epn_out_transfer(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req ) { u32 num; @@ -973,9 +963,8 @@ static int _nbu2ss_epn_out_transfer( /*-------------------------------------------------------------*/ /* Receive Length */ - i_recv_length - = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_LDATA; - + i_recv_length = + _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_LDATA; if (i_recv_length != 0) { result = _nbu2ss_epn_out_data(udc, ep, req, i_recv_length); if (i_recv_length < ep->ep.maxpacket) { @@ -1011,12 +1000,11 @@ static int _nbu2ss_epn_out_transfer( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_in_dma( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u32 num, - u32 length +static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u32 num, + u32 length ) { dma_addr_t p_buffer; @@ -1087,11 +1075,10 @@ static int _nbu2ss_in_dma( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_in_pio( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u32 length +static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u32 length ) { u8 *p_buffer; @@ -1113,9 +1100,8 @@ static int _nbu2ss_epn_in_pio( i_word_length = length / sizeof(u32); if (i_word_length > 0) { for (i = 0; i < i_word_length; i++) { - _nbu2ss_writel( - &preg->EP_REGS[ep->epnum - 1].EP_WRITE - , p_buf_32->dw + _nbu2ss_writel(&preg->EP_REGS[ep->epnum + - 1].EP_WRITE, p_buf_32->dw ); p_buf_32++; @@ -1140,11 +1126,10 @@ static int _nbu2ss_epn_in_pio( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_in_data( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - u32 data_size +static int _nbu2ss_epn_in_data(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + u32 data_size ) { u32 num; @@ -1167,10 +1152,9 @@ static int _nbu2ss_epn_in_data( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_epn_in_transfer( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req +static int _nbu2ss_epn_in_transfer(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req ) { u32 num; @@ -1208,11 +1192,11 @@ static int _nbu2ss_epn_in_transfer( } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_start_transfer( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - bool bflag) +static int _nbu2ss_start_transfer(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + bool bflag +) { int nret = -EINVAL; @@ -1274,8 +1258,8 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) return; if (ep->epnum > 0) { - length = _nbu2ss_readl( - &ep->udc->p_regs->EP_REGS[ep->epnum - 1].EP_LEN_DCNT); + length = _nbu2ss_readl(&ep->udc->p_regs->EP_REGS[ep->epnum + - 1].EP_LEN_DCNT); length &= EPN_LDATA; if (length < ep->ep.maxpacket) @@ -1287,9 +1271,9 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) /*-------------------------------------------------------------------------*/ /* Endpoint Toggle Reset */ -static void _nbu2ss_endpoint_toggle_reset( - struct nbu2ss_udc *udc, - u8 ep_adrs) +static void _nbu2ss_endpoint_toggle_reset(struct nbu2ss_udc *udc, + u8 ep_adrs +) { u8 num; u32 data; @@ -1309,10 +1293,10 @@ static void _nbu2ss_endpoint_toggle_reset( /*-------------------------------------------------------------------------*/ /* Endpoint STALL set */ -static void _nbu2ss_set_endpoint_stall( - struct nbu2ss_udc *udc, - u8 ep_adrs, - bool bstall) +static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc *udc, + u8 ep_adrs, + bool bstall +) { u8 num, epnum; u32 data; @@ -1406,10 +1390,9 @@ static void _nbu2ss_set_test_mode(struct nbu2ss_udc *udc, u32 mode) } /*-------------------------------------------------------------------------*/ -static int _nbu2ss_set_feature_device( - struct nbu2ss_udc *udc, - u16 selector, - u16 wIndex +static int _nbu2ss_set_feature_device(struct nbu2ss_udc *udc, + u16 selector, + u16 wIndex ) { int result = -EOPNOTSUPP; @@ -1490,12 +1473,12 @@ static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset) if (selector == USB_ENDPOINT_HALT) { ep_adrs = wIndex & 0xFF; if (!bset) { - _nbu2ss_endpoint_toggle_reset( - udc, ep_adrs); + _nbu2ss_endpoint_toggle_reset(udc, + ep_adrs); } - _nbu2ss_set_endpoint_stall( - udc, ep_adrs, bset); + _nbu2ss_set_endpoint_stall(udc, + ep_adrs, bset); result = 0; } @@ -1526,9 +1509,8 @@ static inline enum usb_device_speed _nbu2ss_get_speed(struct nbu2ss_udc *udc) } /*-------------------------------------------------------------------------*/ -static void _nbu2ss_epn_set_stall( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep +static void _nbu2ss_epn_set_stall(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep ) { u8 ep_adrs; @@ -1541,8 +1523,8 @@ static void _nbu2ss_epn_set_stall( for (limit_cnt = 0 ; limit_cnt < IN_DATA_EMPTY_COUNT ; limit_cnt++) { - regdata = _nbu2ss_readl( - &preg->EP_REGS[ep->epnum - 1].EP_STATUS); + regdata = _nbu2ss_readl(&preg->EP_REGS[ep->epnum + - 1].EP_STATUS); if ((regdata & EPN_IN_DATA) == 0) break; @@ -1901,10 +1883,10 @@ static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc) } /*-------------------------------------------------------------------------*/ -static void _nbu2ss_ep_done( - struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - int status) +static void _nbu2ss_ep_done(struct nbu2ss_ep *ep, + struct nbu2ss_req *req, + int status +) { struct nbu2ss_udc *udc = ep->udc; @@ -1935,10 +1917,10 @@ static void _nbu2ss_ep_done( } /*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_in_int( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) +static inline void _nbu2ss_epn_in_int(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req +) { int result = 0; u32 status; @@ -1979,10 +1961,10 @@ static inline void _nbu2ss_epn_in_int( } /*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_out_int( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) +static inline void _nbu2ss_epn_out_int(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req +) { int result; @@ -1992,10 +1974,10 @@ static inline void _nbu2ss_epn_out_int( } /*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_in_dma_int( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) +static inline void _nbu2ss_epn_in_dma_int(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req +) { u32 mpkt; u32 size; @@ -2029,10 +2011,10 @@ static inline void _nbu2ss_epn_in_dma_int( } /*-------------------------------------------------------------------------*/ -static inline void _nbu2ss_epn_out_dma_int( - struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - struct nbu2ss_req *req) +static inline void _nbu2ss_epn_out_dma_int(struct nbu2ss_udc *udc, + struct nbu2ss_ep *ep, + struct nbu2ss_req *req +) { int i; u32 num; @@ -2497,9 +2479,9 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) /*-------------------------------------------------------------------------*/ /* usb_ep_ops */ -static int nbu2ss_ep_enable( - struct usb_ep *_ep, - const struct usb_endpoint_descriptor *desc) +static int nbu2ss_ep_enable(struct usb_ep *_ep, + const struct usb_endpoint_descriptor *desc +) { u8 ep_type; unsigned long flags; @@ -2587,9 +2569,9 @@ static int nbu2ss_ep_disable(struct usb_ep *_ep) } /*-------------------------------------------------------------------------*/ -static struct usb_request *nbu2ss_ep_alloc_request( - struct usb_ep *ep, - gfp_t gfp_flags) +static struct usb_request *nbu2ss_ep_alloc_request(struct usb_ep *ep, + gfp_t gfp_flags +) { struct nbu2ss_req *req; @@ -2606,9 +2588,9 @@ static struct usb_request *nbu2ss_ep_alloc_request( } /*-------------------------------------------------------------------------*/ -static void nbu2ss_ep_free_request( - struct usb_ep *_ep, - struct usb_request *_req) +static void nbu2ss_ep_free_request(struct usb_ep *_ep, + struct usb_request *_req +) { struct nbu2ss_req *req; @@ -2620,10 +2602,10 @@ static void nbu2ss_ep_free_request( } /*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_queue( - struct usb_ep *_ep, - struct usb_request *_req, - gfp_t gfp_flags) +static int nbu2ss_ep_queue(struct usb_ep *_ep, + struct usb_request *_req, + gfp_t gfp_flags +) { struct nbu2ss_req *req; struct nbu2ss_ep *ep; @@ -2683,9 +2665,10 @@ static int nbu2ss_ep_queue( if (req->unaligned) { if (!ep->virt_buf) - ep->virt_buf = dma_alloc_coherent( - NULL, PAGE_SIZE, - &ep->phys_buf, GFP_ATOMIC | GFP_DMA); + ep->virt_buf = dma_alloc_coherent(NULL, + PAGE_SIZE, + &ep->phys_buf, + GFP_ATOMIC | GFP_DMA); if (ep->epnum > 0) { if (ep->direct == USB_DIR_IN) memcpy(ep->virt_buf, req->req.buf, @@ -2727,9 +2710,9 @@ static int nbu2ss_ep_queue( } /*-------------------------------------------------------------------------*/ -static int nbu2ss_ep_dequeue( - struct usb_ep *_ep, - struct usb_request *_req) +static int nbu2ss_ep_dequeue(struct usb_ep *_ep, + struct usb_request *_req +) { struct nbu2ss_req *req; struct nbu2ss_ep *ep; @@ -3060,10 +3043,10 @@ static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on) } /*-------------------------------------------------------------------------*/ -static int nbu2ss_gad_ioctl( - struct usb_gadget *pgadget, - unsigned int code, - unsigned long param) +static int nbu2ss_gad_ioctl(struct usb_gadget *pgadget, + unsigned int code, + unsigned long param +) { return 0; } @@ -3152,9 +3135,9 @@ static void nbu2ss_drv_ep_init(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ /* platform_driver */ -static int nbu2ss_drv_contest_init( - struct platform_device *pdev, - struct nbu2ss_udc *udc) +static int nbu2ss_drv_contest_init(struct platform_device *pdev, + struct nbu2ss_udc *udc +) { spin_lock_init(&udc->lock); udc->dev = &pdev->dev; -- 2.18.0 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel