Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753664AbbGaOBt (ORCPT ); Fri, 31 Jul 2015 10:01:49 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:40891 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753628AbbGaOBp (ORCPT ); Fri, 31 Jul 2015 10:01:45 -0400 X-AuditID: cbfee61a-f79a06d000005c6f-12-55bb7fc314f4 From: Robert Baldyga To: balbi@ti.com Cc: gregkh@linuxfoundation.org, Peter.Chen@freescale.com, johnyoun@synopsys.com, dahlmann.thomas@arcor.de, nicolas.ferre@atmel.com, cernekee@gmail.com, leoli@freescale.com, daniel@zonque.org, haojian.zhuang@gmail.com, robert.jarzmik@free.fr, michal.simek@xilinx.com, devel@driverdev.osuosl.org, linux-kernel@vger.kernel.org, linux-usb@vger.kernel.org, linux-omap@vger.kernel.org, linux-geode@lists.infradead.org, linux-arm-kernel@lists.infradead.org, linuxppc-dev@lists.ozlabs.org, andrzej.p@samsung.com, m.szyprowski@samsung.com, stern@rowland.harvard.edu, petr.cvek@tul.cz, Robert Baldyga Subject: [PATCH v5 03/46] usb: gadget: add endpoint capabilities helper macros Date: Fri, 31 Jul 2015 16:00:15 +0200 Message-id: <1438351258-31578-4-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1438351258-31578-1-git-send-email-r.baldyga@samsung.com> References: <1438351258-31578-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAAzWRa0hTYQCG/Xa+nXM2HJyOZh/mBRaVVN5A8CMiirJOEBLEqETIqSe1tjk2 XS4ILTVTSQcaeMlLOYu8reYip5noTKnlBRWVcJukSFpEKOVlKTmlf8/L+8D746UJtgb602mq DF6jkiukpBjat+aYUFt2lyyidyYEVy0WQNzrysbd9Q6AC102At/fXIL43ecNCuc2mEg82haN u+xjAG/Mstg8NynEpcN2iMc7n5C42lgK8bPn+QR2r24JcWu/g8I/F6/iP+O5FB6o3hTguoeP hXjWZqVw1Q8fbHCPkqcQVzb/WsDVb7yBnPO9DXKlbStCbstWKuCsVQ6K66lpobh2YzY3UvEU cNWONcCVWJoAZ+lZAdzg9FsBV/nyEcmtmIO47hU3vLQnTnwimVek6XhN+MkEcerm3zqgNnpn fXV1EzmgUFwERDRiolDFoFO4y35o1Gkii4CYZplGgO4ZlondsA6Qddoq8FgkcwxZVg3Aw74M g0zfxiiPRDBrEA3VFm8HmvZhYlFHY6zHgcxBVDXSQ3hYwsSgkoZ2sLsWhD4OlO0si5hz6Ldp iPIwu+30D3wiDEBSD7yaAOLVSWptYooyUsXfDtPKldpMVUpYUrrSDHZOW/DvAL2d5/sAQwOp t4Rp6JSxQrlOq1f2AUQTUl+J61CXjJUky/V3eE36dU2mgtf2gf00lO6TBL5ql7FMijyDv8Xz al7zvxXQIv8cUKPYCxfOOJZy/aIf9FyDV0RfjAHFBy6CbLJF6N0amK+cv1Dzobh8eELSp1+u nEhl3Xk3hiYT6442lyui4kMKRQ5zHpy+nLg+ZQoKd8SwusyC5sOkMyG+5Gww9GqNOn7TIot4 kaWPKzldHKybGgn9bli7O7z0SxIw47Sv18qkUJsqjzxCaLTyf5PIx0GwAgAA Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Length: 1774 Lines: 48 Add macros useful while initializing array of endpoint capabilities structures. These macros makes structure initialization more compact to decrease number of code lines and increase readability of code. Signed-off-by: Robert Baldyga --- include/linux/usb/gadget.h | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h index a9a4959..82b5bcb 100644 --- a/include/linux/usb/gadget.h +++ b/include/linux/usb/gadget.h @@ -158,6 +158,26 @@ struct usb_ep_caps { unsigned dir_out:1; }; +#define USB_EP_CAPS_TYPE_CONTROL 0x01 +#define USB_EP_CAPS_TYPE_ISO 0x02 +#define USB_EP_CAPS_TYPE_BULK 0x04 +#define USB_EP_CAPS_TYPE_INT 0x08 +#define USB_EP_CAPS_TYPE_ALL \ + (USB_EP_CAPS_TYPE_ISO | USB_EP_CAPS_TYPE_BULK | USB_EP_CAPS_TYPE_INT) +#define USB_EP_CAPS_DIR_IN 0x01 +#define USB_EP_CAPS_DIR_OUT 0x02 +#define USB_EP_CAPS_DIR_ALL (USB_EP_CAPS_DIR_IN | USB_EP_CAPS_DIR_OUT) + +#define USB_EP_CAPS(_type, _dir) \ + { \ + .type_control = !!(_type & USB_EP_CAPS_TYPE_CONTROL), \ + .type_iso = !!(_type & USB_EP_CAPS_TYPE_ISO), \ + .type_bulk = !!(_type & USB_EP_CAPS_TYPE_BULK), \ + .type_int = !!(_type & USB_EP_CAPS_TYPE_INT), \ + .dir_in = !!(_dir & USB_EP_CAPS_DIR_IN), \ + .dir_out = !!(_dir & USB_EP_CAPS_DIR_OUT), \ + } + /** * struct usb_ep - device side representation of USB endpoint * @name:identifier for the endpoint, such as "ep-a" or "ep9in-bulk" -- 1.9.1 -- To unsubscribe from this list: send the line "unsubscribe linux-kernel" in the body of a message to majordomo@vger.kernel.org More majordomo info at http://vger.kernel.org/majordomo-info.html Please read the FAQ at http://www.tux.org/lkml/