* [PATCH v2 4/8] resource: Introduce resource_union() for overlapping resources
[not found] <20200817163647.48982-1-andriy.shevchenko@linux.intel.com>
@ 2020-08-17 16:36 ` Andy Shevchenko
2020-08-17 16:36 ` [PATCH v2 6/8] PCI/ACPI: Replace open coded variant of resource_union() Andy Shevchenko
2020-08-17 16:36 ` [PATCH v2 7/8] PCI/ACPI: Fix description of @handle for acpi_is_root_bridge() Andy Shevchenko
2 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-08-17 16:36 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, linux-acpi
Cc: Andy Shevchenko, Mika Westerberg, Kuppuswamy Sathyanarayanan,
Bjorn Helgaas, linux-pci
Some already present users may utilize resource_union() helper.
Provide it for them and for wider use in the future.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Mika Westerberg <mika.westerberg@linux.intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
---
v2: reused min/max (Rafael)
include/linux/ioport.h | 13 ++++++++++++-
1 file changed, 12 insertions(+), 1 deletion(-)
diff --git a/include/linux/ioport.h b/include/linux/ioport.h
index 50fed618d3fb..a7d50b9a3406 100644
--- a/include/linux/ioport.h
+++ b/include/linux/ioport.h
@@ -10,9 +10,10 @@
#define _LINUX_IOPORT_H
#ifndef __ASSEMBLY__
+#include <linux/bits.h>
#include <linux/compiler.h>
+#include <linux/minmax.h>
#include <linux/types.h>
-#include <linux/bits.h>
/*
* Resources are tree-like, allowing
* nesting etc..
@@ -232,6 +233,16 @@ static inline bool resource_overlaps(struct resource *r1, struct resource *r2)
return r1->start <= r2->end && r1->end >= r2->start;
}
+static inline bool
+resource_union(struct resource *r1, struct resource *r2, struct resource *r)
+{
+ if (!resource_overlaps(r1, r2))
+ return false;
+ r->start = min(r1->start, r2->start);
+ r->end = max(r1->end, r2->end);
+ return true;
+}
+
/* Convenience shorthand with allocation */
#define request_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), 0)
#define request_muxed_region(start,n,name) __request_region(&ioport_resource, (start), (n), (name), IORESOURCE_MUXED)
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 6/8] PCI/ACPI: Replace open coded variant of resource_union()
[not found] <20200817163647.48982-1-andriy.shevchenko@linux.intel.com>
2020-08-17 16:36 ` [PATCH v2 4/8] resource: Introduce resource_union() for overlapping resources Andy Shevchenko
@ 2020-08-17 16:36 ` Andy Shevchenko
2020-08-17 16:36 ` [PATCH v2 7/8] PCI/ACPI: Fix description of @handle for acpi_is_root_bridge() Andy Shevchenko
2 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-08-17 16:36 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, linux-acpi
Cc: Andy Shevchenko, Kuppuswamy Sathyanarayanan, Bjorn Helgaas,
linux-pci, Rafael J . Wysocki
Since we have resource_union() helper, let's utilize it here.
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>
---
v2: added Rb tag (Rafael)
drivers/acpi/pci_root.c | 4 +---
1 file changed, 1 insertion(+), 3 deletions(-)
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index f90e841c59f5..2a6a741896de 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -724,9 +724,7 @@ static void acpi_pci_root_validate_resources(struct device *dev,
* our resources no longer match the ACPI _CRS, but
* the kernel resource tree doesn't allow overlaps.
*/
- if (resource_overlaps(res1, res2)) {
- res2->start = min(res1->start, res2->start);
- res2->end = max(res1->end, res2->end);
+ if (resource_union(res1, res2, res2)) {
dev_info(dev, "host bridge window expanded to %pR; %pR ignored\n",
res2, res1);
free = true;
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
* [PATCH v2 7/8] PCI/ACPI: Fix description of @handle for acpi_is_root_bridge()
[not found] <20200817163647.48982-1-andriy.shevchenko@linux.intel.com>
2020-08-17 16:36 ` [PATCH v2 4/8] resource: Introduce resource_union() for overlapping resources Andy Shevchenko
2020-08-17 16:36 ` [PATCH v2 6/8] PCI/ACPI: Replace open coded variant of resource_union() Andy Shevchenko
@ 2020-08-17 16:36 ` Andy Shevchenko
2 siblings, 0 replies; 3+ messages in thread
From: Andy Shevchenko @ 2020-08-17 16:36 UTC (permalink / raw)
To: Rafael J. Wysocki, Len Brown, linux-acpi
Cc: Andy Shevchenko, Kuppuswamy Sathyanarayanan, Bjorn Helgaas, linux-pci
Fix description of handle parameter in documentation of acpi_is_root_bridge().
Otherwise we get the following warning:
CHECK drivers/acpi/pci_root.c
drivers/acpi/pci_root.c:71: warning: Function parameter or member 'handle' not described in 'acpi_is_root_bridge'
Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
Cc: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
Cc: Bjorn Helgaas <bhelgaas@google.com>
Cc: linux-pci@vger.kernel.org
---
v2: left in the series, but maintainers still may apply it separately
drivers/acpi/pci_root.c | 2 +-
1 file changed, 1 insertion(+), 1 deletion(-)
diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index 2a6a741896de..f723679954d7 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -62,7 +62,7 @@ static DEFINE_MUTEX(osc_lock);
/**
* acpi_is_root_bridge - determine whether an ACPI CA node is a PCI root bridge
- * @handle - the ACPI CA node in question.
+ * @handle: the ACPI CA node in question.
*
* Note: we could make this API take a struct acpi_device * instead, but
* for now, it's more convenient to operate on an acpi_handle.
--
2.28.0
^ permalink raw reply related [flat|nested] 3+ messages in thread
end of thread, other threads:[~2020-08-17 17:34 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
[not found] <20200817163647.48982-1-andriy.shevchenko@linux.intel.com>
2020-08-17 16:36 ` [PATCH v2 4/8] resource: Introduce resource_union() for overlapping resources Andy Shevchenko
2020-08-17 16:36 ` [PATCH v2 6/8] PCI/ACPI: Replace open coded variant of resource_union() Andy Shevchenko
2020-08-17 16:36 ` [PATCH v2 7/8] PCI/ACPI: Fix description of @handle for acpi_is_root_bridge() Andy Shevchenko
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).