summaryrefslogtreecommitdiff
path: root/drivers/thunderbolt/tunnel_pci.c
diff options
context:
space:
mode:
authorMika Westerberg <mika.westerberg@linux.intel.com>2017-02-19 11:39:34 +0300
committerMika Westerberg <mika.westerberg@linux.intel.com>2019-04-18 11:18:52 +0300
commit56183c88f368eef7134c32df826792ee140f2864 (patch)
tree366f801681636db72181ee1fdbd10a9cdbbd1c22 /drivers/thunderbolt/tunnel_pci.c
parent4944269305df09c719f9c406c20c255f1724542a (diff)
downloadlinux-56183c88f368eef7134c32df826792ee140f2864.tar.xz
thunderbolt: Cache adapter specific capability offset into struct port
The adapter specific capability either is there or not if the port does not hold an adapter. Instead of always finding it on-demand we read the offset just once when the port is initialized. While there we update the struct port documentation to follow kernel-doc format. Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Diffstat (limited to 'drivers/thunderbolt/tunnel_pci.c')
-rw-r--r--drivers/thunderbolt/tunnel_pci.c9
1 files changed, 3 insertions, 6 deletions
diff --git a/drivers/thunderbolt/tunnel_pci.c b/drivers/thunderbolt/tunnel_pci.c
index 0637537ea53f..2de4edccbd6d 100644
--- a/drivers/thunderbolt/tunnel_pci.c
+++ b/drivers/thunderbolt/tunnel_pci.c
@@ -148,12 +148,9 @@ bool tb_pci_is_invalid(struct tb_pci_tunnel *tunnel)
static int tb_pci_port_active(struct tb_port *port, bool active)
{
u32 word = active ? 0x80000000 : 0x0;
- int cap = tb_port_find_cap(port, TB_PORT_CAP_ADAP);
- if (cap < 0) {
- tb_port_warn(port, "TB_PORT_CAP_ADAP not found: %d\n", cap);
- return cap;
- }
- return tb_port_write(port, &word, TB_CFG_PORT, cap, 1);
+ if (!port->cap_adap)
+ return -ENXIO;
+ return tb_port_write(port, &word, TB_CFG_PORT, port->cap_adap, 1);
}
/**