diff mbox

[1/2] media: usb: uvc: remove duplicate & operation

Message ID 1508484328-11018-2-git-send-email-climbbb.kim@gmail.com (mailing list archive)
State New, archived
Headers show

Commit Message

Jaejoong Kim Oct. 20, 2017, 7:25 a.m. UTC
usb_endpoint_maxp() has an inline keyword and searches for bits[10:0]
by & operation with 0x7ff. So, we can remove the duplicate & operation
with 0x7ff.

Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
---
 drivers/media/usb/uvc/uvc_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

Comments

Jaejoong Kim Nov. 6, 2017, 2:07 a.m. UTC | #1
Hi, Laurent

Could you please review this patch?

Thanks, jaejoong

2017-10-20 16:25 GMT+09:00 Jaejoong Kim <climbbb.kim@gmail.com>:
> usb_endpoint_maxp() has an inline keyword and searches for bits[10:0]
> by & operation with 0x7ff. So, we can remove the duplicate & operation
> with 0x7ff.
>
> Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>
> ---
>  drivers/media/usb/uvc/uvc_video.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
> index fb86d6a..f4ace63 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1469,13 +1469,13 @@ static unsigned int uvc_endpoint_max_bpi(struct usb_device *dev,
>         case USB_SPEED_HIGH:
>                 psize = usb_endpoint_maxp(&ep->desc);
>                 mult = usb_endpoint_maxp_mult(&ep->desc);
> -               return (psize & 0x07ff) * mult;
> +               return psize * mult;
>         case USB_SPEED_WIRELESS:
>                 psize = usb_endpoint_maxp(&ep->desc);
>                 return psize;
>         default:
>                 psize = usb_endpoint_maxp(&ep->desc);
> -               return psize & 0x07ff;
> +               return psize;
>         }
>  }
>
> --
> 2.7.4
>
Laurent Pinchart Nov. 7, 2017, 11:36 a.m. UTC | #2
Hello Jaejoong,

Thank you for the patch.

On Friday, 20 October 2017 10:25:27 EET Jaejoong Kim wrote:
> usb_endpoint_maxp() has an inline keyword and searches for bits[10:0]
> by & operation with 0x7ff. So, we can remove the duplicate & operation
> with 0x7ff.
> 
> Signed-off-by: Jaejoong Kim <climbbb.kim@gmail.com>

Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>

and applied to my tree.

> ---
>  drivers/media/usb/uvc/uvc_video.c | 4 ++--
>  1 file changed, 2 insertions(+), 2 deletions(-)
> 
> diff --git a/drivers/media/usb/uvc/uvc_video.c
> b/drivers/media/usb/uvc/uvc_video.c index fb86d6a..f4ace63 100644
> --- a/drivers/media/usb/uvc/uvc_video.c
> +++ b/drivers/media/usb/uvc/uvc_video.c
> @@ -1469,13 +1469,13 @@ static unsigned int uvc_endpoint_max_bpi(struct
> usb_device *dev, case USB_SPEED_HIGH:
>  		psize = usb_endpoint_maxp(&ep->desc);
>  		mult = usb_endpoint_maxp_mult(&ep->desc);
> -		return (psize & 0x07ff) * mult;
> +		return psize * mult;
>  	case USB_SPEED_WIRELESS:
>  		psize = usb_endpoint_maxp(&ep->desc);
>  		return psize;
>  	default:
>  		psize = usb_endpoint_maxp(&ep->desc);
> -		return psize & 0x07ff;
> +		return psize;
>  	}
>  }
diff mbox

Patch

diff --git a/drivers/media/usb/uvc/uvc_video.c b/drivers/media/usb/uvc/uvc_video.c
index fb86d6a..f4ace63 100644
--- a/drivers/media/usb/uvc/uvc_video.c
+++ b/drivers/media/usb/uvc/uvc_video.c
@@ -1469,13 +1469,13 @@  static unsigned int uvc_endpoint_max_bpi(struct usb_device *dev,
 	case USB_SPEED_HIGH:
 		psize = usb_endpoint_maxp(&ep->desc);
 		mult = usb_endpoint_maxp_mult(&ep->desc);
-		return (psize & 0x07ff) * mult;
+		return psize * mult;
 	case USB_SPEED_WIRELESS:
 		psize = usb_endpoint_maxp(&ep->desc);
 		return psize;
 	default:
 		psize = usb_endpoint_maxp(&ep->desc);
-		return psize & 0x07ff;
+		return psize;
 	}
 }