Linux-EDAC Archive on lore.kernel.org
 help / color / Atom feed
From: "Enrico Weigelt, metux IT consult" <info@metux.net>
To: linux-kernel@vger.kernel.org
Cc: tim@buttersideup.com, james.morse@arm.com, rrichter@marvell.com,
	jdelvare@suse.com, linux@roeck-us.net, miquel.raynal@bootlin.com,
	richard@nod.at, vigneshr@ti.com, linux-crypto@vger.kernel.org,
	linux-edac@vger.kernel.org, linux-hwmon@vger.kernel.org,
	linux-mtd@lists.infradead.org, linux-pci@vger.kernel.org
Subject: [PATCH 4/6] edac: i82443bxgx_edac: use pci_get_device_by_id()
Date: Thu, 28 Nov 2019 13:54:04 +0100
Message-ID: <20191128125406.10417-4-info@metux.net> (raw)
In-Reply-To: <20191128125406.10417-1-info@metux.net>

Use the new pci_get_device_by_id() helper in order to reduce
a bit of boilerplate.

Signed-off-by: Enrico Weigelt, metux IT consult <info@metux.net>
---
 drivers/edac/i82443bxgx_edac.c | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/drivers/edac/i82443bxgx_edac.c b/drivers/edac/i82443bxgx_edac.c
index a2ca929e2168..c01f51a4848c 100644
--- a/drivers/edac/i82443bxgx_edac.c
+++ b/drivers/edac/i82443bxgx_edac.c
@@ -407,15 +407,13 @@ static int __init i82443bxgx_edacmc_init(void)
 		goto fail0;
 
 	if (mci_pdev == NULL) {
-		const struct pci_device_id *id = &i82443bxgx_pci_tbl[0];
 		int i = 0;
 		i82443bxgx_registered = 0;
 
-		while (mci_pdev == NULL && id->vendor != 0) {
-			mci_pdev = pci_get_device(id->vendor,
-					id->device, NULL);
+		while (mci_pdev == NULL && i82443bxgx_pci_tbl[i].vendor) {
+			mci_pdev = pci_get_device_by_id(
+				&i82443bxgx_pci_tbl[i]);
 			i++;
-			id = &i82443bxgx_pci_tbl[i];
 		}
 		if (!mci_pdev) {
 			edac_dbg(0, "i82443bxgx pci_get_device fail\n");
-- 
2.11.0


  parent reply index

Thread overview: 8+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2019-11-28 12:54 [PATCH 1/6] include: linux: pci.h: introduce pci_get_device_by_id() Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 2/6] mtd: maps: esb2rom: use pci_get_device_by_id() Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 3/6] mtd: maps: amd76xrom: " Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` Enrico Weigelt, metux IT consult [this message]
2019-11-28 13:28   ` [PATCH 4/6] edac: i82443bxgx_edac: " Robert Richter
2019-11-28 12:54 ` [PATCH 5/6] char: hw_random: intel-rng: " Enrico Weigelt, metux IT consult
2019-11-28 12:54 ` [PATCH 6/6] (v3) drivers: hwmon: i5k_amb: simplify probing / device identification Enrico Weigelt, metux IT consult
2019-11-28 14:21   ` Guenter Roeck

Reply instructions:

You may reply publically 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=20191128125406.10417-4-info@metux.net \
    --to=info@metux.net \
    --cc=james.morse@arm.com \
    --cc=jdelvare@suse.com \
    --cc=linux-crypto@vger.kernel.org \
    --cc=linux-edac@vger.kernel.org \
    --cc=linux-hwmon@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-mtd@lists.infradead.org \
    --cc=linux-pci@vger.kernel.org \
    --cc=linux@roeck-us.net \
    --cc=miquel.raynal@bootlin.com \
    --cc=richard@nod.at \
    --cc=rrichter@marvell.com \
    --cc=tim@buttersideup.com \
    --cc=vigneshr@ti.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

Linux-EDAC Archive on lore.kernel.org

Archives are clonable:
	git clone --mirror https://lore.kernel.org/linux-edac/0 linux-edac/git/0.git

	# If you have public-inbox 1.1+ installed, you may
	# initialize and index your mirror using the following commands:
	public-inbox-init -V2 linux-edac linux-edac/ https://lore.kernel.org/linux-edac \
		linux-edac@vger.kernel.org
	public-inbox-index linux-edac

Example config snippet for mirrors

Newsgroup available over NNTP:
	nntp://nntp.lore.kernel.org/org.kernel.vger.linux-edac


AGPL code for this site: git clone https://public-inbox.org/public-inbox.git