From patchwork Sun Aug 11 15:07:56 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088971 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 49421912 for ; Sun, 11 Aug 2019 15:08:41 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 3B24426E47 for ; Sun, 11 Aug 2019 15:08:41 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 2F2BA27DA4; Sun, 11 Aug 2019 15:08:41 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D646526E47 for ; Sun, 11 Aug 2019 15:08:40 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726578AbfHKPId (ORCPT ); Sun, 11 Aug 2019 11:08:33 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:45433 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbfHKPIc (ORCPT ); Sun, 11 Aug 2019 11:08:32 -0400 Received: by mail-wr1-f67.google.com with SMTP id q12so12232034wrj.12; Sun, 11 Aug 2019 08:08:30 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=nxzAYP11S0d/1a3dYYvLWUsgWAZhT+IPIf01ibLHMzA=; b=tERWaxWvAJHPhNnSUfvH2TV0d5qSZRIgCjVz6UZokXxJqBTytjsuS/M6JRAO4kzdf+ bJy+sYgFdnSsj5q2c/HndwoO4nHSsckPH0QmpvSIYhM+Yv0QjlJ+MhmbMPi/Uvxdg/Nu 2pw0L7kZQyR9wFCg7qKRnus4l+XE+V6zefnl+ro5BQ/Ua4idwnVhE4b7tSrA70oDAmNy WRSlh0Ezikj0WaCQQCzSV2U40yIy+QqaWgZczB+aEtjHnF29V5I+rGsxhpHYDWEUpDi3 KyiqDiyC3ZTO7xB9q9Xc3uO86YBWQOMOoJEoUjnMigTb3bAjh13Xg4Q1I64+RCtqp+Kd NeuA== X-Gm-Message-State: APjAAAX/i4HZVmLZwBdi3byVL/gts2DL2ZrwXy8lYFpKuMz/fbh/1X7P MCkmCs88yt8EKv+nAOTM4iU= X-Google-Smtp-Source: APXvYqxmOhuT2C9Rk5NraUXMAcsMupScQ5Aoa3l0Jcg3FmKsUIC3Gv4rRck3bH+3r4UQqkKyZE5f1Q== X-Received: by 2002:adf:f186:: with SMTP id h6mr34996098wro.274.1565536109482; Sun, 11 Aug 2019 08:08:29 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.08.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:08:29 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Sebastian Ott , Gerald Schaefer , "H. Peter Anvin" , Giuseppe Cavallaro , Alexandre Torgue , Matt Porter , Alexandre Bounine , Peter Jones , Bartlomiej Zolnierkiewicz , Cornelia Huck , Alex Williamson , kvm@vger.kernel.org, linux-fbdev@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 1/7] PCI: Add define for the number of standard PCI BARs Date: Sun, 11 Aug 2019 18:07:56 +0300 Message-Id: <20190811150802.2418-2-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Code that iterates over all standard PCI BARs typically uses PCI_STD_RESOURCE_END. However, it requires the "unusual" loop condition "i <= PCI_STD_RESOURCE_END" rather than something more standard like "i < PCI_STD_NUM_BARS". This patch adds the definition PCI_STD_NUM_BARS which is equivalent to "PCI_STD_RESOURCE_END + 1" and updates loop conditions to use it. Signed-off-by: Denis Efremov --- drivers/pci/quirks.c | 2 +- include/linux/pci.h | 2 +- include/uapi/linux/pci_regs.h | 1 + 3 files changed, 3 insertions(+), 2 deletions(-) diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 208aacf39329..02bdf3a0231e 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -475,7 +475,7 @@ static void quirk_extend_bar_to_page(struct pci_dev *dev) { int i; - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { struct resource *r = &dev->resource[i]; if (r->flags & IORESOURCE_MEM && resource_size(r) < PAGE_SIZE) { diff --git a/include/linux/pci.h b/include/linux/pci.h index 9e700d9f9f28..7b9590d5dc2d 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -76,7 +76,7 @@ enum pci_mmap_state { enum { /* #0-5: standard PCI resources */ PCI_STD_RESOURCES, - PCI_STD_RESOURCE_END = 5, + PCI_STD_RESOURCE_END = PCI_STD_RESOURCES + PCI_STD_NUM_BARS - 1, /* #6: expansion ROM resource */ PCI_ROM_RESOURCE, diff --git a/include/uapi/linux/pci_regs.h b/include/uapi/linux/pci_regs.h index f28e562d7ca8..68b571d491eb 100644 --- a/include/uapi/linux/pci_regs.h +++ b/include/uapi/linux/pci_regs.h @@ -34,6 +34,7 @@ * of which the first 64 bytes are standardized as follows: */ #define PCI_STD_HEADER_SIZEOF 64 +#define PCI_STD_NUM_BARS 6 /* Number of standard BARs */ #define PCI_VENDOR_ID 0x00 /* 16 bits */ #define PCI_DEVICE_ID 0x02 /* 16 bits */ #define PCI_COMMAND 0x04 /* 16 bits */ From patchwork Sun Aug 11 15:07:57 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088973 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 139FF13B1 for ; Sun, 11 Aug 2019 15:08:47 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 04A9726E47 for ; Sun, 11 Aug 2019 15:08:47 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id ED5BB27DA4; Sun, 11 Aug 2019 15:08:46 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D197126E47 for ; Sun, 11 Aug 2019 15:08:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726618AbfHKPIl (ORCPT ); Sun, 11 Aug 2019 11:08:41 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:40600 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726566AbfHKPIk (ORCPT ); Sun, 11 Aug 2019 11:08:40 -0400 Received: by mail-wr1-f68.google.com with SMTP id r1so3399847wrl.7; Sun, 11 Aug 2019 08:08:38 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=k/qi0SvYqBli9Esfc6tl2+oW6+EGx4WAoL8xLyXwybo=; b=jcR79KmWfqVnvcxgYwwldxr9nCX+Ay+vebu2kYgDLxzZiFtcu6jENdngxsx1wL24sI Bq9BeMlMiQ/rZcvaz3GWsK4sZlXnp6eVoqhLWx418mZB/P5AnKJqG7KuytslgA7NxAuC 45g8lf6N1E8WmWYJgpBHyLgRfiXTSiKxmtP3lxGnsrAvBc8bv6uzp9GUpy5VFnytJXkw fXHruP6O4Xk/nTMwZiFXLlGtfbBb50qLCj6h97SV0hA0lP7H5v1BfEx3gmYv4g53mA1V /26hRNp5ZgX/50CnPTU/QlpM1QEYexdAT84SKUvEbSVKH53gpygGxcK7aolPHFPajBwb ERkA== X-Gm-Message-State: APjAAAXYx3WebHKrauEBMB1AhIh1bpmgoNUCQ0YkA9ciVLDAL6VsQhC7 LWswhiG8U/UnLM2P9WNwE14= X-Google-Smtp-Source: APXvYqzvBaautR6f7DgRK98zeUTgnnEkICt6CmfBiGp4/CW+elErZwrCFJRxSTIyrbHRMM++d5ZSWQ== X-Received: by 2002:adf:d188:: with SMTP id v8mr14801152wrc.213.1565536118001; Sun, 11 Aug 2019 08:08:38 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.08.37 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:08:37 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Sebastian Ott , Gerald Schaefer , linux-s390@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 2/7] s390/pci: Replace PCI_BAR_COUNT with PCI_STD_NUM_BARS Date: Sun, 11 Aug 2019 18:07:57 +0300 Message-Id: <20190811150802.2418-3-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch replaces local define PCI_BAR_COUNT with global PCI_STD_NUM_BARS. Signed-off-by: Denis Efremov --- arch/s390/include/asm/pci.h | 5 +---- arch/s390/include/asm/pci_clp.h | 6 +++--- arch/s390/pci/pci.c | 16 ++++++++-------- arch/s390/pci/pci_clp.c | 6 +++--- 4 files changed, 15 insertions(+), 18 deletions(-) diff --git a/arch/s390/include/asm/pci.h b/arch/s390/include/asm/pci.h index a2399eff84ca..3a06c264ea53 100644 --- a/arch/s390/include/asm/pci.h +++ b/arch/s390/include/asm/pci.h @@ -2,9 +2,6 @@ #ifndef __ASM_S390_PCI_H #define __ASM_S390_PCI_H -/* must be set before including pci_clp.h */ -#define PCI_BAR_COUNT 6 - #include #include #include @@ -138,7 +135,7 @@ struct zpci_dev { char res_name[16]; bool mio_capable; - struct zpci_bar_struct bars[PCI_BAR_COUNT]; + struct zpci_bar_struct bars[PCI_STD_NUM_BARS]; u64 start_dma; /* Start of available DMA addresses */ u64 end_dma; /* End of available DMA addresses */ diff --git a/arch/s390/include/asm/pci_clp.h b/arch/s390/include/asm/pci_clp.h index 50359172cc48..bd2cb4ea7d93 100644 --- a/arch/s390/include/asm/pci_clp.h +++ b/arch/s390/include/asm/pci_clp.h @@ -77,7 +77,7 @@ struct mio_info { struct { u64 wb; u64 wt; - } addr[PCI_BAR_COUNT]; + } addr[PCI_STD_NUM_BARS]; u32 reserved[6]; } __packed; @@ -98,9 +98,9 @@ struct clp_rsp_query_pci { u16 util_str_avail : 1; /* utility string available? */ u16 pfgid : 8; /* pci function group id */ u32 fid; /* pci function id */ - u8 bar_size[PCI_BAR_COUNT]; + u8 bar_size[PCI_STD_NUM_BARS]; u16 pchid; - __le32 bar[PCI_BAR_COUNT]; + __le32 bar[PCI_STD_NUM_BARS]; u8 pfip[CLP_PFIP_NR_SEGMENTS]; /* pci function internal path */ u32 : 16; u8 fmb_len; diff --git a/arch/s390/pci/pci.c b/arch/s390/pci/pci.c index b0e3b9a0e488..c57ccac25c02 100644 --- a/arch/s390/pci/pci.c +++ b/arch/s390/pci/pci.c @@ -43,7 +43,7 @@ static DECLARE_BITMAP(zpci_domain, ZPCI_NR_DEVICES); static DEFINE_SPINLOCK(zpci_domain_lock); #define ZPCI_IOMAP_ENTRIES \ - min(((unsigned long) ZPCI_NR_DEVICES * PCI_BAR_COUNT / 2), \ + min(((unsigned long) ZPCI_NR_DEVICES * PCI_STD_NUM_BARS / 2), \ ZPCI_IOMAP_MAX_ENTRIES) static DEFINE_SPINLOCK(zpci_iomap_lock); @@ -294,7 +294,7 @@ static void __iomem *pci_iomap_range_mio(struct pci_dev *pdev, int bar, void __iomem *pci_iomap_range(struct pci_dev *pdev, int bar, unsigned long offset, unsigned long max) { - if (!pci_resource_len(pdev, bar) || bar >= PCI_BAR_COUNT) + if (!pci_resource_len(pdev, bar) || bar >= PCI_STD_NUM_BARS) return NULL; if (static_branch_likely(&have_mio)) @@ -324,7 +324,7 @@ static void __iomem *pci_iomap_wc_range_mio(struct pci_dev *pdev, int bar, void __iomem *pci_iomap_wc_range(struct pci_dev *pdev, int bar, unsigned long offset, unsigned long max) { - if (!pci_resource_len(pdev, bar) || bar >= PCI_BAR_COUNT) + if (!pci_resource_len(pdev, bar) || bar >= PCI_STD_NUM_BARS) return NULL; if (static_branch_likely(&have_mio)) @@ -416,7 +416,7 @@ static void zpci_map_resources(struct pci_dev *pdev) resource_size_t len; int i; - for (i = 0; i < PCI_BAR_COUNT; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { len = pci_resource_len(pdev, i); if (!len) continue; @@ -451,7 +451,7 @@ static void zpci_unmap_resources(struct pci_dev *pdev) if (zpci_use_mio(zdev)) return; - for (i = 0; i < PCI_BAR_COUNT; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { len = pci_resource_len(pdev, i); if (!len) continue; @@ -514,7 +514,7 @@ static int zpci_setup_bus_resources(struct zpci_dev *zdev, snprintf(zdev->res_name, sizeof(zdev->res_name), "PCI Bus %04x:%02x", zdev->domain, ZPCI_BUS_NR); - for (i = 0; i < PCI_BAR_COUNT; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (!zdev->bars[i].size) continue; entry = zpci_alloc_iomap(zdev); @@ -551,7 +551,7 @@ static void zpci_cleanup_bus_resources(struct zpci_dev *zdev) { int i; - for (i = 0; i < PCI_BAR_COUNT; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (!zdev->bars[i].size || !zdev->bars[i].res) continue; @@ -573,7 +573,7 @@ int pcibios_add_device(struct pci_dev *pdev) pdev->dev.dma_ops = &s390_pci_dma_ops; zpci_map_resources(pdev); - for (i = 0; i < PCI_BAR_COUNT; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { res = &pdev->resource[i]; if (res->parent || !res->flags) continue; diff --git a/arch/s390/pci/pci_clp.c b/arch/s390/pci/pci_clp.c index 9bdff4defef1..8b729b5f2972 100644 --- a/arch/s390/pci/pci_clp.c +++ b/arch/s390/pci/pci_clp.c @@ -145,7 +145,7 @@ static int clp_store_query_pci_fn(struct zpci_dev *zdev, { int i; - for (i = 0; i < PCI_BAR_COUNT; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { zdev->bars[i].val = le32_to_cpu(response->bar[i]); zdev->bars[i].size = response->bar_size[i]; } @@ -164,8 +164,8 @@ static int clp_store_query_pci_fn(struct zpci_dev *zdev, sizeof(zdev->util_str)); } zdev->mio_capable = response->mio_addr_avail; - for (i = 0; i < PCI_BAR_COUNT; i++) { - if (!(response->mio.valid & (1 << (PCI_BAR_COUNT - i - 1)))) + for (i = 0; i < PCI_STD_NUM_BARS; i++) { + if (!(response->mio.valid & (1 << (PCI_STD_NUM_BARS - i - 1)))) continue; zdev->bars[i].mio_wb = (void __iomem *) response->mio.addr[i].wb; From patchwork Sun Aug 11 15:07:58 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088975 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 814BD912 for ; Sun, 11 Aug 2019 15:08:54 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 72C9626E47 for ; Sun, 11 Aug 2019 15:08:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 675A627DA4; Sun, 11 Aug 2019 15:08:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 1272726E47 for ; Sun, 11 Aug 2019 15:08:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726619AbfHKPIx (ORCPT ); Sun, 11 Aug 2019 11:08:53 -0400 Received: from mail-wm1-f68.google.com ([209.85.128.68]:39674 "EHLO mail-wm1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726500AbfHKPIx (ORCPT ); Sun, 11 Aug 2019 11:08:53 -0400 Received: by mail-wm1-f68.google.com with SMTP id u25so9616438wmc.4; Sun, 11 Aug 2019 08:08:51 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=3BYnAF3fY6hZ3+LPNhPGX5fxT42mNry1jIwD9JVWWfw=; b=p/TS87t2uY9d4isHZh9fQtc5oKB1LtHY8t+HBDAoexjLfVBpt6bd5/+MsYGzVXyNog mhyjnoOF51PAlWHQRpOcMk8AgaWOTsOUr87ja/d7b25YrtbvPv8PzbnbxH0itIrfq+Bi uKWJIUOE8mzjaNvlqqO23TU1jpe2+A7mxwqFLN0BvXeoAP5hM4Paf7OgCF+XMV0Qwp24 P9zkUeocGt0rodSZm/7jjP05zLT2AaAwi5//1FdjfiWONGDf/nH4DK2aFJWEmeT7zTgr pUxbkYdU3umZHDmH7ng5ngIrD5u6TsapjPr8HsIxo3JKWP90D/XEvUKFdhkV6zsYUrfR OUjQ== X-Gm-Message-State: APjAAAVakGJKhd5nOyKNTxtQEnn3Ro07u43/E+Ei9KEsAXVPaI8gKHJQ xZ0kLKR9B4Nx4lgpyXpVn4E= X-Google-Smtp-Source: APXvYqwc8f96jo0z4WSjTuSnCue4cUUPxmdy0KXgwVIooKuJdShIIQeZTtsOo5EQUL/2J5tNNfDdbg== X-Received: by 2002:a1c:2581:: with SMTP id l123mr15817858wml.10.1565536131207; Sun, 11 Aug 2019 08:08:51 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.08.50 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:08:50 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , "H. Peter Anvin" , x86@kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 3/7] x86/PCI: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END Date: Sun, 11 Aug 2019 18:07:58 +0300 Message-Id: <20190811150802.2418-4-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors the loop condition scheme from 'i <= PCI_STD_RESOURCE_END' to 'i < PCI_STD_NUM_BARS'. Signed-off-by: Denis Efremov --- arch/x86/pci/common.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/arch/x86/pci/common.c b/arch/x86/pci/common.c index 9acab6ac28f5..1e59df041456 100644 --- a/arch/x86/pci/common.c +++ b/arch/x86/pci/common.c @@ -135,7 +135,7 @@ static void pcibios_fixup_device_resources(struct pci_dev *dev) * resource so the kernel doesn't attempt to assign * it later on in pci_assign_unassigned_resources */ - for (bar = 0; bar <= PCI_STD_RESOURCE_END; bar++) { + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { bar_r = &dev->resource[bar]; if (bar_r->start == 0 && bar_r->end != 0) { bar_r->flags = 0; From patchwork Sun Aug 11 15:08:00 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088977 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 28196912 for ; Sun, 11 Aug 2019 15:10:07 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 144F126E47 for ; Sun, 11 Aug 2019 15:10:07 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 03AFA27DA4; Sun, 11 Aug 2019 15:10:07 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 9EFB026E47 for ; Sun, 11 Aug 2019 15:10:06 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726460AbfHKPKA (ORCPT ); Sun, 11 Aug 2019 11:10:00 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:44248 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726453AbfHKPKA (ORCPT ); Sun, 11 Aug 2019 11:10:00 -0400 Received: by mail-wr1-f66.google.com with SMTP id p17so102482260wrf.11; Sun, 11 Aug 2019 08:09:59 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=zQ5jk2zBiGOX8kvtlaUrE9zeV0LbnVUP8cNg6rY4+bo=; b=X8MLPsROl1dmqkBusutFm7dAVkU9qw4121R/flE0NuD6Bfbf6I1geFMYE3DRepY4Ej zbj4X8I7MykkboSV7SLg/EPY12Zhs4IQg0rP7jPjd+GEKX1ZFODvVeMqouk2ZblZBteK J7ys5upUVxEmqndx8yQhblqbJoo4//8gMYqxVenzQNc37QqBYIUsdT/+cCh7agXGzheW kI0/IFYe/QgQSUZOuS1fzFUO7vQ9RTQpa59F3UTN3gOtfIRULDKXo3eoZeVrrQDUmgS6 3KcJ2F/bpAhnfVVqvvMZGXJqBpmjC8IxI6OSuetGnbm2rloMQ44IdpJBgGNv/Ti/7b8k EgQw== X-Gm-Message-State: APjAAAWjVR76h022hcQnL4M5zWKqICLc0o7bP0SabSFo86dMsIcuLIIK nVxxtsfs7qRG6QxLYZS1c+c= X-Google-Smtp-Source: APXvYqwtpXMA/ATmIUzg8Uz0IIOf1hxCxO2YXWI/DXx6dbUrzIeJgQVBwEV3sqHRsytdBVNq6SVJRw== X-Received: by 2002:a5d:48cf:: with SMTP id p15mr37023414wrs.151.1565536198605; Sun, 11 Aug 2019 08:09:58 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.09.57 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:09:58 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Giuseppe Cavallaro , Alexandre Torgue , netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 4/7] PCI/net: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END Date: Sun, 11 Aug 2019 18:08:00 +0300 Message-Id: <20190811150802.2418-5-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors the loop condition scheme from 'i <= PCI_STD_RESOURCE_END' to 'i < PCI_STD_NUM_BARS'. Signed-off-by: Denis Efremov --- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- 2 files changed, 3 insertions(+), 3 deletions(-) diff --git a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c index 86f9c07a38cf..cfe496cdd78b 100644 --- a/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c +++ b/drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c @@ -258,7 +258,7 @@ static int stmmac_pci_probe(struct pci_dev *pdev, } /* Get the base address of device */ - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue; ret = pcim_iomap_regions(pdev, BIT(i), pci_name(pdev)); @@ -296,7 +296,7 @@ static void stmmac_pci_remove(struct pci_dev *pdev) stmmac_dvr_remove(&pdev->dev); - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pdev, i) == 0) continue; pcim_iounmap_regions(pdev, BIT(i)); diff --git a/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c b/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c index 386bafe74c3f..fa8604d7b797 100644 --- a/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c +++ b/drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c @@ -34,7 +34,7 @@ static int xlgmac_probe(struct pci_dev *pcidev, const struct pci_device_id *id) return ret; } - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (pci_resource_len(pcidev, i) == 0) continue; ret = pcim_iomap_regions(pcidev, BIT(i), XLGMAC_DRV_NAME); From patchwork Sun Aug 11 15:08:01 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088979 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 04C5B912 for ; Sun, 11 Aug 2019 15:10:12 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id E9EA826E47 for ; Sun, 11 Aug 2019 15:10:11 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id DE3D927DA4; Sun, 11 Aug 2019 15:10:11 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 8B47A26E47 for ; Sun, 11 Aug 2019 15:10:11 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726453AbfHKPKL (ORCPT ); Sun, 11 Aug 2019 11:10:11 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:36956 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfHKPKK (ORCPT ); Sun, 11 Aug 2019 11:10:10 -0400 Received: by mail-wr1-f67.google.com with SMTP id z11so548516wrt.4; Sun, 11 Aug 2019 08:10:09 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=G2Y0IzyQvN3L+ryh+30m+GJo2QD0YzGvKKX16dAP924=; b=QXkkY5MdsJvsohfboQ5kWIBIKMbiQuiSoQQ0+Io4NJRUXtKLLuMzlfDGBSzjcSWRkq fHzI3xjZX4I3afoyhMS7lDlX8Bvccor27juwc7tIXa/Sx7+1K6u812J7i7Gbcm9EEHUY JljlrHV14SnV5g75lEwEbYfp+rPlCCgs3XL15iNBxqS+M0vATQtiZ3+0DWuwD5pY1wiG GWhJ6qHpfbfKo/IBIWnYNnznO2bQOBLJ99ei1krPs1acNNADMjLF6k9EXxPLUtIyACZu ErI5ZVEyfs6kXf4uGfdronAOstb2GKMKchjW6f3iY9LEbn4eXKsI7tTCVVUGnQbMgZXe 4Hcg== X-Gm-Message-State: APjAAAWy91PySrVk2t8jN9kpW6lxfYIwRBrHCQUuPpH2856wDoe+NBeF Js6vT5S1T3Do+54HozHVYVo= X-Google-Smtp-Source: APXvYqwAOyO7u1Z+QZQa8A3kWzhh/ybTau/WlFtAYxoFb5yBtOy8Kt0sU2iNBawz8TrvflkZW3rWHg== X-Received: by 2002:adf:f186:: with SMTP id h6mr35004721wro.274.1565536208696; Sun, 11 Aug 2019 08:10:08 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.10.07 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:10:08 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Matt Porter , Alexandre Bounine , linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 5/7] rapidio/tsi721: use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END Date: Sun, 11 Aug 2019 18:08:01 +0300 Message-Id: <20190811150802.2418-6-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors the loop condition scheme from 'i <= PCI_STD_RESOURCE_END' to 'i < PCI_STD_NUM_BARS'. Signed-off-by: Denis Efremov --- drivers/rapidio/devices/tsi721.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/rapidio/devices/tsi721.c b/drivers/rapidio/devices/tsi721.c index 125a173bed45..4dd31dd9feea 100644 --- a/drivers/rapidio/devices/tsi721.c +++ b/drivers/rapidio/devices/tsi721.c @@ -2755,7 +2755,7 @@ static int tsi721_probe(struct pci_dev *pdev, { int i; - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { tsi_debug(INIT, &pdev->dev, "res%d %pR", i, &pdev->resource[i]); } From patchwork Sun Aug 11 15:08:02 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088983 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 6F5A413B1 for ; Sun, 11 Aug 2019 15:10:23 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 617D226E47 for ; Sun, 11 Aug 2019 15:10:23 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5577027DA4; Sun, 11 Aug 2019 15:10:23 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=unavailable version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 15BF226E47 for ; Sun, 11 Aug 2019 15:10:23 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726597AbfHKPKT (ORCPT ); Sun, 11 Aug 2019 11:10:19 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43182 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfHKPKS (ORCPT ); Sun, 11 Aug 2019 11:10:18 -0400 Received: by mail-wr1-f66.google.com with SMTP id p13so27909813wru.10; Sun, 11 Aug 2019 08:10:17 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=Vj2vxmEq04G+0lv3DiBK9P3rP7zDECsRpielYU6EHVQ=; b=BJEmKCR9rKbO/86x4Vb3gYf2GGTlDGyo0AFhR3ZKcxYF4C/H+waQFYI2re02H3k3k6 XlYiH3+ykF5CR31jtQ2v1t5QnB9onVozi5HKWwKecaeCBHm4UlkTQZtMYUpUv+/TOP9x MYy4wRtDNqb1wrIq9k7hkIOHV5L7P4ZAV+PLirmnDEBfPTGELXF0F2fqYJ/Ho8gwJ2uA QulUB8mbt6WEa6b3ts4vytEcEEnzUhNoSKZEkRnsWWHJ4TEWj9AO0PHE2KLQmmJGNH82 cIvttOZjaHfxuCNIQiPe3amkdKUIVqOxDAU5NWwWpvI1zPEh6+dprooZ2Ef8uLWEY40+ 52Hg== X-Gm-Message-State: APjAAAV86/HGT3KZQuBjzmhSSiWyaacvYlt7CwRi4ZHFJGVvXI42dAbk 7WBBaILPl7gwwQXnF+BP8fE= X-Google-Smtp-Source: APXvYqzD15wCpqhoSznLdo+VOoB+/5W/wWM9KDpP06MrKPaWev2h+3Mx8cU8mRArMcKwxx7SkWaU/A== X-Received: by 2002:a05:6000:1085:: with SMTP id y5mr27884882wrw.285.1565536216498; Sun, 11 Aug 2019 08:10:16 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.10.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:10:16 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Peter Jones , Bartlomiej Zolnierkiewicz , linux-fbdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 6/7] efifb: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END Date: Sun, 11 Aug 2019 18:08:02 +0300 Message-Id: <20190811150802.2418-7-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors the loop condition scheme from 'i <= PCI_STD_RESOURCE_END' to 'i < PCI_STD_NUM_BARS'. Signed-off-by: Denis Efremov Acked-by: Bartlomiej Zolnierkiewicz --- drivers/video/fbdev/efifb.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/drivers/video/fbdev/efifb.c b/drivers/video/fbdev/efifb.c index 04a22663b4fb..6c72b825e92a 100644 --- a/drivers/video/fbdev/efifb.c +++ b/drivers/video/fbdev/efifb.c @@ -668,7 +668,7 @@ static void efifb_fixup_resources(struct pci_dev *dev) if (!base) return; - for (i = 0; i <= PCI_STD_RESOURCE_END; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { struct resource *res = &dev->resource[i]; if (!(res->flags & IORESOURCE_MEM)) From patchwork Sun Aug 11 15:08:04 2019 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: "Denis Efremov (Oracle)" X-Patchwork-Id: 11088985 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork-2.web.codeaurora.org (Postfix) with ESMTP id 0F033912 for ; Sun, 11 Aug 2019 15:10:55 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F3B1A205C0 for ; Sun, 11 Aug 2019 15:10:54 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E7E9926E47; Sun, 11 Aug 2019 15:10:54 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00,MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 89093205C0 for ; Sun, 11 Aug 2019 15:10:54 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726457AbfHKPKy (ORCPT ); Sun, 11 Aug 2019 11:10:54 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:33365 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726231AbfHKPKx (ORCPT ); Sun, 11 Aug 2019 11:10:53 -0400 Received: by mail-wr1-f68.google.com with SMTP id n9so102614582wru.0; Sun, 11 Aug 2019 08:10:52 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id:in-reply-to :references:mime-version:content-transfer-encoding; bh=ZvL0w/RrWzCXmEqGtiPSbyCPgpLUV0eBfGdylB2j+qE=; b=CLzcbNGvwl9aPNKORIzGoCSyJPRTTIBLGJs8OAJKGg2pCfzOKAn7KKXwrMa3jdJuln pNe+nYY+fREDZEVjonjvbC5OkQ8uJYiPn9yw3ucd8agyuPL7I6FlvL/yduM4Z3J0qw5d po/wAIZk0WFNVNWshwuVreIuCFZPvU17rhWl8cLJ7pboEez1qxRCLZ+aGdR75N31/38K RYXhhKoOruptS34HOrlB8qpeuKL0cBoaJq+Uift5dSll3nMsrDMQIoh464juyaP3GWGi 4X/Uni57EilSwZzsXTrh7GvjEwYaEp4CJ+5rz+7+RqHVVZgqlmYD77US7FvBknNEAIv4 WgsA== X-Gm-Message-State: APjAAAU0yWTDoc2AcxvV0lMEKeG8yS0PYXpCy46epvMv8MGzrtiwXzzY 2sQWCW4BxT74nphpwVmGR6U= X-Google-Smtp-Source: APXvYqyC1XseTJUsID4U0s2kw/P6UJNA5sVYJ6WdgeL+XNrPosY9yRULJaidsX4driYK6FPd5RYWNw== X-Received: by 2002:adf:90d0:: with SMTP id i74mr22816979wri.218.1565536251573; Sun, 11 Aug 2019 08:10:51 -0700 (PDT) Received: from localhost.localdomain (broadband-188-32-48-208.ip.moscow.rt.ru. [188.32.48.208]) by smtp.googlemail.com with ESMTPSA id y16sm227049408wrg.85.2019.08.11.08.10.49 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Sun, 11 Aug 2019 08:10:51 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Cornelia Huck , Alex Williamson , kvm@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH 7/7] vfio_pci: Use PCI_STD_NUM_BARS in loops instead of PCI_STD_RESOURCE_END Date: Sun, 11 Aug 2019 18:08:04 +0300 Message-Id: <20190811150802.2418-8-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190811150802.2418-1-efremov@linux.com> References: <20190811150802.2418-1-efremov@linux.com> MIME-Version: 1.0 Sender: linux-pci-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-pci@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP This patch refactors the loop condition scheme from 'i <= PCI_STD_RESOURCE_END' to 'i < PCI_STD_NUM_BARS'. Signed-off-by: Denis Efremov --- drivers/vfio/pci/vfio_pci.c | 4 ++-- drivers/vfio/pci/vfio_pci_config.c | 2 +- drivers/vfio/pci/vfio_pci_private.h | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 703948c9fbe1..13f5430e3f3c 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -115,7 +115,7 @@ static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev) INIT_LIST_HEAD(&vdev->dummy_resources_list); - for (bar = PCI_STD_RESOURCES; bar <= PCI_STD_RESOURCE_END; bar++) { + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { res = vdev->pdev->resource + bar; if (!IS_ENABLED(CONFIG_VFIO_PCI_MMAP)) @@ -399,7 +399,7 @@ static void vfio_pci_disable(struct vfio_pci_device *vdev) vfio_config_free(vdev); - for (bar = PCI_STD_RESOURCES; bar <= PCI_STD_RESOURCE_END; bar++) { + for (bar = 0; bar < PCI_STD_NUM_BARS; bar++) { if (!vdev->barmap[bar]) continue; pci_iounmap(pdev, vdev->barmap[bar]); diff --git a/drivers/vfio/pci/vfio_pci_config.c b/drivers/vfio/pci/vfio_pci_config.c index f0891bd8444c..6035a2961160 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -455,7 +455,7 @@ static void vfio_bar_fixup(struct vfio_pci_device *vdev) bar = (__le32 *)&vdev->vconfig[PCI_BASE_ADDRESS_0]; - for (i = PCI_STD_RESOURCES; i <= PCI_STD_RESOURCE_END; i++, bar++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++, bar++) { if (!pci_resource_start(pdev, i)) { *bar = 0; /* Unmapped by host = unimplemented to user */ continue; diff --git a/drivers/vfio/pci/vfio_pci_private.h b/drivers/vfio/pci/vfio_pci_private.h index ee6ee91718a4..8a2c7607d513 100644 --- a/drivers/vfio/pci/vfio_pci_private.h +++ b/drivers/vfio/pci/vfio_pci_private.h @@ -86,8 +86,8 @@ struct vfio_pci_reflck { struct vfio_pci_device { struct pci_dev *pdev; - void __iomem *barmap[PCI_STD_RESOURCE_END + 1]; - bool bar_mmap_supported[PCI_STD_RESOURCE_END + 1]; + void __iomem *barmap[PCI_STD_NUM_BARS]; + bool bar_mmap_supported[PCI_STD_NUM_BARS]; u8 *pci_config_map; u8 *vconfig; struct perm_bits *msi_perm;