diff options
author | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-14 14:19:44 +0000 |
---|---|---|
committer | Aidan MacDonald <amachronic@protonmail.com> | 2021-11-14 17:58:39 +0000 |
commit | 6e61e6f0c882ae4f6797b6a8c3ae92bb41e82893 (patch) | |
tree | 1e18aa8f968fb4ce7e1bc9e8f85f91958bd40972 /firmware/usbstack/usb_core.c | |
parent | f8810be6decfabce76d2fc64940dc4ef442c0f9f (diff) | |
download | rockbox-6e61e6f0c882ae4f6797b6a8c3ae92bb41e82893.tar.gz rockbox-6e61e6f0c882ae4f6797b6a8c3ae92bb41e82893.zip |
usb_core: don't buffer control request unnecessarily
Due to how the old control request API worked, the request
pointer (and the pointed-to contents) passed by the driver
must remain valid for the lifetime of the request.
The buffered copy wasn't used consistently anyway, so it
should be safe to just get rid of it.
(This only affects the old API compatibility layer.)
Change-Id: I00294c718a7515a91b84f7c7cae5220c73aa5960
Diffstat (limited to 'firmware/usbstack/usb_core.c')
-rw-r--r-- | firmware/usbstack/usb_core.c | 4 |
1 files changed, 1 insertions, 3 deletions
diff --git a/firmware/usbstack/usb_core.c b/firmware/usbstack/usb_core.c index 8e32e3501f..63df173033 100644 --- a/firmware/usbstack/usb_core.c +++ b/firmware/usbstack/usb_core.c | |||
@@ -264,7 +264,6 @@ static struct usb_class_driver drivers[USB_NUM_DRIVERS] = | |||
264 | }; | 264 | }; |
265 | 265 | ||
266 | #ifdef USB_LEGACY_CONTROL_API | 266 | #ifdef USB_LEGACY_CONTROL_API |
267 | static struct usb_ctrlrequest active_request_buf; | ||
268 | static struct usb_ctrlrequest* volatile active_request = NULL; | 267 | static struct usb_ctrlrequest* volatile active_request = NULL; |
269 | static void* volatile control_write_data = NULL; | 268 | static void* volatile control_write_data = NULL; |
270 | static volatile bool control_write_data_done = false; | 269 | static volatile bool control_write_data_done = false; |
@@ -1020,8 +1019,7 @@ void usb_core_control_complete(int status) | |||
1020 | /* Only needed if the driver does not support the new API yet */ | 1019 | /* Only needed if the driver does not support the new API yet */ |
1021 | void usb_core_legacy_control_request(struct usb_ctrlrequest* req) | 1020 | void usb_core_legacy_control_request(struct usb_ctrlrequest* req) |
1022 | { | 1021 | { |
1023 | memcpy(&active_request_buf, req, sizeof(*req)); | 1022 | active_request = req; |
1024 | active_request = &active_request_buf; | ||
1025 | control_write_data = NULL; | 1023 | control_write_data = NULL; |
1026 | control_write_data_done = false; | 1024 | control_write_data_done = false; |
1027 | 1025 | ||