Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp1474056pxb; Sat, 16 Oct 2021 10:50:04 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyAWuR6BeVJkaE5qs3OwFRMWt4l1dcdcHyrvfley3hu+vMOO9mqMbRcCu/Ls/PpxoL3lPNJ X-Received: by 2002:a17:906:3715:: with SMTP id d21mr16877301ejc.74.1634406603843; Sat, 16 Oct 2021 10:50:03 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634406603; cv=none; d=google.com; s=arc-20160816; b=aRtRZCK3x3fNgMX/sGUzHmJna5pOzTZ89rGjq7Xek2hnbJho+mjGNFKt2SbjPFGcv3 ucIJZ/XOV1fZTyVquduXBI9Q0sMKEyWA+Kbs76j70H11M3/AwWkZF4xr7nz/K+ksZuQL XgD3kAH6+MFqCdnJMDeESbqOiyTfywpivibwml0BnD4v4DezqEUtv3UurgaGfZWQQM0m lIQlfESV3pKF+klGuuYfN97NS2rGQG02tl0DvZgS1GcaT5+K/4CZdpnLZDuigavG+khY szZvfa0oEqrjOFhcTbcOZGrrurVMmLGHqFJv8URuKjEyhPXRIsly5qiNaLw74JkT8pMZ nWAg== 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=F90TVLLbkkjlFTZkt/NbI81qyTfS7mybpJeR5bN32UQ=; b=PHTmA8lhwIw1uXb6lcjJls+xQS2GeRqmzS4ZkJ0WACzQ3c1I4DVXCDLldQbGHIQSXW Kyxp7sphkrXy99ABol4SgYLfY8upB98w7CbXl0FAwegAtPdfhJQPgTHI0y8ySTomFsH8 RgG+TUmD5pQ5GD18POCF/vvctFkpb9XgQpuzqrcx8HU2CuIUO+Y58BhBWx4xm/G/DYdh 63beXmgf9FbhFXLLbtGSgU+Q68UEej2LFLaEKa2S+Nmi6Fs3WczO9bXgcQ3UlUnQ9xpJ dl5S7ibWIeeNZiBh9K6zOwI9s2R0l5M/f9mwKt47W4qrxJfl9wUuh31A+4IGqV+4dgCz MZCw== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=l5ELkb75; 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 v14si11662249edb.415.2021.10.16.10.49.24; Sat, 16 Oct 2021 10:50:03 -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=l5ELkb75; 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 S240786AbhJOOsu (ORCPT + 99 others); Fri, 15 Oct 2021 10:48:50 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:59356 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S240620AbhJOOso (ORCPT ); Fri, 15 Oct 2021 10:48:44 -0400 Received: from mail-pg1-x52f.google.com (mail-pg1-x52f.google.com [IPv6:2607:f8b0:4864:20::52f]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id E7282C061767; Fri, 15 Oct 2021 07:46:37 -0700 (PDT) Received: by mail-pg1-x52f.google.com with SMTP id g184so8814972pgc.6; Fri, 15 Oct 2021 07:46:37 -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=F90TVLLbkkjlFTZkt/NbI81qyTfS7mybpJeR5bN32UQ=; b=l5ELkb75e7o0WqRg7nGZ9P1QoeNbxsEGVGFrefZQ/ppVbqiJYC1+5+OpX+KkPqFvDw aLGb7yL88woVFnJUuNdXLXM7/DxVZSEr3pByuWd9EGz3SqrwAmcg4h7rmKL/gbbcU0zp uoZZHfztxBoQquCz1RWFxPrkPirdb0uzbp761KgtQfLB2JNySaD7mQrZb/q63HLuptZQ JhXsY4Ao8rLTq8UORVBZmUs3ULDA+EZXHAvFjKbAho7UaV76oaiIW+HqibjGA/wtr5hc xcrfviYyAtIJbjobyVBkN/6OhUP05e6UwqOO42UDz+MHh8hLguqcHg/lLcyMMeEG6cOM LZag== 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=F90TVLLbkkjlFTZkt/NbI81qyTfS7mybpJeR5bN32UQ=; b=LmG/tLotS1IuNunINvyYBV7b3/ep14HjjpCHhh9qdS/jFejKHFJrwSXuX2Xmh2zRF3 gxqCCekKSXOsygopBeMvGYWcqeraeEiasTeG5eYFxXmwUnvH26CnZG5jwI0hUJzs5Q1c MwUe3ksaJ/asucthZYbp9eq4iGSmIuxQ8r67Vm2urnh5BZ3IoRtSQDoX7ThvWB/VUrad ZYJ0EXh/QAyeK+9IEbQyFt3tN6gKFWKql8GcxY1gTY94eb5/E3N6Ld95Vjsa5p+QSOoZ 4dAPOKpHXleEG3NR5/3U+UVE0Ds7rstH0BCzcg9Wfn5XVPonnEtxzMnwrkVNRoWymx+F sEig== X-Gm-Message-State: AOAM533SojuL0VHg8E5V0oGFyCdfT6OlCPlJQ1whyVLDazEAXogj8yZp fIPHRULUa9W842phI8m1dXA= X-Received: by 2002:a63:590e:: with SMTP id n14mr9425002pgb.434.1634309197420; Fri, 15 Oct 2021 07:46:37 -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.46.34 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Fri, 15 Oct 2021 07:46:37 -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, =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= Subject: [PATCH v2 21/24] PCI: cpqphp: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Fri, 15 Oct 2021 20:09:02 +0530 Message-Id: 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. Use RESPONSE_IS_PCI_ERROR() to check the response we get when we read data from hardware. This helps unify PCI error response checking and make error checks consistent and easier to find. Signed-off-by: Naveen Naidu --- drivers/pci/hotplug/cpqphp_ctrl.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/hotplug/cpqphp_ctrl.c b/drivers/pci/hotplug/cpqphp_ctrl.c index 1b26ca0b3701..d5274b9b06a5 100644 --- a/drivers/pci/hotplug/cpqphp_ctrl.c +++ b/drivers/pci/hotplug/cpqphp_ctrl.c @@ -2273,7 +2273,7 @@ static u32 configure_new_device(struct controller *ctrl, struct pci_func *func while ((function < max_functions) && (!stop_it)) { pci_bus_read_config_dword(ctrl->pci_bus, PCI_DEVFN(func->device, function), 0x00, &ID); - if (ID == 0xFFFFFFFF) { + if (RESPONSE_IS_PCI_ERROR(&ID)) { function++; } else { /* Setup slot structure. */ @@ -2517,7 +2517,7 @@ static int configure_new_function(struct controller *ctrl, struct pci_func *func pci_bus_read_config_dword(pci_bus, PCI_DEVFN(device, 0), 0x00, &ID); pci_bus->number = func->bus; - if (ID != 0xFFFFFFFF) { /* device present */ + if (!RESPONSE_IS_PCI_ERROR(&ID)) { /* device present */ /* Setup slot structure. */ new_slot = cpqhp_slot_create(hold_bus_node->base); -- 2.25.1