Received: by 2002:a05:6a10:22f:0:0:0:0 with SMTP id 15csp1529013pxk; Fri, 2 Oct 2020 11:50:35 -0700 (PDT) X-Google-Smtp-Source: ABdhPJwNstmzq6AHPb9wVyfuT67L/v2kktgEWFnHtVzQom4L1p/hXGwSrWjqPvPN4Y765CU3dVtI X-Received: by 2002:a50:9d0a:: with SMTP id v10mr3902873ede.144.1601664635213; Fri, 02 Oct 2020 11:50:35 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1601664635; cv=none; d=google.com; s=arc-20160816; b=edLmeJdlrBHOD5qHKHj8cJbek+og8vsc1PENFv0f5a6QaYxQrqybcPP5LnC75QbAjZ NBkuSSt8XlmGM6z8rCbREXOQh9cnlVVPnviKQYDMbJJ9ilVTgc0tzCnoFwCuKHRTcAfn M+lM42RAb+iCa830XMukgCagc+sytQovURe4umtrCjXPXh4XJfXd7T0RXkP7wkRr1Ioh 7gqq/YC8xwpGfqNxsmjAzozhyeMV9h295FqIeMhOvZ7HzjQ2xz1krzV7ffKnfV5+hcrr R33RVf/anvbfHArgOxYfH931kLWIPWkWE6cRgPQQUCo9kix/OgrHo6wa6Gnjo8BGFm5U gKPg== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature:dkim-signature; bh=iOxe6nk3a+qZ/VViUWD1V7pp14CzJsfaUhKJXMIDY9k=; b=cOtOIKiQv5pL3aYayE7fESEQt2MNBjsU7h5QFafKP0WZ9jUbBoT8muDqnxxEeYKmea gOt81yi3TzGgnYXmZ0LBu7q8Y47aLY3ASwFNTs2l0dVg+529Ps0FUlXsijBLmD+PDF60 19fvEecviyq7NvsAWupsquvWKXHTZXmNbKHTMrJNMOGOSyvfJPHe8Y4fIJjR1RcKfKG2 8BdolivoI997+5lMQO7nVsO2JuV/ou45IiSrOBauCyZjJpKpG6gh5OPSjM2PQaOO0wCC cf7GphIDx0T8dvDeyCEGssnvcd9hsFOTxbp4IY02a+IVDOlu+/sSqtfpTX9F1VKTPwZS AK/g== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@oregontracks.org header.s=fm1 header.b="gbV/8SiA"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Xj8STda4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id r8si1571368ejo.510.2020.10.02.11.50.09; Fri, 02 Oct 2020 11:50:35 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) client-ip=23.128.96.18; Authentication-Results: mx.google.com; dkim=pass header.i=@oregontracks.org header.s=fm1 header.b="gbV/8SiA"; dkim=pass header.i=@messagingengine.com header.s=fm3 header.b=Xj8STda4; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 23.128.96.18 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2388387AbgJBSsE (ORCPT + 99 others); Fri, 2 Oct 2020 14:48:04 -0400 Received: from out1-smtp.messagingengine.com ([66.111.4.25]:44821 "EHLO out1-smtp.messagingengine.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S2388369AbgJBSsD (ORCPT ); Fri, 2 Oct 2020 14:48:03 -0400 Received: from compute4.internal (compute4.nyi.internal [10.202.2.44]) by mailout.nyi.internal (Postfix) with ESMTP id 648065C0140; Fri, 2 Oct 2020 14:48:01 -0400 (EDT) Received: from mailfrontend2 ([10.202.2.163]) by compute4.internal (MEProxy); Fri, 02 Oct 2020 14:48:01 -0400 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= oregontracks.org; h=from:to:cc:subject:date:message-id :in-reply-to:references:mime-version:content-transfer-encoding; s=fm1; bh=iOxe6nk3a+qZ/VViUWD1V7pp14CzJsfaUhKJXMIDY9k=; b=gbV/8 SiA5dPFk866rra6hFcW4UP135XkQgbx5zbDRvraYEqtkFlHICGU6Jux4IOcP16Da IiTOqJnkHhMEu2S6fhtSRhcuHzPxtvLcbxV8GpgIyt31DyWD/J5qWkv8p+BPc5sB 5vAaPqlq0i56eY0Md19eo3Xo/Yo2KZjzumOiPCCP2/f2meeComknCXj8JM8XMdAi 1GbTkp1O7ymOBsoU5nVlfR//xNX01kRviLuRKUOc7WHScncPPw9XDMWOzCxHHMHy 91SkoXkkPlY5wRdIadlHXjBIueCTVQEpFabcHO5Kn6tRI4c5uuqSSmwQBLaoIRnS 6Rm9KL/4X7TaXwCkA== DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d= messagingengine.com; h=cc:content-transfer-encoding:date:from :in-reply-to:message-id:mime-version:references:subject:to :x-me-proxy:x-me-proxy:x-me-sender:x-me-sender:x-sasl-enc; s= fm3; bh=iOxe6nk3a+qZ/VViUWD1V7pp14CzJsfaUhKJXMIDY9k=; b=Xj8STda4 C+BOICJaIS9XxU5bJ6+QkhRADHcp1sobzgCRnmBVmxJk/+jeT7sTxiLKpEGpWATH SV14KLxiFvrCd28d0zS7wkrn6kR/yjPeUomcbo3Pw+bGflEl9v4/bIlJ/NOonGe9 qwv8lOeUWh1mZkUzXTFeKv0DgBWyJg8UpJ0hM3FPhpIeFXD91PxGzvdpXh92Fjwm rNaYTYvlmLtN2C9oz6mWAPW6pCsxDyGHanJ3IglIXZpVIqLHBixM37/6pxFdCsQg 86K4fMbTb6BZAwjyMeWhSy+J334m1tbnnKMcz6gFFX5fghTRnDtF4htqpU4TmQ8B TLNKxEJ6UcNl3Q== X-ME-Sender: X-ME-Proxy-Cause: gggruggvucftvghtrhhoucdtuddrgedujedrfeeigdduvdekucetufdoteggodetrfdotf fvucfrrhhofhhilhgvmecuhfgrshhtofgrihhlpdfqfgfvpdfurfetoffkrfgpnffqhgen uceurghilhhouhhtmecufedttdenucenucfjughrpefhvffufffkofgjfhgggfestdekre dtredttdenucfhrhhomhepufgvrghnucggucfmvghllhgvhicuoehsvggrnhhvkhdruggv vhesohhrvghgohhnthhrrggtkhhsrdhorhhgqeenucggtffrrghtthgvrhhnpeehkeffte eiudeiffelkeelvefftdelhfeitdeigeffleeufedvgfegvdefvedtteenucfkphepvdeg rddvtddrudegkedrgeelnecuvehluhhsthgvrhfuihiivgepvdenucfrrghrrghmpehmrg hilhhfrhhomhepshgvrghnvhhkrdguvghvsehorhgvghhonhhtrhgrtghkshdrohhrgh X-ME-Proxy: Received: from arch-ashland-svkelley.hsd1.or.comcast.net (c-24-20-148-49.hsd1.or.comcast.net [24.20.148.49]) by mail.messagingengine.com (Postfix) with ESMTPA id E1F083064686; Fri, 2 Oct 2020 14:47:59 -0400 (EDT) From: Sean V Kelley To: bhelgaas@google.com, Jonathan.Cameron@huawei.com, rafael.j.wysocki@intel.com, ashok.raj@intel.com, tony.luck@intel.com, sathyanarayanan.kuppuswamy@intel.com, qiuxu.zhuo@intel.com Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Sean V Kelley Subject: [PATCH v8 05/14] PCI/ERR: Use "bridge" for clarity in pcie_do_recovery() Date: Fri, 2 Oct 2020 11:47:26 -0700 Message-Id: <20201002184735.1229220-6-seanvk.dev@oregontracks.org> X-Mailer: git-send-email 2.28.0 In-Reply-To: <20201002184735.1229220-1-seanvk.dev@oregontracks.org> References: <20201002184735.1229220-1-seanvk.dev@oregontracks.org> MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org From: Sean V Kelley A generic term such as "bridge" may be used for something with a subordinate bus. The mix of ports would benefit from a use of the term. Further clarity can be had in pcie_do_recovery() with use of pci_upstream_bridge() in place of dev->bus->self. Reverse the pcie_do_recovery() conditional logic and replace use of "dev" with "bridge". Suggested-by: Bjorn Helgaas Signed-off-by: Sean V Kelley Acked-by: Jonathan Cameron --- drivers/pci/pcie/err.c | 28 +++++++++++++++++----------- 1 file changed, 17 insertions(+), 11 deletions(-) diff --git a/drivers/pci/pcie/err.c b/drivers/pci/pcie/err.c index 950612342f1c..e68ea5243ff2 100644 --- a/drivers/pci/pcie/err.c +++ b/drivers/pci/pcie/err.c @@ -152,20 +152,26 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, { pci_ers_result_t status = PCI_ERS_RESULT_CAN_RECOVER; struct pci_bus *bus; + struct pci_dev *bridge; + int type; /* - * Error recovery runs on all subordinates of the first downstream port. - * If the downstream port detected the error, it is cleared at the end. + * Error recovery runs on all subordinates of the first downstream + * bridge. If the downstream bridge detected the error, it is + * cleared at the end. */ - if (!(pci_pcie_type(dev) == PCI_EXP_TYPE_ROOT_PORT || - pci_pcie_type(dev) == PCI_EXP_TYPE_DOWNSTREAM)) - dev = dev->bus->self; - bus = dev->subordinate; - + type = pci_pcie_type(dev); + if (type == PCI_EXP_TYPE_ROOT_PORT || + type == PCI_EXP_TYPE_DOWNSTREAM) + bridge = dev; + else + bridge = pci_upstream_bridge(dev); + + bus = bridge->subordinate; pci_dbg(dev, "broadcast error_detected message\n"); if (state == pci_channel_io_frozen) { pci_walk_bus(bus, report_frozen_detected, &status); - status = reset_subordinate_device(dev); + status = reset_subordinate_device(bridge); if (status != PCI_ERS_RESULT_RECOVERED) { pci_warn(dev, "subordinate device reset failed\n"); goto failed; @@ -197,9 +203,9 @@ pci_ers_result_t pcie_do_recovery(struct pci_dev *dev, pci_dbg(dev, "broadcast resume message\n"); pci_walk_bus(bus, report_resume, &status); - if (pcie_aer_is_native(dev)) - pcie_clear_device_status(dev); - pci_aer_clear_nonfatal_status(dev); + if (pcie_aer_is_native(bridge)) + pcie_clear_device_status(bridge); + pci_aer_clear_nonfatal_status(bridge); pci_info(dev, "device recovery successful\n"); return status; -- 2.28.0