Received: by 2002:a25:1506:0:0:0:0:0 with SMTP id 6csp2878043ybv; Mon, 24 Feb 2020 13:30:33 -0800 (PST) X-Google-Smtp-Source: APXvYqzmbiW1XtndTte/UvFavtLMCSUHwubRFfwWtlz0i6pQsAH3EV2670FYzO+qnf9z3IM/1RuU X-Received: by 2002:a9d:6a4f:: with SMTP id h15mr41645966otn.86.1582579833366; Mon, 24 Feb 2020 13:30:33 -0800 (PST) ARC-Seal: i=1; a=rsa-sha256; t=1582579833; cv=none; d=google.com; s=arc-20160816; b=Hs/HnBZro7fWO/1Z15/IHgdgUwBKH3OucqG2xB/xDAHK7LDO0B1bFD+jDqEByFm1oe 5En4G66qpDTafnLqPo++wrCOwXuLjoRfl9+AfpMd3a+oGl4AwQXPLnlqv36PjqQFNYfa L8TWj15r7UqVKRfp65PnHibI4i+eVU7dg8t6Bp/N5TOUnzB87PcdEQSs/Cc6EC31jMLp VHv32gINMfqWqq7YAjit5wFS/qRiLg1cN6SIVbqQwrP8pOquSm0n01HSxu1RUmYS70H2 8kHZzh5a0zKQT1LwUZ4eFaDXzalV1nXrEUEMy2BamB9AyqNaQwQN0cnknMybcQh299sR J/8g== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding :content-language:in-reply-to:mime-version:user-agent:date :message-id:references:cc:to:from:subject:dkim-signature; bh=4ePoQM9FMGKqv4Tet944qGjHoWr4YdITdi8WCr48XQE=; b=j+bGH93U34yldZiFbh44BC60afsL57x/MxrgNUHoI/NNdBg+2X1MEj7NGBlGajOrQp 99gw5lCYyhxPPFx8ytsp5OhRWZrlwUlbzbqOJLQIU8t/B4ZAFsp/38+/tSyrgUABTB7k hAfeVIXDgcUNADsNOm42UvBPrVG0c3WpUnPvvIIMNl5qIQQc8lmBAV04QOKLp5brl5mp IsmMOJTxFlioUXQQFzgAN6h0X3HQ9ZElvr2ykJEECFy/bZSsHlg4MLWLrgbfAOcLOdfl w3uRGdzHfC0nsGy1d+6Yju40qYIj9RzNSBIpdyiXy/Yv1N/09FIGWQeddyGce+ISgGg9 MBGA== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Wsb1P9jQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id t184si6016680oig.184.2020.02.24.13.30.21; Mon, 24 Feb 2020 13:30:33 -0800 (PST) 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; dkim=pass header.i=@gmail.com header.s=20161025 header.b=Wsb1P9jQ; 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; dmarc=pass (p=NONE sp=QUARANTINE dis=NONE) header.from=gmail.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1728339AbgBXV3w (ORCPT + 99 others); Mon, 24 Feb 2020 16:29:52 -0500 Received: from mail-wm1-f65.google.com ([209.85.128.65]:51317 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1728011AbgBXV3t (ORCPT ); Mon, 24 Feb 2020 16:29:49 -0500 Received: by mail-wm1-f65.google.com with SMTP id t23so846657wmi.1; Mon, 24 Feb 2020 13:29:48 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20161025; h=subject:from:to:cc:references:message-id:date:user-agent :mime-version:in-reply-to:content-language:content-transfer-encoding; bh=4ePoQM9FMGKqv4Tet944qGjHoWr4YdITdi8WCr48XQE=; b=Wsb1P9jQEiF1IO2n76fs9xq4T9QbIj9YXd6SI/DA4Y8j8BTYxfPy+wrh2QxV4WjHBx 34rvlUTboSsZUi4H79FEYfym43FdNTOfMsuUcOGvWMFZdrYjf5zJW2OTODXD7AZ9+Ane aPdroTgvj3vfXzspmGpHDEnAKRlOfb/GHjyYKawYHj7gTX17Ue1VkFzhHYSgJVPqCNzX vgi/6n88QKy9NiwuFt3N7qgD0PU7/bg/6CuTEX8ABVV5FWMI0PlK30uVbf9CnN6H8GPO 82gds9gHr4hufC1K4u+H/4ABcZdp1IxfQwD79fU0FM2Jtpug3uq7G2JxQ98D1w6Cw14B TubA== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:subject:from:to:cc:references:message-id:date :user-agent:mime-version:in-reply-to:content-language :content-transfer-encoding; bh=4ePoQM9FMGKqv4Tet944qGjHoWr4YdITdi8WCr48XQE=; b=hRsEUfpA0mxSBbsqxoRXwgg+a4ZvUZF41AP9WGepOOFhuDB4cNpHeSHiCTsRIrNzZ1 FmE6Jxdlbzf8ignyWuXdVbbDTEPT72a8lQaJJE8Ebuz6bGH+b5FHIKbfMbDq4vDHmSpE So4qEXOnbGY4I1L+wtWkTvZawo+VFuqGAjQ2Q7W87uDdLvhCAn1DIddOryRpk2J7cLzl virF1aC6xh7+fnGAz5KFdhSweQ+sRSnRGBvTp2VZKSynShPr5VlJbGWFT1bNsW4zQEIR GPkg1CmglO70PalYwYlo937zKDc7yI1fWVdhacoIe7YwXJkk23qAaEUZRk/v3n9UvH0R ySMA== X-Gm-Message-State: APjAAAXC7F4L6WVh+t4pFNb4duyeptmiUKItZ4VFrTo8dslcBQWb3yMO iKnwh+6GBrRKQBSts0HfHlkJkmy+ X-Received: by 2002:a1c:4d03:: with SMTP id o3mr919880wmh.164.1582579787655; Mon, 24 Feb 2020 13:29:47 -0800 (PST) Received: from ?IPv6:2003:ea:8f29:6000:3d90:eff:31bc:c6a9? (p200300EA8F2960003D900EFF31BCC6A9.dip0.t-ipconnect.de. [2003:ea:8f29:6000:3d90:eff:31bc:c6a9]) by smtp.googlemail.com with ESMTPSA id b11sm20510727wrx.89.2020.02.24.13.29.46 (version=TLS1_3 cipher=TLS_AES_128_GCM_SHA256 bits=128/128); Mon, 24 Feb 2020 13:29:47 -0800 (PST) Subject: [PATCH 5/8] net: sungem: use pci_status_get_and_clear_errors From: Heiner Kallweit To: Bjorn Helgaas , Realtek linux nic maintainers , David Miller , Mirko Lindner , Stephen Hemminger , Clemens Ladisch , Jaroslav Kysela , Takashi Iwai Cc: "linux-pci@vger.kernel.org" , Linux Kernel Mailing List , "netdev@vger.kernel.org" , alsa-devel@alsa-project.org References: <5939f711-92aa-e7ed-2a26-4f1e4169f786@gmail.com> Message-ID: Date: Mon, 24 Feb 2020 22:26:35 +0100 User-Agent: Mozilla/5.0 (Windows NT 10.0; WOW64; rv:68.0) Gecko/20100101 Thunderbird/68.5.0 MIME-Version: 1.0 In-Reply-To: <5939f711-92aa-e7ed-2a26-4f1e4169f786@gmail.com> Content-Type: text/plain; charset=utf-8 Content-Language: en-US Content-Transfer-Encoding: 7bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Use new helper pci_status_get_and_clear_errors() to simplify the code. Signed-off-by: Heiner Kallweit --- drivers/net/ethernet/sun/sungem.c | 30 +++++++++--------------------- 1 file changed, 9 insertions(+), 21 deletions(-) diff --git a/drivers/net/ethernet/sun/sungem.c b/drivers/net/ethernet/sun/sungem.c index 8358064fb..2d392a7b1 100644 --- a/drivers/net/ethernet/sun/sungem.c +++ b/drivers/net/ethernet/sun/sungem.c @@ -545,37 +545,25 @@ static int gem_pci_interrupt(struct net_device *dev, struct gem *gp, u32 gem_sta } if (pci_estat & GREG_PCIESTAT_OTHER) { - u16 pci_cfg_stat; + int pci_errs; /* Interrogate PCI config space for the * true cause. */ - pci_read_config_word(gp->pdev, PCI_STATUS, - &pci_cfg_stat); - netdev_err(dev, "Read PCI cfg space status [%04x]\n", - pci_cfg_stat); - if (pci_cfg_stat & PCI_STATUS_PARITY) + pci_errs = pci_status_get_and_clear_errors(gp->pdev); + netdev_err(dev, "PCI status errors[%04x]\n", pci_errs); + if (pci_errs & PCI_STATUS_PARITY) netdev_err(dev, "PCI parity error detected\n"); - if (pci_cfg_stat & PCI_STATUS_SIG_TARGET_ABORT) + if (pci_errs & PCI_STATUS_SIG_TARGET_ABORT) netdev_err(dev, "PCI target abort\n"); - if (pci_cfg_stat & PCI_STATUS_REC_TARGET_ABORT) + if (pci_errs & PCI_STATUS_REC_TARGET_ABORT) netdev_err(dev, "PCI master acks target abort\n"); - if (pci_cfg_stat & PCI_STATUS_REC_MASTER_ABORT) + if (pci_errs & PCI_STATUS_REC_MASTER_ABORT) netdev_err(dev, "PCI master abort\n"); - if (pci_cfg_stat & PCI_STATUS_SIG_SYSTEM_ERROR) + if (pci_errs & PCI_STATUS_SIG_SYSTEM_ERROR) netdev_err(dev, "PCI system error SERR#\n"); - if (pci_cfg_stat & PCI_STATUS_DETECTED_PARITY) + if (pci_errs & PCI_STATUS_DETECTED_PARITY) netdev_err(dev, "PCI parity error\n"); - - /* Write the error bits back to clear them. */ - pci_cfg_stat &= (PCI_STATUS_PARITY | - PCI_STATUS_SIG_TARGET_ABORT | - PCI_STATUS_REC_TARGET_ABORT | - PCI_STATUS_REC_MASTER_ABORT | - PCI_STATUS_SIG_SYSTEM_ERROR | - PCI_STATUS_DETECTED_PARITY); - pci_write_config_word(gp->pdev, - PCI_STATUS, pci_cfg_stat); } /* For all PCI errors, we should reset the chip. */ -- 2.25.1