1
0
mirror of https://bitbucket.org/librepilot/librepilot.git synced 2025-01-17 02:52:12 +01:00

usbhook: make ctrl endpoint OUT treat request as const

The req parameter is passed to the OUT stage as a convenience.
Since the OUT callback is called *after* the transfer has occurred,
modifying the req would have absolutely no effect.  Marking this
as const makes this expectation clear.
This commit is contained in:
Stacey Sheldon 2013-02-11 08:11:12 -05:00 committed by Alessio Morale
parent 590feefd9b
commit 02addaf4a0
2 changed files with 3 additions and 3 deletions

View File

@ -55,7 +55,7 @@ struct pios_usb_ifops {
void (*init)(uint32_t context);
void (*deinit)(uint32_t context);
bool (*setup)(uint32_t context, struct usb_setup_request * req);
void (*ctrl_data_out)(uint32_t context, struct usb_setup_request * req);
void (*ctrl_data_out)(uint32_t context, const struct usb_setup_request * req);
};
extern void PIOS_USBHOOK_RegisterIfOps(uint8_t ifnum, struct pios_usb_ifops * ifops, uint32_t context);

View File

@ -114,7 +114,7 @@ static struct pios_usb_hid_dev * PIOS_USB_HID_alloc(void)
static void PIOS_USB_HID_IF_Init(uint32_t usb_hid_id);
static void PIOS_USB_HID_IF_DeInit(uint32_t usb_hid_id);
static bool PIOS_USB_HID_IF_Setup(uint32_t usb_hid_id, struct usb_setup_request *req);
static void PIOS_USB_HID_IF_CtrlDataOut(uint32_t usb_hid_id, struct usb_setup_request *req);
static void PIOS_USB_HID_IF_CtrlDataOut(uint32_t usb_hid_id, const struct usb_setup_request *req);
static struct pios_usb_ifops usb_hid_ifops = {
.init = PIOS_USB_HID_IF_Init,
@ -425,7 +425,7 @@ static bool PIOS_USB_HID_IF_Setup(uint32_t usb_hid_id, struct usb_setup_request
return true;
}
static void PIOS_USB_HID_IF_CtrlDataOut(__attribute__((unused)) uint32_t usb_hid_id, __attribute__((unused)) struct usb_setup_request *req)
static void PIOS_USB_HID_IF_CtrlDataOut(__attribute__((unused)) uint32_t usb_hid_id, __attribute__((unused)) const struct usb_setup_request *req)
{
/* HID devices don't have any OUT data stages on the control endpoint */
PIOS_Assert(0);