diff options
author | Heikki Krogerus <heikki.krogerus@linux.intel.com> | 2021-04-07 09:55:54 +0300 |
---|---|---|
committer | Greg Kroah-Hartman <gregkh@linuxfoundation.org> | 2021-04-09 16:00:00 +0200 |
commit | b433c4c789d612cf58739a772bbddbd949bafd20 (patch) | |
tree | 6c500a26a62578af2a5d65064680f142d2dc788b /include/linux/usb.h | |
parent | 63cd78617350dae99cc5fbd8f643b83ee819fe33 (diff) |
usb: Iterator for ports
Introducing usb_for_each_port(). It works the same way as
usb_for_each_dev(), but instead of going through every USB
device in the system, it walks through the USB ports in the
system.
Acked-by: Alan Stern <stern@rowland.harvard.edu>
Signed-off-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Link: https://lore.kernel.org/r/20210407065555.88110-4-heikki.krogerus@linux.intel.com
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
Diffstat (limited to 'include/linux/usb.h')
-rw-r--r-- | include/linux/usb.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/linux/usb.h b/include/linux/usb.h index ddd2f5b2a282..eaae24217e8a 100644 --- a/include/linux/usb.h +++ b/include/linux/usb.h @@ -882,6 +882,15 @@ extern struct usb_host_interface *usb_find_alt_setting( unsigned int iface_num, unsigned int alt_num); +#if IS_REACHABLE(CONFIG_USB) +int usb_for_each_port(void *data, int (*fn)(struct device *, void *)); +#else +static inline int usb_for_each_port(void *data, int (*fn)(struct device *, void *)) +{ + return 0; +} +#endif + /* port claiming functions */ int usb_hub_claim_port(struct usb_device *hdev, unsigned port1, struct usb_dev_state *owner); |