This patch fixes various indentation and coding style issues in EMXX UDC device controller driver. --- Task 10 of the Eudyptula challenge. drivers/staging/emxx_udc/emxx_udc.c | 636 ++++++++++++++-------------- 1 file changed, 315 insertions(+), 321 deletions(-) diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c index a913d40f0801..f533f2c73ac5 100644 --- a/drivers/staging/emxx_udc/emxx_udc.c +++ b/drivers/staging/emxx_udc/emxx_udc.c @@ -34,8 +34,8 @@ #define DRIVER_DESC "EMXX UDC driver" #define DMA_ADDR_INVALID (~(dma_addr_t)0) -static const char driver_name[] = "emxx_udc"; -static const char driver_desc[] = DRIVER_DESC; +static const char driver_name[] = "emxx_udc"; +static const char driver_desc[] = DRIVER_DESC; /*===========================================================================*/ /* Prototype */ @@ -76,7 +76,7 @@ static inline void _nbu2ss_writel(void __iomem *address, u32 udata) /* Set Bit */ static inline void _nbu2ss_bitset(void __iomem *address, u32 udata) { - u32 reg_dt = __raw_readl(address) | (udata); + u32 reg_dt = __raw_readl(address) | (udata); __raw_writel(reg_dt, address); } @@ -85,7 +85,7 @@ static inline void _nbu2ss_bitset(void __iomem *address, u32 udata) /* Clear Bit */ static inline void _nbu2ss_bitclr(void __iomem *address, u32 udata) { - u32 reg_dt = __raw_readl(address) & ~(udata); + u32 reg_dt = __raw_readl(address) & ~(udata); __raw_writel(reg_dt, address); } @@ -94,7 +94,7 @@ static inline void _nbu2ss_bitclr(void __iomem *address, u32 udata) /*-------------------------------------------------------------------------*/ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) { - int i; + int i; u32 reg_data; pr_info("=== %s()\n", __func__); @@ -107,7 +107,7 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) spin_unlock(&udc->lock); dev_dbg(&udc->dev, "\n-USB REG-\n"); - for (i = 0x0 ; i < USB_BASE_SIZE ; i += 16) { + for (i = 0x0; i < USB_BASE_SIZE; i += 16) { reg_data = _nbu2ss_readl(IO_ADDRESS(USB_BASE_ADDRESS + i)); dev_dbg(&udc->dev, "USB%04x =%08x", i, (int)reg_data); @@ -129,11 +129,11 @@ static void _nbu2ss_dump_register(struct nbu2ss_udc *udc) /* Endpoint 0 Callback (Complete) */ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req) { - u8 recipient; - u16 selector; - u16 wIndex; - u32 test_mode; - struct usb_ctrlrequest *p_ctrl; + u8 recipient; + u16 selector; + u16 wIndex; + u32 test_mode; + struct usb_ctrlrequest *p_ctrl; struct nbu2ss_udc *udc; if ((!_ep) || (!_req)) @@ -145,8 +145,9 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req) if (p_ctrl->bRequest == USB_REQ_SET_FEATURE) { /*-------------------------------------------------*/ /* SET_FEATURE */ - recipient = (u8)(p_ctrl->bRequestType & USB_RECIP_MASK); - selector = le16_to_cpu(p_ctrl->wValue); + recipient = + (u8)(p_ctrl->bRequestType & USB_RECIP_MASK); + selector = le16_to_cpu(p_ctrl->wValue); if ((recipient == USB_RECIP_DEVICE) && (selector == USB_DEVICE_TEST_MODE)) { wIndex = le16_to_cpu(p_ctrl->wIndex); @@ -176,8 +177,8 @@ static void _nbu2ss_create_ep0_packet(struct nbu2ss_udc *udc, /* Acquisition of the first address of RAM(FIFO) */ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc) { - u32 num, buf_type; - u32 data, last_ram_adr, use_ram_size; + u32 num, buf_type; + u32 data, last_ram_adr, use_ram_size; struct ep_regs __iomem *p_ep_regs; @@ -207,12 +208,12 @@ static u32 _nbu2ss_get_begin_ram_address(struct nbu2ss_udc *udc) /* Construction of Endpoint */ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { - u32 num; - u32 data; - u32 begin_adrs; + u32 num; + u32 data; + u32 begin_adrs; if (ep->epnum == 0) - return -EINVAL; + return -EINVAL; num = ep->epnum - 1; @@ -282,11 +283,11 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /* Release of Endpoint */ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { - u32 num; - u32 data; + u32 num; + u32 data; if ((ep->epnum == 0) || (udc->vbus_active == 0)) - return -EINVAL; + return -EINVAL; num = ep->epnum - 1; @@ -330,8 +331,8 @@ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /* DMA setting (without Endpoint 0) */ static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { - u32 num; - u32 data; + u32 num; + u32 data; data = _nbu2ss_readl(&udc->p_regs->USBSSCONF); if (((ep->epnum == 0) || (data & (1 << ep->epnum)) == 0)) @@ -352,7 +353,7 @@ static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /*---------------------------------------------------------*/ /* DMA Mode etc. */ - data = EPN_STOP_MODE | EPN_STOP_SET | EPN_DMAMODE0; + data = EPN_STOP_MODE | EPN_STOP_SET | EPN_DMAMODE0; _nbu2ss_writel(&udc->p_regs->EP_REGS[num].EP_DMA_CTRL, data); } else { /*---------------------------------------------------------*/ @@ -370,8 +371,8 @@ static void _nbu2ss_ep_dma_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /* DMA setting release */ static void _nbu2ss_ep_dma_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) { - u32 num; - u32 data; + u32 num; + u32 data; struct fc_regs __iomem *preg = udc->p_regs; if (udc->vbus_active == 0) @@ -415,8 +416,8 @@ static void _nbu2ss_ep_dma_abort(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) static void _nbu2ss_ep_in_end(struct nbu2ss_udc *udc, u32 epnum, u32 data32, u32 length) { - u32 data; - u32 num; + u32 data; + u32 num; struct fc_regs __iomem *preg = udc->p_regs; if (length >= sizeof(u32)) @@ -459,22 +460,22 @@ static void _nbu2ss_dma_map_single(struct nbu2ss_udc *udc, 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; } @@ -485,9 +486,9 @@ static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req, u8 direct) { - u8 data[4]; - u8 *p; - u32 count = 0; + u8 data[4]; + u8 *p; + u32 count = 0; if (direct == USB_DIR_OUT) { count = req->req.actual % 4; @@ -506,9 +507,8 @@ static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, } else { dma_unmap_single(udc->gadget.dev.parent, req->req.dma, req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE - : DMA_FROM_DEVICE); + (direct == USB_DIR_IN) + ? DMA_TO_DEVICE : DMA_FROM_DEVICE); } req->req.dma = DMA_ADDR_INVALID; req->mapped = 0; @@ -516,9 +516,9 @@ static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, if (!req->unaligned) dma_sync_single_for_cpu(udc->gadget.dev.parent, req->req.dma, req->req.length, - (direct == USB_DIR_IN) - ? DMA_TO_DEVICE - : DMA_FROM_DEVICE); + (direct == USB_DIR_IN) + ? DMA_TO_DEVICE + : DMA_FROM_DEVICE); } if (count) { @@ -533,7 +533,7 @@ static void _nbu2ss_dma_unmap_single(struct nbu2ss_udc *udc, /* Endpoint 0 OUT Transfer (PIO) */ static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) { - u32 i; + u32 i; u32 numreads = length / sizeof(u32); union usb_reg_access *buf32 = (union usb_reg_access *)buf; @@ -546,21 +546,21 @@ static int ep0_out_pio(struct nbu2ss_udc *udc, u8 *buf, u32 length) buf32++; } - return numreads * sizeof(u32); + return numreads * sizeof(u32); } /*-------------------------------------------------------------------------*/ /* Endpoint 0 OUT Transfer (PIO, OverBytes) */ static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) { - u32 i; - u32 i_read_size = 0; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; + u32 i; + u32 i_read_size = 0; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; if ((length > 0) && (length < sizeof(u32))) { temp_32.dw = _nbu2ss_readl(&udc->p_regs->EP0_READ); - for (i = 0 ; i < length ; i++) + for (i = 0; i < length; i++) p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; i_read_size += length; } @@ -572,11 +572,11 @@ static int ep0_out_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) /* Endpoint 0 IN Transfer (PIO) */ static int EP0_in_PIO(struct nbu2ss_udc *udc, u8 *p_buf, u32 length) { - u32 i; - u32 i_max_length = EP0_PACKETSIZE; - u32 i_word_length = 0; - u32 i_write_length = 0; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; + u32 i; + u32 i_max_length = EP0_PACKETSIZE; + u32 i_word_length = 0; + u32 i_write_length = 0; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; /*------------------------------------------------------------*/ /* Transfer Length */ @@ -602,12 +602,12 @@ static int ep0_in_overbytes(struct nbu2ss_udc *udc, u8 *p_buf, u32 i_remain_size) { - u32 i; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; + u32 i; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32 = (union usb_reg_access *)p_buf; if ((i_remain_size > 0) && (i_remain_size < sizeof(u32))) { - for (i = 0 ; i < i_remain_size ; i++) + for (i = 0; i < i_remain_size; i++) temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; _nbu2ss_ep_in_end(udc, 0, temp_32.dw, i_remain_size); @@ -621,7 +621,7 @@ static int ep0_in_overbytes(struct nbu2ss_udc *udc, /* Transfer NULL Packet (Epndoint 0) */ static int EP0_send_NULL(struct nbu2ss_udc *udc, bool pid_flag) { - u32 data; + u32 data; data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); data &= ~(u32)EP0_INAK; @@ -640,7 +640,7 @@ static int EP0_send_NULL(struct nbu2ss_udc *udc, bool pid_flag) /* Receive NULL Packet (Endpoint 0) */ static int EP0_receive_NULL(struct nbu2ss_udc *udc, bool pid_flag) { - u32 data; + u32 data; data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); data &= ~(u32)EP0_ONAK; @@ -657,10 +657,10 @@ 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) { - u8 *p_buffer; /* IN Data Buffer */ - u32 data; - u32 i_remain_size = 0; - int result = 0; + u8 *p_buffer; /* IN Data Buffer */ + u32 data; + u32 i_remain_size = 0; + int result = 0; /*-------------------------------------------------------------*/ /* End confirmation */ @@ -673,10 +673,10 @@ static int _nbu2ss_ep0_in_transfer(struct nbu2ss_udc *udc, } } - return 0; /* Transfer End */ + return 0; /* Transfer End */ } - /*-------------------------------------------------------------*/ + /*-------------------------------------------------------------*/ /* NAK release */ data = _nbu2ss_readl(&udc->p_regs->EP0_CONTROL); data |= EP0_INAK_EN; @@ -712,11 +712,11 @@ static int _nbu2ss_ep0_in_transfer(struct nbu2ss_udc *udc, static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, struct nbu2ss_req *req) { - u8 *p_buffer; - u32 i_remain_size; - u32 i_recv_length; - int result = 0; - int f_rcv_zero; + u8 *p_buffer; + u32 i_remain_size; + u32 i_recv_length; + int result = 0; + int f_rcv_zero; /*-------------------------------------------------------------*/ /* Receive data confirmation */ @@ -728,8 +728,9 @@ static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, p_buffer = (u8 *)req->req.buf; p_buffer += req->req.actual; - result = ep0_out_pio(udc, p_buffer - , min(i_remain_size, i_recv_length)); + result = + ep0_out_pio(udc, p_buffer, + min(i_remain_size, i_recv_length)); if (result < 0) return result; @@ -740,8 +741,10 @@ static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, p_buffer += result; i_remain_size -= result; - result = ep0_out_overbytes(udc, p_buffer - , min(i_remain_size, i_recv_length)); + result = + ep0_out_overbytes(udc, p_buffer, + min(i_remain_size, + i_recv_length)); req->req.actual += result; } } else { @@ -759,11 +762,11 @@ static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, } } - return 0; /* Transfer End */ + return 0; /* Transfer End */ } if ((req->req.actual % EP0_PACKETSIZE) != 0) - return 0; /* Short Packet Transfer End */ + return 0; /* Short Packet Transfer End */ if (req->req.actual > req->req.length) { dev_err(udc->dev, " *** Overrun Error\n"); @@ -787,17 +790,17 @@ static int _nbu2ss_ep0_out_transfer(struct nbu2ss_udc *udc, static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req, u32 num, u32 length) { - dma_addr_t p_buffer; - u32 mpkt; - u32 lmpkt; - u32 dmacnt; - u32 burst = 1; - u32 data; - int result = -EINVAL; + dma_addr_t p_buffer; + u32 mpkt; + u32 lmpkt; + u32 dmacnt; + u32 burst = 1; + u32 data; + int result = -EINVAL; struct fc_regs __iomem *preg = udc->p_regs; if (req->dma_flag) - return 1; /* DMA is forwarded */ + return 1; /* DMA is forwarded */ req->dma_flag = TRUE; p_buffer = req->req.dma; @@ -830,8 +833,7 @@ static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req, _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, 0); _nbu2ss_bitclr(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); } else { - _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT - , (dmacnt << 16)); + _nbu2ss_writel(&preg->EP_REGS[num].EP_LEN_DCNT, (dmacnt << 16)); _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_BURST_SET); } _nbu2ss_bitset(&preg->EP_REGS[num].EP_DMA_CTRL, EPN_DMA_EN); @@ -846,17 +848,17 @@ static int _nbu2ss_out_dma(struct nbu2ss_udc *udc, struct nbu2ss_req *req, static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req, u32 length) { - u8 *p_buffer; - u32 i; - u32 data; - u32 i_word_length; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32; - int result = 0; + u8 *p_buffer; + u32 i; + u32 data; + u32 i_word_length; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32; + int result = 0; struct fc_regs __iomem *preg = udc->p_regs; if (req->dma_flag) - return 1; /* DMA is forwarded */ + return 1; /* DMA is forwarded */ if (length == 0) return 0; @@ -870,7 +872,8 @@ static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, /* Copy of every four bytes */ for (i = 0; i < i_word_length; i++) { p_buf_32->dw = - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); + _nbu2ss_readl( + &preg->EP_REGS[ep->epnum - 1].EP_READ); p_buf_32++; } result = i_word_length * sizeof(u32); @@ -881,8 +884,8 @@ static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, /*---------------------------------------------------------*/ /* Copy of fraction byte */ temp_32.dw = - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); - for (i = 0 ; i < data ; i++) + _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_READ); + for (i = 0; i < data; i++) p_buf_32->byte.DATA[i] = temp_32.byte.DATA[i]; result += data; } @@ -901,9 +904,9 @@ static int _nbu2ss_epn_out_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, static int _nbu2ss_epn_out_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req, u32 data_size) { - u32 num; - u32 i_buf_size; - int nret = 1; + u32 num; + u32 i_buf_size; + int nret = 1; if (ep->epnum == 0) return -EINVAL; @@ -913,7 +916,7 @@ static int _nbu2ss_epn_out_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, i_buf_size = min((req->req.length - req->req.actual), data_size); if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) && - (i_buf_size >= sizeof(u32))) { + (i_buf_size >= sizeof(u32))) { nret = _nbu2ss_out_dma(udc, req, num, i_buf_size); } else { i_buf_size = min_t(u32, i_buf_size, ep->ep.maxpacket); @@ -928,9 +931,9 @@ static int _nbu2ss_epn_out_transfer(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req) { - u32 num; - u32 i_recv_length; - int result = 1; + u32 num; + u32 i_recv_length; + int result = 1; struct fc_regs __iomem *preg = udc->p_regs; if (ep->epnum == 0) @@ -940,8 +943,8 @@ static int _nbu2ss_epn_out_transfer(struct nbu2ss_udc *udc, /*-------------------------------------------------------------*/ /* 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); @@ -981,17 +984,17 @@ static int _nbu2ss_epn_out_transfer(struct nbu2ss_udc *udc, 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; - u32 mpkt; /* MaxPacketSize */ - u32 lmpkt; /* Last Packet Data Size */ - u32 dmacnt; /* IN Data Size */ - u32 i_write_length; - u32 data; - int result = -EINVAL; + dma_addr_t p_buffer; + u32 mpkt; /* MaxPacketSize */ + u32 lmpkt; /* Last Packet Data Size */ + u32 dmacnt; /* IN Data Size */ + u32 i_write_length; + u32 data; + int result = -EINVAL; struct fc_regs __iomem *preg = udc->p_regs; if (req->dma_flag) - return 1; /* DMA is forwarded */ + return 1; /* DMA is forwarded */ #ifdef USE_DMA if (req->req.actual == 0) @@ -1011,7 +1014,7 @@ static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, /* Number of transmission packets */ if (mpkt < i_write_length) { dmacnt = i_write_length / mpkt; - lmpkt = (i_write_length % mpkt) & ~(u32)0x3; + lmpkt = (i_write_length % mpkt) & ~(u32)0x3; if (lmpkt != 0) dmacnt++; else @@ -1019,7 +1022,7 @@ static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, } else { dmacnt = 1; - lmpkt = i_write_length & ~(u32)0x3; + lmpkt = i_write_length & ~(u32)0x3; } /* Packet setting */ @@ -1052,17 +1055,17 @@ static int _nbu2ss_in_dma(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req, u32 length) { - u8 *p_buffer; - u32 i; - u32 data; - u32 i_word_length; - union usb_reg_access temp_32; - union usb_reg_access *p_buf_32 = NULL; - int result = 0; + u8 *p_buffer; + u32 i; + u32 data; + u32 i_word_length; + union usb_reg_access temp_32; + union usb_reg_access *p_buf_32 = NULL; + int result = 0; struct fc_regs __iomem *preg = udc->p_regs; if (req->dma_flag) - return 1; /* DMA is forwarded */ + return 1; /* DMA is forwarded */ if (length > 0) { p_buffer = (u8 *)req->req.buf; @@ -1072,9 +1075,8 @@ static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, 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 - ); + &preg->EP_REGS[ep->epnum - 1].EP_WRITE, + p_buf_32->dw); p_buf_32++; } @@ -1085,7 +1087,7 @@ static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, if (result != ep->ep.maxpacket) { data = length - result; temp_32.dw = 0; - for (i = 0 ; i < data ; i++) + for (i = 0; i < data; i++) temp_32.byte.DATA[i] = p_buf_32->byte.DATA[i]; _nbu2ss_ep_in_end(udc, ep->epnum, temp_32.dw, data); @@ -1101,8 +1103,8 @@ static int _nbu2ss_epn_in_pio(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, static int _nbu2ss_epn_in_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req, u32 data_size) { - u32 num; - int nret = 1; + u32 num; + int nret = 1; if (ep->epnum == 0) return -EINVAL; @@ -1122,12 +1124,13 @@ static int _nbu2ss_epn_in_data(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, /*-------------------------------------------------------------------------*/ static int _nbu2ss_epn_in_transfer(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, struct nbu2ss_req *req) + struct nbu2ss_ep *ep, + struct nbu2ss_req *req) { - u32 num; - u32 i_buf_size; - int result = 0; - u32 status; + u32 num; + u32 i_buf_size; + int result = 0; + u32 status; if (ep->epnum == 0) return -EINVAL; @@ -1161,10 +1164,9 @@ static int _nbu2ss_epn_in_transfer(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static int _nbu2ss_start_transfer(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, - struct nbu2ss_req *req, - bool bflag) + struct nbu2ss_req *req, bool bflag) { - int nret = -EINVAL; + int nret = -EINVAL; req->dma_flag = FALSE; req->div_len = 0; @@ -1215,8 +1217,8 @@ static int _nbu2ss_start_transfer(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) { - u32 length; - bool bflag = FALSE; + u32 length; + bool bflag = FALSE; struct nbu2ss_req *req; req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); @@ -1224,7 +1226,8 @@ static void _nbu2ss_restert_transfer(struct nbu2ss_ep *ep) return; if (ep->epnum > 0) { - length = _nbu2ss_readl( + length = + _nbu2ss_readl( &ep->udc->p_regs->EP_REGS[ep->epnum - 1].EP_LEN_DCNT); length &= EPN_LDATA; @@ -1239,8 +1242,8 @@ 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) { - u8 num; - u32 data; + u8 num; + u32 data; if ((ep_adrs == 0) || (ep_adrs == 0x80)) return; @@ -1260,8 +1263,8 @@ static void _nbu2ss_endpoint_toggle_reset(struct nbu2ss_udc *udc, u8 ep_adrs) static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc *udc, u8 ep_adrs, bool bstall) { - u8 num, epnum; - u32 data; + u8 num, epnum; + u32 data; struct nbu2ss_ep *ep; struct fc_regs __iomem *preg = udc->p_regs; @@ -1292,17 +1295,18 @@ static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc *udc, /* Clear STALL */ ep->stalled = FALSE; if (ep_adrs & USB_DIR_IN) { - _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL - , EPN_ISTL); + _nbu2ss_bitclr(&preg->EP_REGS[num].EP_CONTROL, + EPN_ISTL); } else { data = - _nbu2ss_readl(&preg->EP_REGS[num].EP_CONTROL); + _nbu2ss_readl( + &preg->EP_REGS[num].EP_CONTROL); data &= ~EPN_OSTL; data |= EPN_OSTL_EN; - _nbu2ss_writel(&preg->EP_REGS[num].EP_CONTROL - , data); + _nbu2ss_writel(&preg->EP_REGS[num].EP_CONTROL, + data); } ep->stalled = FALSE; @@ -1317,7 +1321,7 @@ static void _nbu2ss_set_endpoint_stall(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static void _nbu2ss_set_test_mode(struct nbu2ss_udc *udc, u32 mode) { - u32 data; + u32 data; if (mode > MAX_TEST_MODE_NUM) return; @@ -1336,7 +1340,7 @@ 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) { - int result = -EOPNOTSUPP; + int result = -EOPNOTSUPP; switch (selector) { case USB_DEVICE_REMOTE_WAKEUP: @@ -1362,8 +1366,8 @@ static int _nbu2ss_set_feature_device(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) { - u8 epnum; - u32 data = 0, bit_data; + u8 epnum; + u32 data = 0, bit_data; struct fc_regs __iomem *preg = udc->p_regs; epnum = ep_adrs & ~USB_ENDPOINT_DIR_MASK; @@ -1390,23 +1394,21 @@ static int _nbu2ss_get_ep_stall(struct nbu2ss_udc *udc, u8 ep_adrs) /*-------------------------------------------------------------------------*/ static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset) { - u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); - u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); - u16 selector = le16_to_cpu(udc->ctrl.wValue); - u16 wIndex = le16_to_cpu(udc->ctrl.wIndex); - u8 ep_adrs; - int result = -EOPNOTSUPP; + u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); + u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); + u16 selector = le16_to_cpu(udc->ctrl.wValue); + u16 wIndex = le16_to_cpu(udc->ctrl.wIndex); + u8 ep_adrs; + int result = -EOPNOTSUPP; - if ((udc->ctrl.wLength != 0x0000) || - (direction != USB_DIR_OUT)) { + if ((udc->ctrl.wLength != 0x0000) || (direction != USB_DIR_OUT)) return -EINVAL; - } switch (recipient) { case USB_RECIP_DEVICE: if (bset) result = - _nbu2ss_set_feature_device(udc, selector, wIndex); + _nbu2ss_set_feature_device(udc, selector, wIndex); break; case USB_RECIP_ENDPOINT: @@ -1414,12 +1416,11 @@ 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; } @@ -1439,7 +1440,7 @@ static inline int _nbu2ss_req_feature(struct nbu2ss_udc *udc, bool bset) /*-------------------------------------------------------------------------*/ static inline enum usb_device_speed _nbu2ss_get_speed(struct nbu2ss_udc *udc) { - u32 data; + u32 data; enum usb_device_speed speed = USB_SPEED_FULL; data = _nbu2ss_readl(&udc->p_regs->USB_STATUS); @@ -1450,20 +1451,19 @@ 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; - u32 regdata; - int limit_cnt = 0; + u8 ep_adrs; + u32 regdata; + int limit_cnt = 0; struct fc_regs __iomem *preg = udc->p_regs; if (ep->direct == USB_DIR_IN) { - for (limit_cnt = 0 - ; limit_cnt < IN_DATA_EMPTY_COUNT - ; limit_cnt++) { - regdata = _nbu2ss_readl( + for (limit_cnt = 0; limit_cnt < IN_DATA_EMPTY_COUNT; + limit_cnt++) { + regdata = + _nbu2ss_readl( &preg->EP_REGS[ep->epnum - 1].EP_STATUS); if ((regdata & EPN_IN_DATA) == 0) @@ -1480,12 +1480,12 @@ static void _nbu2ss_epn_set_stall(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static int std_req_get_status(struct nbu2ss_udc *udc) { - u32 length; - u16 status_data = 0; - u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); - u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); - u8 ep_adrs; - int result = -EINVAL; + u32 length; + u16 status_data = 0; + u8 recipient = (u8)(udc->ctrl.bRequestType & USB_RECIP_MASK); + u8 direction = (u8)(udc->ctrl.bRequestType & USB_DIR_IN); + u8 ep_adrs; + int result = -EINVAL; if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN)) return result; @@ -1546,12 +1546,11 @@ static int std_req_set_feature(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static int std_req_set_address(struct nbu2ss_udc *udc) { - int result = 0; - u32 wValue = le16_to_cpu(udc->ctrl.wValue); + int result = 0; + u32 wValue = le16_to_cpu(udc->ctrl.wValue); - if ((udc->ctrl.bRequestType != 0x00) || - (udc->ctrl.wIndex != 0x0000) || - (udc->ctrl.wLength != 0x0000)) { + if ((udc->ctrl.bRequestType != 0x00) || + (udc->ctrl.wIndex != 0x0000) || (udc->ctrl.wLength != 0x0000)) { return -EINVAL; } @@ -1571,9 +1570,8 @@ static int std_req_set_configuration(struct nbu2ss_udc *udc) { u32 config_value = (u32)(le16_to_cpu(udc->ctrl.wValue) & 0x00ff); - if ((udc->ctrl.wIndex != 0x0000) || - (udc->ctrl.wLength != 0x0000) || - (udc->ctrl.bRequestType != 0x00)) { + if ((udc->ctrl.wIndex != 0x0000) || + (udc->ctrl.wLength != 0x0000) || (udc->ctrl.bRequestType != 0x00)) { return -EINVAL; } @@ -1602,9 +1600,9 @@ static inline void _nbu2ss_read_request_data(struct nbu2ss_udc *udc, u32 *pdata) /*-------------------------------------------------------------------------*/ static inline int _nbu2ss_decode_request(struct nbu2ss_udc *udc) { - bool bcall_back = TRUE; - int nret = -EINVAL; - struct usb_ctrlrequest *p_ctrl; + bool bcall_back = TRUE; + int nret = -EINVAL; + struct usb_ctrlrequest *p_ctrl; p_ctrl = &udc->ctrl; _nbu2ss_read_request_data(udc, (u32 *)p_ctrl); @@ -1675,9 +1673,9 @@ static inline int _nbu2ss_decode_request(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc) { - int nret; - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[0]; + int nret; + struct nbu2ss_req *req; + struct nbu2ss_ep *ep = &udc->ep[0]; req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) @@ -1698,9 +1696,9 @@ static inline int _nbu2ss_ep0_in_data_stage(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc) { - int nret; - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[0]; + int nret; + struct nbu2ss_req *req; + struct nbu2ss_ep *ep = &udc->ep[0]; req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) @@ -1722,8 +1720,8 @@ static inline int _nbu2ss_ep0_out_data_stage(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc) { - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[0]; + struct nbu2ss_req *req; + struct nbu2ss_ep *ep = &udc->ep[0]; req = list_first_entry_or_null(&ep->queue, struct nbu2ss_req, queue); if (!req) { @@ -1744,10 +1742,10 @@ static inline int _nbu2ss_ep0_status_stage(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc) { - int i; - u32 status; - u32 intr; - int nret = -1; + int i; + u32 status; + u32 intr; + int nret = -1; status = _nbu2ss_readl(&udc->p_regs->EP0_STATUS); intr = status & EP0_STATUS_RW_BIT; @@ -1799,8 +1797,7 @@ static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc) if ((status & STG_END_INT) || (status & SETUP_INT) || (status & EP0_OUT_NULL_INT)) { status &= ~(STG_END_INT - | EP0_OUT_INT - | EP0_OUT_NULL_INT); + | EP0_OUT_INT | EP0_OUT_NULL_INT); nret = _nbu2ss_ep0_status_stage(udc); } @@ -1824,8 +1821,7 @@ 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) + struct nbu2ss_req *req, int status) { struct nbu2ss_udc *udc = ep->udc; @@ -1860,8 +1856,8 @@ static inline void _nbu2ss_epn_in_int(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req) { - int result = 0; - u32 status; + int result = 0; + u32 status; struct fc_regs __iomem *preg = udc->p_regs; @@ -1879,7 +1875,8 @@ static inline void _nbu2ss_epn_in_int(struct nbu2ss_udc *udc, } else { if (req->zero && ((req->req.actual % ep->ep.maxpacket) == 0)) { status = - _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS); + _nbu2ss_readl( + &preg->EP_REGS[ep->epnum - 1].EP_STATUS); if ((status & EPN_IN_FULL) == 0) { /*-----------------------------------------*/ @@ -1903,7 +1900,7 @@ static inline void _nbu2ss_epn_out_int(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req) { - int result; + int result; result = _nbu2ss_epn_out_transfer(udc, ep, req); if (result <= 0) @@ -1915,8 +1912,8 @@ static inline void _nbu2ss_epn_in_dma_int(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req) { - u32 mpkt; - u32 size; + u32 mpkt; + u32 size; struct usb_request *preq; preq = &req->req; @@ -1951,10 +1948,10 @@ static inline void _nbu2ss_epn_out_dma_int(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep, struct nbu2ss_req *req) { - int i; - u32 num; - u32 dmacnt, ep_dmacnt; - u32 mpkt; + int i; + u32 num; + u32 dmacnt, ep_dmacnt; + u32 mpkt; struct fc_regs __iomem *preg = udc->p_regs; num = ep->epnum - 1; @@ -1968,13 +1965,13 @@ static inline void _nbu2ss_epn_out_dma_int(struct nbu2ss_udc *udc, } } - ep_dmacnt = _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) - & EPN_DMACNT; + ep_dmacnt = + _nbu2ss_readl(&preg->EP_REGS[num].EP_LEN_DCNT) & EPN_DMACNT; ep_dmacnt >>= 16; for (i = 0; i < EPC_PLL_LOCK_COUNT; i++) { dmacnt = _nbu2ss_readl(&preg->EP_DCR[num].EP_DCR1) - & DCR1_EPN_DMACNT; + & DCR1_EPN_DMACNT; dmacnt >>= 16; if (ep_dmacnt == dmacnt) break; @@ -2007,11 +2004,11 @@ static inline void _nbu2ss_epn_out_dma_int(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static inline void _nbu2ss_epn_int(struct nbu2ss_udc *udc, u32 epnum) { - u32 num; - u32 status; + u32 num; + u32 status; - struct nbu2ss_req *req; - struct nbu2ss_ep *ep = &udc->ep[epnum]; + struct nbu2ss_req *req; + struct nbu2ss_ep *ep = &udc->ep[epnum]; num = epnum - 1; @@ -2062,8 +2059,7 @@ static void _nbu2ss_ep0_enable(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, - struct nbu2ss_ep *ep, - int status) + struct nbu2ss_ep *ep, int status) { struct nbu2ss_req *req; @@ -2087,7 +2083,7 @@ static int _nbu2ss_nuke(struct nbu2ss_udc *udc, /*-------------------------------------------------------------------------*/ static void _nbu2ss_quiesce(struct nbu2ss_udc *udc) { - struct nbu2ss_ep *ep; + struct nbu2ss_ep *ep; udc->gadget.speed = USB_SPEED_UNKNOWN; @@ -2102,7 +2098,7 @@ static void _nbu2ss_quiesce(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) { - u32 reg_dt; + u32 reg_dt; if (udc->vbus_active == 0) return -ESHUTDOWN; @@ -2111,7 +2107,7 @@ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) /* D+ Pullup */ if (udc->driver) { reg_dt = (_nbu2ss_readl(&udc->p_regs->USB_CONTROL) - | PUE2) & ~(u32)CONNECTB; + | PUE2) & ~(u32)CONNECTB; _nbu2ss_writel(&udc->p_regs->USB_CONTROL, reg_dt); } @@ -2119,7 +2115,7 @@ static int _nbu2ss_pullup(struct nbu2ss_udc *udc, int is_on) } else { /* D+ Pulldown */ reg_dt = (_nbu2ss_readl(&udc->p_regs->USB_CONTROL) | CONNECTB) - & ~(u32)PUE2; + & ~(u32)PUE2; _nbu2ss_writel(&udc->p_regs->USB_CONTROL, reg_dt); udc->gadget.speed = USB_SPEED_UNKNOWN; @@ -2150,7 +2146,7 @@ static void _nbu2ss_fifo_flush(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep) /*-------------------------------------------------------------------------*/ static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) { - int waitcnt = 0; + int waitcnt = 0; if (udc->udc_enabled) return 0; @@ -2166,8 +2162,8 @@ static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) _nbu2ss_writel(&udc->p_regs->AHBSCTR, WAIT_MODE); - _nbu2ss_writel(&udc->p_regs->AHBMCTR, - HBUSREQ_MODE | HTRANS_MODE | WBURST_TYPE); + _nbu2ss_writel(&udc->p_regs->AHBMCTR, + HBUSREQ_MODE | HTRANS_MODE | WBURST_TYPE); while (!(_nbu2ss_readl(&udc->p_regs->EPCTR) & PLL_LOCK)) { waitcnt++; @@ -2178,7 +2174,7 @@ static int _nbu2ss_enable_controller(struct nbu2ss_udc *udc) } } - _nbu2ss_bitset(&udc->p_regs->UTMI_CHARACTER_1, USB_SQUSET); + _nbu2ss_bitset(&udc->p_regs->UTMI_CHARACTER_1, USB_SQUSET); _nbu2ss_bitset(&udc->p_regs->USB_CONTROL, (INT_SEL | SOF_RCV)); @@ -2213,13 +2209,13 @@ static void _nbu2ss_disable_controller(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) { - int nret; - u32 reg_dt; + int nret; + u32 reg_dt; /* chattering */ - mdelay(VBUS_CHATTERING_MDELAY); /* wait (ms) */ + mdelay(VBUS_CHATTERING_MDELAY); /* wait (ms) */ - /* VBUS ON Check*/ + /* VBUS ON Check */ reg_dt = gpiod_get_value(vbus_gpio); if (reg_dt == 0) { udc->linux_suspended = 0; @@ -2246,7 +2242,7 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) _nbu2ss_disable_controller(udc); } } else { - mdelay(5); /* wait (5ms) */ + mdelay(5); /* wait (5ms) */ reg_dt = gpiod_get_value(vbus_gpio); if (reg_dt == 0) return; @@ -2284,8 +2280,8 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline void _nbu2ss_int_bus_reset(struct nbu2ss_udc *udc) { - udc->devstate = USB_STATE_DEFAULT; - udc->remote_wakeup = 0; + udc->devstate = USB_STATE_DEFAULT; + udc->remote_wakeup = 0; _nbu2ss_quiesce(udc); @@ -2308,7 +2304,7 @@ static inline void _nbu2ss_int_usb_resume(struct nbu2ss_udc *udc) /*-------------------------------------------------------------------------*/ static inline void _nbu2ss_int_usb_suspend(struct nbu2ss_udc *udc) { - u32 reg_dt; + u32 reg_dt; if (udc->usb_suspended == 0) { reg_dt = gpiod_get_value(vbus_gpio); @@ -2331,7 +2327,7 @@ static inline void _nbu2ss_int_usb_suspend(struct nbu2ss_udc *udc) /* VBUS (GPIO153) Interrupt */ static irqreturn_t _nbu2ss_vbus_irq(int irq, void *_udc) { - struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; + struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; spin_lock(&udc->lock); _nbu2ss_check_vbus(udc); @@ -2344,11 +2340,11 @@ static irqreturn_t _nbu2ss_vbus_irq(int irq, void *_udc) /* Interrupt (udc) */ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) { - u8 suspend_flag = 0; - u32 status; - u32 epnum, int_bit; + u8 suspend_flag = 0; + u32 status; + u32 epnum, int_bit; - struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; + struct nbu2ss_udc *udc = (struct nbu2ss_udc *)_udc; struct fc_regs __iomem *preg = udc->p_regs; if (gpiod_get_value(vbus_gpio) == 0) { @@ -2417,11 +2413,11 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc) static int nbu2ss_ep_enable(struct usb_ep *_ep, const struct usb_endpoint_descriptor *desc) { - u8 ep_type; - unsigned long flags; + u8 ep_type; + unsigned long flags; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; if ((!_ep) || (!desc)) { pr_err(" *** %s, bad param\n", __func__); @@ -2476,9 +2472,9 @@ static int nbu2ss_ep_enable(struct usb_ep *_ep, /*-------------------------------------------------------------------------*/ static int nbu2ss_ep_disable(struct usb_ep *_ep) { - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; + unsigned long flags; if (!_ep) { pr_err(" *** %s, bad param\n", __func__); @@ -2496,7 +2492,7 @@ static int nbu2ss_ep_disable(struct usb_ep *_ep) return -ESHUTDOWN; spin_lock_irqsave(&udc->lock, flags); - _nbu2ss_nuke(udc, ep, -EINPROGRESS); /* dequeue request */ + _nbu2ss_nuke(udc, ep, -EINPROGRESS); /* dequeue request */ spin_unlock_irqrestore(&udc->lock, flags); return 0; @@ -2521,8 +2517,7 @@ static struct usb_request *nbu2ss_ep_alloc_request(struct usb_ep *ep, } /*-------------------------------------------------------------------------*/ -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; @@ -2537,12 +2532,12 @@ static void nbu2ss_ep_free_request(struct usb_ep *_ep, 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; - struct nbu2ss_udc *udc; - unsigned long flags; - bool bflag; - int result = -EINVAL; + struct nbu2ss_req *req; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; + unsigned long flags; + bool bflag; + int result = -EINVAL; /* catch various bogus parameters */ if ((!_ep) || (!_req)) { @@ -2557,8 +2552,7 @@ static int nbu2ss_ep_queue(struct usb_ep *_ep, req = container_of(_req, struct nbu2ss_req, req); if (unlikely(!_req->complete || - !_req->buf || - !list_empty(&req->queue))) { + !_req->buf || !list_empty(&req->queue))) { if (!_req->complete) pr_err("udc: %s --- !_req->complete\n", __func__); @@ -2595,10 +2589,10 @@ static int nbu2ss_ep_queue(struct usb_ep *_ep, if (req->unaligned) { if (!ep->virt_buf) - ep->virt_buf = dma_alloc_coherent( - NULL, PAGE_SIZE, - &ep->phys_buf, GFP_ATOMIC | GFP_DMA); - if (ep->epnum > 0) { + 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, req->req.length); @@ -2641,9 +2635,9 @@ static int nbu2ss_ep_queue(struct usb_ep *_ep, /*-------------------------------------------------------------------------*/ static int nbu2ss_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) { - struct nbu2ss_req *req; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; + struct nbu2ss_req *req; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; unsigned long flags; /* catch various bogus parameters */ @@ -2681,11 +2675,11 @@ static int nbu2ss_ep_dequeue(struct usb_ep *_ep, struct usb_request *_req) /*-------------------------------------------------------------------------*/ static int nbu2ss_ep_set_halt(struct usb_ep *_ep, int value) { - u8 ep_adrs; - unsigned long flags; + u8 ep_adrs; + unsigned long flags; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; if (!_ep) { pr_err("%s, bad param\n", __func__); @@ -2729,11 +2723,11 @@ static int nbu2ss_ep_set_wedge(struct usb_ep *_ep) /*-------------------------------------------------------------------------*/ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) { - u32 data; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; - struct fc_regs __iomem *preg; + u32 data; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; + unsigned long flags; + struct fc_regs __iomem *preg; if (!_ep) { pr_err("%s, bad param\n", __func__); @@ -2761,7 +2755,7 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) } else { data = _nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_LEN_DCNT) - & EPN_LDATA; + & EPN_LDATA; } spin_unlock_irqrestore(&udc->lock, flags); @@ -2770,12 +2764,12 @@ static int nbu2ss_ep_fifo_status(struct usb_ep *_ep) } /*-------------------------------------------------------------------------*/ -static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) +static void nbu2ss_ep_fifo_flush(struct usb_ep *_ep) { - u32 data; - struct nbu2ss_ep *ep; - struct nbu2ss_udc *udc; - unsigned long flags; + u32 data; + struct nbu2ss_ep *ep; + struct nbu2ss_udc *udc; + unsigned long flags; if (!_ep) { pr_err("udc: %s, bad param\n", __func__); @@ -2823,8 +2817,8 @@ static const struct usb_ep_ops nbu2ss_ep_ops = { /*-------------------------------------------------------------------------*/ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) { - u32 data; - struct nbu2ss_udc *udc; + u32 data; + struct nbu2ss_udc *udc; if (!pgadget) { pr_err("udc: %s, bad param\n", __func__); @@ -2842,10 +2836,10 @@ static int nbu2ss_gad_get_frame(struct usb_gadget *pgadget) /*-------------------------------------------------------------------------*/ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) { - int i; - u32 data; + int i; + u32 data; - struct nbu2ss_udc *udc; + struct nbu2ss_udc *udc; if (!pgadget) { pr_err("%s, bad param\n", __func__); @@ -2878,8 +2872,8 @@ static int nbu2ss_gad_wakeup(struct usb_gadget *pgadget) static int nbu2ss_gad_set_selfpowered(struct usb_gadget *pgadget, int is_selfpowered) { - struct nbu2ss_udc *udc; - unsigned long flags; + struct nbu2ss_udc *udc; + unsigned long flags; if (!pgadget) { pr_err("%s, bad param\n", __func__); @@ -2904,8 +2898,8 @@ static int nbu2ss_gad_vbus_session(struct usb_gadget *pgadget, int is_active) /*-------------------------------------------------------------------------*/ static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned int mA) { - struct nbu2ss_udc *udc; - unsigned long flags; + struct nbu2ss_udc *udc; + unsigned long flags; if (!pgadget) { pr_err("%s, bad param\n", __func__); @@ -2924,8 +2918,8 @@ static int nbu2ss_gad_vbus_draw(struct usb_gadget *pgadget, unsigned int mA) /*-------------------------------------------------------------------------*/ static int nbu2ss_gad_pullup(struct usb_gadget *pgadget, int is_on) { - struct nbu2ss_udc *udc; - unsigned long flags; + struct nbu2ss_udc *udc; + unsigned long flags; if (!pgadget) { pr_err("%s, bad param\n", __func__); @@ -3011,7 +3005,7 @@ static const struct { /*-------------------------------------------------------------------------*/ static void nbu2ss_drv_ep_init(struct nbu2ss_udc *udc) { - int i; + int i; INIT_LIST_HEAD(&udc->gadget.ep_list); udc->gadget.ep0 = &udc->ep[0].ep; @@ -3077,8 +3071,8 @@ static int nbu2ss_drv_contest_init(struct platform_device *pdev, */ static int nbu2ss_drv_probe(struct platform_device *pdev) { - int status = -ENODEV; - struct nbu2ss_udc *udc; + int status = -ENODEV; + struct nbu2ss_udc *udc; struct resource *r; int irq; void __iomem *mmio_base; @@ -3135,7 +3129,7 @@ static int nbu2ss_drv_probe(struct platform_device *pdev) /*-------------------------------------------------------------------------*/ static void nbu2ss_drv_shutdown(struct platform_device *pdev) { - struct nbu2ss_udc *udc; + struct nbu2ss_udc *udc; udc = platform_get_drvdata(pdev); if (!udc) @@ -3147,9 +3141,9 @@ static void nbu2ss_drv_shutdown(struct platform_device *pdev) /*-------------------------------------------------------------------------*/ static int nbu2ss_drv_remove(struct platform_device *pdev) { - struct nbu2ss_udc *udc; - struct nbu2ss_ep *ep; - int i; + struct nbu2ss_udc *udc; + struct nbu2ss_ep *ep; + int i; udc = &udc_controller; @@ -3169,7 +3163,7 @@ static int nbu2ss_drv_remove(struct platform_device *pdev) /*-------------------------------------------------------------------------*/ static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state) { - struct nbu2ss_udc *udc; + struct nbu2ss_udc *udc; udc = platform_get_drvdata(pdev); if (!udc) @@ -3195,8 +3189,8 @@ static int nbu2ss_drv_suspend(struct platform_device *pdev, pm_message_t state) /*-------------------------------------------------------------------------*/ static int nbu2ss_drv_resume(struct platform_device *pdev) { - u32 data; - struct nbu2ss_udc *udc; + u32 data; + struct nbu2ss_udc *udc; udc = platform_get_drvdata(pdev); if (!udc) -- 2.21.0 _______________________________________________ devel mailing list devel@xxxxxxxxxxxxxxxxxxxxxx http://driverdev.linuxdriverproject.org/mailman/listinfo/driverdev-devel