[PATCH] usb: gadget: Use put_unaligned_le16() from asm/unaligned.h

Ahmad Fatoum a.fatoum at pengutronix.de
Tue Apr 14 01:38:36 PDT 2026



On 4/13/26 9:51 PM, Sascha Hauer wrote:
> usbstring.c has its own put_unaligned_le16() function instead of using
> the existing one from asm/unaligned.h. This was never a problem, but
> since 87d3ae4bee ("filetype: fix unaligned access for x86_linux_bootimage")
> the conflicting definition from asm/unaligned.h leaks in which results
> in a failed build. Drop the duplicate function and explicitly include
> the correct definition.
> 
> Signed-off-by: Sascha Hauer <s.hauer at pengutronix.de>

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

> ---
>  drivers/usb/gadget/usbstring.c | 7 +------
>  1 file changed, 1 insertion(+), 6 deletions(-)
> 
> diff --git a/drivers/usb/gadget/usbstring.c b/drivers/usb/gadget/usbstring.c
> index 58eb28ad1a..209a3d01d8 100644
> --- a/drivers/usb/gadget/usbstring.c
> +++ b/drivers/usb/gadget/usbstring.c
> @@ -8,12 +8,7 @@
>  
>  #include <linux/usb/ch9.h>
>  #include <linux/usb/gadget.h>
> -
> -static inline void put_unaligned_le16(u16 val, u8 *p)
> -{
> -	*p++ = val;
> -	*p++ = val >> 8;
> -}
> +#include <asm/unaligned.h>
>  
>  static int utf8_to_utf16le(const char *s, __le16 *cp, unsigned len)
>  {

-- 
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