[PATCH] staging: emxx_udc: Remove unneeded parentheses

Jack Schofield posted 1 patch 2 years, 9 months ago
drivers/staging/emxx_udc/emxx_udc.c | 6 +++---
1 file changed, 3 insertions(+), 3 deletions(-)
[PATCH] staging: emxx_udc: Remove unneeded parentheses
Posted by Jack Schofield 2 years, 9 months ago
Parentheses are not required around condition tests. Remove to follow
Linux Kernel coding style. Issue reported by checkpatch.

Signed-off-by: Jack Schofield <schofija@oregonstate.edu>
---
There are more instances of extra parens to cleanup. If this patch is
welcome I can continue to cleanup this file.

 drivers/staging/emxx_udc/emxx_udc.c | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
index b4e19174bef2..1d4ac8374fe2 100644
--- a/drivers/staging/emxx_udc/emxx_udc.c
+++ b/drivers/staging/emxx_udc/emxx_udc.c
@@ -149,8 +149,8 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req)
 			/* SET_FEATURE */
 			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)) {
+			if (recipient == USB_RECIP_DEVICE &&
+			    selector == USB_DEVICE_TEST_MODE) {
 				wIndex = le16_to_cpu(p_ctrl->wIndex);
 				test_mode = (u32)(wIndex >> 8);
 				_nbu2ss_set_test_mode(udc, test_mode);
@@ -287,7 +287,7 @@ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)
 	u32		num;
 	u32		data;
 
-	if ((ep->epnum == 0) || (udc->vbus_active == 0))
+	if (ep->epnum == 0 || udc->vbus_active == 0)
 		return	-EINVAL;
 
 	num = ep->epnum - 1;
-- 
2.25.1
Re: [PATCH] staging: emxx_udc: Remove unneeded parentheses
Posted by Greg Kroah-Hartman 2 years, 9 months ago
On Sun, Nov 27, 2022 at 08:40:12PM -0800, Jack Schofield wrote:
> Parentheses are not required around condition tests. Remove to follow
> Linux Kernel coding style. Issue reported by checkpatch.
> 
> Signed-off-by: Jack Schofield <schofija@oregonstate.edu>
> ---
> There are more instances of extra parens to cleanup. If this patch is
> welcome I can continue to cleanup this file.
> 
>  drivers/staging/emxx_udc/emxx_udc.c | 6 +++---
>  1 file changed, 3 insertions(+), 3 deletions(-)
> 
> diff --git a/drivers/staging/emxx_udc/emxx_udc.c b/drivers/staging/emxx_udc/emxx_udc.c
> index b4e19174bef2..1d4ac8374fe2 100644
> --- a/drivers/staging/emxx_udc/emxx_udc.c
> +++ b/drivers/staging/emxx_udc/emxx_udc.c
> @@ -149,8 +149,8 @@ static void _nbu2ss_ep0_complete(struct usb_ep *_ep, struct usb_request *_req)
>  			/* SET_FEATURE */
>  			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)) {
> +			if (recipient == USB_RECIP_DEVICE &&
> +			    selector == USB_DEVICE_TEST_MODE) {
>  				wIndex = le16_to_cpu(p_ctrl->wIndex);
>  				test_mode = (u32)(wIndex >> 8);
>  				_nbu2ss_set_test_mode(udc, test_mode);
> @@ -287,7 +287,7 @@ static int _nbu2ss_epn_exit(struct nbu2ss_udc *udc, struct nbu2ss_ep *ep)
>  	u32		num;
>  	u32		data;
>  
> -	if ((ep->epnum == 0) || (udc->vbus_active == 0))
> +	if (ep->epnum == 0 || udc->vbus_active == 0)

This type of change requires you to remember the == comes before || so
it's best to just leave the code as-is to make it much more obvious
what is happening.

sorry,

greg k-h