Received: by 2002:a25:8b12:0:0:0:0:0 with SMTP id i18csp693550ybl; Fri, 16 Aug 2019 02:27:34 -0700 (PDT) X-Google-Smtp-Source: APXvYqy+gqoJKtxqX7P5sbS2MYiqejUJD1Pvezy6qFH51FL4L3cEGDC+p9XUmOMIbnj2FaxEC9GC X-Received: by 2002:a17:902:7c12:: with SMTP id x18mr8450979pll.123.1565947654132; Fri, 16 Aug 2019 02:27:34 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1565947654; cv=none; d=google.com; s=arc-20160816; b=h+W/TnWuXpwMXJaotbsj6IJXY2Js14YvTOSQO7MzAS0GcMMS56tKR5RDkjxwoxs3T7 XOwDJzQQAx5pZTJv2xQp69zcJlHPscdNcy3CptN6TGeDr+QZry2dIrnzdcAi0KUn+UG+ ZWzyLASI8eSnXmn1ZZ0ayrq+q6GLCU62i3LXc9XU9QU7hn/5vmtH21sYThFxKKnoKDmV DJZO1MxkyHVyY7cz+w7CM9eMK6SmxSsCJ2E3ZCj0e+n+K+++QXkSPmaIbu1IOBsEEBYN lBfxOj2IL20dfXw8vbh7bHsS2Xaqz/nwRvVDtJKwoWLV1e4f7gjWL/SG7FRPYC5Y6fZt ulGA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:sender:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from; bh=fQFIDh4S3BKcxzlORjnStXsZ6DfUzI3N/hnvhmTuLs8=; b=PLF0D0d6cC+gUT26HoqCTZJODYOiWTh0OqxVcx8VqdDgo40IF23AmKUEnnlBBZ0Ahs 5VUzrPs3mS3XgbZy6Y90JaR5cjcRKJbMaCIQa4kRuLWmeq4XhPP2M3AlE+jDaldLlAuO 1sRJg/TmeOSD83wZCPU5w9pdPlFsrN7iqJdRaU0C0bBvirBoIbKrIoCK6KmibSOjk3KI N714JsxWquJm3rwOJwK7pYs5ke/woRhIdSNR+9Rjo+WLkDtH23gdFYrj+nt70D6Sl6XW 9u4cCodBRxibBLOne98gZZBybdWIKS2kxDayrp6ygadsWtj+YOs9qXgyQMPAfisRishc y+JA== ARC-Authentication-Results: i=1; mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Return-Path: Received: from vger.kernel.org (vger.kernel.org. [209.132.180.67]) by mx.google.com with ESMTP id r200si3411086pgr.518.2019.08.16.02.27.17; Fri, 16 Aug 2019 02:27:34 -0700 (PDT) Received-SPF: pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) client-ip=209.132.180.67; Authentication-Results: mx.google.com; spf=pass (google.com: best guess record for domain of linux-kernel-owner@vger.kernel.org designates 209.132.180.67 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S1727252AbfHPJ02 (ORCPT + 99 others); Fri, 16 Aug 2019 05:26:28 -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-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 Content-Transfer-Encoding: 8bit Sender: linux-kernel-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org 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); -- 2.21.0