From patchwork Thu Mar 23 17:36:10 2023 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 8bit X-Patchwork-Submitter: Andy Shevchenko X-Patchwork-Id: 13185949 Return-Path: X-Spam-Checker-Version: SpamAssassin 3.4.0 (2014-02-07) on aws-us-west-2-korg-lkml-1.web.codeaurora.org Received: from lists.xenproject.org (lists.xenproject.org [192.237.175.120]) (using TLSv1.2 with cipher ECDHE-RSA-AES256-GCM-SHA384 (256/256 bits)) (No client certificate requested) by smtp.lore.kernel.org (Postfix) with ESMTPS id 8AAF9C77B60 for ; Thu, 23 Mar 2023 17:36:10 +0000 (UTC) Received: from list by lists.xenproject.org with outflank-mailman.514005.795902 (Exim 4.92) (envelope-from ) id 1pfOr4-0001kv-TQ; Thu, 23 Mar 2023 17:36:02 +0000 X-Outflank-Mailman: Message body and most headers restored to incoming version Received: by outflank-mailman (output) from mailman id 514005.795902; Thu, 23 Mar 2023 17:36:02 +0000 Received: from localhost ([127.0.0.1] helo=lists.xenproject.org) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pfOr4-0001kS-LD; Thu, 23 Mar 2023 17:36:02 +0000 Received: by outflank-mailman (input) for mailman id 514005; Thu, 23 Mar 2023 17:36:01 +0000 Received: from se1-gles-flk1-in.inumbo.com ([94.247.172.50] helo=se1-gles-flk1.inumbo.com) by lists.xenproject.org with esmtp (Exim 4.92) (envelope-from ) id 1pfOr3-0000iP-6N for xen-devel@lists.xenproject.org; Thu, 23 Mar 2023 17:36:01 +0000 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by se1-gles-flk1.inumbo.com (Halon) with ESMTPS id 2c59aa0b-c9a1-11ed-b464-930f4c7d94ae; Thu, 23 Mar 2023 18:35:59 +0100 (CET) Received: from orsmga002.jf.intel.com ([10.7.209.21]) by fmsmga101.fm.intel.com with ESMTP/TLS/ECDHE-RSA-AES256-GCM-SHA384; 23 Mar 2023 10:35:46 -0700 Received: from black.fi.intel.com ([10.237.72.28]) by orsmga002.jf.intel.com with ESMTP; 23 Mar 2023 10:35:36 -0700 Received: by black.fi.intel.com (Postfix, from userid 1003) id 1873736E; Thu, 23 Mar 2023 19:36:12 +0200 (EET) X-BeenThere: xen-devel@lists.xenproject.org List-Id: Xen developer discussion List-Unsubscribe: , List-Post: List-Help: List-Subscribe: , Errors-To: xen-devel-bounces@lists.xenproject.org Precedence: list Sender: "Xen-devel" X-Inumbo-ID: 2c59aa0b-c9a1-11ed-b464-930f4c7d94ae DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679592959; x=1711128959; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yfeoYNUxbO0e2gvMFM4I3e9/lrxCDzuwgcUE0vRubSk=; b=SnsPC8EmMiZi1EyU3GPkdcv2rNN7HJ4yLh8AdCyIFA4SZ48euhSX1lW+ rrHIa9gzDxTZusb6BbxusNULuLAzqlz0pnMDIROuxvM+wSql53f/3S9Jj ul77FVTI8THfhOPW0oCVMHE7pM/1jvlaGomKra8N0u9ChzvFCgTK/ynLl 2ya3Av+3Lw+Ed9z8EQs2V1tKnG+gh/JTMMI5Zctem8snBc/1Hn/885kRd eMYsxOqWY44WhaeDyTseU9vdnZbgj910ZUzaB3INL+bR04Eo3ngRTlYTF /LwWUNAW7jym4R4KkNjpFphUELz7l58OOkv6XmqAk5Qnm9xC/CHYvRysR w==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="367308136" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="367308136" X-ExtLoop1: 1 X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="682380750" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="682380750" From: Andy Shevchenko To: =?utf-8?q?Micka=C3=ABl_Sala=C3=BCn?= , Andy Shevchenko , Mika Westerberg , =?utf-8?q?Krzysztof_Wilc?= =?utf-8?q?zy=C5=84ski?= , Michael Ellerman , Randy Dunlap , Arnd Bergmann , Niklas Schnelle , Bjorn Helgaas , "Rafael J. Wysocki" , =?utf-8?q?Pali_Roh=C3=A1r?= , "Maciej W. Rozycki" , Juergen Gross , Dominik Brodowski , linux-kernel@vger.kernel.org, linux-alpha@vger.kernel.org, linux-arm-kernel@lists.infradead.org, linux-mips@vger.kernel.org, linuxppc-dev@lists.ozlabs.org, linux-sh@vger.kernel.org, sparclinux@vger.kernel.org, linux-pci@vger.kernel.org, xen-devel@lists.xenproject.org, linux-acpi@vger.kernel.org Cc: Miguel Ojeda , Richard Henderson , Ivan Kokshaysky , Matt Turner , Russell King , Andrew Lunn , Sebastian Hesselbarth , Gregory Clement , Thomas Bogendoerfer , Nicholas Piggin , Christophe Leroy , Anatolij Gustschin , Yoshinori Sato , Rich Felker , John Paul Adrian Glaubitz , "David S. Miller" , Bjorn Helgaas , Stefano Stabellini , Oleksandr Tyshchenko Subject: [PATCH v7 6/6] PCI: Make use of pci_resource_n() Date: Thu, 23 Mar 2023 19:36:10 +0200 Message-Id: <20230323173610.60442-7-andriy.shevchenko@linux.intel.com> X-Mailer: git-send-email 2.40.0.1.gaa8946217a0b In-Reply-To: <20230323173610.60442-1-andriy.shevchenko@linux.intel.com> References: <20230323173610.60442-1-andriy.shevchenko@linux.intel.com> MIME-Version: 1.0 Replace open-coded implementations of pci_resource_n() in pci.h. Signed-off-by: Andy Shevchenko Reviewed-by: Philippe Mathieu-Daudé --- include/linux/pci.h | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/include/linux/pci.h b/include/linux/pci.h index 70a4684d5f26..9539cf63fe5e 100644 --- a/include/linux/pci.h +++ b/include/linux/pci.h @@ -2006,14 +2006,12 @@ int pci_iobar_pfn(struct pci_dev *pdev, int bar, struct vm_area_struct *vma); * for accessing popular PCI BAR info */ #define pci_resource_n(dev, bar) (&(dev)->resource[(bar)]) -#define pci_resource_start(dev, bar) ((dev)->resource[(bar)].start) -#define pci_resource_end(dev, bar) ((dev)->resource[(bar)].end) -#define pci_resource_flags(dev, bar) ((dev)->resource[(bar)].flags) -#define pci_resource_len(dev,bar) \ - ((pci_resource_end((dev), (bar)) == 0) ? 0 : \ - \ - (pci_resource_end((dev), (bar)) - \ - pci_resource_start((dev), (bar)) + 1)) +#define pci_resource_start(dev, bar) (pci_resource_n(dev, bar)->start) +#define pci_resource_end(dev, bar) (pci_resource_n(dev, bar)->end) +#define pci_resource_flags(dev, bar) (pci_resource_n(dev, bar)->flags) +#define pci_resource_len(dev,bar) \ + (pci_resource_end((dev), (bar)) ? \ + resource_size(pci_resource_n((dev), (bar))) : 0) #define __pci_dev_for_each_resource_0(dev, res, ...) \ for (unsigned int __b = 0; \