From patchwork Thu Nov 28 12:54:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 11265969 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id A6D9F13A4 for ; Thu, 28 Nov 2019 12:58:56 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 876F021774 for ; Thu, 28 Nov 2019 12:58:56 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726545AbfK1M64 (ORCPT ); Thu, 28 Nov 2019 07:58:56 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:54199 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726252AbfK1M64 (ORCPT ); Thu, 28 Nov 2019 07:58:56 -0500 Received: from orion.localdomain ([95.117.37.214]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MUY9w-1iRTdx29gW-00QSQQ; Thu, 28 Nov 2019 13:54:33 +0100 From: "Enrico Weigelt, metux IT consult" 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 1/6] include: linux: pci.h: introduce pci_get_device_by_id() Date: Thu, 28 Nov 2019 13:54:01 +0100 Message-Id: <20191128125406.10417-1-info@metux.net> X-Mailer: git-send-email 2.11.0 X-Provags-ID: V03:K1:38OkZkxKYjduW4lFWkkXpmNgmHkotIPpFTk3wHRoh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9hGIaHd2hXzWKKrAYXxWLNoAfpPpxkBab7RONNYNsZ/y1Ty +vl6YAdeoGR8p0KxwDZg== Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Enrico Weigelt Introduce a little helper for getting pci device via struct pci_device_id, helpful for reducing a little bit of boilerplate. Signed-off-by: Enrico Weigelt, metux IT consult --- include/linux/pci.h | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/include/linux/pci.h b/include/linux/pci.h index eb9f371aa77c..f6650b13724a 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -1050,6 +1050,21 @@ struct pci_bus *pci_find_next_bus(const struct pci_bus *from); struct pci_dev *pci_get_device(unsigned int vendor, unsigned int device, struct pci_dev *from); + +/** + * pci_get_device_by_id() - get pci dev by struct pci_device_id + * @id: pci_device_id struct + * + * Retrieve PCI device by struct pci_device_id struct + * + * @return: pointer to struct pci_dev if sucessful, NULL otherwise + */ +static inline struct pci_dev *pci_get_device_by_id( + const struct pci_device_id *id) +{ + return pci_get_device(id->vendor, id->device, NULL); +} + struct pci_dev *pci_get_subsys(unsigned int vendor, unsigned int device, unsigned int ss_vendor, unsigned int ss_device, struct pci_dev *from); From patchwork Thu Nov 28 12:54:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 11265951 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id D83F5138C for ; Thu, 28 Nov 2019 12:56:54 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id B78C721774 for ; Thu, 28 Nov 2019 12:56:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726681AbfK1M4y (ORCPT ); Thu, 28 Nov 2019 07:56:54 -0500 Received: from mout.kundenserver.de ([212.227.126.187]:33409 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbfK1M4x (ORCPT ); Thu, 28 Nov 2019 07:56:53 -0500 Received: from orion.localdomain ([95.117.37.214]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MyK1E-1hbdcU0isO-00ydb8; Thu, 28 Nov 2019 13:54:34 +0100 From: "Enrico Weigelt, metux IT consult" 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 2/6] mtd: maps: esb2rom: use pci_get_device_by_id() Date: Thu, 28 Nov 2019 13:54:02 +0100 Message-Id: <20191128125406.10417-2-info@metux.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191128125406.10417-1-info@metux.net> References: <20191128125406.10417-1-info@metux.net> X-Provags-ID: V03:K1:LJ4XD4Q1I99644y7Yi8gy5ObuDirUwTeYOjL2svDYQFbmIEiqVd vGqICSXk5rQO+LpL8caYsCfU5mx3d3HH5lM+2lZ2CEC58FUd5oY6TspsspPuQyR8euODIMZ n1i2gE8epRjsRuicdy7dtKZt2dS7q4Yan+TOCBWn6G9TyYJU4ClCXJ6c0GAieG84hIBeQbF 5BlvrLn6Hpt6J17cgNARA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:huBOBxAjfPw=:zTo6XDhnLLzzv4ltg2BFi1 nF2A00B8dy/VI82VW2OR01ds3tNc3tlEoJbXB2DTIR8n8UfO5/gexNjvuMhroiSHZIXOd3kvx jGNfa5bnxm1dbSM0gMs+w/D6WU8b9vg55rfVAqAY/gh3PLZFnRjlVbKILDLKsKA8gMEllJIWa MKleovtQv0maEKfs6ZGBCqYa3JoG2XmXP7pY2rA46EZyHg4HuDgtVhMa9RFQ5FvPR/TZHgTkX eAWmw44grNDI5c1aHxTSzw6XrY2hq5gKGxCHeKlqP2G+UKnfunIU5Wiop4A4T3eoxBh+qUliP /hmcVhTWAHRRqb1kyliqjsonMyZVmpIIXrfntkaJD577lHx7deq4OB+vCqt0VlBItzHd/aQMk 4n/WY/6SI3nFbPxXamY6/F31fegGPmno9Si3NvXd/tZbtgJEPpVvD9vZynF6/fD6SvOhFMWYW xNkgPUQQ2QCSIDdIyfUtLtcKRSTqn93H2r00mAUcQ3IYbM/VOcoivlgbOeMehDgxA3tBIdMtx 7nltM8Qh54ZJir0i84C1ziLMX13ZP0oD+y3hYBv283tLfALIGCDDje1bxzCJFfuuj8FgcD8jh cpPACtaPhZCZT2Zb27kDXOFvd6O1ePurAbNrIaRckJOmdoz6HXkDWtPJ+dhKPn2YB3Ch4CRT9 qGB05QuHTPE+MoD+Tu3H6EMjm+BOtddiG72X5hMDgKwZx/m+6AGzFjiLFMAtd1uavzPqCPrGr hTttJv+ul5QcjQNcqwdBDyCFqhITSMjI/0bb9Neas+U0GwS2Z+ZPC2aHk/bvb0+wJAssQ8IyH G+Mh+rLaqXVLNlC8EaSnZ++5+T2u8tT4WxyfiGko+FA50gM9mKPmEl9OHzpHqWghgcpPBwTUz oi7mN497nCPqXxEoMqNw== Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org From: Enrico Weigelt 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 --- drivers/mtd/maps/esb2rom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/maps/esb2rom.c b/drivers/mtd/maps/esb2rom.c index 5c27c6994896..0c638ac6ad82 100644 --- a/drivers/mtd/maps/esb2rom.c +++ b/drivers/mtd/maps/esb2rom.c @@ -421,7 +421,7 @@ static int __init init_esb2rom(void) pdev = NULL; for (id = esb2rom_pci_tbl; id->vendor; id++) { printk(KERN_DEBUG "device id = %x\n", id->device); - pdev = pci_get_device(id->vendor, id->device, NULL); + pdev = pci_get_device_by_id(id); if (pdev) { printk(KERN_DEBUG "matched device = %x\n", id->device); break; From patchwork Thu Nov 28 12:54:03 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 11265985 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id E70326C1 for ; Thu, 28 Nov 2019 13:00:36 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id C456221775 for ; Thu, 28 Nov 2019 13:00:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726556AbfK1NAg (ORCPT ); Thu, 28 Nov 2019 08:00:36 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:58291 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726448AbfK1NAg (ORCPT ); Thu, 28 Nov 2019 08:00:36 -0500 Received: from orion.localdomain ([95.117.37.214]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MKKER-1iEWnt3SjH-00LkPB; Thu, 28 Nov 2019 13:54:34 +0100 From: "Enrico Weigelt, metux IT consult" 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 3/6] mtd: maps: amd76xrom: use pci_get_device_by_id() Date: Thu, 28 Nov 2019 13:54:03 +0100 Message-Id: <20191128125406.10417-3-info@metux.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191128125406.10417-1-info@metux.net> References: <20191128125406.10417-1-info@metux.net> X-Provags-ID: V03:K1:kHHWDalUVUqjlafRyIBDsEVrMDclpS6WFOcs2fJqalWicwdQghg xuEXtV526bjd5k4WcJfvLri5gHj3mTA2elZo05psIN/BL0IYjbsFx73zY7qOePNgjzjErsa kephRy+9U7L17Fjl1nNwmeDO5WtgjG4pSkuT9CawtD2JlPNhZQi26P0EcKRYUshBzobhF/h zCsfwx4mIUAImOjsQ+atw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:HVNFLXUI8no=:Nc0GdKIXzMS7m180256uDy jCFDBRie3blvAsXX+pcsXjmc479xIx8f5/lZCyg8xMQZwTcIOZWWhVvaXcrSQvuRmCkDJD+yz xi13CUwqIUGbCnxDx4HwD1DwXt3UW1QH0SwM0mtzNFbWBVXXoUZTl7S1YyTqwCZZG/QqFEql/ KXGfoEv7z711cgxYbuynC1dj5W0vcc0n1QSZSdcCUrm/7nnrD70V9hEa3FdmyJYpX+EA7FqaE NE4sdcvhdg/EW6OQOv2QINUEofKv0d/g9h9H/POzWr8oQ8WPf0iXEMfQOFFWr3mk76Nia1l/x GeKYo2M7k3h+Q11m34NEcm6hmwAqotrk7gGSW8ICDHj36cDjFYY3wB2QknwRAGp3ONoC9x44J 2o3HnIhGKChll6830UJPp1xuG7bZZNiJO5apnFTK8lmlEgjSMPV/ynWGb0YGEATxI8bYUtSw8 tD0Aycmup8cAkUGNFI3TrHtlg4sgYSRXHRcOCnbVqaBWmNwRmuXS4Q/fVvW0ayNZKcy8X274k GVDTQ8qX8E8RR5r8xEWtaFlh29j0UPWsJr1Afix5Yp/s2DiXQ/56GVkEDfp4nY7jx5dR9VP3C DdHyD7FXgrW5pPgGulBP5FOdKqCiTLdmlH+YcsrZY/6yh1MPvJWx9BLp5DaXAWdcQhj2vs3wf Cm5rWh57LhE43A/XHN6SSJGP0L7+u7PdHLWtYH36k/NFeXbeaTzR5e3311LdUauXeSht7/fNw lAJPgZfup5MeWPNT7Hq1tRVoC2apQG+jn70abCWQg/ybgXsLXerEWsCieft9hca8+V3btu1IW uu+dfpMkilp/WPQK1n86856jiB1m+wC896dZy8GvAM3YEA6yU3s9PHEIN7KIHE0+QKbKIaq8N SY+iucKAdtRbwvbTWAQw== Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org 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 --- drivers/mtd/maps/amd76xrom.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/mtd/maps/amd76xrom.c b/drivers/mtd/maps/amd76xrom.c index 462fadb56bdb..07a402dbdf44 100644 --- a/drivers/mtd/maps/amd76xrom.c +++ b/drivers/mtd/maps/amd76xrom.c @@ -323,7 +323,7 @@ static int __init init_amd76xrom(void) const struct pci_device_id *id; pdev = NULL; for(id = amd76xrom_pci_tbl; id->vendor; id++) { - pdev = pci_get_device(id->vendor, id->device, NULL); + pdev = pci_get_device_by_id(id); if (pdev) { break; } From patchwork Thu Nov 28 12:54:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 11265945 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0A0B51393 for ; Thu, 28 Nov 2019 12:56:50 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id DE01521774 for ; Thu, 28 Nov 2019 12:56:49 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726448AbfK1M4t (ORCPT ); Thu, 28 Nov 2019 07:56:49 -0500 Received: from mout.kundenserver.de ([212.227.126.131]:47357 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbfK1M4t (ORCPT ); Thu, 28 Nov 2019 07:56:49 -0500 Received: from orion.localdomain ([95.117.37.214]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1Mj8Vx-1hvDjy246X-00fC0B; Thu, 28 Nov 2019 13:54:35 +0100 From: "Enrico Weigelt, metux IT consult" 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> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191128125406.10417-1-info@metux.net> References: <20191128125406.10417-1-info@metux.net> X-Provags-ID: V03:K1:9EUuGTPFx9yVqpEoKdlnLYODqk9fzt9TtUcFLxUJNQuCt8Dur2J ACsPPHh76A4wFy8Z88Uwcih8Gh0dLZpBgM8CFlKvY0QA8CbpcQLiyPn2pyQvfVC0LvrKJga Cc1aJBxlcwchVkCPVIP3TXc8IMtS9wGQaNQjzGegaEmSeVHuId1bQ7trzN6njcAQpcGXqw0 CyUuKxSGvW13czLk3/woA== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:/fn+U6evcp8=:mG00zLE+KR2h6oHqb9009C L0fikJ9nBQgS+pmDUpSajRT4HUgHowXnOvY7nwciAUil9VzSSq5nS6YUn9wUiEJbCmBNMLBBi 9GNdhWPS1tyZZwSwlZKHW8wKz+wikAN8xUu6xrk4YFNN23kXZplI4zmNLc+Lm5NyhRAcNdTIn zy59HI05sybYGVBCSLYg7ZHBT8R1zeYbZwKMqGNW4KS58cEhkWwLinI5jCexhRJ84HZZ+BoN1 G3gCzTOfZgWRYOZCs88AkG/lhETTv0KlMQYhKgL7ekvBt7psZVSXZ/8i3OBWs8nO/GhCTTNyJ zoZAY24hx+Pi36uQKrn26DyHbKnFkAWh/JhYMI+8XYHj3RMrXDJmLGAADEQ8R7udrni5VDqRQ lIUeB02b37i4SJS82xbox6wwsVxwI4Y0yKU7hg41FJkk0yO59QBugIBSQMqoMuC8LwGZhF5Tt ChOYleEqTKERFMWYdnAQpTtmOUQYPTKU/6K02ai1cOGFMYV2JbZk1eMDM/7homG2m5rb9bIIl FtwTTsakh/VyDO4Xv+1wDFd/Ikjme1b8mbIQclCY8siGvzx4CZh0wrQpHYOLhR6tJC17XL3mK IaVxXZbWmn5zjH4JoffpYxppi9setLwa8TImMh23Np222al9COuJD16fmAPMYIbRxoHwrk4HP 8Sd3yluxx5TCu/GorU/8vmVsRwGuRqEDm9KjAC2Cnn94lyTRGo1dVG/xfH+/xJGUfQgeab/lE IAshHFivK66H3YugaZnI3Fi5fIl4E0cFBdikOvm05PGkuNcE6Jv9wBeexKJo7o3NB+eECt7hu 99QB4XBE7inceZX+WISbvRB+ohIstws4Entssak1jqg2wR4RN1TBTWYp/wY0m2rLoAKQCa+x/ B6FZ1HHlOMjNBYVsVT/A== Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org 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 --- 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"); From patchwork Thu Nov 28 12:54:05 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 11265959 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 1FF1C15AB for ; Thu, 28 Nov 2019 12:57:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id 01B192178F for ; Thu, 28 Nov 2019 12:57:02 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726715AbfK1M4y (ORCPT ); Thu, 28 Nov 2019 07:56:54 -0500 Received: from mout.kundenserver.de ([212.227.126.133]:42669 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726670AbfK1M4x (ORCPT ); Thu, 28 Nov 2019 07:56:53 -0500 Received: from orion.localdomain ([95.117.37.214]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1MUY9w-1iRTe00XvE-00QSQQ; Thu, 28 Nov 2019 13:54:36 +0100 From: "Enrico Weigelt, metux IT consult" 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 5/6] char: hw_random: intel-rng: use pci_get_device_by_id() Date: Thu, 28 Nov 2019 13:54:05 +0100 Message-Id: <20191128125406.10417-5-info@metux.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191128125406.10417-1-info@metux.net> References: <20191128125406.10417-1-info@metux.net> X-Provags-ID: V03:K1:EbWrMi3cKVLJ5grbOjx3/hSD38kPrYADX4wYa3I2tB+lljpckSy 15HWVYCgNQbjb4Jw3Jq5wDzRihvWg1A40U38MsKdMEXp34A3CDPgBn18wQGaajyXKEeu5ay NsIDm3ieOx2cqQOzjrtF3v4KCOsDSDg4nKPQBitqKPLXkyvJNky+o2SHLXJPJQ6Nw06jjRO p/cWYppeb0dvhCnWHwmrw== X-Spam-Flag: NO X-UI-Out-Filterresults: notjunk:1;V03:K0:b3/pDDdW3UM=:HOt218E1TJBg5l8PwQMbn5 w/I+vFLUvPQdEAp5cDPDg8n2h4ya8JtA1HanhyNAmcyh4vGsMgeYRXlZpmvZupMH+axBIuqxu pVFcwt4Sp1TMawpRn0F8Dv4vvffgxawkECTS8zzNlz8idaOZtBZbVNa8LAmWjXwgSKrkpSodl GnNhy4Pq+UMaqA5ikRxkqWeg9y/u5VllU0cKvl8g+g/brdHyCsqj1pXtL2K/n5bHFOTqC+rzu kI9M8bVpPIUPwYxM0aRhWZ6s8bTo4/CCiIDqsN2HAGB/iyPXUNnPROFJV7w+Z4IMLFcxMm2e2 uNX+S+c0Mr2Q9jCug6/ntRuVhcBUpFChhRw1nCf3jlJi6Rrl7NU16lumMoqUoBmNSdO5ZBiua JDI+G2P254oeJieUNKspfKPMjXMZ+mVbeVUGIBV2EHkADJvn4zHbRZA8npJo2h4urY8LcjVCi F0McB4lBnIjPPbL/XyEZKdx53XUn8OTfNAdQWnk40u1SQ8cjqYLCjbdqw5YHP99HwciWY6qYw YFmBo7tZmLZuXvwd+B8O+8CiJ/K6lSUuZXn3RqDz18foPro7g1/IKzz3/623ktdU3AChdOCud BBaIsqme1ehxmVRejswtrs6qTMwX7saoU0f+2BbMnEWjKA+zrpvwppooxFiT9K/3JcsI4CRRQ C1lU8pQ5UCuTW1INIXckNLWG+HTBP7lmhcLKzmassUponhmRCYGY8LUwg+tC1U2V1s4NBM3DV M376+7mY/UZ2s/l0w27Lqhmv+C7hfea+YTSGQrNnOnNXBS4mFSGa/gsGiJXGg9qt+bXgnF4vx Wf6zkZEV35085jbvkNP9VGozwPbfIZsVTOE+NFgOcG+0J5BFDm3tdRJ5FqwaSS7iQU3gN9iQH yI5kHlzVQgjPoyZ/zF2Q== Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org 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 --- drivers/char/hw_random/intel-rng.c | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/drivers/char/hw_random/intel-rng.c b/drivers/char/hw_random/intel-rng.c index 290c880266bf..6b8d37a81166 100644 --- a/drivers/char/hw_random/intel-rng.c +++ b/drivers/char/hw_random/intel-rng.c @@ -335,8 +335,7 @@ static int __init mod_init(void) struct intel_rng_hw *intel_rng_hw; for (i = 0; !dev && pci_tbl[i].vendor; ++i) - dev = pci_get_device(pci_tbl[i].vendor, pci_tbl[i].device, - NULL); + dev = pci_get_device_by_id(&pci_tbl[i]); if (!dev) goto out; /* Device not found. */ From patchwork Thu Nov 28 12:54:06 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Enrico Weigelt, metux IT consult" X-Patchwork-Id: 11265975 Return-Path: Received: from mail.kernel.org (pdx-korg-mail-1.web.codeaurora.org [172.30.200.123]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 13E5C13A4 for ; Thu, 28 Nov 2019 12:59:02 +0000 (UTC) Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.kernel.org (Postfix) with ESMTP id F16B321781 for ; Thu, 28 Nov 2019 12:59:01 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726694AbfK1M64 (ORCPT ); Thu, 28 Nov 2019 07:58:56 -0500 Received: from mout.kundenserver.de ([212.227.126.134]:38901 "EHLO mout.kundenserver.de" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726320AbfK1M64 (ORCPT ); Thu, 28 Nov 2019 07:58:56 -0500 Received: from orion.localdomain ([95.117.37.214]) by mrelayeu.kundenserver.de (mreue011 [212.227.15.167]) with ESMTPSA (Nemesis) id 1M6lYs-1iS5a63Cne-008K9w; Thu, 28 Nov 2019 13:54:36 +0100 From: "Enrico Weigelt, metux IT consult" 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 6/6] (v3) drivers: hwmon: i5k_amb: simplify probing / device identification Date: Thu, 28 Nov 2019 13:54:06 +0100 Message-Id: <20191128125406.10417-6-info@metux.net> X-Mailer: git-send-email 2.11.0 In-Reply-To: <20191128125406.10417-1-info@metux.net> References: <20191128125406.10417-1-info@metux.net> X-Provags-ID: V03:K1:Nfm/ouWc4jRhP1248kvcV2nWBCbvyeuIdCR2JmLXcgSHdMu+yqx 258WteSO6QCJnHCa1QNT5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BBcPB3e1KJj4M+wy41x3Yr CXgcobIA+Wr+GV2MXlAQ== Sender: linux-edac-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-edac@vger.kernel.org Simpilify the probing by putting all chip-specific data directly into the pci match table, removing the redundant chipset_ids table. Changes v3: * use pci_get_device_by_id() introduces by a previous patch of this queue Changes v2: * use PCI_DEVICE_DATA() macro in the pci match table * directly pass the pci device id to i5k_channel_probe(), instead of computing it internally by extra offset parameter Submitted: 2019-06-06 Signed-off-by: Enrico Weigelt --- drivers/hwmon/i5k_amb.c | 38 +++++++++++++++----------------------- 1 file changed, 15 insertions(+), 23 deletions(-) diff --git a/drivers/hwmon/i5k_amb.c b/drivers/hwmon/i5k_amb.c index b09c39abd3a8..cb85607d104f 100644 --- a/drivers/hwmon/i5k_amb.c +++ b/drivers/hwmon/i5k_amb.c @@ -414,16 +414,14 @@ static int i5k_amb_add(void) } static int i5k_find_amb_registers(struct i5k_amb_data *data, - unsigned long devid) + const struct pci_device_id *devid) { struct pci_dev *pcidev; u32 val32; int res = -ENODEV; /* Find AMB register memory space */ - pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, - devid, - NULL); + pcidev = pci_get_device_by_id(devid); if (!pcidev) return -ENODEV; @@ -447,14 +445,15 @@ static int i5k_find_amb_registers(struct i5k_amb_data *data, return res; } -static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id) +static int i5k_channel_probe(u16 *amb_present, unsigned int vendor, + unsigned int device) { struct pci_dev *pcidev; u16 val16; int res = -ENODEV; /* Copy the DIMM presence map for these two channels */ - pcidev = pci_get_device(PCI_VENDOR_ID_INTEL, dev_id, NULL); + pcidev = pci_get_device(vendor, device, NULL); if (!pcidev) return -ENODEV; @@ -473,23 +472,12 @@ static int i5k_channel_probe(u16 *amb_present, unsigned long dev_id) return res; } -static struct { - unsigned long err; - unsigned long fbd0; -} chipset_ids[] = { - { PCI_DEVICE_ID_INTEL_5000_ERR, PCI_DEVICE_ID_INTEL_5000_FBD0 }, - { PCI_DEVICE_ID_INTEL_5400_ERR, PCI_DEVICE_ID_INTEL_5400_FBD0 }, - { 0, 0 } -}; - -#ifdef MODULE static const struct pci_device_id i5k_amb_ids[] = { - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5000_ERR) }, - { PCI_DEVICE(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_5400_ERR) }, + { PCI_DEVICE_DATA(INTEL, 5000_ERR, PCI_DEVICE_ID_INTEL_5000_FBD0) }, + { PCI_DEVICE_DATA(INTEL, 5400_ERR, PCI_DEVICE_ID_INTEL_5400_FBD0) }, { 0, } }; MODULE_DEVICE_TABLE(pci, i5k_amb_ids); -#endif static int i5k_amb_probe(struct platform_device *pdev) { @@ -504,22 +492,26 @@ static int i5k_amb_probe(struct platform_device *pdev) /* Figure out where the AMB registers live */ i = 0; do { - res = i5k_find_amb_registers(data, chipset_ids[i].err); + res = i5k_find_amb_registers(data, &i5k_amb_ids[i]); if (res == 0) break; i++; - } while (chipset_ids[i].err); + } while (i5k_amb_ids[i].device); if (res) goto err; /* Copy the DIMM presence map for the first two channels */ - res = i5k_channel_probe(&data->amb_present[0], chipset_ids[i].fbd0); + res = i5k_channel_probe(&data->amb_present[0], + i5k_amb_ids[i].vendor, + i5k_amb_ids[i].driver_data); if (res) goto err; /* Copy the DIMM presence map for the optional second two channels */ - i5k_channel_probe(&data->amb_present[2], chipset_ids[i].fbd0 + 1); + i5k_channel_probe(&data->amb_present[2], + i5k_amb_ids[i].vendor, + i5k_amb_ids[i].driver_data+1); /* Set up resource regions */ reso = request_mem_region(data->amb_base, data->amb_len, DRVNAME);