From 484cb153fe5ffcd0b7cf423cf29aaeadd0e862b1 Mon Sep 17 00:00:00 2001 From: Radion Mirchevsky Date: Wed, 4 Oct 2017 14:53:54 +0300 Subject: thunderbolt: Add tb_xdomain_find_by_route() This is needed by the new ICM interface to find xdomains by route string instead of link and depth. While there update existing tb_xdomain_find_* functions to use tb_xdomain_get() instead of open-coding the same. Signed-off-by: Radion Mirchevsky Signed-off-by: Mika Westerberg Reviewed-by: Andy Shevchenko --- include/linux/thunderbolt.h | 13 +++++++++++++ 1 file changed, 13 insertions(+) (limited to 'include/linux/thunderbolt.h') diff --git a/include/linux/thunderbolt.h b/include/linux/thunderbolt.h index 7b69853188b1..27b9be34d4b9 100644 --- a/include/linux/thunderbolt.h +++ b/include/linux/thunderbolt.h @@ -237,6 +237,7 @@ int tb_xdomain_enable_paths(struct tb_xdomain *xd, u16 transmit_path, u16 receive_ring); int tb_xdomain_disable_paths(struct tb_xdomain *xd); struct tb_xdomain *tb_xdomain_find_by_uuid(struct tb *tb, const uuid_t *uuid); +struct tb_xdomain *tb_xdomain_find_by_route(struct tb *tb, u64 route); static inline struct tb_xdomain * tb_xdomain_find_by_uuid_locked(struct tb *tb, const uuid_t *uuid) @@ -250,6 +251,18 @@ tb_xdomain_find_by_uuid_locked(struct tb *tb, const uuid_t *uuid) return xd; } +static inline struct tb_xdomain * +tb_xdomain_find_by_route_locked(struct tb *tb, u64 route) +{ + struct tb_xdomain *xd; + + mutex_lock(&tb->lock); + xd = tb_xdomain_find_by_route(tb, route); + mutex_unlock(&tb->lock); + + return xd; +} + static inline struct tb_xdomain *tb_xdomain_get(struct tb_xdomain *xd) { if (xd) -- cgit