diff options
author | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-16 14:22:53 +0300 |
---|---|---|
committer | Linus Torvalds <torvalds@linux-foundation.org> | 2022-12-16 14:22:53 +0300 |
commit | 58bcac11fd94f950abc7b8466c5ceac7be07a00e (patch) | |
tree | 69ccedd64b1aab0f387d303376593bc2c1aa7032 /tools | |
parent | 84e57d292203a45c96dbcb2e6be9dd80961d981a (diff) | |
parent | 81c25247a2a03a0f97e4805d7aff7541ccff6baa (diff) | |
download | linux-58bcac11fd94f950abc7b8466c5ceac7be07a00e.tar.xz |
Merge tag 'usb-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb
Pull USB and Thunderbolt driver updates from Greg KH:
"Here is the large set of USB and Thunderbolt driver changes for
6.2-rc1. Overall, thanks to the removal of a driver, more lines were
removed than added, a nice change. Highlights include:
- removal of the sisusbvga driver that was not used by anyone anymore
- minor thunderbolt driver changes and tweaks
- chipidea driver updates
- usual set of typec driver features and hardware support added
- musb minor driver fixes
- fotg210 driver fixes, bringing that hardware back from the "dead"
- minor dwc3 driver updates
- addition, and then removal, of a list.h helper function for many
USB and other subsystem drivers, that ended up breaking the build.
That will come back for 6.3-rc1, it missed this merge window.
- usual xhci updates and enhancements
- usb-serial driver updates and support for new devices
- other minor USB driver updates
All of these have been in linux-next for a while with no reported
problems"
* tag 'usb-6.2-rc1' of git://git.kernel.org/pub/scm/linux/kernel/git/gregkh/usb: (153 commits)
usb: gadget: uvc: Rename bmInterfaceFlags -> bmInterlaceFlags
usb: dwc2: power on/off phy for peripheral mode in dual-role mode
usb: dwc2: disable lpm feature on Rockchip SoCs
dt-bindings: usb: mtk-xhci: add support for mt7986
usb: dwc3: core: defer probe on ulpi_read_id timeout
usb: ulpi: defer ulpi_register on ulpi_read_id timeout
usb: misc: onboard_usb_hub: add Genesys Logic GL850G hub support
dt-bindings: usb: Add binding for Genesys Logic GL850G hub controller
dt-bindings: vendor-prefixes: add Genesys Logic
usb: fotg210-udc: fix potential memory leak in fotg210_udc_probe()
usb: typec: tipd: Set mode of operation for USB Type-C connector
usb: gadget: udc: drop obsolete dependencies on COMPILE_TEST
usb: musb: remove extra check in musb_gadget_vbus_draw
usb: gadget: uvc: Prevent buffer overflow in setup handler
usb: dwc3: qcom: Fix memory leak in dwc3_qcom_interconnect_init
usb: typec: wusb3801: fix fwnode refcount leak in wusb3801_probe()
usb: storage: Add check for kcalloc
USB: sisusbvga: use module_usb_driver()
USB: sisusbvga: rename sisusb.c to sisusbvga.c
USB: sisusbvga: remove console support
...
Diffstat (limited to 'tools')
-rw-r--r-- | tools/usb/ffs-aio-example/simple/device_app/aio_simple.c | 44 |
1 files changed, 31 insertions, 13 deletions
diff --git a/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c b/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c index 1f44a29818bf..96616eb4600b 100644 --- a/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c +++ b/tools/usb/ffs-aio-example/simple/device_app/aio_simple.c @@ -25,7 +25,9 @@ * For more information, please refer to <http://unlicense.org/> */ -#define _BSD_SOURCE /* for endian.h */ +/* $(CROSS_COMPILE)cc -g -o aio_simple aio_simple.c -laio */ + +#define _DEFAULT_SOURCE /* for endian.h */ #include <endian.h> #include <errno.h> @@ -49,6 +51,22 @@ #define BUF_LEN 8192 +/* + * cpu_to_le16/32 are used when initializing structures, a context where a + * function call is not allowed. To solve this, we code cpu_to_le16/32 in a way + * that allows them to be used when initializing structures. + */ + +#if BYTE_ORDER == __LITTLE_ENDIAN +#define cpu_to_le16(x) (x) +#define cpu_to_le32(x) (x) +#else +#define cpu_to_le16(x) ((((x) >> 8) & 0xffu) | (((x) & 0xffu) << 8)) +#define cpu_to_le32(x) \ + ((((x) & 0xff000000u) >> 24) | (((x) & 0x00ff0000u) >> 8) | \ + (((x) & 0x0000ff00u) << 8) | (((x) & 0x000000ffu) << 24)) +#endif + /******************** Descriptors and Strings *******************************/ static const struct { @@ -62,12 +80,12 @@ static const struct { } __attribute__ ((__packed__)) fs_descs, hs_descs; } __attribute__ ((__packed__)) descriptors = { .header = { - .magic = htole32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2), - .flags = htole32(FUNCTIONFS_HAS_FS_DESC | + .magic = cpu_to_le32(FUNCTIONFS_DESCRIPTORS_MAGIC_V2), + .flags = cpu_to_le32(FUNCTIONFS_HAS_FS_DESC | FUNCTIONFS_HAS_HS_DESC), - .length = htole32(sizeof(descriptors)), + .length = cpu_to_le32(sizeof(descriptors)), }, - .fs_count = htole32(3), + .fs_count = cpu_to_le32(3), .fs_descs = { .intf = { .bLength = sizeof(descriptors.fs_descs.intf), @@ -89,7 +107,7 @@ static const struct { .bmAttributes = USB_ENDPOINT_XFER_BULK, }, }, - .hs_count = htole32(3), + .hs_count = cpu_to_le32(3), .hs_descs = { .intf = { .bLength = sizeof(descriptors.hs_descs.intf), @@ -103,14 +121,14 @@ static const struct { .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 1 | USB_DIR_IN, .bmAttributes = USB_ENDPOINT_XFER_BULK, - .wMaxPacketSize = htole16(512), + .wMaxPacketSize = cpu_to_le16(512), }, .bulk_source = { .bLength = sizeof(descriptors.hs_descs.bulk_source), .bDescriptorType = USB_DT_ENDPOINT, .bEndpointAddress = 2 | USB_DIR_OUT, .bmAttributes = USB_ENDPOINT_XFER_BULK, - .wMaxPacketSize = htole16(512), + .wMaxPacketSize = cpu_to_le16(512), }, }, }; @@ -125,13 +143,13 @@ static const struct { } __attribute__ ((__packed__)) lang0; } __attribute__ ((__packed__)) strings = { .header = { - .magic = htole32(FUNCTIONFS_STRINGS_MAGIC), - .length = htole32(sizeof(strings)), - .str_count = htole32(1), - .lang_count = htole32(1), + .magic = cpu_to_le32(FUNCTIONFS_STRINGS_MAGIC), + .length = cpu_to_le32(sizeof(strings)), + .str_count = cpu_to_le32(1), + .lang_count = cpu_to_le32(1), }, .lang0 = { - htole16(0x0409), /* en-us */ + cpu_to_le16(0x0409), /* en-us */ STR_INTERFACE, }, }; |