diff mbox series

[v4,5/6] PCI/ACPI: Replace open coded variant of resource_union()

Message ID 20201102210025.53520-6-andriy.shevchenko@linux.intel.com
State New
Headers show
Series resource: introduce union(), intersection() API | expand

Commit Message

Andy Shevchenko Nov. 2, 2020, 9 p.m. UTC
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>
---
 drivers/acpi/pci_root.c | 4 +---
 1 file changed, 1 insertion(+), 3 deletions(-)

Comments

Kuppuswamy, Sathyanarayanan Nov. 2, 2020, 9:03 p.m. UTC | #1
On 11/2/20 1:00 PM, Andy Shevchenko wrote:
> 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>
Reviewed-by: Kuppuswamy Sathyanarayanan <sathyanarayanan.kuppuswamy@linux.intel.com>
> ---
>   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 c12b5fb3e8fb..0bf072cef6cf 100644
> --- a/drivers/acpi/pci_root.c
> +++ b/drivers/acpi/pci_root.c
> @@ -722,9 +722,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;
>
diff mbox series

Patch

diff --git a/drivers/acpi/pci_root.c b/drivers/acpi/pci_root.c
index c12b5fb3e8fb..0bf072cef6cf 100644
--- a/drivers/acpi/pci_root.c
+++ b/drivers/acpi/pci_root.c
@@ -722,9 +722,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;