[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <20190331152458.4ugdshjg6qyu2pzr@wunner.de>
Date: Sun, 31 Mar 2019 17:24:58 +0200
From: Lukas Wunner <lukas@...ner.de>
To: Mika Westerberg <mika.westerberg@...ux.intel.com>
Cc: linux-kernel@...r.kernel.org,
Michael Jamet <michael.jamet@...el.com>,
Yehezkel Bernat <YehezkelShB@...il.com>,
Andreas Noever <andreas.noever@...il.com>,
Andy Shevchenko <andriy.shevchenko@...ux.intel.com>,
Christian Kellner <ckellner@...hat.com>,
Mario.Limonciello@...l.com
Subject: Re: [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
Powered by blists - more mailing lists