linux-pci.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Heiner Kallweit <hkallweit1@gmail.com>
To: Bjorn Helgaas <bhelgaas@google.com>,
	Realtek linux nic maintainers <nic_swsd@realtek.com>,
	David Miller <davem@davemloft.net>,
	Mirko Lindner <mlindner@marvell.com>,
	Stephen Hemminger <stephen@networkplumber.org>,
	Clemens Ladisch <clemens@ladisch.de>,
	Jaroslav Kysela <perex@perex.cz>, Takashi Iwai <tiwai@suse.com>
Cc: "linux-pci@vger.kernel.org" <linux-pci@vger.kernel.org>,
	Linux Kernel Mailing List <linux-kernel@vger.kernel.org>,
	"netdev@vger.kernel.org" <netdev@vger.kernel.org>,
	alsa-devel@alsa-project.org
Subject: [PATCH v3 3/8] r8169: use pci_status_get_and_clear_errors
Date: Tue, 25 Feb 2020 15:04:52 +0100	[thread overview]
Message-ID: <d11d10d9-aeeb-e31f-29f6-02de977f29bf@gmail.com> (raw)
In-Reply-To: <20ca7c1f-7530-2d89-40a6-d97a65aa25ef@gmail.com>

Use new helper pci_status_get_and_clear_errors() to simplify the code.

Signed-off-by: Heiner Kallweit <hkallweit1@gmail.com>
---
 drivers/net/ethernet/realtek/r8169_main.c | 15 ++++++---------
 1 file changed, 6 insertions(+), 9 deletions(-)

diff --git a/drivers/net/ethernet/realtek/r8169_main.c b/drivers/net/ethernet/realtek/r8169_main.c
index f081007a2..4495a3cf9 100644
--- a/drivers/net/ethernet/realtek/r8169_main.c
+++ b/drivers/net/ethernet/realtek/r8169_main.c
@@ -4357,13 +4357,15 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
 {
 	struct rtl8169_private *tp = netdev_priv(dev);
 	struct pci_dev *pdev = tp->pci_dev;
-	u16 pci_status, pci_cmd;
+	int pci_status_errs;
+	u16 pci_cmd;
 
 	pci_read_config_word(pdev, PCI_COMMAND, &pci_cmd);
-	pci_read_config_word(pdev, PCI_STATUS, &pci_status);
 
-	netif_err(tp, intr, dev, "PCI error (cmd = 0x%04x, status = 0x%04x)\n",
-		  pci_cmd, pci_status);
+	pci_status_errs = pci_status_get_and_clear_errors(pdev);
+
+	netif_err(tp, intr, dev, "PCI error (cmd = 0x%04x, status_errs = 0x%04x)\n",
+		  pci_cmd, pci_status_errs);
 
 	/*
 	 * The recovery sequence below admits a very elaborated explanation:
@@ -4380,11 +4382,6 @@ static void rtl8169_pcierr_interrupt(struct net_device *dev)
 
 	pci_write_config_word(pdev, PCI_COMMAND, pci_cmd);
 
-	pci_write_config_word(pdev, PCI_STATUS,
-		pci_status & (PCI_STATUS_DETECTED_PARITY |
-		PCI_STATUS_SIG_SYSTEM_ERROR | PCI_STATUS_REC_MASTER_ABORT |
-		PCI_STATUS_REC_TARGET_ABORT | PCI_STATUS_SIG_TARGET_ABORT));
-
 	rtl_schedule_task(tp, RTL_FLAG_TASK_RESET_PENDING);
 }
 
-- 
2.25.1



  parent reply	other threads:[~2020-02-25 14:09 UTC|newest]

Thread overview: 13+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2020-02-25 14:03 [PATCH v3 0/8] PCI: add and use constant PCI_STATUS_ERROR_BITS and helper pci_status_get_and_clear_errors Heiner Kallweit
2020-02-25 14:03 ` [PATCH v3 1/8] PCI: add constant PCI_STATUS_ERROR_BITS Heiner Kallweit
2020-02-25 20:50   ` Bjorn Helgaas
2020-02-25 21:35     ` Heiner Kallweit
2020-02-25 14:04 ` [PATCH v3 2/8] PCI: add pci_status_get_and_clear_errors Heiner Kallweit
2020-02-25 20:57   ` Bjorn Helgaas
2020-02-25 14:04 ` Heiner Kallweit [this message]
2020-02-25 14:05 ` [PATCH v3 4/8] net: cassini: use pci_status_get_and_clear_errors Heiner Kallweit
2020-02-25 14:05 ` [PATCH v3 5/8] net: sungem: " Heiner Kallweit
2020-02-25 14:06 ` [PATCH v3 6/8] net: skfp: use PCI_STATUS_ERROR_BITS Heiner Kallweit
2020-02-25 14:07 ` [PATCH v3 7/8] PCI: pci-bridge-emul: " Heiner Kallweit
2020-02-25 14:07 ` [PATCH v3 8/8] sound: bt87x: use pci_status_get_and_clear_errors Heiner Kallweit
2020-02-25 20:57 ` [PATCH v3 0/8] PCI: add and use constant PCI_STATUS_ERROR_BITS and helper pci_status_get_and_clear_errors Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=d11d10d9-aeeb-e31f-29f6-02de977f29bf@gmail.com \
    --to=hkallweit1@gmail.com \
    --cc=alsa-devel@alsa-project.org \
    --cc=bhelgaas@google.com \
    --cc=clemens@ladisch.de \
    --cc=davem@davemloft.net \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=mlindner@marvell.com \
    --cc=netdev@vger.kernel.org \
    --cc=nic_swsd@realtek.com \
    --cc=perex@perex.cz \
    --cc=stephen@networkplumber.org \
    --cc=tiwai@suse.com \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).