Received: by 2002:a05:6a10:5bc5:0:0:0:0 with SMTP id os5csp722359pxb; Thu, 21 Oct 2021 08:16:26 -0700 (PDT) X-Google-Smtp-Source: ABdhPJyfqeCrScaOXs0SMUWBfqWPMbIp9N5QTjaOS1lQIpkxQF3gpYMuFCy6MGXYql/Dk256JaHj X-Received: by 2002:a17:90a:c08d:: with SMTP id o13mr7431623pjs.181.1634829386495; Thu, 21 Oct 2021 08:16:26 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1634829386; cv=none; d=google.com; s=arc-20160816; b=PTnT0Rb0xrx9lttJl7q6K6Tc+0WW1UBpdgOjYwXK6i5oswoEikWPuVqrBoU7mucdLV INEC69bDV5zaA0tLkdhrr3aN4pedhRPcTn6Cgdtn5mlaToPBEhCKOnTxnjbG1lznV7dH yI0lAz0vdJP3EwhaWdlGsW2/6YYrH1drsZ6OggvLtYk4H/4D8UgFfKcXMfaodp5OZcEF tmx151k4NaSZxlxW14nJpzCV9CAkAX7ywcCW1h8FvuA4MPE/eJ23Fw+aZvXoRvAmmDk3 q02Kz9fIuJdIKVZa6lakzcytzzBb9i0HuExUXEEtxE0bDjIJLXYFIts4LoWb+q7queQr WRvQ== 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=FjWSerZb+dWA69lxPfira4z913yuChERYmgQMsWZtRA=; b=OW3QGId1ST+fL4MKNYwlqFJvTHVOblgvs2L3V/sTME2lgkjARA7be217+ikkv2aUj+ 8YVpcu9iUYG+CieJMX2aM73mOYyF2kpAfEnT7q3htjXiPzSAroxi6t1wQGF6Kn64Leqw 7AVmTp3HbOcrRPA4oXQuh7vMbMTDewmDMQrhUjdmSgbF8aBnNnynIzbAy5DufLzyHv3V g2EFT0nPoJJkOpqb2TQj1prWcrzjdZjfYbrR9vLePzytTjLYJ+9YzqJqGlRDZq1fxDA3 mUIGZIZ3DLTw91d5Jai0pvH5qWapKJPKLjCPQD+xb5PlhqMYLnN7S9Idrjf3+PjOP1Lp xjOQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20210112 header.b=iGh3AHug; 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 g23si11786951pji.57.2021.10.21.08.16.10; Thu, 21 Oct 2021 08:16:26 -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=iGh3AHug; 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 S231819AbhJUPR2 (ORCPT + 99 others); Thu, 21 Oct 2021 11:17:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:49570 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231849AbhJUPRR (ORCPT ); Thu, 21 Oct 2021 11:17:17 -0400 Received: from mail-pl1-x632.google.com (mail-pl1-x632.google.com [IPv6:2607:f8b0:4864:20::632]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id 103B3C07978C; Thu, 21 Oct 2021 08:14:15 -0700 (PDT) Received: by mail-pl1-x632.google.com with SMTP id y1so617768plk.10; Thu, 21 Oct 2021 08:14:15 -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=FjWSerZb+dWA69lxPfira4z913yuChERYmgQMsWZtRA=; b=iGh3AHug5XPwueQdVcAQr4MP740tduvSvglgnF1J0evD83ER61uw+1QC2rufw2YuiX 1xYvMHoj2Jjn5E25nql1ikj9XKxyXY1lQrlpG3JAyaB4Xgwzsz//bWGkcv+xd5w9ltRC P/huvBwEUI5w0CCYlkrzwvcnc1Q8PkSzAVknEH05giViW1UQUN35mJaI11FGoYCXNVBl LtUKtEfE8ZRKrqtDh0FxqikjObvPO9OP5/N5hKR8DGJT7VPmu9rGO36jvyImqLg1IPpA LqdlVVkGq8g8PP3dfJVhMpU2YjqtsHIINKQ1XJ4aGX6vWegKqqhj3HNT6hLalCVn2j/c S8Wg== 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=FjWSerZb+dWA69lxPfira4z913yuChERYmgQMsWZtRA=; b=0SLkfwLRSc8u/56b5TW44G6LQrXcUO4ugN9hFRlTeZxVeHFM94Xe9KJVkPdLaysslV ytQDSm8KYU+wyb/xky1fpW1p7JHWq2Q/tWmrkyQP5QkZhJ2RtXOKer0LAqlTyycrQWf1 +X3BAhPQPUwMmj5ltOwHuNhjMzOMZJyoFFH3bR6Uduq8c3RyCRz4ZaAvgqTEcHqVUdTo 0d1hRH5vDvTOVkr/xAaJmSk1vl6nHnErLF4lpfm/8ty8hta6lOGppe1RCKpHwORn1dt4 1bAwIG/4FbAX6/vgfipthL/cEuaNj2KBvVSX2vsSOxuvxLhianMB5KkULEHe3waR5JB2 kMaQ== X-Gm-Message-State: AOAM532zBAHACifyq0XFfABXYycKij/yO6ivestQK9/8/7obXgO3gH5y TCl89v8Tp2jK5sYj85T+MjI= X-Received: by 2002:a17:902:9a97:b0:13e:2da4:8132 with SMTP id w23-20020a1709029a9700b0013e2da48132mr5758192plp.34.1634829254500; Thu, 21 Oct 2021 08:14:14 -0700 (PDT) Received: from localhost.localdomain ([2406:7400:63:29a4:d874:a949:6890:f95f]) by smtp.gmail.com with ESMTPSA id c9sm5508027pgq.58.2021.10.21.08.14.10 (version=TLS1_3 cipher=TLS_AES_256_GCM_SHA384 bits=256/256); Thu, 21 Oct 2021 08:14:14 -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, skhan@linuxfoundation.org, Qiuxu Zhuo , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Sean V Kelley Subject: [PATCH v3 20/25] PCI/PME: Use RESPONSE_IS_PCI_ERROR() to check read from hardware Date: Thu, 21 Oct 2021 20:37:45 +0530 Message-Id: <236b7af1f36698b34c01857d0a2a18c4ab850c5f.1634825082.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. 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. Compile tested only. Signed-off-by: Naveen Naidu --- drivers/pci/pcie/pme.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/drivers/pci/pcie/pme.c b/drivers/pci/pcie/pme.c index 1d0dd77fed3a..bad7ba420c18 100644 --- a/drivers/pci/pcie/pme.c +++ b/drivers/pci/pcie/pme.c @@ -224,7 +224,7 @@ static void pcie_pme_work_fn(struct work_struct *work) break; pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); - if (rtsta == (u32) ~0) + if (RESPONSE_IS_PCI_ERROR(rtsta)) break; if (rtsta & PCI_EXP_RTSTA_PME) { @@ -274,7 +274,7 @@ static irqreturn_t pcie_pme_irq(int irq, void *context) spin_lock_irqsave(&data->lock, flags); pcie_capability_read_dword(port, PCI_EXP_RTSTA, &rtsta); - if (rtsta == (u32) ~0 || !(rtsta & PCI_EXP_RTSTA_PME)) { + if (RESPONSE_IS_PCI_ERROR(rtsta) || !(rtsta & PCI_EXP_RTSTA_PME)) { spin_unlock_irqrestore(&data->lock, flags); return IRQ_NONE; } -- 2.25.1