]> git.baikalelectronics.ru Git - kernel.git/commit
usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus
authorJack Pham <jackp@codeaurora.org>
Fri, 31 Jan 2020 03:10:35 +0000 (19:10 -0800)
committerFelipe Balbi <balbi@kernel.org>
Tue, 11 Feb 2020 06:45:45 +0000 (08:45 +0200)
commit4c01b12b92ab22ad1268a7c44af4bfbd27a274ad
treef35b42b2db5a606330f8ccbb9f7d56c1bbd21e87
parentc273c6786d1fa1c87f7a1f993cf94b037b0cdaf6
usb: gadget: composite: Fix bMaxPower for SuperSpeedPlus

SuperSpeedPlus peripherals must report their bMaxPower of the
configuration descriptor in units of 8mA as per the USB 3.2
specification. The current switch statement in encode_bMaxPower()
only checks for USB_SPEED_SUPER but not USB_SPEED_SUPER_PLUS so
the latter falls back to USB 2.0 encoding which uses 2mA units.
Replace the switch with a simple if/else.

Fixes: 2eef73473325 ("usb: gadget: composite: Write SuperSpeedPlus config descriptors")
Signed-off-by: Jack Pham <jackp@codeaurora.org>
Signed-off-by: Felipe Balbi <balbi@kernel.org>
drivers/usb/gadget/composite.c