Thread (37 messages) 37 messages, 6 authors, 2016-09-15

Re: [PATCH 1/2] PCI: Add pci_find_resource()

From: "Rafael J. Wysocki" <rafael@kernel.org>
Date: 2016-09-14 22:47:21
Also in: linux-pci

On Thu, Sep 15, 2016 at 12:16 AM, Bjorn Helgaas [off-list ref] wrote:
On Tue, Sep 13, 2016 at 03:19:41PM +0300, Mika Westerberg wrote:
quoted
Add a new helper function pci_find_resource() that can be used to find out
whether a given resource (for example from a child device) is contained
within given PCI device's standard resources.

Signed-off-by: Mika Westerberg <mika.westerberg@linux.intel.com>
Acked-by: Bjorn Helgaas <bhelgaas@google.com>

I think the ACPI part of this series is more interesting than the PCI
part, so I propose that Rafael merge the series if he likes it.
I do, thanks!
quoted
---
 drivers/pci/pci.c   | 27 +++++++++++++++++++++++++++
 include/linux/pci.h |  4 ++++
 2 files changed, 31 insertions(+)
diff --git a/drivers/pci/pci.c b/drivers/pci/pci.c
index aab9d5115a5f..491f879f34cb 100644
--- a/drivers/pci/pci.c
+++ b/drivers/pci/pci.c
@@ -480,6 +480,33 @@ struct resource *pci_find_parent_resource(const struct pci_dev *dev,
 EXPORT_SYMBOL(pci_find_parent_resource);

 /**
+ * pci_find_resource - Return matching PCI device resource
+ * @dev: PCI device to query
+ * @res: Resource to look for
+ *
+ * Goes over standard PCI resources (BARs) and checks if the given resource
+ * is partially or fully contained in any of them. In that case the
+ * matching resource is returned, %NULL otherwise.
+ */
+struct resource *pci_find_resource(struct pci_dev *dev, struct resource *res)
+{
+     int i;
+
+     if (!res)
+             return NULL;
I agree that this test for !res is unnecessary.
Right.

I'm assuming the patch will be updated to drop this check.

Thanks,
Rafael
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help