From a3cfebdc1b3ab379646f61f095102f7d2b8f6f31 Mon Sep 17 00:00:00 2001 From: Mika Westerberg Date: Sat, 25 Jul 2020 10:32:46 +0300 Subject: thunderbolt: Introduce tb_port_is_nhi() This is useful if one needs to check if adapter (port) is the host interface (NHI). Make tb_port_alloc_hopid() take advantage of this. Signed-off-by: Mika Westerberg Reviewed-by: Greg Kroah-Hartman --- drivers/thunderbolt/tb.h | 5 +++++ 1 file changed, 5 insertions(+) (limited to 'drivers/thunderbolt/tb.h') diff --git a/drivers/thunderbolt/tb.h b/drivers/thunderbolt/tb.h index a1d5de53a349..6aee18b4f53d 100644 --- a/drivers/thunderbolt/tb.h +++ b/drivers/thunderbolt/tb.h @@ -464,6 +464,11 @@ static inline bool tb_port_is_null(const struct tb_port *port) return port && port->port && port->config.type == TB_TYPE_PORT; } +static inline bool tb_port_is_nhi(const struct tb_port *port) +{ + return port && port->config.type == TB_TYPE_NHI; +} + static inline bool tb_port_is_pcie_down(const struct tb_port *port) { return port && port->config.type == TB_TYPE_PCIE_DOWN; -- cgit v1.2.3