[PATCH v2 2/5] usb: core: make usb_set_maxpacket_ep public

Ahmad Fatoum a.fatoum at pengutronix.de
Wed Aug 19 02:15:14 PDT 2026


On 8/17/26 10:47 AM, Fabian Pflug wrote:
> The function will be used by the efi usb driver to set the maxpackets
> per endpoint.
> 
> Signed-off-by: Fabian Pflug <f.pflug at pengutronix.de>

Reviewed-by: Ahmad Fatoum <a.fatoum at pengutronix.de>

> ---
>  drivers/usb/core/usb.c | 12 ++----------
>  drivers/usb/core/usb.h |  2 ++
>  2 files changed, 4 insertions(+), 10 deletions(-)
> 
> diff --git a/drivers/usb/core/usb.c b/drivers/usb/core/usb.c
> index ae87137447..ce10b71f40 100644
> --- a/drivers/usb/core/usb.c
> +++ b/drivers/usb/core/usb.c
> @@ -127,16 +127,8 @@ static int usb_set_configuration(struct usb_device *dev, int configuration)
>  		return res;
>  }
>  
> -/* The routine usb_set_maxpacket_ep() is extracted from the loop of routine
> - * usb_set_maxpacket(), because the optimizer of GCC 4.x chokes on this routine
> - * when it is inlined in 1 single routine. What happens is that the register r3
> - * is used as loop-count 'i', but gets overwritten later on.
> - * This is clearly a compiler bug, but it is easier to workaround it here than
> - * to update the compiler (Occurs with at least several GCC 4.{1,2},x
> - * CodeSourcery compilers like e.g. 2007q3, 2008q1, 2008q3 lite editions on ARM)
> - */
> -static void  noinline
> -usb_set_maxpacket_ep(struct usb_device *dev, struct usb_endpoint_descriptor *ep)
> +void usb_set_maxpacket_ep(struct usb_device *dev,
> +			  struct usb_endpoint_descriptor *ep)
>  {
>  	int b;
>  
> diff --git a/drivers/usb/core/usb.h b/drivers/usb/core/usb.h
> index 0d4f80c21d..b503e5b4a8 100644
> --- a/drivers/usb/core/usb.h
> +++ b/drivers/usb/core/usb.h
> @@ -6,5 +6,7 @@ struct usb_device *usb_alloc_new_device(void);
>  void usb_free_device(struct usb_device *dev);
>  int usb_new_device(struct usb_device *dev);
>  void usb_remove_device(struct usb_device *dev);
> +void usb_set_maxpacket_ep(struct usb_device *dev,
> +			  struct usb_endpoint_descriptor *ep);
>  
>  #endif /* __CORE_USB_H */
> 

-- 
Pengutronix e.K.                  |                             |
Steuerwalder Str. 21              | http://www.pengutronix.de/  |
31137 Hildesheim, Germany         | Phone: +49-5121-206917-0    |
Amtsgericht Hildesheim, HRA 2686  | Fax:   +49-5121-206917-5555 |




More information about the barebox mailing list