From patchwork Fri Aug 16 09:24:28 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: 11097371 X-Patchwork-Delegate: bhelgaas@google.com 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 C375B912 for ; Fri, 16 Aug 2019 09:25:13 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id B2F0028994 for ; Fri, 16 Aug 2019 09:25:13 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A3F2328995; Fri, 16 Aug 2019 09:25:13 +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 5148D289AF for ; Fri, 16 Aug 2019 09:25:13 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727100AbfHPJZG (ORCPT ); Fri, 16 Aug 2019 05:25:06 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:50529 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726864AbfHPJZF (ORCPT ); Fri, 16 Aug 2019 05:25:05 -0400 Received: by mail-wm1-f65.google.com with SMTP id v15so3497486wml.0; Fri, 16 Aug 2019 02:25:04 -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=QO8yCch33opuXgmTAPGDbZToVsky87JDx6C5dq0lMyrihIEEYKc0KJ0R9QG8zl7Y5y abESgonhXEJdvseVYKiRVQxuLBEr+Yw3om/K9IBNRw9+QzS9apNDb8ap9YBW1Go5kw0L G3J8tnN2dkVzQda4nfhoeSuI4J5oPGh5w1bjJElAIj1+ThiyrK5xW8HUdIJRac5X6d2w sl7F2+j7Wl9/ZF+sbSKUxm4Cq6U+24LQ6qvEsCUutffe1OJ5FCjmgpIpNurKLU4OGLDL fmtFu/fKA8tzigOY5PC4lPNDTrtZmDE8YFlLCqaZJb0aQwvGHBBVOUOfB5gxb5U6gdnh XK0Q== X-Gm-Message-State: APjAAAVQSyHVQoM1EJjndBDEhufcTZfDw4qIhTZSAI+1vAHl+eGYwH8O VUDx8qZ9LfnYOpXbgvUzXR4= X-Google-Smtp-Source: APXvYqwdkzptSDBPYf3snC2X8tSU5Jjgv3fMa6O+QngGpQvJwi3nqYEMp2zDy4ghfVZwAHsAABD5yA== X-Received: by 2002:a1c:4d0c:: with SMTP id o12mr6541900wmh.62.1565947503517; Fri, 16 Aug 2019 02:25:03 -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 q20sm16521138wrc.79.2019.08.16.02.25.01 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:25:03 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Sebastian Ott , Gerald Schaefer , "H. Peter Anvin" , Giuseppe Cavallaro , Alexandre Torgue , Matt Porter , Alexandre Bounine , Peter Jones , Bartlomiej Zolnierkiewicz , Cornelia Huck , Alex Williamson , Andrew Murray , Jose Abreu , kvm@vger.kernel.org, linux-fbdev@vger.kernel.org, netdev@vger.kernel.org, x86@kernel.org, linux-s390@vger.kernel.org Subject: [PATCH v2 01/10] PCI: Add define for the number of standard PCI BARs Date: Fri, 16 Aug 2019 12:24:28 +0300 Message-Id: <20190816092437.31846-2-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Fri Aug 16 09:24:29 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: 11097373 X-Patchwork-Delegate: bhelgaas@google.com 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 D4D28912 for ; Fri, 16 Aug 2019 09:25:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id C25B628994 for ; Fri, 16 Aug 2019 09:25:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id B53A4289AF; Fri, 16 Aug 2019 09:25:35 +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 2928C28994 for ; Fri, 16 Aug 2019 09:25:35 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1726949AbfHPJZb (ORCPT ); Fri, 16 Aug 2019 05:25:31 -0400 Received: from mail-wr1-f65.google.com ([209.85.221.65]:33274 "EHLO mail-wr1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbfHPJZb (ORCPT ); Fri, 16 Aug 2019 05:25:31 -0400 Received: by mail-wr1-f65.google.com with SMTP id u16so913024wrr.0; Fri, 16 Aug 2019 02:25:29 -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=Fntp33qn2e0+rfrAKkMpvIy567W3g/jh7FV7d6teK/0=; b=W+QSCrTSb7m6QE1PVN/Q+a6VXK54JlsFWFgvHwFh/VXxqiaNLFIOFTw1PVDQmPgCCQ YiOhxy4q23fuy+SEyKO5+49oDs2WyNH52kWFC2N2TE2i3ZPDIWjlNCsnuP6I3LiZeW03 yX2aTtVMuWE5urh4UHUU4beuBY/jm305Biba/toGYrTliwMGXT3K75HHTCXwOjJ6/b/l dc4aT8jR0UwbMGCgO1kqehQ2iL3IFqE1ypurAX9B2LsDcKeUGiXplElEW+TDQOcVaL/k rB41AYHY4YZUFXylngBbQA9gicN483+neqGy0l4HKSQq/XvAE4ejEa3xDROHqBqFJVdV 48Cg== X-Gm-Message-State: APjAAAUIIuPsvxnjitMpP6YoC4KokXfawJUVsLPEhtif8nnoG+J301TK lSSEuxtiyQPZhmy6DEjK2tE= X-Google-Smtp-Source: APXvYqzQB4v94eoHBt/5TldQAGq6gST4Qq7LD13LC7duZtBzH4qQxO1d3ekmaT5pVs4K9/L2m/Ao6Q== X-Received: by 2002:adf:ec0d:: with SMTP id x13mr9986048wrn.240.1565947528892; Fri, 16 Aug 2019 02:25:28 -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 q20sm16521138wrc.79.2019.08.16.02.25.27 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:25:28 -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 v2 02/10] s390/pci: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:29 +0300 Message-Id: <20190816092437.31846-3-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. Signed-off-by: Denis Efremov Acked-by: Sebastian Ott --- 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..aca372c8e34f 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 (bar >= PCI_STD_NUM_BARS || !pci_resource_len(pdev, bar)) 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 (bar >= PCI_STD_NUM_BARS || !pci_resource_len(pdev, bar)) 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 Fri Aug 16 09:24:30 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: 11097377 X-Patchwork-Delegate: bhelgaas@google.com 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 6E1941395 for ; Fri, 16 Aug 2019 09:26:16 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 5C955288E6 for ; Fri, 16 Aug 2019 09:26:16 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 5100F2899C; Fri, 16 Aug 2019 09:26:16 +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 F271F288E6 for ; Fri, 16 Aug 2019 09:26:15 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727042AbfHPJ0P (ORCPT ); Fri, 16 Aug 2019 05:26:15 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:38356 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727041AbfHPJ0P (ORCPT ); Fri, 16 Aug 2019 05:26:15 -0400 Received: by mail-wm1-f66.google.com with SMTP id m125so3508112wmm.3; Fri, 16 Aug 2019 02:26:13 -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=KXsrIoNvOcPMUtNmShEj3wf+mDCBfSR89zIxU2/p+Yg=; b=ZgiV/7j9bYI39v7P2L0AaPSYevwGRrGRSCmf6WofGoBQG8LauGVdn4OYSSZQLdagOv tVHtTOB22QwQxr5tXdLGwTIIhwvvCryQRPDnG/+6qoHHwBsXbEcnxCKar/4xJA6Wkdtk EY53kREPOd0QGmEV8qoIe+BQukWW6Yu7f35h4J/FZtgb3Not4iK4WOVxQ4XZhV9aD1OL RTa9BEeRLkS2nl74o5hCnbE3smUY4i9oRdqrPAI2Zg1/tBaXxT9YnsFoMfS6/wG2UREj wEo912kKFAIvTcycFiAcQ4A2qswSAtk38a+rBM5CfL9jGdT59Sj2PJv7SML4xLO0a6dm ysBQ== X-Gm-Message-State: APjAAAUt4nKzZUnGG4GgTfZyPKXovrFq2OTitApYllNp0hxSvqHAySYe POrnN7kwo35WM3qTA4+P6u0= X-Google-Smtp-Source: APXvYqxYf7RljwLr3IkqjenWAlZMEq5Ux5Hc488Jt0Y920RYCpAFdA0+1VkjuEtUcJ+lF5u3sXhkxg== X-Received: by 2002:a1c:a584:: with SMTP id o126mr6446587wme.147.1565947573088; Fri, 16 Aug 2019 02:26:13 -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 q20sm16521138wrc.79.2019.08.16.02.26.12 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:12 -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 v2 03/10] x86/PCI: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:30 +0300 Message-Id: <20190816092437.31846-4-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. 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 Fri Aug 16 09:24:31 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: 11097395 X-Patchwork-Delegate: bhelgaas@google.com 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 6764414F7 for ; Fri, 16 Aug 2019 09:26:46 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 56B0B286C6 for ; Fri, 16 Aug 2019 09:26:46 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 4AFD928995; Fri, 16 Aug 2019 09:26: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 EC0BE286C6 for ; Fri, 16 Aug 2019 09:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727151AbfHPJ0R (ORCPT ); Fri, 16 Aug 2019 05:26:17 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:37679 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbfHPJ0R (ORCPT ); Fri, 16 Aug 2019 05:26:17 -0400 Received: by mail-wm1-f65.google.com with SMTP id z23so3519587wmf.2; Fri, 16 Aug 2019 02:26:15 -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=zu/6tv2CuG9JSQuI18kICycXFKyLsNIBW3plqogVCew=; b=PXLHyB6ISITixXWc1WLZQ7AynlA3Qlu5U64S3tCJe+EBXEkFPMPkHj3F4VPewv8t0O gbKYi9983RHiTcEVeZg2GCNPgHVBByg/KUI1xeFx+2uG0Rl7ZScsbFuHAS16QCzuhxDR ca8thiwKld6yjNiNwQTwTzvXKUG13W8Mg1f/K/19YL17iz3PEWo1u5IX/QZNeEsKI/8K DnVhIurYjV27PCDIysVEQdiOfmpryAMno+ySd8AJSYtfXKetCWMpYD53UCDaPJLZ2XbU e71E3bpoworFdqbJerD1OD9Ga0p5pT4EmEGbxaI7P39xP5vjO0nRy+053IL3FQCYbvTB +1AA== X-Gm-Message-State: APjAAAXl+xuJSi5OkCf2DAoO7JypMnMJvSJ7JgCELVFgA1iyO9zP/845 SiItgP+O5LWiZ5nZkr9yTkQ= X-Google-Smtp-Source: APXvYqwkeKKLiMCmGh1NBcy9Mq6BnTtP4R9CiQ5W4g6W/f7Sgo6YX/5uTrr5xdEP7iD3iZb+FpsCLg== X-Received: by 2002:a1c:5a56:: with SMTP id o83mr6219308wmb.103.1565947574930; Fri, 16 Aug 2019 02:26:14 -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 q20sm16521138wrc.79.2019.08.16.02.26.13 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:14 -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 v2 04/10] stmmac: pci: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:31 +0300 Message-Id: <20190816092437.31846-5-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. Signed-off-by: Denis Efremov --- drivers/net/ethernet/stmicro/stmmac/stmmac_pci.c | 4 ++-- 1 file changed, 2 insertions(+), 2 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)); From patchwork Fri Aug 16 09:24:32 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: 11097393 X-Patchwork-Delegate: bhelgaas@google.com 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 E2DCF912 for ; Fri, 16 Aug 2019 09:26:45 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D2407286C6 for ; Fri, 16 Aug 2019 09:26:45 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id C605D28995; Fri, 16 Aug 2019 09:26:45 +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 7D7AD286C6 for ; Fri, 16 Aug 2019 09:26:45 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727076AbfHPJ0j (ORCPT ); Fri, 16 Aug 2019 05:26:39 -0400 Received: from mail-wr1-f66.google.com ([209.85.221.66]:43193 "EHLO mail-wr1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1726882AbfHPJ0R (ORCPT ); Fri, 16 Aug 2019 05:26:17 -0400 Received: by mail-wr1-f66.google.com with SMTP id y8so889763wrn.10; Fri, 16 Aug 2019 02:26: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=8wZECesGtaRN/hRYulA3qe8bal21Vcfb+3jseiWhwfY=; b=bkPJ9CukYSfviTLfUNvMZxjAt0wpK7fRb62iizYE6pUiXOckclHEiifu+aH2/a3Dco FDmQq/sDpoz+zAHBOaipyq86Wo7FmS5Fyu1Rtwgbe0oS5qbSz9Eaq09EYMdNedKJxUt2 TW8H6E2zxzVZIJkpHKJNYdumAxkUvJCGLMef+zEFk+K4Tk64rQCU+xj9rQC42ZVIkiOE Fo/bVhuIo4ODOdAjgYmOK39mJv5fP39Kyz8s4N8Q7s0uJ6nchxhmKOguIJKjFUYkz/Rr 5KnnLmTE4sLYnlOx0AQBowUveHAafgkAmYQMynEVUmYCn/MfpF79eE2rWCoAlvNf54wh 5dJw== X-Gm-Message-State: APjAAAU+k6npsBphoCa4GadmvxVccGAqC+QfWJE04cZvYdWWYE/9hiu5 cHdScLyQkZK3A554IKmCNKw= X-Google-Smtp-Source: APXvYqwuxfNSFouvi+v+ALP0jEZo8ZXiE/rQwczcKeo2zAKeyWd11YX4OO/5BLo8ME3TczTKhqp5Mg== X-Received: by 2002:adf:f28d:: with SMTP id k13mr9032006wro.19.1565947576600; Fri, 16 Aug 2019 02:26: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 q20sm16521138wrc.79.2019.08.16.02.26.15 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:16 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , Jose Abreu , netdev@vger.kernel.org, linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org Subject: [PATCH v2 05/10] net: dwc-xlgmac: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:32 +0300 Message-Id: <20190816092437.31846-6-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. Signed-off-by: Denis Efremov --- drivers/net/ethernet/synopsys/dwc-xlgmac-pci.c | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) 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 Fri Aug 16 09:24:33 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: 11097391 X-Patchwork-Delegate: bhelgaas@google.com 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 0E0B6912 for ; Fri, 16 Aug 2019 09:26:40 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id F0F99288E6 for ; Fri, 16 Aug 2019 09:26:39 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id E4D48289D1; Fri, 16 Aug 2019 09:26:39 +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 8AB9A28995 for ; Fri, 16 Aug 2019 09:26:39 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727184AbfHPJ0V (ORCPT ); Fri, 16 Aug 2019 05:26:21 -0400 Received: from mail-wr1-f67.google.com ([209.85.221.67]:33391 "EHLO mail-wr1-f67.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbfHPJ0U (ORCPT ); Fri, 16 Aug 2019 05:26:20 -0400 Received: by mail-wr1-f67.google.com with SMTP id u16so915314wrr.0; Fri, 16 Aug 2019 02:26:18 -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=XIWx6CaxG/uLJ4bEXyuLwT1G87Dm8YPWSJ3PPeconzU=; b=DQTb2WbWyYu0KnLdqnJVnUTauIbErgLoXBHTLCft0DwoBRcfOWKKyLgZiktN/CLsSb dz0Q7MX3u3ZtTtx7nW6iQnIFQI5G64evWA0Fg2XiIFNAu0pDQUAldC3DEZnunJB4LWX1 LE5riguqfIN5xuMACfpVNp78ma/fcqw9TXG3oacvd9kJKnW4syLcZ4ONtbIwvvJXfchK hBbFA/uWtskZDVGIxPhpZXG1fYyd0LGtIHPZnDk/k8EwyU7gQFNH+TseB3KEMuVZyL3v MaYy6+WZm51zEeplyiAH5Ifp+a0ohbcghSqnaRXS/SjrIAJqXF1HshzvUuOl5W4gLUDO uL0w== X-Gm-Message-State: APjAAAWnn19fT7HPGsQvxQBHkZXlXvQN3C8AXQDwatA6OiB4tdIak42d nfUfgAccI/+wUa8N0B/bozwtx1j/wU4= X-Google-Smtp-Source: APXvYqwao3NDsFoACbdfqfDD1z7VPAGtorUtFADCe9Hjpb7lK6xv/P1JXTArZYZlE93oqNQ6CwljcQ== X-Received: by 2002:a5d:404d:: with SMTP id w13mr9588210wrp.253.1565947578220; Fri, 16 Aug 2019 02:26:18 -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 q20sm16521138wrc.79.2019.08.16.02.26.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:17 -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 v2 06/10] rapidio/tsi721: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:33 +0300 Message-Id: <20190816092437.31846-7-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. 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 Fri Aug 16 09:24:34 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: 11097387 X-Patchwork-Delegate: bhelgaas@google.com 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 E7A381395 for ; Fri, 16 Aug 2019 09:26:38 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id D767E286C6 for ; Fri, 16 Aug 2019 09:26:38 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id CB5B0289B6; Fri, 16 Aug 2019 09:26:38 +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 A88B0286C6 for ; Fri, 16 Aug 2019 09:26:37 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727206AbfHPJ0X (ORCPT ); Fri, 16 Aug 2019 05:26:23 -0400 Received: from mail-wm1-f65.google.com ([209.85.128.65]:34693 "EHLO mail-wm1-f65.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727030AbfHPJ0W (ORCPT ); Fri, 16 Aug 2019 05:26:22 -0400 Received: by mail-wm1-f65.google.com with SMTP id e8so2774286wme.1; Fri, 16 Aug 2019 02:26:20 -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=IolRIeTGcRrWhMPHSs5hGUeW7sCKN9H4QrJAPD2CaXs=; b=UZxYYnvhNYop13mkLpDgj8Sn+co0KbQBZ7ycyn7IbmZ41BI7cI6V2AdDwwOP5DSrX9 914lBGPWYiadgpVcpXjA+YWgkIRClT857OUad8PW6Pj0W/EqEkfGatp/XqTZ+tZEJ5bN 4eX8gZkSehkC2gMRm8B+kU4VMsoV+cijOV+nQLU3IZzSK5JVIQG2guTVuk2L645vamaM YNLSvIq528kaLRdchaNNhb/wodgYPtaMzMXIMdRQksWVFqAIiQsyZjz2gulmXmZdpIPQ J46DhMWqnb5FVcpIjcf3iDx0w6i4cXGKmSfbzL4bonjllwvzibkuVETPXd2Qj042vsW2 6gvg== X-Gm-Message-State: APjAAAVGD73kCMs9zOBTgTidZtHJeW0qYnPQLkpyDhzMPftbt8rOnIhh qZap2Nn+UCezDTBHBjUwtgM= X-Google-Smtp-Source: APXvYqzZTJggv0PlnsUCE87zj1rpi2PYlHhjlC+A+bUWKgcBGnPNV4fmxljDubNFccwPDYU4KCwiLA== X-Received: by 2002:a05:600c:2056:: with SMTP id p22mr6179932wmg.155.1565947580049; Fri, 16 Aug 2019 02:26:20 -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 q20sm16521138wrc.79.2019.08.16.02.26.18 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:19 -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 v2 07/10] efifb: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:34 +0300 Message-Id: <20190816092437.31846-8-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. Acked-by: Bartlomiej Zolnierkiewicz Signed-off-by: Denis Efremov --- 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 Fri Aug 16 09:24:35 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: 11097385 X-Patchwork-Delegate: bhelgaas@google.com 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 878F2912 for ; Fri, 16 Aug 2019 09:26:36 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 77A35286C6 for ; Fri, 16 Aug 2019 09:26:36 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6BA1928995; Fri, 16 Aug 2019 09:26:36 +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 13CF4286C6 for ; Fri, 16 Aug 2019 09:26:36 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727226AbfHPJ0Y (ORCPT ); Fri, 16 Aug 2019 05:26:24 -0400 Received: from mail-wm1-f66.google.com ([209.85.128.66]:36017 "EHLO mail-wm1-f66.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727141AbfHPJ0Y (ORCPT ); Fri, 16 Aug 2019 05:26:24 -0400 Received: by mail-wm1-f66.google.com with SMTP id g67so3515522wme.1; Fri, 16 Aug 2019 02:26:22 -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=VCBC1nHkile48mY94V95RJMwkkBLR3LBIagBpciu5yg=; b=WEUufkhsfmFdyCCPtGxHwjQbtuNVK1POWA9rFO5ONgaVRpSAuiDG6DBYb5ctpUis9A WneOxogDdo2UXlmVJ7/3inwF8RSyhWA3Cp0FmZeuS4N+Br7Y9RUet5a17ih4OztKfKW4 2+kvW6c23NvOKH4t2U/3MqSsgyTmVz73dxqoHaMjUAA7hxogmkWDfZ6+M3KWtvABku1a j/JYnqXCmGZv55+uBu5Ci2fQCdbxP032y/LEEQujBdvLfDugqOrGvg8BBYbfAdHVFy5w o9yXoCepgZT2jtUYIiWHp6zH9JQAudvBKppuquAROQVs4UucTxCjbrS37wAGPfhvtniQ Yr9Q== X-Gm-Message-State: APjAAAX1N1bzv+/1aPdUHXUjJYLLvf8Vq1Cltfxdkgbp/FiZYAw/HPF2 V+cR1AVAEoRKoWelEhtdxDA= X-Google-Smtp-Source: APXvYqw28sA05m0NJBVJdOHWxcsf+e6ETT/4+J9XklzzECtokBSPpk/j2HBhAcXCsE6EfVpjW0JZKQ== X-Received: by 2002:a1c:630b:: with SMTP id x11mr6225403wmb.135.1565947581534; Fri, 16 Aug 2019 02:26:21 -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 q20sm16521138wrc.79.2019.08.16.02.26.20 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:21 -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 v2 08/10] vfio_pci: Loop using PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:35 +0300 Message-Id: <20190816092437.31846-9-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Refactor loops to use 'i < PCI_STD_NUM_BARS' instead of 'i <= PCI_STD_RESOURCE_END'. Signed-off-by: Denis Efremov --- drivers/vfio/pci/vfio_pci.c | 11 +++++++---- drivers/vfio/pci/vfio_pci_config.c | 10 ++++++---- drivers/vfio/pci/vfio_pci_private.h | 4 ++-- 3 files changed, 15 insertions(+), 10 deletions(-) diff --git a/drivers/vfio/pci/vfio_pci.c b/drivers/vfio/pci/vfio_pci.c index 703948c9fbe1..cb7d220d3246 100644 --- a/drivers/vfio/pci/vfio_pci.c +++ b/drivers/vfio/pci/vfio_pci.c @@ -110,13 +110,15 @@ static inline bool vfio_pci_is_vga(struct pci_dev *pdev) static void vfio_pci_probe_mmaps(struct vfio_pci_device *vdev) { struct resource *res; - int bar; + int i; struct vfio_pci_dummy_resource *dummy_res; INIT_LIST_HEAD(&vdev->dummy_resources_list); - for (bar = PCI_STD_RESOURCES; bar <= PCI_STD_RESOURCE_END; bar++) { - res = vdev->pdev->resource + bar; + for (i = 0; i < PCI_STD_NUM_BARS; i++) { + int bar = i + PCI_STD_RESOURCES; + + res = &vdev->pdev->resource[bar]; if (!IS_ENABLED(CONFIG_VFIO_PCI_MMAP)) goto no_mmap; @@ -399,7 +401,8 @@ 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 (i = 0; i < PCI_STD_NUM_BARS; i++) { + bar = i + PCI_STD_RESOURCES; 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..df8772395219 100644 --- a/drivers/vfio/pci/vfio_pci_config.c +++ b/drivers/vfio/pci/vfio_pci_config.c @@ -455,16 +455,18 @@ 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++) { - if (!pci_resource_start(pdev, i)) { + for (i = 0; i < PCI_STD_NUM_BARS; i++, bar++) { + int ibar = i + PCI_STD_RESOURCES; + + if (!pci_resource_start(pdev, ibar)) { *bar = 0; /* Unmapped by host = unimplemented to user */ continue; } - mask = ~(pci_resource_len(pdev, i) - 1); + mask = ~(pci_resource_len(pdev, ibar) - 1); *bar &= cpu_to_le32((u32)mask); - *bar |= vfio_generate_bar_flags(pdev, i); + *bar |= vfio_generate_bar_flags(pdev, ibar); if (*bar & cpu_to_le32(PCI_BASE_ADDRESS_MEM_TYPE_64)) { bar++; 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; From patchwork Fri Aug 16 09:24:36 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: 11097381 X-Patchwork-Delegate: bhelgaas@google.com 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 239C31395 for ; Fri, 16 Aug 2019 09:26:35 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 0F165288E6 for ; Fri, 16 Aug 2019 09:26:35 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 0068E286C6; Fri, 16 Aug 2019 09:26:34 +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 99F65286C6 for ; Fri, 16 Aug 2019 09:26:34 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727241AbfHPJ0a (ORCPT ); Fri, 16 Aug 2019 05:26:30 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:36388 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727220AbfHPJ0Y (ORCPT ); Fri, 16 Aug 2019 05:26:24 -0400 Received: by mail-wr1-f68.google.com with SMTP id r3so908492wrt.3; Fri, 16 Aug 2019 02:26:23 -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=+0XuGCmLUKascNoqMOdQFyww1K30R55i9BTSz45B+Sw=; b=qVPreuQBx0l/ekXj0XcveNZDItFcd/WBl020drQucKst9u9TQXRKAUSV2HD5hfUaAp rGzFBN5YZDWjIc7zXKQwk0EBVTrS9wX9WSgUVEjKzqVJxu+stwH+o/s9y7znuH2AU6FX H+F46SLG2FACM64GIMYWVKQ3iKkHPUgXn9RJWBPTvMkFNhOHjH09zMCD8hMGgbXWUZeO KkGnoc9VKk8ldOyMd9dHu49QFQ3GGQytsZwD2ft0/GJEq9URMbQLhBm8QtMnHKv4JuGG gR9CxNg54vIyW2EIR3YT8UDqjzcVZfRlUvpe2y6epsvpxeuoUlmrUoYx1DWGtntUEArS V4dg== X-Gm-Message-State: APjAAAXrWqpAAmICwcZeB2Sp3yryh9vNwBOMVZH+Dvj3RoAiGErIlpIZ jMf98ghk/CK9TR0Sn6u+KB7pcy1RD00= X-Google-Smtp-Source: APXvYqytMngYXrbX785/qwPiJcgCv9SjaTwj9S3vfVgnUKaNSbDPpqBNbG5TYhofYDxFEddZ+QZjsA== X-Received: by 2002:a5d:5183:: with SMTP id k3mr4034791wrv.270.1565947583156; Fri, 16 Aug 2019 02:26:23 -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 q20sm16521138wrc.79.2019.08.16.02.26.22 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:22 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Andrew Murray Subject: [PATCH v2 09/10] PCI: hv: Use PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:36 +0300 Message-Id: <20190816092437.31846-10-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Replace the magic constant with define PCI_STD_NUM_BARS. Signed-off-by: Denis Efremov --- drivers/pci/controller/pci-hyperv.c | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/drivers/pci/controller/pci-hyperv.c b/drivers/pci/controller/pci-hyperv.c index 40b625458afa..1665c23b649f 100644 --- a/drivers/pci/controller/pci-hyperv.c +++ b/drivers/pci/controller/pci-hyperv.c @@ -307,7 +307,7 @@ struct pci_bus_relations { struct pci_q_res_req_response { struct vmpacket_descriptor hdr; s32 status; /* negative values are failures */ - u32 probed_bar[6]; + u32 probed_bar[PCI_STD_NUM_BARS]; } __packed; struct pci_set_power { @@ -503,7 +503,7 @@ struct hv_pci_dev { * What would be observed if one wrote 0xFFFFFFFF to a BAR and then * read it back, for each of the BAR offsets within config space. */ - u32 probed_bar[6]; + u32 probed_bar[PCI_STD_NUM_BARS]; }; struct hv_pci_compl { @@ -1327,7 +1327,7 @@ static void survey_child_resources(struct hv_pcibus_device *hbus) * so it's sufficient to just add them up without tracking alignment. */ list_for_each_entry(hpdev, &hbus->children, list_entry) { - for (i = 0; i < 6; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { if (hpdev->probed_bar[i] & PCI_BASE_ADDRESS_SPACE_IO) dev_err(&hbus->hdev->device, "There's an I/O BAR in this list!\n"); @@ -1401,7 +1401,7 @@ static void prepopulate_bars(struct hv_pcibus_device *hbus) /* Pick addresses for the BARs. */ do { list_for_each_entry(hpdev, &hbus->children, list_entry) { - for (i = 0; i < 6; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { bar_val = hpdev->probed_bar[i]; if (bar_val == 0) continue; @@ -1558,7 +1558,7 @@ static void q_resource_requirements(void *context, struct pci_response *resp, "query resource requirements failed: %x\n", resp->status); } else { - for (i = 0; i < 6; i++) { + for (i = 0; i < PCI_STD_NUM_BARS; i++) { completion->hpdev->probed_bar[i] = q_res_req->probed_bar[i]; } From patchwork Fri Aug 16 09:24:37 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: 11097379 X-Patchwork-Delegate: bhelgaas@google.com 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 D0695912 for ; Fri, 16 Aug 2019 09:26:28 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id BEA4D289D1 for ; Fri, 16 Aug 2019 09:26:28 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id A967F289F1; Fri, 16 Aug 2019 09:26:28 +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 24F12289D1 for ; Fri, 16 Aug 2019 09:26:28 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727248AbfHPJ01 (ORCPT ); Fri, 16 Aug 2019 05:26:27 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43212 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1727241AbfHPJ00 (ORCPT ); Fri, 16 Aug 2019 05:26:26 -0400 Received: by mail-wr1-f68.google.com with SMTP id y8so890134wrn.10; Fri, 16 Aug 2019 02:26:25 -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=fQFIDh4S3BKcxzlORjnStXsZ6DfUzI3N/hnvhmTuLs8=; b=CWw/YvrlegXOrjLsqedl6yU38/BWBbnuB0l9bleEwM1I1GMZ27VAvuUvuaORJNaMNH L+/qa+p7a8UcL3HAWlQXFP4qFEdp0RFdHcXYErBlEZKGoMWWakTVDQKNRiXl4x5atchO 9lX+L/aQfJG9U8Q3cpePfF4czq2kKgQWmzLye9Gn7UVBZW0Vihdn2Y3GPHM+gcNWXjM9 9wY0Ctayb1o1qP+a4w2onl580ixnlkl/g6f3bCSkfSi3MqxJ/rwXrvEj7CUIkr4t5XVb uOodklnuj6PrfDZurJYc6hM8oTt2/mRYf5P7RuKjvXcLzjZzKZcj9YLJqk7MohhpKBOl N6sA== X-Gm-Message-State: APjAAAVmCHVBVAWplkvJKFq2deKdr4hAa9KjjpKGMnGy+77SuK0y8UMb WHmh73Ysy/AEYB1L1ivfHP16ziDIoJs= X-Google-Smtp-Source: APXvYqwG11k4igHgrryrjPHyfeT7XXX08qys061YfZoc8Z1PSbAFAnEUv3PxRdRufCgDzgfe8AsPIg== X-Received: by 2002:adf:f5c5:: with SMTP id k5mr10271991wrp.42.1565947584701; Fri, 16 Aug 2019 02:26:24 -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 q20sm16521138wrc.79.2019.08.16.02.26.23 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Fri, 16 Aug 2019 02:26:24 -0700 (PDT) From: Denis Efremov To: Bjorn Helgaas Cc: Denis Efremov , linux-kernel@vger.kernel.org, linux-pci@vger.kernel.org, Andrew Murray Subject: [PATCH v2 10/10] PCI: Use PCI_STD_NUM_BARS Date: Fri, 16 Aug 2019 12:24:37 +0300 Message-Id: <20190816092437.31846-11-efremov@linux.com> X-Mailer: git-send-email 2.21.0 In-Reply-To: <20190816092437.31846-1-efremov@linux.com> References: <20190816092437.31846-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 Replace the magic constant with define PCI_STD_NUM_BARS. Signed-off-by: Denis Efremov --- drivers/pci/pci.c | 11 ++++++----- drivers/pci/quirks.c | 2 +- 2 files changed, 7 insertions(+), 6 deletions(-) diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c index 1b27b5af3d55..a9005c9eee6c 100644 --- a/drivers/pci/pci.c +++ b/drivers/pci/pci.c @@ -3768,7 +3768,7 @@ void pci_release_selected_regions(struct pci_dev *pdev, int bars) { int i; - for (i = 0; i < 6; i++) + for (i = 0; i < PCI_STD_NUM_BARS; i++) if (bars & (1 << i)) pci_release_region(pdev, i); } @@ -3779,7 +3779,7 @@ static int __pci_request_selected_regions(struct pci_dev *pdev, int bars, { int i; - for (i = 0; i < 6; i++) + for (i = 0; i < PCI_STD_NUM_BARS; i++) if (bars & (1 << i)) if (__pci_request_region(pdev, i, res_name, excl)) goto err_out; @@ -3827,7 +3827,7 @@ EXPORT_SYMBOL(pci_request_selected_regions_exclusive); void pci_release_regions(struct pci_dev *pdev) { - pci_release_selected_regions(pdev, (1 << 6) - 1); + pci_release_selected_regions(pdev, (1 << PCI_STD_NUM_BARS) - 1); } EXPORT_SYMBOL(pci_release_regions); @@ -3846,7 +3846,8 @@ EXPORT_SYMBOL(pci_release_regions); */ int pci_request_regions(struct pci_dev *pdev, const char *res_name) { - return pci_request_selected_regions(pdev, ((1 << 6) - 1), res_name); + return pci_request_selected_regions(pdev, + ((1 << PCI_STD_NUM_BARS) - 1), res_name); } EXPORT_SYMBOL(pci_request_regions); @@ -3868,7 +3869,7 @@ EXPORT_SYMBOL(pci_request_regions); int pci_request_regions_exclusive(struct pci_dev *pdev, const char *res_name) { return pci_request_selected_regions_exclusive(pdev, - ((1 << 6) - 1), res_name); + ((1 << PCI_STD_NUM_BARS) - 1), res_name); } EXPORT_SYMBOL(pci_request_regions_exclusive); diff --git a/drivers/pci/quirks.c b/drivers/pci/quirks.c index 02bdf3a0231e..51caa61e6112 100644 --- a/drivers/pci/quirks.c +++ b/drivers/pci/quirks.c @@ -1810,7 +1810,7 @@ static void quirk_alder_ioapic(struct pci_dev *pdev) * The next five BARs all seem to be rubbish, so just clean * them out. */ - for (i = 1; i < 6; i++) + for (i = 1; i < PCI_STD_NUM_BARS; i++) memset(&pdev->resource[i], 0, sizeof(pdev->resource[i])); } DECLARE_PCI_FIXUP_HEADER(PCI_VENDOR_ID_INTEL, PCI_DEVICE_ID_INTEL_EESSC, quirk_alder_ioapic);