On Mon, Jan 27, 2014 at 08:58:15AM +0800, Peter Chen wrote:
> - delete the warning message at interrupt handler, and adds judgement at
> ep_enable, if non-ep0 requests ctrl transfer, it will indicate an error.
> - delete hw_test_and_clear_setup_status which is a broken code
> - Tested with g_mass_storage, g_ncm, g_ether
> 
> Cc: matthieu.cas...@parrot.com
> Reported-by: Michael Grzeschik <m...@pengutronix.de>
> Signed-off-by: Peter Chen <peter.c...@freescale.com>
> ---
>  drivers/usb/chipidea/udc.c |   28 ++++++++--------------------
>  1 files changed, 8 insertions(+), 20 deletions(-)
> 
> diff --git a/drivers/usb/chipidea/udc.c b/drivers/usb/chipidea/udc.c
> index 0a61c66..0dc56ae 100644
> --- a/drivers/usb/chipidea/udc.c
> +++ b/drivers/usb/chipidea/udc.c
> @@ -178,19 +178,6 @@ static int hw_ep_get_halt(struct ci_hdrc *ci, int num, 
> int dir)
>  }
>  
>  /**
> - * hw_test_and_clear_setup_status: test & clear setup status (execute without
> - *                                 interruption)
> - * @n: endpoint number
> - *
> - * This function returns setup status
> - */
> -static int hw_test_and_clear_setup_status(struct ci_hdrc *ci, int n)
> -{
> -     n = ep_to_bit(ci, n);
> -     return hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(n));
> -}
> -
> -/**
>   * hw_ep_prime: primes endpoint (execute without interruption)
>   * @num:     endpoint number
>   * @dir:     endpoint direction
> @@ -997,14 +984,10 @@ __acquires(ci->lock)
>                       }
>               }
>  
> -             if (hwep->type != USB_ENDPOINT_XFER_CONTROL ||
> -                 !hw_test_and_clear_setup_status(ci, i))
> -                     continue;
> -
> -             if (i != 0) {
> -                     dev_warn(ci->dev, "ctrl traffic at endpoint %d\n", i);
> +             /* Only handle setup packet below */
> +             if (i != 0 ||
> +                     !hw_test_and_clear(ci, OP_ENDPTSETUPSTAT, BIT(0)))
>                       continue;
> -             }
>  
>               /*
>                * Flush data and handshake transactions of previous
> @@ -1193,6 +1176,11 @@ static int ep_enable(struct usb_ep *ep,
>  
>       hwep->qh.ptr->td.next |= cpu_to_le32(TD_TERMINATE);   /* needed? */
>  
> +     if (hwep->num != 0 && hwep->type == USB_ENDPOINT_XFER_CONTROL) {
> +             dev_err(hwep->ci->dev, "Set control xfer at non-ep0\n");
> +             retval = -EINVAL;
> +     }
> +
>       /*
>        * Enable endpoints in the HW other than ep0 as ep0
>        * is always enabled
> -- 
> 1.7.8

Acked-by: Michael Grzeschik <m...@pengutronix.de>
Tested-by: Michael Grzeschik <m...@pengutronix.de>

-- 
Pengutronix e.K.                           |                             |
Industrial Linux Solutions                 | http://www.pengutronix.de/  |
Peiner Str. 6-8, 31137 Hildesheim, Germany | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686           | Fax:   +49-5121-206917-5555 |
--
To unsubscribe from this list: send the line "unsubscribe linux-usb" in
the body of a message to majord...@vger.kernel.org
More majordomo info at  http://vger.kernel.org/majordomo-info.html

Reply via email to