• [PATCH v3 06/19] thunderbolt: Move tb_switch_phy_port_from_link() to th

    From Mika Westerberg@21:1/5 to All on Mon Oct 2 12:50:02 2017
    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>
    ---
    drivers/thunderbolt/icm.c | 2 +-
    drivers/thunderbolt/tb.h | 7 -------
    include/linux/thunderbolt.h | 7 +++++++
    3 files changed, 8 insertions(+), 8 deletions(-)

    diff --git a/drivers/thunderbolt/icm.c b/drivers/thunderbolt/icm.c
    index 53250fc057e1..8c22b91ed040 100644
    --- a/drivers/thunderbolt/icm.c
    +++ b/drivers/thunderbolt/icm.c
    @@ -89,7 +89,7 @@ static inline struct tb *icm_to_tb(struct icm *icm)

    static inline u8 phy_port_from_route(u64 route, u8 depth)
    {
    - return tb_switch_phy_port_from_link(route >> ((depth - 1) * 8));
    + return tb_phy_port_from_link(route >> ((depth - 1) * 8));
    }

    static inline u8 dual_link_from_link(u8 link)
    diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h
    index 2fefe76621ca..ea21d927bd09 100644
    --- a/drivers/thunderbolt/tb.h
    +++ b/drivers/thunderbolt/tb.h
    @@ -40,8 +40,6 @@ struct tb_switch_nvm {
    };

    #define TB_SWITCH_KEY_SIZE 32
    -/* Each physical port contains 2 links on modern controllers */
    -#define TB_SWITCH_LINKS_PER_PH