From patchwork Mon Jul 27 09:16:13 2015 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Robert Baldyga X-Patchwork-Id: 6871251 Return-Path: X-Original-To: patchwork-linux-omap@patchwork.kernel.org Delivered-To: patchwork-parsemail@patchwork1.web.kernel.org Received: from mail.kernel.org (mail.kernel.org [198.145.29.136]) by patchwork1.web.kernel.org (Postfix) with ESMTP id 56E9D9F46B for ; Mon, 27 Jul 2015 09:34:37 +0000 (UTC) Received: from mail.kernel.org (localhost [127.0.0.1]) by mail.kernel.org (Postfix) with ESMTP id 8616420685 for ; Mon, 27 Jul 2015 09:34:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DF6692066F for ; Mon, 27 Jul 2015 09:34:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753317AbbG0JRr (ORCPT ); Mon, 27 Jul 2015 05:17:47 -0400 Received: from mailout4.samsung.com ([203.254.224.34]:33338 "EHLO mailout4.samsung.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1752566AbbG0JRp (ORCPT ); Mon, 27 Jul 2015 05:17:45 -0400 Received: from epcpsbgm2new.samsung.com (epcpsbgm2 [203.254.230.27]) by mailout4.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTP id <0NS500BZI35EHPC0@mailout4.samsung.com>; Mon, 27 Jul 2015 18:17:38 +0900 (KST) X-AuditID: cbfee61b-f79706d000001b96-c1-55b5f7323413 Received: from epmmp1.local.host ( [203.254.227.16]) by epcpsbgm2new.samsung.com (EPCPMTA) with SMTP id 30.CC.07062.237F5B55; Mon, 27 Jul 2015 18:17:38 +0900 (KST) Received: from AMDC2122.DIGITAL.local ([106.120.53.17]) by mmp1.samsung.com (Oracle Communications Messaging Server 7.0.5.31.0 64bit (built May 5 2014)) with ESMTPA id <0NS500L1Z34BGGA0@mmp1.samsung.com>; Mon, 27 Jul 2015 18:17:38 +0900 (KST) 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 v4 03/46] usb: gadget: add endpoint capabilities helper macros Date: Mon, 27 Jul 2015 11:16:13 +0200 Message-id: <1437988616-6962-4-git-send-email-r.baldyga@samsung.com> X-Mailer: git-send-email 1.9.1 In-reply-to: <1437988616-6962-1-git-send-email-r.baldyga@samsung.com> References: <1437988616-6962-1-git-send-email-r.baldyga@samsung.com> X-Brightmail-Tracker: H4sIAAAAAAAAA+NgFprDIsWRmVeSWpSXmKPExsVy+t9jAV2j71tDDc5/1bSY9bKdxeLg/XqL vQvuMlp03j/MbNH09xWLxZ4zv9gtmhevZ7O4sM7cYvfpS4wWvx4IWWx6fI3Vov/caRaLy7vm sFnMXtLPYrFoWSuzxe/v/1gt1h65y27x7mWExbfLzewWx2b/ZbKY3zGV1eLB4Z3sFrPeCFtM +H2BzUHCY/KTjUweC35tZfG4t+8wi0f/us+sHv8O9zN57Jx1l91j/9w17B6bl9R7nJ+xkNFj 9t0fjB59W1YxemzZ/5nR4/iN7UweM1f2snl83iTnsffzb5YAwSgum5TUnMyy1CJ9uwSujA37 uQqW8FQsvLWLtYGxk6uLkZNDQsBEon1WOxOELSZx4d56ti5GLg4hgaWMEo03jzBDOD8ZJT48 +MwKUsUmoCOx5fsERhBbREBAYv2LS+wgRcwCP1gkzs7rZgdJCAv4SVx89Y4NxGYRUJU43d4H ZvMKuEhsfX+BEWKdnMTJY5PBhnIKuEosmbYV6AwOoG0uEkeua01g5F3AyLCKUSK1ILmgOCk9 1ygvtVyvODG3uDQvXS85P3cTIzjOnknvYDy8y/0QowAHoxIP7wWVraFCrIllxZW5hxglOJiV RHgfRwGFeFMSK6tSi/Lji0pzUosPMUpzsCiJ8+qbbAoVEkhPLEnNTk0tSC2CyTJxcEo1MO6z /t6p+vjGBuXFX/3WTeBuKyxhvLm2Rmb55E7/vEmNmkfu3dTJd6oX8sjMs3SddWOT3IbDP2zZ GZ/VNn5M1eKq5DNw5fg06/VP47dmUV+rHycmuClcvbVydmsyQ1Nw+T2pCynu3drvjBsfRDk+ VDGoSldcmPIuPFf6SFrnBsu/3ZmqpX2blFiKMxINtZiLihMBD8u74q8CAAA= Sender: linux-omap-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-omap@vger.kernel.org X-Spam-Status: No, score=-8.2 required=5.0 tests=BAYES_00, RCVD_IN_DNSWL_HI, RP_MATCHES_RCVD, UNPARSEABLE_RELAY autolearn=unavailable version=3.3.1 X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on mail.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP 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 2e85b86..c71b1de 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"