Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1410089pxb; Sat, 16 Oct 2021 09:13:19 -0700 (PDT) X-Google-Smtp-Source: ABdhPJw3AM9RHWAsPCy8KtF4HqeCpVe9zI/5P/INI/1wAMB/WeTlP/S4P+KvRSf6Fdk1BdlVxPW+ X-Received: by 2002:a17:90a:d996:: with SMTP id d22mr33440530pjv.20.1634400799385; Sat, 16 Oct 2021 09:13:19 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634400799; cv=none; d=google.com; s=arc-20160816; b=K2KAssdMq2tM+4VePFbJlY+6PQO945D+Ib1t3pC6MKfXEvWsOZSzsrEbhBvNG1tCRa 2uHfv4K8IkFOniRZh7KvxFVeE1fF05bnmFIrSLssqEabc4i+b+AFYeSfqsSeC/k3yK/x yfphuqcZA5mxog2Td5fzWjbK1/AbbB0n+gBHv5RPSqvYVoio0h1a7er17CxMTtoA3xvu VLi2aCY55FxumpyjASKKzs2qJ21pfIsSOx/rw57WPGddf7SVvfACK4hde75RSIZHAlEd HErgfqcJqXsQPCv8Qh9p6MrsrXiXkDBjZM5kTWpzDgXSFMQERZeCQwbLQ7qjiJGpGqll xT3g== 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; bh=E2kMW7De0WUTFR8R6pbmw+v+DfoEFjJfFZEPmx6TpIo=; b=JfGbqY31Q3Mq9Y04fcais+FtYMFoUTKHkcz1Wb+zhGOLFzWi4o2IL6RMdNYJsghjU+ eHQpV1ghHt/mF++wsHNvQnyegeY/WtZV+77SY/oEVh9Mm+T7yJz3Gg9UmYLQZYNNa1t6 BZg2U92ZnC+ZcRKbJpw/7asuPvmh8RzvB0jxHASlO0VzJyOnqiTMCwkaLbWP+BuJRZ1l wwH5/H/L1C8Tttf46QypEE8bitFQ0zn1vh03ndOA3SPFWkOAjBhbcckQpHltWg0qnZ+n V9UUI3MypbwcXTyEtRaoyJFTHrmBtl4iZriGET8Os4VyWpRvDx6rD+VsoxKUkv41dA/R qswA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=eMtI6REO; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [23.128.96.18]) by mx.google.com with ESMTP id lb3si4496884pjb.8.2021.10.16.09.13.06; Sat, 16 Oct 2021 09:13:19 -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=@gmail.com header.s=20210112 header.b=eMtI6REO; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S240627AbhJOOpb (ORCPT + 99 others); Fri, 15 Oct 2021 10:45:31 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:58358 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S236502AbhJOOpb (ORCPT ); Fri, 15 Oct 2021 10:45:31 -0400 Received: from mail-pg1-x535.google.com (mail-pg1-x535.google.com [IPv6:2607:f8b0:4864:20::535]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id AB711C061762; Fri, 15 Oct 2021 07:43:24 -0700 (PDT) Received: by mail-pg1-x535.google.com with SMTP id s136so5566766pgs.4; Fri, 15 Oct 2021 07:43:24 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20210112; h=from:to:cc:subject:date:message-id:in-reply-to:references :mime-version:content-transfer-encoding; bh=E2kMW7De0WUTFR8R6pbmw+v+DfoEFjJfFZEPmx6TpIo=; b=eMtI6REOFWix9KtW5tFZKnYJASMZfWRLSZnk5Z3YHrAZfJHAzvFnr8ylXwPFqc2a/a sSZ8UvQq1tqytMA7xvcnnsiLWefZHtOIvyR4w48y0+/FL2UKgIHln+v2qE2m/w+JTFM1 5/mXXW1NrvfbNEM0Kxme6uJJEBTs38ZYlbTHW6Re7rHSajvVurS8Uq1V2v4NCeWCfPhp 0AMJSPYYm2sBLxJatPIFmiVJT/Oh5NHr53JmOewoMKlOnjkfBC7TBlY4MypeOeGa17pJ HGEAOs0d5LPR7Euvw8ZGAQvAt0r8Wbzm43Xw5FKSEaUKTN3vn6bLTxu6DfAsFds4nbK0 6Xag== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20210112; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=E2kMW7De0WUTFR8R6pbmw+v+DfoEFjJfFZEPmx6TpIo=; b=abcCKJ862rC3oxYZKPlpeogY3LHRU2KmvCQ5GGuOznL8frk1aDYPY8ctqrhDw73leE tVWdevuXeDkFRlasrJWbyw/kDJWltmM4z9fV4xMg4OI0652Vnmel++1w+a0hV1i6yyFn Rvk/mvJ0ofnbeX2ksOSNV6bGT2y6oHwIXXWdYC2ZhqSra5tozFF06JwG0T7Zp4HAJSd+ eWdiA69B6gctj8MbHPPWvirwmWxUBpT+Ohl31Ew5GMMWm1hWjRJyeFxZb36sVu5gJOPp prYzXyZrE7qQegIFuzzY6MzKSVBdmTtcNWmkY7RTPBhVv9C5d+4CmblLJVTVmYBAsNnC 8N7w== X-Gm-Message-State: AOAM532jijJFWIhQjl/h+0JJ2/K0XYOWnsAaKu4oatljkZreCYF4/cS4 z74ulerp4HXtCjUeZILsPtE= X-Received: by 2002:a62:2f81:0:b0:44b:b390:956b with SMTP id v123-20020a622f81000000b0044bb390956bmr12110659pfv.30.1634309004189; Fri, 15 Oct 2021 07:43:24 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:4806:9a51:7f4b:9b5c:337a]) by smtp.gmail.com with ESMTPSA id f18sm5293491pfa.60.2021.10.15.07.43.19 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:43:23 -0700 (PDT) From: Naveen Naidu To: bhelgaas@google.com Cc: Naveen Naidu , linux-kernel-mentees@lists.linuxfoundation.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org, Ryder Lee , Jianjun Wang , Lorenzo Pieralisi , Rob Herring , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Matthias Brugger , linux-mediatek@lists.infradead.org (open list:PCIE DRIVER FOR MEDIATEK), linux-arm-kernel@lists.infradead.org (moderated list:ARM/Mediatek SoC support) Subject: [PATCH v2 07/24] PCI: mediatek: Remove redundant error fabrication when device read fails Date: Fri, 15 Oct 2021 20:08:48 +0530 Message-Id: <4aa74ccd31c42b108b61f2ad274bae59a1d25114.1634306198.git.naveennaidu479@gmail.com> X-Mailer: git-send-email 2.25.1 In-Reply-To: References: MIME-Version: 1.0 Content-Transfer-Encoding: 8bit Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org An MMIO read from a PCI device that doesn't exist or doesn't respond causes a PCI error. There's no real data to return to satisfy the CPU read, so most hardware fabricates ~0 data. The host controller drivers sets the error response values (~0) and returns an error when faulty hardware read occurs. But the error response value (~0) is already being set in PCI_OP_READ and PCI_USER_READ_CONFIG whenever a read by host controller driver fails. Thus, it's no longer necessary for the host controller drivers to fabricate any error response. This helps unify PCI error response checking and make error check consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/controller/pcie-mediatek.c | 11 ++--------- 1 file changed, 2 insertions(+), 9 deletions(-) diff --git a/drivers/pci/controller/pcie-mediatek.c b/drivers/pci/controller/pcie-mediatek.c index 2f3f974977a3..a19f8ec5d392 100644 --- a/drivers/pci/controller/pcie-mediatek.c +++ b/drivers/pci/controller/pcie-mediatek.c @@ -365,19 +365,12 @@ static int mtk_pcie_config_read(struct pci_bus *bus, unsigned int devfn, { struct mtk_pcie_port *port; u32 bn = bus->number; - int ret; port = mtk_pcie_find_port(bus, devfn); - if (!port) { - *val = ~0; + if (!port) return PCIBIOS_DEVICE_NOT_FOUND; - } - - ret = mtk_pcie_hw_rd_cfg(port, bn, devfn, where, size, val); - if (ret) - *val = ~0; - return ret; + return mtk_pcie_hw_rd_cfg(port, bn, devfn, where, size, val); } static int mtk_pcie_config_write(struct pci_bus *bus, unsigned int devfn, -- 2.25.1