From: Tilman Sauerbeck Date: Mon, 8 Jul 2019 19:04:37 +0000 (+0200) Subject: common: USB_VcomDeinit() always shuts down the singleton CDC device. X-Git-Url: http://git.code-monkey.de/?a=commitdiff_plain;h=de363e44939a3a3738da4fa32717baebb04f6338;p=gps-watch.git common: USB_VcomDeinit() always shuts down the singleton CDC device. This removes the function's argument. --- diff --git a/src/common/virtual_com.c b/src/common/virtual_com.c index aa25cd7..9b40b50 100644 --- a/src/common/virtual_com.c +++ b/src/common/virtual_com.c @@ -660,10 +660,14 @@ USB_VcomInit (uint16_t vid, uint16_t pid) } /* See virtual_com.h for documentation of this function. */ -void USB_VcomDeinit(usb_device_handle deviceHandle) +void +USB_VcomDeinit (void) { - USB_DeviceStop(deviceHandle); - USB_DeviceDeinit(deviceHandle); + if (s_cdcVcom.deviceHandle == NULL) + return; + + USB_DeviceStop (s_cdcVcom.deviceHandle); + USB_DeviceDeinit (s_cdcVcom.deviceHandle); s_cdcVcom.deviceHandle = NULL; /* XXX: We are not stopping the USBOTG clock yet. */ diff --git a/src/common/virtual_com.h b/src/common/virtual_com.h index c8e5f02..84acdfa 100644 --- a/src/common/virtual_com.h +++ b/src/common/virtual_com.h @@ -134,6 +134,6 @@ usb_device_handle USB_VcomInit (uint16_t vid, uint16_t pid); * * @return pointer to USB device handle. */ -void USB_VcomDeinit(usb_device_handle deviceHandle); +void USB_VcomDeinit (void); #endif /* _USB_CDC_VCOM_H_ */