diff options
| author | Mika Westerberg <[email protected]> | 2017-10-02 13:38:33 +0300 |
|---|---|---|
| committer | David S. Miller <[email protected]> | 2017-10-02 11:24:41 -0700 |
| commit | e69b71f8458b78a2ef44e3d07374a8f46e45123d (patch) | |
| tree | f9d0ed77163f829cc1824478f4beda9446254492 /include/linux | |
| parent | 9e99b9f4d5c36340dabda6d14053195b2a43796b (diff) | |
thunderbolt: Move tb_switch_phy_port_from_link() to thunderbolt.h
A Thunderbolt service might need to find the physical port from a link
the cable is connected to. For instance networking driver uses this
information to generate MAC address according the Apple ThunderboltIP
protocol.
Move this function to thunderbolt.h and rename it to
tb_phy_port_from_link() to reflect the fact that it does not take switch
as parameter.
Signed-off-by: Mika Westerberg <[email protected]>
Reviewed-by: Michael Jamet <[email protected]>
Reviewed-by: Yehezkel Bernat <[email protected]>
Reviewed-by: Andy Shevchenko <[email protected]>
Signed-off-by: David S. Miller <[email protected]>
Diffstat (limited to 'include/linux')
| -rw-r--r-- | include/linux/thunderbolt.h | 7 |
1 files changed, 7 insertions, 0 deletions
diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h index 910b1bf92112..43b8d1e09341 100644 --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h @@ -78,6 +78,13 @@ struct tb { extern struct bus_type tb_bus_type; +#define TB_LINKS_PER_PHY_PORT 2 + +static inline unsigned int tb_phy_port_from_link(unsigned int link) +{ + return (link - 1) / TB_LINKS_PER_PHY_PORT; +} + /** * struct tb_property_dir - XDomain property directory * @uuid: Directory UUID or %NULL if root directory |