[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <063D6719AE5E284EB5DD2968C1650D6D1CB71091@AcuExch.aculab.com>
Date: Fri, 31 Jul 2015 15:51:52 +0000
From: David Laight <David.Laight@...LAB.COM>
To: 'Robert Baldyga' <r.baldyga@...sung.com>,
"balbi@...com" <balbi@...com>
CC: "nicolas.ferre@...el.com" <nicolas.ferre@...el.com>,
"robert.jarzmik@...e.fr" <robert.jarzmik@...e.fr>,
"m.szyprowski@...sung.com" <m.szyprowski@...sung.com>,
"devel@...verdev.osuosl.org" <devel@...verdev.osuosl.org>,
"cernekee@...il.com" <cernekee@...il.com>,
"michal.simek@...inx.com" <michal.simek@...inx.com>,
"stern@...land.harvard.edu" <stern@...land.harvard.edu>,
"Peter.Chen@...escale.com" <Peter.Chen@...escale.com>,
"dahlmann.thomas@...or.de" <dahlmann.thomas@...or.de>,
"johnyoun@...opsys.com" <johnyoun@...opsys.com>,
"linux-geode@...ts.infradead.org" <linux-geode@...ts.infradead.org>,
"haojian.zhuang@...il.com" <haojian.zhuang@...il.com>,
"andrzej.p@...sung.com" <andrzej.p@...sung.com>,
"linux-omap@...r.kernel.org" <linux-omap@...r.kernel.org>,
"petr.cvek@....cz" <petr.cvek@....cz>,
"linux-arm-kernel@...ts.infradead.org"
<linux-arm-kernel@...ts.infradead.org>,
"gregkh@...uxfoundation.org" <gregkh@...uxfoundation.org>,
"linux-usb@...r.kernel.org" <linux-usb@...r.kernel.org>,
"linux-kernel@...r.kernel.org" <linux-kernel@...r.kernel.org>,
"linuxppc-dev@...ts.ozlabs.org" <linuxppc-dev@...ts.ozlabs.org>,
"daniel@...que.org" <daniel@...que.org>
Subject: RE: [PATCH v5 02/46] usb: gadget: add endpoint capabilities flags
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 <r.baldyga@...sung.com>
> ---
> 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
Powered by blists - more mailing lists