usb: gadget: uvc: configfs: Sort frame intervals upon writing
authorPaul Elder <paul.elder@ideasonboard.com>
Sun, 2 Sep 2018 23:46:03 +0000 (19:46 -0400)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 20 Nov 2019 17:47:20 +0000 (18:47 +0100)
commit4e6c6562409058eb8f1f0a6d098fd16b57cca241
tree7d33beff8aa47339dccda1f02286cc5a951fae01
parentd036103870c6d6d069e4a751716650ef4b40783e
usb: gadget: uvc: configfs: Sort frame intervals upon writing

[ Upstream commit 89969a842e72b1b653140a4bbddd927b242736d0 ]

There is an issue where the host is unable to tell the gadget what frame
rate it wants if the dwFrameIntervals in the interface descriptors are
not in ascending order. This means that when instantiating a uvc gadget
via configfs the user must make sure the dwFrameIntervals are in
ascending order.

Instead of silently failing the breaking of this rule, we sort the
dwFrameIntervals upon writing to configfs.

Signed-off-by: Paul Elder <paul.elder@ideasonboard.com>
Reviewed-by: Laurent Pinchart <laurent.pinchart@ideasonboard.com>
Signed-off-by: Sasha Levin <sashal@kernel.org>
drivers/usb/gadget/function/uvc_configfs.c