Skip to contentSkip to conversation

media: usb: remove duplicate & operation

PATCH In review Jaejoong Kim 2 participants 5 messages Oct 20, 2017 – Nov 7, 2017

Subsystems (2)
lore
Share & tools
lore
#0 lore raw

cover media: usb: remove duplicate & operation

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.

Jaejoong Kim (2):
media: usb: uvc: remove duplicate & operation
media: usb: usbtv: remove duplicate & operation

 drivers/media/usb/usbtv/usbtv-core.c | 2 +-
 drivers/media/usb/uvc/uvc_video.c    | 4 ++--
 2 files changed, 3 insertions(+), 3 deletions(-)
Signature · 1 line
2.7.4
#1 lore raw

PATCH 1/2 media: usb: uvc: remove duplicate & operation

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.

---
 drivers/media/usb/uvc/uvc_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_video.c +2 -2
index fb86d6a..f4ace63 100644
@@ -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;
 	}
 }
 
Signature · 1 line
2.7.4
#4 lore raw

PATCH 2/2 media: usb: usbtv: remove duplicate & operation

In reply to Jaejoong Kim

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.

---
 drivers/media/usb/usbtv/usbtv-core.c | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)
drivers/media/usb/usbtv/usbtv-core.c +1 -1
index ceb953b..a95a468 100644
@@ -84,7 +84,7 @@ static int usbtv_probe(struct usb_interface *intf,
 	/* Packet size is split into 11 bits of base size and count of
 	 * extra multiplies of it.*/
 	size = usb_endpoint_maxp(&ep->desc);
-	size = (size & 0x07ff) * usb_endpoint_maxp_mult(&ep->desc);
+	size = size * usb_endpoint_maxp_mult(&ep->desc);
 
 	/* Device structure */
 	usbtv = kzalloc(sizeof(struct usbtv), GFP_KERNEL);
Signature · 1 line
2.7.4
#2 lore raw

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

In reply to Jaejoong Kim

Hi, Laurent

Could you please review this patch?

Thanks, jaejoong

2017-10-20 16:25 GMT+09:00 Jaejoong Kim <[email protected]>:

Quoted 32 lines

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.

---
 drivers/media/usb/uvc/uvc_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
drivers/media/usb/uvc/uvc_video.c +2 -3
index fb86d6a..f4ace63 100644
@@ -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

maintainer Reviewed-by on v1 1/2
#3 lore raw

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

In reply to Jaejoong Kim

Hello Jaejoong,

Thank you for the patch.

Quoted 5 lines · 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.

and applied to my tree.

Quoted 23 lines
---
 drivers/media/usb/uvc/uvc_video.c | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)
(quoted diff) +0 -0

b/drivers/media/usb/uvc/uvc_video.c index fb86d6a..f4ace63 100644

drivers/media/usb/uvc/uvc_video.c +0 -0
@@ -1469,13 +1469,13 @@ static unsigned int uvc_endpoint_max_bpi(struct

usb_device *dev, case USB_SPEED_HIGH:

drivers/media/usb/uvc/uvc_video.c +2 -2
 		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;
 	}
 }
Signature · 3 lines
Regards,

Laurent Pinchart