Return-Path: Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1753403AbbGaPyw (ORCPT ); Fri, 31 Jul 2015 11:54:52 -0400 Received: from smtp-out4.electric.net ([192.162.216.182]:53366 "EHLO smtp-out4.electric.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1753280AbbGaPyq (ORCPT ); Fri, 31 Jul 2015 11:54:46 -0400 X-Greylist: delayed 726 seconds by postgrey-1.27 at vger.kernel.org; Fri, 31 Jul 2015 11:54:45 EDT From: David Laight To: "'Robert Baldyga'" , "balbi@ti.com" CC: "nicolas.ferre@atmel.com" , "robert.jarzmik@free.fr" , "m.szyprowski@samsung.com" , "devel@driverdev.osuosl.org" , "cernekee@gmail.com" , "michal.simek@xilinx.com" , "stern@rowland.harvard.edu" , "Peter.Chen@freescale.com" , "dahlmann.thomas@arcor.de" , "johnyoun@synopsys.com" , "linux-geode@lists.infradead.org" , "haojian.zhuang@gmail.com" , "andrzej.p@samsung.com" , "linux-omap@vger.kernel.org" , "petr.cvek@tul.cz" , "linux-arm-kernel@lists.infradead.org" , "gregkh@linuxfoundation.org" , "linux-usb@vger.kernel.org" , "linux-kernel@vger.kernel.org" , "linuxppc-dev@lists.ozlabs.org" , "daniel@zonque.org" Subject: RE: [PATCH v5 02/46] usb: gadget: add endpoint capabilities flags Thread-Topic: [PATCH v5 02/46] usb: gadget: add endpoint capabilities flags Thread-Index: AQHQy5mlf1Y3sIOXhUWcQYq44O8Xj531uSxg Date: Fri, 31 Jul 2015 15:51:52 +0000 Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB71091@AcuExch.aculab.com> References: <1438351258-31578-1-git-send-email-r.baldyga@samsung.com> <1438351258-31578-3-git-send-email-r.baldyga@samsung.com> In-Reply-To: <1438351258-31578-3-git-send-email-r.baldyga@samsung.com> Accept-Language: en-GB, en-US Content-Language: en-US X-MS-Has-Attach: X-MS-TNEF-Correlator: x-originating-ip: [10.202.99.200] Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 X-Outbound-IP: 213.249.233.130 X-Env-From: David.Laight@ACULAB.COM X-PolicySMART: 3396946, 3397078 Sender: linux-kernel-owner@vger.kernel.org List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Content-Transfer-Encoding: 8bit X-MIME-Autoconverted: from base64 to 8bit by mail.home.local id t6VFsuoj011079 Content-Length: 1656 Lines: 51 From: Robert Baldyga > Sent: 31 July 2015 15:00 > Introduce struct usb_ep_caps which contains information about capabilities > of usb endpoints - supported transfer types and directions. This structure > should be filled by UDC driver for each of its endpoints, and will be > used in epautoconf in new ep matching mechanism which will replace ugly > guessing of endpoint capabilities basing on its name. > > Signed-off-by: Robert Baldyga > --- > include/linux/usb/gadget.h | 21 +++++++++++++++++++++ > 1 file changed, 21 insertions(+) > > diff --git a/include/linux/usb/gadget.h b/include/linux/usb/gadget.h > index 68fb5e8..a9a4959 100644 > --- a/include/linux/usb/gadget.h > +++ b/include/linux/usb/gadget.h > @@ -141,10 +141,29 @@ struct usb_ep_ops { > }; ... > +struct usb_ep_caps { > + unsigned type_control:1; > + unsigned type_iso:1; > + unsigned type_bulk:1; > + unsigned type_int:1; > + unsigned dir_in:1; > + unsigned dir_out:1; > +}; With the way this is used (eg below from 13/46) + + if (i == 0) { + ep->ep.caps.type_control = true; + } else { + ep->ep.caps.type_iso = true; + ep->ep.caps.type_bulk = true; + ep->ep.caps.type_int = true; + } + + ep->ep.caps.dir_in = true; + ep->ep.caps.dir_out = true; I think it would be more obvious if you used a u8 and explicit bitmasks. The initialisation (as above) would the be explicitly assigning 'not supported' to the other fields. The compiler will also generate much better code... David ????{.n?+???????+%?????ݶ??w??{.n?+????{??G?????{ay?ʇڙ?,j??f???h?????????z_??(?階?ݢj"???m??????G????????????&???~???iO???z??v?^?m???? ????????I?