Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > linux.kernel > #1411944

[PATCH v2 1/6] PCI: Add helpers to request/release memory and I/O regions

From Johannes Thumshirn <jthumshirn@suse.de>
Newsgroups linux.kernel
Subject [PATCH v2 1/6] PCI: Add helpers to request/release memory and I/O regions
Date 2016-06-02 09:40 +0200
Message-ID <rFvou-2Z6-19@gated-at.bofh.it> (permalink)
References <rFvot-2Z6-1@gated-at.bofh.it>
Organization linux.* mail to news gateway

Show all headers | View raw


Add helpers to request and release a device's memory or I/O regions.

With these helpers in place, one does not need to select a device's memory or
I/O regions with pci_select_bars() prior to requesting or releasing them.

Suggested-by: Christoph Hellwig <hch@infradead.org>
Signed-off-by: Johannes Thumshirn <jthumshirn@suse.de>
Reviewed-by: Christoph Hellwig <hch@lst.de>
Cc: Christoph Hellwig <hch@infradead.org>
---
 include/linux/pci.h | 28 ++++++++++++++++++++++++++++
 1 file changed, 28 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 932ec74..565c38e 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2007,6 +2007,34 @@ static inline bool pci_is_dev_assigned(struct pci_dev *pdev)
 	return (pdev->dev_flags & PCI_DEV_FLAGS_ASSIGNED) == PCI_DEV_FLAGS_ASSIGNED;
 }
 
+static inline int
+pci_request_io_regions(struct pci_dev *pdev, const char *name)
+{
+	return pci_request_selected_regions(pdev,
+			    pci_select_bars(pdev, IORESOURCE_IO), name);
+}
+
+static inline void
+pci_release_io_regions(struct pci_dev *pdev)
+{
+	return pci_release_selected_regions(pdev,
+			    pci_select_bars(pdev, IORESOURCE_IO));
+}
+
+static inline int
+pci_request_mem_regions(struct pci_dev *pdev, const char *name)
+{
+	return pci_request_selected_regions(pdev,
+			    pci_select_bars(pdev, IORESOURCE_MEM), name);
+}
+
+static inline void
+pci_release_mem_regions(struct pci_dev *pdev)
+{
+	return pci_release_selected_regions(pdev,
+			    pci_select_bars(pdev, IORESOURCE_MEM));
+}
+
 /**
  * pci_ari_enabled - query ARI forwarding status
  * @bus: the PCI bus
-- 
1.8.5.6

Back to linux.kernel | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread


Thread

[PATCH v2 0/6] Introduce pci_(request|release)_(mem|io)_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
  [PATCH v2 2/6] NVMe: Use pci_(request|release)_mem_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
  [PATCH v2 4/6] GenWQE: Use pci_(request|release)_mem_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
  [PATCH v2 6/6] alx: Use pci_(request|release)_mem_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
  [PATCH v2 1/6] PCI: Add helpers to request/release memory and I/O regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
    Re: [PATCH v2 1/6] PCI: Add helpers to request/release memory and  I/O regions kbuild test robot <lkp@intel.com> - 2016-06-05 01:30 +0200
    Re: [PATCH v2 1/6] PCI: Add helpers to request/release memory and  I/O regions kbuild test robot <lkp@intel.com> - 2016-06-05 01:40 +0200
      Re: [PATCH v2 1/6] PCI: Add helpers to request/release memory and  I/O regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-06 10:20 +0200
  [PATCH v2 5/6] ethernet/intel: Use pci_(request|release)_mem_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
    Re: [PATCH v2 5/6] ethernet/intel: Use  pci_(request|release)_mem_regions Jeff Kirsher <jeffrey.t.kirsher@intel.com> - 2016-06-02 23:10 +0200
  [PATCH v2 3/6] lpfc: Use pci_(request|release)_mem_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-02 09:40 +0200
    Re: [PATCH v2 3/6] lpfc: Use pci_(request|release)_mem_regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-06-06 10:20 +0200

csiph-web