Received: by 2002:a25:4158:0:0:0:0:0 with SMTP id o85csp627510yba; Sun, 31 Mar 2019 08:25:59 -0700 (PDT) X-Google-Smtp-Source: APXvYqzQtE3dRtpbuaDsXxJ26K/oQQ0aGMpB+VDa/ePcdEL3aSMEoax9UnvjeXVBRdEirPfoxHv9 X-Received: by 2002:a17:902:a714:: with SMTP id w20mr60898560plq.331.1554045959472; Sun, 31 Mar 2019 08:25:59 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1554045959; cv=none; d=google.com; s=arc-20160816; b=zNCJqhBfxHIX7ITVk6PixItOi4jZbQsPI93T19O7iF5ykjPOTlDQ/Sj+62W2zQ2Bf7 /O7CTPvmUe4R/3X/P2Y4VtctgXo+/vYS5beA5BACOfCROs5Iv81AQzVc2IQc6SlNrvdI inVCuZfk3g3eqRFMmukux3hblrdRQi/lBelrEBqZT7EmugSMpd9Qv/hBD/OtqHFDnl9C 81R7KZhu93hokuzQL2LspCuCiMNNJUtUAx87es31KIS5gApkveokf+36By4uhINbPrGj zXeE8qGxmqjiD/bRu3YSsWUgCV7fJ7oQ60C7gEcpb7ufOF2eM93lrQz6W0kCTWZ8+9pn fH5Q== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:user-agent:in-reply-to :content-disposition:mime-version:references:message-id:subject:cc :to:from:date; bh=Da6/zcDRb1xZbX39nu4hEPmVNjfT1Y9CBntFyjcppi4=; b=hz+biDc02k53yLyv2NrWhuIDXdvqth6ZSLlr/dDclzUpLyeNJDJlKDoq8Sw7/JVCKL vUouegqssc7ppfyZ3lqjmC7zobW9rcsiwuUQBI2guw4nAzWJNP2aJFDDppUYewy+50sb lMGoMXDk4oqA9qaW2uYxgMoSGVF7/WT+Eq5TU5mJpDER7TBYHfRx2jKoL/LdfirLErQu y1FOpiQojLKoBDNzbzWwzag/0MQpxsNub8eNtYw1HAXaa2vSJL+LuBz95/ih0an7fPRo 78M3ENU7FJ6NoJyKfAI+7lLhf4UV5JJZ0+CwXm2CBxwBB0R6OurmseAVqdcd7j3lx7Ix QBUQ== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id q5si6882199pgc.425.2019.03.31.08.25.43; Sun, 31 Mar 2019 08:25:59 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1731255AbfCaPZB (ORCPT + 99 others); Sun, 31 Mar 2019 11:25:01 -0400 Received: from bmailout2.hostsharing.net ([83.223.90.240]:47393 "EHLO bmailout2.hostsharing.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1731211AbfCaPZB (ORCPT ); Sun, 31 Mar 2019 11:25:01 -0400 Received: from h08.hostsharing.net (h08.hostsharing.net [83.223.95.28]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (Client CN "*.hostsharing.net", Issuer "COMODO RSA Domain Validation Secure Server CA" (not verified)) by bmailout2.hostsharing.net (Postfix) with ESMTPS id 4BBBB2800B3F5; Sun, 31 Mar 2019 17:24:59 +0200 (CEST) Received: by h08.hostsharing.net (Postfix, from userid 100393) id 00BCA5B4FE; Sun, 31 Mar 2019 17:24:58 +0200 (CEST) Date: Sun, 31 Mar 2019 17:24:58 +0200 From: Lukas Wunner To: Mika Westerberg Cc: linux-kernel@vger.kernel.org, Michael Jamet , Yehezkel Bernat , Andreas Noever , Andy Shevchenko , Christian Kellner , Mario.Limonciello@dell.com Subject: Re: [PATCH v3 12/36] thunderbolt: Properly disable path Message-ID: <20190331152458.4ugdshjg6qyu2pzr@wunner.de> References: <20190328123633.42882-1-mika.westerberg@linux.intel.com> <20190328123633.42882-13-mika.westerberg@linux.intel.com> MIME-Version: 1.0 Content-Type: text/plain; charset=us-ascii Content-Disposition: inline In-Reply-To: <20190328123633.42882-13-mika.westerberg@linux.intel.com> User-Agent: NeoMutt/20170113 (1.7.2) Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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