Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

thunderbolt: Expose usb4_port_index() to other modules

Make usb4_port_index() available to other files in the driver, rename
and add function documentation.

Signed-off-by: Alan Borzeszkowski <alan.borzeszkowski@linux.intel.com>
Reviewed-by: Heikki Krogerus <heikki.krogerus@linux.intel.com>
Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>

authored by

Alan Borzeszkowski and committed by
Mika Westerberg
f93b5e24 1a760d10

+12 -3
+1
drivers/thunderbolt/tb.h
··· 1468 1468 struct usb4_port *usb4_port_device_add(struct tb_port *port); 1469 1469 void usb4_port_device_remove(struct usb4_port *usb4); 1470 1470 int usb4_port_device_resume(struct usb4_port *usb4); 1471 + int usb4_port_index(const struct tb_switch *sw, const struct tb_port *port); 1471 1472 1472 1473 static inline bool usb4_port_device_is_offline(const struct usb4_port *usb4) 1473 1474 {
+11 -3
drivers/thunderbolt/usb4.c
··· 935 935 return status ? -EIO : 0; 936 936 } 937 937 938 - static int usb4_port_idx(const struct tb_switch *sw, const struct tb_port *port) 938 + /** 939 + * usb4_port_index() - Finds matching USB4 port index 940 + * @sw: USB4 router 941 + * @port: USB4 protocol or lane adapter 942 + * 943 + * Finds matching USB4 port index (starting from %0) that given @port goes 944 + * through. 945 + */ 946 + int usb4_port_index(const struct tb_switch *sw, const struct tb_port *port) 939 947 { 940 948 struct tb_port *p; 941 949 int usb4_idx = 0; ··· 977 969 struct tb_port *usb4_switch_map_pcie_down(struct tb_switch *sw, 978 970 const struct tb_port *port) 979 971 { 980 - int usb4_idx = usb4_port_idx(sw, port); 972 + int usb4_idx = usb4_port_index(sw, port); 981 973 struct tb_port *p; 982 974 int pcie_idx = 0; 983 975 ··· 1008 1000 struct tb_port *usb4_switch_map_usb3_down(struct tb_switch *sw, 1009 1001 const struct tb_port *port) 1010 1002 { 1011 - int usb4_idx = usb4_port_idx(sw, port); 1003 + int usb4_idx = usb4_port_index(sw, port); 1012 1004 struct tb_port *p; 1013 1005 int usb_idx = 0; 1014 1006