Received: by 2002:a05:6358:11c7:b0:104:8066:f915 with SMTP id i7csp7957700rwl; Thu, 23 Mar 2023 10:41:47 -0700 (PDT) X-Google-Smtp-Source: AK7set+qqGoZbU/DYf95gb9fAPUHxHGuPdaG2oXscgINF5g+QIoUdt7uoVGVp0xQ3eCAF0c0fEnK X-Received: by 2002:a17:902:d413:b0:19b:afb:b92e with SMTP id b19-20020a170902d41300b0019b0afbb92emr6357033ple.40.1679593306956; Thu, 23 Mar 2023 10:41:46 -0700 (PDT) ARC-Seal: i=1; a=rsa-sha256; t=1679593306; cv=none; d=google.com; s=arc-20160816; b=CsyQtH8AlIn8qWAHRDl15P0wgdTk2ncU+sZT3NTWWl+JPkgtSUUq2KycLCJrkpzLpP fkNYqYzw3jrnExJwI5iK34HOvI9f4gWwjq+rg0BPhQZycPh7VkYG45bEpClSucZIwjyi QJfYFqr9kqVJ3pEsa/96VrSxGffm2o8yqay/vAroEKcQ18MsMFyXItL9g3P+TS0vLvP9 jEuYPlyG/yS5pII2f+HgzkVXqI4v8wl4X+8dOBQ11Iw1ZTpDSuxLw51J1u19nk8mJAMy 36YLlcQfdccDg/UPj3h8/HUmomG9Kl87iUePU/BcQUe3KsXd3uJ/l+IjUGktfnjEGVVd J9TA== ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=google.com; s=arc-20160816; h=list-id:precedence:content-transfer-encoding:mime-version :references:in-reply-to:message-id:date:subject:cc:to:from :dkim-signature; bh=z4rdmNdp2XYKH1j9y5e4dc3+ql74INf8wD0CKVk+K18=; b=ti205mA767N7NEUbLPnSR49Gil8Q1XPxgCOrYJzfm+rWma35/b2nI6GIc0qs6rHl6c w0WfHdMlHaHlestT48PehiooEG5tG13GrLEY1EQxMFC0HPAYmLGiMeNawj++fKNQk2GB wBWS8LSQ8i2Xi4SLpMNsKGtEtkvW9HiTtH9pZGXxrc6ttCLET5kKu7SkkFhPiLzSNsBf n7pTXgDYWeOmfqFNqH9ELIU1UubOSX62gqkg5eb+91gjkgHhD55bz5jskkfNN0g95cmP rupybFLvkpKRxhncs8AGEm/os5vYnUPz5VwDz9wUiY97+6J7SeXkHpz2n0xVxN1lorgC 6GbQ== ARC-Authentication-Results: i=1; mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FT1gzqkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Return-Path: Received: from out1.vger.email (out1.vger.email. [2620:137:e000::1:20]) by mx.google.com with ESMTP id e16-20020a17090301d000b001a20679d548si1293088plh.183.2023.03.23.10.41.35; Thu, 23 Mar 2023 10:41:46 -0700 (PDT) Received-SPF: pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) client-ip=2620:137:e000::1:20; Authentication-Results: mx.google.com; dkim=pass header.i=@intel.com header.s=Intel header.b=FT1gzqkl; spf=pass (google.com: domain of linux-kernel-owner@vger.kernel.org designates 2620:137:e000::1:20 as permitted sender) smtp.mailfrom=linux-kernel-owner@vger.kernel.org; dmarc=pass (p=NONE sp=NONE dis=NONE) header.from=intel.com Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S229589AbjCWRh2 (ORCPT + 99 others); Thu, 23 Mar 2023 13:37:28 -0400 Received: from lindbergh.monkeyblade.net ([23.128.96.19]:53742 "EHLO lindbergh.monkeyblade.net" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S231794AbjCWRgY (ORCPT ); Thu, 23 Mar 2023 13:36:24 -0400 Received: from mga01.intel.com (mga01.intel.com [192.55.52.88]) by lindbergh.monkeyblade.net (Postfix) with ESMTPS id D0660D528; Thu, 23 Mar 2023 10:36:13 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/simple; d=intel.com; i=@intel.com; q=dns/txt; s=Intel; t=1679592973; x=1711128973; h=from:to:cc:subject:date:message-id:in-reply-to: references:mime-version:content-transfer-encoding; bh=yfeoYNUxbO0e2gvMFM4I3e9/lrxCDzuwgcUE0vRubSk=; b=FT1gzqklAuYPpscS5ITwqvz+pr9w2+z5Zk8jTzLagY2kTKM4noAg/nc1 uTUw+1f2TYov7hTnXpWHJM/u6KyZ+40VggN6CEjAKdjDuU8sTgacXTtiP t5BgEPthN5QcEo5tIoEECIHhO2lYV8jjcxYc61QwilY6Y7Q/lRj0mUk6s vTq733lXW2u9CwekaBWkPB7rfaEnAseDFZgNi0mPCNdoHejSEKjeKPjrQ uCRBssud0ImvQd3vt7jkWrHC9B7FupAHjL1HjNCGqpr6afLBAQ/Iyy0vf yBOni7AgVrYMHs2iPE+udEwLw4MAGCkMBNDMeJEakh0M+R0g2lYVQg/LC A==; X-IronPort-AV: E=McAfee;i="6600,9927,10658"; a="367308126" X-IronPort-AV: E=Sophos;i="5.98,285,1673942400"; d="scan'208";a="367308126" 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 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" 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) From: Andy Shevchenko To: =?UTF-8?q?Micka=C3=ABl=20Sala=C3=BCn?= , Andy Shevchenko , Mika Westerberg , =?UTF-8?q?Krzysztof=20Wilczy=C5=84ski?= , Michael Ellerman , Randy Dunlap , Arnd Bergmann , Niklas Schnelle , Bjorn Helgaas , "Rafael J. Wysocki" , =?UTF-8?q?Pali=20Roh=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 Content-Transfer-Encoding: 8bit X-Spam-Status: No, score=-2.4 required=5.0 tests=DKIMWL_WL_HIGH,DKIM_SIGNED, DKIM_VALID,DKIM_VALID_EF,RCVD_IN_DNSWL_MED,RCVD_IN_MSPIKE_H3, RCVD_IN_MSPIKE_WL,SPF_HELO_NONE,SPF_NONE autolearn=unavailable autolearn_force=no version=3.4.6 X-Spam-Checker-Version: SpamAssassin 3.4.6 (2021-04-09) on lindbergh.monkeyblade.net Precedence: bulk List-ID: X-Mailing-List: linux-kernel@vger.kernel.org Replace open-coded implementations of pci_resource_n() in pci.h. Signed-off-by: Andy Shevchenko --- 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; \ -- 2.40.0.1.gaa8946217a0b