All of lore.kernel.org
 help / color / mirror / Atom feed
From: Johannes Thumshirn <jthumshirn@suse.de>
To: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org, linux-kernel@vger.kernel.org,
	Christoph Hellwig <hch@infradead.org>,
	Johannes Thumshirn <jthumshirn@suse.de>
Subject: [PATCH v3 1/6] PCI: Add helpers to request/release memory and I/O regions
Date: Tue,  7 Jun 2016 09:44:01 +0200	[thread overview]
Message-ID: <a671e7f69275a39dfc63f88fd0969d664c218cab.1465200424.git.jthumshirn@suse.de> (raw)
In-Reply-To: <cover.1465200424.git.jthumshirn@suse.de>
In-Reply-To: <cover.1465200424.git.jthumshirn@suse.de>

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..9ee6569 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -1401,6 +1401,34 @@ typedef int (*arch_set_vga_state_t)(struct pci_dev *pdev, bool decode,
 		      unsigned int command_bits, u32 flags);
 void pci_register_set_vga_state(arch_set_vga_state_t func);
 
+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));
+}
+
 #else /* CONFIG_PCI is not enabled */
 
 static inline void pci_set_flags(int flags) { }
-- 
1.8.5.6

  reply	other threads:[~2016-06-07  7:44 UTC|newest]

Thread overview: 28+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-06-07  7:44 [PATCH v3 0/6] Introduce pci_(request|release)_(mem|io)_regions Johannes Thumshirn
2016-06-07  7:44 ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-07  7:44 ` Johannes Thumshirn
2016-06-07  7:44 ` Johannes Thumshirn [this message]
2016-06-07  7:44 ` [PATCH v3 2/6] NVMe: Use pci_(request|release)_mem_regions Johannes Thumshirn
2016-06-07  7:44   ` Johannes Thumshirn
2016-06-17 11:27   ` Johannes Thumshirn
2016-06-17 11:27     ` Johannes Thumshirn
2016-06-21 22:27     ` Bjorn Helgaas
2016-06-21 22:27       ` Bjorn Helgaas
2016-06-07  7:44 ` [PATCH v3 3/6] lpfc: " Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 4/6] GenWQE: " Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 5/6] ethernet/intel: " Johannes Thumshirn
2016-06-07  7:44   ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-07  7:44 ` [PATCH v3 6/6] alx: " Johannes Thumshirn
2016-06-07  7:44   ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-07 11:57 ` [PATCH v3 0/6] Introduce pci_(request|release)_(mem|io)_regions Christoph Hellwig
2016-06-07 11:57   ` [Intel-wired-lan] " Christoph Hellwig
2016-06-07 11:57   ` Christoph Hellwig
2016-06-08  7:28 ` Johannes Thumshirn
2016-06-08  7:28   ` [Intel-wired-lan] " Johannes Thumshirn
2016-06-08  7:28   ` Johannes Thumshirn
2016-06-08 23:04   ` Jeff Kirsher
2016-06-08 23:04     ` [Intel-wired-lan] " Jeff Kirsher
2016-06-08 23:04     ` Jeff Kirsher
2016-06-21 22:28 ` Bjorn Helgaas
2016-06-21 22:28   ` [Intel-wired-lan] " Bjorn Helgaas
2016-06-21 22:28   ` Bjorn Helgaas

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=a671e7f69275a39dfc63f88fd0969d664c218cab.1465200424.git.jthumshirn@suse.de \
    --to=jthumshirn@suse.de \
    --cc=bhelgaas@google.com \
    --cc=hch@infradead.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-pci@vger.kernel.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.