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 <mika.westerberg@linux.intel.com> Reviewed-by: Michael Jamet <michael.jamet@intel.com> Reviewed-by: Yehezkel Bernat <yehezkel.bernat@intel.com> Reviewed-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com> Signed-off-by: David S. Miller <davem@davemloft.net>
This commit is contained in:

committed by
David S. Miller

parent
9e99b9f4d5
commit
e69b71f845
@@ -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
|
||||
|
Reference in New Issue
Block a user