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


Groups > linux.kernel > #1410231 > unrolled thread

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

Started byJohannes Thumshirn <jthumshirn@suse.de>
First post2016-05-31 14:10 +0200
Last post2016-06-01 10:00 +0200
Articles 2 — 2 participants

Back to article view | Back to linux.kernel

This discussion starts older than the indexed window; earlier articles aren't shown. The article labeled Started by below is the oldest one visible, not the original post.


Contents

  [PATCH 1/5] PCI: Add helpers to request/release memory and I/O regions Johannes Thumshirn <jthumshirn@suse.de> - 2016-05-31 14:10 +0200
    Re: [PATCH 1/5] PCI: Add helpers to request/release memory and I/O  regions Christoph Hellwig <hch@infradead.org> - 2016-06-01 10:00 +0200

#1410231 — [PATCH 1/5] PCI: Add helpers to request/release memory and I/O regions

FromJohannes Thumshirn <jthumshirn@suse.de>
Date2016-05-31 14:10 +0200
Subject[PATCH 1/5] PCI: Add helpers to request/release memory and I/O regions
Message-ID<rEQEG-2x9-29@gated-at.bofh.it>
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>
---
 include/linux/pci.h | 29 +++++++++++++++++++++++++++++
 1 file changed, 29 insertions(+)

diff --git a/include/linux/pci.h b/include/linux/pci.h
index 932ec74..846f4cf 100644
--- a/include/linux/pci.h
+++ b/include/linux/pci.h
@@ -2007,6 +2007,35 @@ 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

[toc] | [next] | [standalone]


#1410902 — Re: [PATCH 1/5] PCI: Add helpers to request/release memory and I/O regions

FromChristoph Hellwig <hch@infradead.org>
Date2016-06-01 10:00 +0200
SubjectRe: [PATCH 1/5] PCI: Add helpers to request/release memory and I/O regions
Message-ID<rF9ei-5BV-15@gated-at.bofh.it>
In reply to#1410231
On Tue, May 31, 2016 at 02:05:09PM +0200, Johannes Thumshirn wrote:
> 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>
> ---
>  include/linux/pci.h | 29 +++++++++++++++++++++++++++++
>  1 file changed, 29 insertions(+)
> 
> diff --git a/include/linux/pci.h b/include/linux/pci.h
> index 932ec74..846f4cf 100644
> --- a/include/linux/pci.h
> +++ b/include/linux/pci.h
> @@ -2007,6 +2007,35 @@ 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);

Needs a little indentation tweak to not spill over 80 characters.  Two
tabs should be plenty indentation for the continuation of function
arguments.  Ditto for the other functions,

Otherwise looks fine:

Reviewed-by: Christoph Hellwig <hch@lst.de>

[toc] | [prev] | [standalone]


Back to top | Article view | linux.kernel


csiph-web