mirror of
https://mirrors.bfsu.edu.cn/git/linux.git
synced 2025-01-27 16:25:32 +08:00
thunderbolt: Move CLx enabling into tb_enable_clx()
This avoids some duplication and makes the flow slightly easier to understand. Also follows what we do in tb_enable_tmu(). Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
This commit is contained in:
parent
4f9a4f25ad
commit
1a9b6cb8b5
@ -240,6 +240,18 @@ static void tb_discover_dp_resources(struct tb *tb)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
static int tb_enable_clx(struct tb_switch *sw)
|
||||||
|
{
|
||||||
|
int ret;
|
||||||
|
|
||||||
|
/*
|
||||||
|
* CL0s and CL1 are enabled and supported together.
|
||||||
|
* Silently ignore CLx enabling in case CLx is not supported.
|
||||||
|
*/
|
||||||
|
ret = tb_switch_clx_enable(sw, TB_CL1);
|
||||||
|
return ret == -EOPNOTSUPP ? 0 : ret;
|
||||||
|
}
|
||||||
|
|
||||||
static int tb_increase_switch_tmu_accuracy(struct device *dev, void *data)
|
static int tb_increase_switch_tmu_accuracy(struct device *dev, void *data)
|
||||||
{
|
{
|
||||||
struct tb_switch *sw;
|
struct tb_switch *sw;
|
||||||
@ -777,7 +789,6 @@ static void tb_scan_port(struct tb_port *port)
|
|||||||
struct tb_port *upstream_port;
|
struct tb_port *upstream_port;
|
||||||
bool discovery = false;
|
bool discovery = false;
|
||||||
struct tb_switch *sw;
|
struct tb_switch *sw;
|
||||||
int ret;
|
|
||||||
|
|
||||||
if (tb_is_upstream_port(port))
|
if (tb_is_upstream_port(port))
|
||||||
return;
|
return;
|
||||||
@ -876,14 +887,10 @@ static void tb_scan_port(struct tb_port *port)
|
|||||||
* CL0s and CL1 are enabled and supported together.
|
* CL0s and CL1 are enabled and supported together.
|
||||||
* Silently ignore CLx enabling in case CLx is not supported.
|
* Silently ignore CLx enabling in case CLx is not supported.
|
||||||
*/
|
*/
|
||||||
if (discovery) {
|
if (discovery)
|
||||||
tb_sw_dbg(sw, "discovery, not touching CL states\n");
|
tb_sw_dbg(sw, "discovery, not touching CL states\n");
|
||||||
} else {
|
else if (tb_enable_clx(sw))
|
||||||
ret = tb_switch_clx_enable(sw, TB_CL1);
|
tb_sw_warn(sw, "failed to enable CL states\n");
|
||||||
if (ret && ret != -EOPNOTSUPP)
|
|
||||||
tb_sw_warn(sw, "failed to enable %s on upstream port\n",
|
|
||||||
tb_switch_clx_name(TB_CL1));
|
|
||||||
}
|
|
||||||
|
|
||||||
if (tb_enable_tmu(sw))
|
if (tb_enable_tmu(sw))
|
||||||
tb_sw_warn(sw, "failed to enable TMU\n");
|
tb_sw_warn(sw, "failed to enable TMU\n");
|
||||||
@ -2022,20 +2029,13 @@ static int tb_suspend_noirq(struct tb *tb)
|
|||||||
static void tb_restore_children(struct tb_switch *sw)
|
static void tb_restore_children(struct tb_switch *sw)
|
||||||
{
|
{
|
||||||
struct tb_port *port;
|
struct tb_port *port;
|
||||||
int ret;
|
|
||||||
|
|
||||||
/* No need to restore if the router is already unplugged */
|
/* No need to restore if the router is already unplugged */
|
||||||
if (sw->is_unplugged)
|
if (sw->is_unplugged)
|
||||||
return;
|
return;
|
||||||
|
|
||||||
/*
|
if (tb_enable_clx(sw))
|
||||||
* CL0s and CL1 are enabled and supported together.
|
tb_sw_warn(sw, "failed to re-enable CL states\n");
|
||||||
* Silently ignore CLx re-enabling in case CLx is not supported.
|
|
||||||
*/
|
|
||||||
ret = tb_switch_clx_enable(sw, TB_CL1);
|
|
||||||
if (ret && ret != -EOPNOTSUPP)
|
|
||||||
tb_sw_warn(sw, "failed to re-enable %s on upstream port\n",
|
|
||||||
tb_switch_clx_name(TB_CL1));
|
|
||||||
|
|
||||||
if (tb_enable_tmu(sw))
|
if (tb_enable_tmu(sw))
|
||||||
tb_sw_warn(sw, "failed to restore TMU configuration\n");
|
tb_sw_warn(sw, "failed to restore TMU configuration\n");
|
||||||
|
Loading…
Reference in New Issue
Block a user