lkml.org 
[lkml]   [2019]   [Mar]   [31]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
Date
From
SubjectRe: [PATCH v3 12/36] thunderbolt: Properly disable path
On Thu, Mar 28, 2019 at 03:36:09PM +0300, Mika Westerberg wrote:
> +static int __tb_path_deactivate_hop(struct tb_port *port, int hop_index)
> +{
> + struct tb_regs_hop hop;
> + ktime_t timeout;
> + int ret;
> +
> + if (port->sw->is_unplugged)
> + return 0;

This check is basically a duplication of the checks added in patch 4 ...


> +
> + /* Disable the path */
> + ret = tb_port_read(port, &hop, TB_CFG_HOPS, 2 * hop_index, 2);
> + if (ret)
> + return ret;
[...]
> static void __tb_path_deactivate_hops(struct tb_path *path, int first_hop)
> {
> int i, res;
> - struct tb_regs_hop hop = { };
> +
> for (i = first_hop; i < path->path_length; i++) {
> - res = tb_port_write(path->hops[i].in_port, &hop, TB_CFG_HOPS,
> - 2 * path->hops[i].in_hop_index, 2);
> + res = __tb_path_deactivate_hop(path->hops[i].in_port,
> + path->hops[i].in_hop_index);
> if (res)
> tb_port_warn(path->hops[i].in_port,
> "hop deactivation failed for hop %d, index %d\n",

... however you return 0 above to avoid the warning here whereas the checks
added in patch 4 return -ENODEV. You may want to change "if (res)" to
"if (res && res != -ENODEV)" and drop the unplugged check in
__tb_path_deactivate_hop().

Thanks,

Lukas

\
 
 \ /
  Last update: 2019-03-31 17:26    [W:0.207 / U:61.752 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site