• Bhupesh Sharma's avatar
    tools: usb: ffs-aio-example: Fix build error with aarch64-*-gnu-gcc toolchain(s) · c5edb757
    Bhupesh Sharma authored
    
    
    The tools/usb/aio_simple.c file when cross-compiled with
    aarch64-*-gnu-gcc toolchain(s) leads to the following errors:
    
      aio_simple.c:30:10: fatal error: endian.h: No such file or directory
      30 | #include <endian.h>
          |          ^~~~~~~~~~
    
      aio_simple.c:88:14: note: (near initialization for
                          'descriptors.fs_count')
      aio_simple.c:110:14: error: initializer element is not constant
      110 |  .hs_count = htole32(3),
          |              ^~~~~~~
      aio_simple.c:110:14: note: (near initialization for
                          'descriptors.hs_count')
      aio_simple.c:124:22: error: initializer element is not constant
      124 |    .wMaxPacketSize = htole16(512),
          |                      ^~~~~~~
      aio_simple.c:124:22: note: (near initialization for
                           'descriptors.hs_descs.bulk_sink.wMaxPacketSize')
    
    Fix these compilation issues by:
     - Switching to _DEFAULT_SOURCE:
        _BSD_SOURCE is deprecated and gives a build warning. Let's use
        _DEFAULT_SOURCE instead.
     - Currently this file uses library htole16/32 function calls.
       Replace these with equivalent 'cpu_to_le16/32' calls.
    
    Cc: Felipe Balbi <balbi@kernel.org>
    Cc: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
    Signed-off-by: default avatarBhupesh Sharma <bhupesh.sharma@linaro.org>
    Link: https://lore.kernel.org/r/20221029161312.171165-1-bhupesh.sharma@linaro.org
    
    Signed-off-by: default avatarGreg Kroah-Hartman <gregkh@linuxfoundation.org>
    c5edb757
aio_simple.c 9.54 KB