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>
此提交包含在:
Mika Westerberg
2017-02-19 10:39:34 +02:00
父節點 4944269305
當前提交 56183c88f3
共有 4 個檔案被更改,包括 13 行新增10 行删除

查看文件

@@ -151,8 +151,8 @@ static struct tb_port *tb_find_unused_down_port(struct tb_switch *sw)
continue;
if (sw->ports[i].config.type != TB_TYPE_PCIE_DOWN)
continue;
cap = tb_port_find_cap(&sw->ports[i], TB_PORT_CAP_ADAP);
if (cap < 0)
cap = sw->ports[i].cap_adap;
if (!cap)
continue;
res = tb_port_read(&sw->ports[i], &data, TB_CFG_PORT, cap, 1);
if (res < 0)
@@ -197,8 +197,8 @@ static void tb_activate_pcie_devices(struct tb *tb)
}
/* check whether port is already activated */
cap = tb_port_find_cap(up_port, TB_PORT_CAP_ADAP);
if (cap < 0)
cap = up_port->cap_adap;
if (!cap)
continue;
if (tb_port_read(up_port, &data, TB_CFG_PORT, cap, 1))
continue;