usb: add usb_endpoint_maxp() macro
authorkuninori.morimoto.gx@renesas.com <kuninori.morimoto.gx@renesas.com>
Mon, 25 Jul 2011 07:39:30 +0000 (00:39 -0700)
committerGreg Kroah-Hartman <gregkh@suse.de>
Mon, 22 Aug 2011 22:54:38 +0000 (15:54 -0700)
Signed-off-by: Kuninori Morimoto <kuninori.morimoto.gx@renesas.com>
Signed-off-by: Greg Kroah-Hartman <gregkh@suse.de>
include/linux/usb/ch9.h

index 0fd3fbdd8283fe1004698ed22f8860eb3abecec9..e809deabf5031f533ff33cbfd7f918bde2426b2a 100644 (file)
@@ -34,6 +34,7 @@
 #define __LINUX_USB_CH9_H
 
 #include <linux/types.h>       /* __u8 etc */
+#include <asm/byteorder.h>     /* le16_to_cpu */
 
 /*-------------------------------------------------------------------------*/
 
@@ -570,6 +571,17 @@ static inline int usb_endpoint_is_isoc_out(
        return usb_endpoint_xfer_isoc(epd) && usb_endpoint_dir_out(epd);
 }
 
+/**
+ * usb_endpoint_maxp - get endpoint's max packet size
+ * @epd: endpoint to be checked
+ *
+ * Returns @epd's max packet
+ */
+static inline int usb_endpoint_maxp(const struct usb_endpoint_descriptor *epd)
+{
+       return le16_to_cpu(epd->wMaxPacketSize);
+}
+
 /*-------------------------------------------------------------------------*/
 
 /* USB_DT_SS_ENDPOINT_COMP: SuperSpeed Endpoint Companion descriptor */