Skip to contentSkip to conversation

staging: emxx_udc: emxx_udc.c checkpatch modifications

PATCH New Walt Feasel 1 participant 6 messages Nov 21, 2016 Staging

lore
Share & tools
lore
#0 lore raw

cover staging: emxx_udc: emxx_udc.c checkpatch modifications

Make Linux kernel style modifications for emxx_udc.c to include:

Blank lines after {
Logical continuation
Single statement blocks
Spaces preferred around operators
Align parenthesis

Walt Feasel (5):
staging: emxx_udc: emxx_udc.c Blank lines after {
staging: emxx_udc: emxx_udc.c Logical continuation
staging: emxx_udc: emxx_udc.c {} Single statement blocks
staging: emxx_udc: emxx_udc.c Spaces preferred around operators
staging: emxx_udc: emxx_udc.c Align parenthesis

 drivers/staging/emxx_udc/emxx_udc.c | 57 ++++++++++++-------------------------
 1 file changed, 18 insertions(+), 39 deletions(-)
Signature · 1 line
2.1.4
#1 lore raw

PATCH 1/5 staging: emxx_udc: emxx_udc.c Blank lines after {

Make suggested checkpatch modification for
CHECK: Blank lines aren't necessary after an
open brace '{'

---
 drivers/staging/emxx_udc/emxx_udc.c | 13 -------------
 1 file changed, 13 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +0 -13
index 31f4206..409761a 100644
@@ -153,7 +153,6 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req)
 	udc = (struct nbu2ss_udc *)_req->context;
 	p_ctrl = &udc->ctrl;
 	if ((p_ctrl->bRequestType & USB_TYPE_MASK) == USB_TYPE_STANDARD) {
-
 		if (p_ctrl->bRequest == USB_REQ_SET_FEATURE) {
 			/*-------------------------------------------------*/
 			/* SET_FEATURE */
@@ -753,7 +752,6 @@ static int _nbu2ss_ep0_out_transfer(
 	/* Receive data confirmation */
 	iRecvLength = _nbu2ss_readl(&udc->p_regs->EP0_LENGTH) & EP0_LDATA;
 	if (iRecvLength != 0) {
-
 		fRcvZero = 0;
 
 		iRemainSize = req->req.length - req->req.actual;
@@ -930,7 +928,6 @@ static int _nbu2ss_epn_out_pio(
 
 	if ((req->req.actual == req->req.length)
 			|| ((req->req.actual % ep->ep.maxpacket) != 0)) {
-
 		result = 0;
 	}
 
@@ -1001,7 +998,6 @@ static int _nbu2ss_epn_out_transfer(
 	} else {
 		if ((req->req.actual == req->req.length)
 			|| ((req->req.actual % ep->ep.maxpacket) != 0)) {
-
 			result = 0;
 		}
 	}
@@ -1557,7 +1553,6 @@ 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);
 
@@ -1584,7 +1579,6 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
 
 	if ((udc->ctrl.wValue != 0x0000)
 		|| (direction != USB_DIR_IN)) {
-
 		return result;
 	}
 
@@ -1982,7 +1976,6 @@ static inline void _nbu2ss_epn_in_int(
 
 	} else {
 		if (req->zero && ((req->req.actual % ep->ep.maxpacket) == 0)) {
-
 			status =
 			_nbu2ss_readl(&preg->EP_REGS[ep->epnum - 1].EP_STATUS);
 
@@ -2330,7 +2323,6 @@ static inline void _nbu2ss_check_vbus(struct nbu2ss_udc *udc)
 	/* VBUS ON Check*/
 	reg_dt = gpio_get_value(VBUS_VALUE);
 	if (reg_dt == 0) {
-
 		udc->linux_suspended = 0;
 
 		_nbu2ss_reset_controller(udc);
@@ -2502,7 +2494,6 @@ static irqreturn_t _nbu2ss_udc_irq(int irq, void *_udc)
 			int_bit = status >> 8;
 
 			for (epnum = 0; epnum < NUM_ENDPOINTS; epnum++) {
-
 				if (0x01 & int_bit)
 					_nbu2ss_ep_int(udc, epnum);
 
@@ -2548,7 +2539,6 @@ static int nbu2ss_ep_enable(
 	ep_type = usb_endpoint_type(desc);
 	if ((ep_type == USB_ENDPOINT_XFER_CONTROL)
 		|| (ep_type == USB_ENDPOINT_XFER_ISOC)) {
-
 		pr_err(" *** %s, bat bmAttributes\n", __func__);
 		return -EINVAL;
 	}
@@ -2559,7 +2549,6 @@ static int nbu2ss_ep_enable(
 
 	if ((!udc->driver)
 		|| (udc->gadget.speed == USB_SPEED_UNKNOWN)) {
-
 		dev_err(ep->udc->dev, " *** %s, udc !!\n", __func__);
 		return -ESHUTDOWN;
 	}
@@ -2677,7 +2666,6 @@ static int nbu2ss_ep_queue(
 	if (unlikely
 	    (!_req->complete || !_req->buf
 	     || !list_empty(&req->queue))) {
-
 		if (!_req->complete)
 			pr_err("udc: %s --- !_req->complete\n", __func__);
 
@@ -2736,7 +2724,6 @@ static int nbu2ss_ep_queue(
 	list_add_tail(&req->queue, &ep->queue);
 
 	if (bflag && !ep->stalled) {
-
 		result = _nbu2ss_start_transfer(udc, ep, req, FALSE);
 		if (result < 0) {
 			dev_err(udc->dev, " *** %s, result = %d\n", __func__,
Signature · 1 line
2.1.4
#2 lore raw

PATCH 2/5 staging: emxx_udc: emxx_udc.c Logical continuation

In reply to Walt Feasel

Make suggested checkpatch modification for
CHECK: Logical continuations should be on the
previous line

---
 drivers/staging/emxx_udc/emxx_udc.c | 37 +++++++++++++++----------------------
 1 file changed, 15 insertions(+), 22 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +15 -22
index 409761a..de8f065 100644
@@ -926,8 +926,8 @@ static int _nbu2ss_epn_out_pio(
 
 	req->req.actual += result;
 
-	if ((req->req.actual == req->req.length)
-			|| ((req->req.actual % ep->ep.maxpacket) != 0)) {
+	if ((req->req.actual == req->req.length) ||
+	    ((req->req.actual % ep->ep.maxpacket) != 0)) {
 		result = 0;
 	}
 
@@ -953,9 +953,8 @@ static int _nbu2ss_epn_out_data(
 
 	iBufSize = min((req->req.length - req->req.actual), data_size);
 
-	if ((ep->ep_type != USB_ENDPOINT_XFER_INT)
-		&& (req->req.dma != 0)
-		&& (iBufSize  >= sizeof(u32))) {
+	if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) &&
+	    (iBufSize  >= sizeof(u32))) {
 		nret = _nbu2ss_out_dma(udc, req, num, iBufSize);
 	} else {
 		iBufSize = min_t(u32, iBufSize, ep->ep.maxpacket);
@@ -996,8 +995,8 @@ static int _nbu2ss_epn_out_transfer(
 			}
 		}
 	} else {
-		if ((req->req.actual == req->req.length)
-			|| ((req->req.actual % ep->ep.maxpacket) != 0)) {
+		if ((req->req.actual == req->req.length) ||
+		    ((req->req.actual % ep->ep.maxpacket) != 0)) {
 			result = 0;
 		}
 	}
@@ -1166,9 +1165,8 @@ static int _nbu2ss_epn_in_data(
 
 	num = ep->epnum - 1;
 
-	if ((ep->ep_type != USB_ENDPOINT_XFER_INT)
-		&& (req->req.dma != 0)
-		&& (data_size >= sizeof(u32))) {
+	if ((ep->ep_type != USB_ENDPOINT_XFER_INT) && (req->req.dma != 0) &&
+	    (data_size >= sizeof(u32))) {
 		nret = _nbu2ss_in_dma(udc, ep, req, num, data_size);
 	} else {
 		data_size = min_t(u32, data_size, ep->ep.maxpacket);
@@ -1577,8 +1575,7 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
 	u8	ep_adrs;
 	int	result = -EINVAL;
 
-	if ((udc->ctrl.wValue != 0x0000)
-		|| (direction != USB_DIR_IN)) {
+	if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN)) {
 		return result;
 	}
 
@@ -1891,9 +1888,8 @@ static inline void _nbu2ss_ep0_int(struct nbu2ss_udc *udc)
 			break;
 
 		case EP0_OUT_STATUS_PAHSE:
-			if ((status & STG_END_INT)
-			|| (status & SETUP_INT)
-			|| (status & EP0_OUT_NULL_INT)) {
+			if ((status & STG_END_INT) || (status & SETUP_INT) ||
+			    (status & EP0_OUT_NULL_INT)) {
 				status &= ~(STG_END_INT
 						| EP0_OUT_INT
 						| EP0_OUT_NULL_INT);
@@ -2537,8 +2533,8 @@ static int nbu2ss_ep_enable(
 	}
 
 	ep_type = usb_endpoint_type(desc);
-	if ((ep_type == USB_ENDPOINT_XFER_CONTROL)
-		|| (ep_type == USB_ENDPOINT_XFER_ISOC)) {
+	if ((ep_type == USB_ENDPOINT_XFER_CONTROL) ||
+	    (ep_type == USB_ENDPOINT_XFER_ISOC)) {
 		pr_err(" *** %s, bat bmAttributes\n", __func__);
 		return -EINVAL;
 	}
@@ -2547,8 +2543,7 @@ static int nbu2ss_ep_enable(
 	if (udc->vbus_active == 0)
 		return -ESHUTDOWN;
 
-	if ((!udc->driver)
-		|| (udc->gadget.speed == USB_SPEED_UNKNOWN)) {
+	if ((!udc->driver) || (udc->gadget.speed == USB_SPEED_UNKNOWN)) {
 		dev_err(ep->udc->dev, " *** %s, udc !!\n", __func__);
 		return -ESHUTDOWN;
 	}
@@ -2663,9 +2658,7 @@ static int nbu2ss_ep_queue(
 	}
 
 	req = container_of(_req, struct nbu2ss_req, req);
-	if (unlikely
-	    (!_req->complete || !_req->buf
-	     || !list_empty(&req->queue))) {
+	if (unlikely(!_req->complete || !_req->buf || !list_empty(&req->queue))) {
 		if (!_req->complete)
 			pr_err("udc: %s --- !_req->complete\n", __func__);
 
Signature · 1 line
2.1.4
#3 lore raw

PATCH 3/5 staging: emxx_udc: emxx_udc.c {} Single statement blocks

In reply to Walt Feasel

Make suggested checkpatch modification for
WARNING: braces {} are not necessary for single
statement blocks

---
 drivers/staging/emxx_udc/emxx_udc.c | 3 +--
 1 file changed, 1 insertion(+), 2 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +1 -2
index de8f065..3a29f38 100644
@@ -1575,9 +1575,8 @@ static int std_req_get_status(struct nbu2ss_udc *udc)
 	u8	ep_adrs;
 	int	result = -EINVAL;
 
-	if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN)) {
+	if ((udc->ctrl.wValue != 0x0000) || (direction != USB_DIR_IN))
 		return result;
-	}
 
 	length = min_t(u16, udc->ctrl.wLength, sizeof(status_data));
 
Signature · 1 line
2.1.4
#4 lore raw

PATCH 4/5 staging: emxx_udc: emxx_udc.c Spaces preferred around operators

In reply to Walt Feasel

Make suggested checkpatch modification for
CHECK: spaces preferred around that '|'

---
 drivers/staging/emxx_udc/emxx_udc.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/staging/emxx_udc/emxx_udc.c +1 -1
index 3a29f38..65672b5 100644
@@ -262,7 +262,7 @@ static int _nbu2ss_ep_init(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)
 	}
 
 	_nbu2ss_bitset(&udc->p_regs->EP_REGS[num].EP_CONTROL, data);
-	_nbu2ss_endpoint_toggle_reset(udc, (ep->epnum|ep->direct));
+	_nbu2ss_endpoint_toggle_reset(udc, (ep->epnum | ep->direct));
 
 	if (ep->direct == USB_DIR_OUT) {
 		/*---------------------------------------------------------*/
Signature · 1 line
2.1.4
#5 lore raw

PATCH 5/5 staging: emxx_udc: emxx_udc.c Align parenthesis

In reply to Walt Feasel

Make suggested checkpatch modification for
CHECK: Alignment should match open parenthesis

---
 drivers/staging/emxx_udc/emxx_udc.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/staging/emxx_udc/emxx_udc.c +2 -2
index 65672b5..3f42fa8 100644
@@ -3284,8 +3284,8 @@ static int nbu2ss_drv_remove(struct platform_device *pdev)
 	for (i = 0; i < NUM_ENDPOINTS; i++) {
 		ep = &udc->ep[i];
 		if (ep->virt_buf)
-			dma_free_coherent(NULL, PAGE_SIZE,
-				(void *)ep->virt_buf, ep->phys_buf);
+			dma_free_coherent(NULL, PAGE_SIZE, (void *)ep->virt_buf,
+					  ep->phys_buf);
 	}
 
 	/* Interrupt Handler - Release */
Signature · 1 line
2.1.4