From 1ba0395a18c02dfbdc66f8b0f5fa930353b26705 Mon Sep 17 00:00:00 2001 From: Nicolas Boichat Date: Fri, 11 Aug 2017 11:58:56 +0800 Subject: [PATCH] usb_api.h: Stub usb_wake if CONFIG_USB_REMOTE_WAKEUP is not defined Removes clutter in callers, so that they do not have to wrap usb_wake calls around ifdefs. BRANCH=none BUG=none TEST=make buildall -j Change-Id: I8641cb7aff702920aaa119e644dc812d5c3e774b Signed-off-by: Nicolas Boichat Reviewed-on: https://chromium-review.googlesource.com/612220 Reviewed-by: Vincent Palatin --- chip/stm32/usb_hid_keyboard.c | 2 -- chip/stm32/usb_hid_touchpad.c | 2 -- include/usb_api.h | 8 ++++++-- 3 files changed, 6 insertions(+), 6 deletions(-) diff --git a/chip/stm32/usb_hid_keyboard.c b/chip/stm32/usb_hid_keyboard.c index 48cf0c470b..a78d2f7bda 100644 --- a/chip/stm32/usb_hid_keyboard.c +++ b/chip/stm32/usb_hid_keyboard.c @@ -211,10 +211,8 @@ static void write_keyboard_report(void) EP_TX_VALID, 0); } -#ifdef CONFIG_USB_REMOTE_WAKEUP /* Wake up host, if required. */ usb_wake(); -#endif } static void hid_keyboard_tx(void) diff --git a/chip/stm32/usb_hid_touchpad.c b/chip/stm32/usb_hid_touchpad.c index 879baffa4f..a780a0a110 100644 --- a/chip/stm32/usb_hid_touchpad.c +++ b/chip/stm32/usb_hid_touchpad.c @@ -179,10 +179,8 @@ void set_touchpad_report(struct usb_hid_touchpad_report *report) /* enable TX */ STM32_TOGGLE_EP(USB_EP_HID_TOUCHPAD, EP_TX_MASK, EP_TX_VALID, 0); -#ifdef CONFIG_USB_REMOTE_WAKEUP /* Wake up host, if required. */ usb_wake(); -#endif } static void hid_touchpad_tx(void) diff --git a/include/usb_api.h b/include/usb_api.h index 4803890504..6a08916031 100644 --- a/include/usb_api.h +++ b/include/usb_api.h @@ -49,12 +49,16 @@ void usb_release(void); int usb_is_suspended(void); /* - * Tell the host to wake up. Requires CONFIG_USB_REMOTE_WAKEUP to be defined, - * and a chip that implements the function. + * Tell the host to wake up. Does nothing if CONFIG_USB_REMOTE_WAKEUP is not + * defined. * * Returns immediately, suspend status can be checked using usb_is_suspended. */ +#ifdef CONFIG_USB_REMOTE_WAKEUP void usb_wake(void); +#else +static inline void usb_wake(void) {} +#endif /* Board-specific USB wake, for side-band wake, called by usb_wake above. */ void board_usb_wake(void);