USB: core: add helpers to retrieve endpoints
authorJohan Hovold <johan@kernel.org>
Fri, 17 Mar 2017 10:35:30 +0000 (11:35 +0100)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Thu, 23 Mar 2017 12:53:16 +0000 (13:53 +0100)
commit66a359390e7e34f9a4c489467234b107b3d76169
treee42bc277535cf39ea5f9249a1508f81f08e22d00
parent96cfcc9c461ca0a45ec223120984e1ae852f867e
USB: core: add helpers to retrieve endpoints

Many USB drivers iterate over the available endpoints to find required
endpoints of a specific type and direction. Typically the endpoints are
required for proper function and a missing endpoint should abort probe.

To facilitate code reuse, add a helper to retrieve common endpoints
(bulk or interrupt, in or out) and four wrappers to find a single
endpoint.

Note that the helpers are marked as __must_check to serve as a reminder
to always verify that all expected endpoints are indeed present. This
also means that any optional endpoints, typically need to be looked up
through separate calls.

Signed-off-by: Johan Hovold <johan@kernel.org>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/usb/core/usb.c
include/linux/usb.h