* [PATCH] USB: fsl_udc_core: Use (&) instead of (==) to compare ISO XFER
@ 2011-11-22 1:15 Peter Chen
2011-11-22 1:22 ` Michal Nazarewicz
0 siblings, 1 reply; 4+ messages in thread
From: Peter Chen @ 2011-11-22 1:15 UTC (permalink / raw)
To: leoli, balbi; +Cc: gregkh, linuxppc-dev, linux-usb, stable
Some ISO gadgets, like audio, has SYNC attribute as well as
USB_ENDPOINT_XFER_ISOC for their bmAttributes at ISO endpoint
descriptor. So, it needs to use & instead of == to judge if
it is ISO XFER.
Signed-off-by: Peter Chen <peter.chen@freescale.com>
---
drivers/usb/gadget/fsl_udc_core.c | 4 ++--
1 files changed, 2 insertions(+), 2 deletions(-)
diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fsl_udc_core.c
index d786ba3..bf40de3 100644
--- a/drivers/usb/gadget/fsl_udc_core.c
+++ b/drivers/usb/gadget/fsl_udc_core.c
@@ -877,7 +877,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
VDBG("%s, bad ep", __func__);
return -EINVAL;
}
- if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
+ if (ep->desc->bmAttributes & USB_ENDPOINT_XFER_ISOC) {
if (req->req.length > ep->ep.maxpacket)
return -EMSGSIZE;
}
@@ -1032,7 +1032,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, int value)
goto out;
}
- if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
+ if (ep->desc->bmAttributes & USB_ENDPOINT_XFER_ISOC) {
status = -EOPNOTSUPP;
goto out;
}
--
1.6.3.3
^ permalink raw reply related [flat|nested] 4+ messages in thread
* Re: [PATCH] USB: fsl_udc_core: Use (&) instead of (==) to compare ISO XFER
2011-11-22 1:15 [PATCH] USB: fsl_udc_core: Use (&) instead of (==) to compare ISO XFER Peter Chen
@ 2011-11-22 1:22 ` Michal Nazarewicz
2011-11-22 1:26 ` Michal Nazarewicz
0 siblings, 1 reply; 4+ messages in thread
From: Michal Nazarewicz @ 2011-11-22 1:22 UTC (permalink / raw)
To: leoli, balbi, Peter Chen; +Cc: gregkh, linuxppc-dev, linux-usb, stable
On Tue, 22 Nov 2011 02:15:21 +0100, Peter Chen <peter.chen@freescale.com=
> wrote:
> Some ISO gadgets, like audio, has SYNC attribute as well as
> USB_ENDPOINT_XFER_ISOC for their bmAttributes at ISO endpoint
> descriptor. So, it needs to use & instead of =3D=3D to judge if
> it is ISO XFER.
>
> Signed-off-by: Peter Chen <peter.chen@freescale.com>
> ---
> drivers/usb/gadget/fsl_udc_core.c | 4 ++--
> 1 files changed, 2 insertions(+), 2 deletions(-)
>
> diff --git a/drivers/usb/gadget/fsl_udc_core.c b/drivers/usb/gadget/fs=
l_udc_core.c
> index d786ba3..bf40de3 100644
> --- a/drivers/usb/gadget/fsl_udc_core.c
> +++ b/drivers/usb/gadget/fsl_udc_core.c
> @@ -877,7 +877,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_reques=
t *_req, gfp_t gfp_flags)
> VDBG("%s, bad ep", __func__);
> return -EINVAL;
> }
> - if (ep->desc->bmAttributes =3D=3D USB_ENDPOINT_XFER_ISOC) {
> + if (ep->desc->bmAttributes & USB_ENDPOINT_XFER_ISOC) {
What you really meant is:
(ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) =3D=3D USB_ENDPOIN=
T_XFER_ISOC
It would probably be useful to create a function that performs that chec=
k rather
than having to type all of that every time.
> if (req->req.length > ep->ep.maxpacket)
> return -EMSGSIZE;
> }
> @@ -1032,7 +1032,7 @@ static int fsl_ep_set_halt(struct usb_ep *_ep, i=
nt value)
> goto out;
> }
>- if (ep->desc->bmAttributes =3D=3D USB_ENDPOINT_XFER_ISOC) {
> + if (ep->desc->bmAttributes & USB_ENDPOINT_XFER_ISOC) {
> status =3D -EOPNOTSUPP;
> goto out;
> }
-- =
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=3D./ `o
..o | Computer Science, Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz=
(o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] USB: fsl_udc_core: Use (&) instead of (==) to compare ISO XFER
2011-11-22 1:22 ` Michal Nazarewicz
@ 2011-11-22 1:26 ` Michal Nazarewicz
2011-11-24 9:37 ` Felipe Balbi
0 siblings, 1 reply; 4+ messages in thread
From: Michal Nazarewicz @ 2011-11-22 1:26 UTC (permalink / raw)
To: leoli, balbi, Peter Chen; +Cc: gregkh, linuxppc-dev, linux-usb, stable
> On Tue, 22 Nov 2011 02:15:21 +0100, Peter Chen <peter.chen@freescale.c=
om> wrote:
>> @@ -877,7 +877,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_reque=
st *_req, gfp_t gfp_flags)
>> VDBG("%s, bad ep", __func__);
>> return -EINVAL;
>> }
>> - if (ep->desc->bmAttributes =3D=3D USB_ENDPOINT_XFER_ISOC) {
>> + if (ep->desc->bmAttributes & USB_ENDPOINT_XFER_ISOC) {
On Tue, 22 Nov 2011 02:22:10 +0100, Michal Nazarewicz <mina86@mina86.com=
> wrote:
> What you really meant is:
>
> (ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) =3D=3D USB_ENDPO=
INT_XFER_ISOC
>
> It would probably be useful to create a function that performs that ch=
eck rather
> than having to type all of that every time.
Ah, there it is:
usb_endpoint_xfer_isoc(ep)
:)
>
>> if (req->req.length > ep->ep.maxpacket)
>> return -EMSGSIZE;
>> }
-- =
Best regards, _ _
.o. | Liege of Serenely Enlightened Majesty of o' \,=3D./ `o
..o | Computer Science, Micha=C5=82 =E2=80=9Cmina86=E2=80=9D Nazarewicz=
(o o)
ooo +----<email/xmpp: mpn@google.com>--------------ooO--(_)--Ooo--
^ permalink raw reply [flat|nested] 4+ messages in thread
* Re: [PATCH] USB: fsl_udc_core: Use (&) instead of (==) to compare ISO XFER
2011-11-22 1:26 ` Michal Nazarewicz
@ 2011-11-24 9:37 ` Felipe Balbi
0 siblings, 0 replies; 4+ messages in thread
From: Felipe Balbi @ 2011-11-24 9:37 UTC (permalink / raw)
To: Michal Nazarewicz
Cc: gregkh, linux-usb, balbi, Peter Chen, linuxppc-dev, stable
[-- Attachment #1: Type: text/plain, Size: 900 bytes --]
On Tue, Nov 22, 2011 at 02:26:24AM +0100, Michal Nazarewicz wrote:
> >On Tue, 22 Nov 2011 02:15:21 +0100, Peter Chen <peter.chen@freescale.com> wrote:
> >>@@ -877,7 +877,7 @@ fsl_ep_queue(struct usb_ep *_ep, struct usb_request *_req, gfp_t gfp_flags)
> >> VDBG("%s, bad ep", __func__);
> >> return -EINVAL;
> >> }
> >>- if (ep->desc->bmAttributes == USB_ENDPOINT_XFER_ISOC) {
> >>+ if (ep->desc->bmAttributes & USB_ENDPOINT_XFER_ISOC) {
>
> On Tue, 22 Nov 2011 02:22:10 +0100, Michal Nazarewicz <mina86@mina86.com> wrote:
> >What you really meant is:
> >
> >(ep->desc->bmAttributes & USB_ENDPOINT_XFERTYPE_MASK) == USB_ENDPOINT_XFER_ISOC
> >
> >It would probably be useful to create a function that performs that check rather
> >than having to type all of that every time.
>
> Ah, there it is:
>
> usb_endpoint_xfer_isoc(ep)
yeah, please use the helpers.
--
balbi
[-- Attachment #2: Digital signature --]
[-- Type: application/pgp-signature, Size: 836 bytes --]
^ permalink raw reply [flat|nested] 4+ messages in thread
end of thread, other threads:[~2011-11-24 9:37 UTC | newest]
Thread overview: 4+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2011-11-22 1:15 [PATCH] USB: fsl_udc_core: Use (&) instead of (==) to compare ISO XFER Peter Chen
2011-11-22 1:22 ` Michal Nazarewicz
2011-11-22 1:26 ` Michal Nazarewicz
2011-11-24 9:37 ` Felipe Balbi
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).