usb: Add mutex to usb_enable

The purpose of this commit is to prevent user from
calling usb_enable() twice from different contexes.

If for example user configures composite device with hid
and USB uart console (CONFIG_USB_UART_CONSOLE=y)
then introduced mutex will prevent from calling
usb_enable twice and thus lead to undefined behaviour of
usb driver controller.

usb_enable shall always be called once as it refers to usb driver
and for now only one USB driver instance is supported in Zephyr.
This mechanism ensures that.

Signed-off-by: Emil Obalski <emil.obalski@nordicsemi.no>
1 file changed