diff mbox series

[v1,7/7] ACPI: watchdog: Replace open coded variant of resource_union()

Message ID 20200813175729.15088-7-andriy.shevchenko@linux.intel.com (mailing list archive)
State Changes Requested, archived
Headers show
Series [v1,1/7] resource: Simplify region_intersects() by reducing conditionals | expand

Commit Message

Andy Shevchenko Aug. 13, 2020, 5:57 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: Mika Westerberg <mika.westerberg@linux.intel.com>
---
 drivers/acpi/acpi_watchdog.c | 6 +-----
 1 file changed, 1 insertion(+), 5 deletions(-)

Comments

Rafael J. Wysocki Aug. 14, 2020, 3:27 p.m. UTC | #1
On Thu, Aug 13, 2020 at 7:57 PM Andy Shevchenko
<andriy.shevchenko@linux.intel.com> wrote:
>
> Since we have resource_union() helper, let's utilize it here.
>
> Signed-off-by: Andy Shevchenko <andriy.shevchenko@linux.intel.com>
> Cc: Mika Westerberg <mika.westerberg@linux.intel.com>

Reviewed-by: Rafael J. Wysocki <rafael.j.wysocki@intel.com>

> ---
>  drivers/acpi/acpi_watchdog.c | 6 +-----
>  1 file changed, 1 insertion(+), 5 deletions(-)
>
> diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
> index 5c1e9ea43123..ca28183f4d13 100644
> --- a/drivers/acpi/acpi_watchdog.c
> +++ b/drivers/acpi/acpi_watchdog.c
> @@ -151,11 +151,7 @@ void __init acpi_watchdog_init(void)
>                 found = false;
>                 resource_list_for_each_entry(rentry, &resource_list) {
>                         if (rentry->res->flags == res.flags &&
> -                           resource_overlaps(rentry->res, &res)) {
> -                               if (res.start < rentry->res->start)
> -                                       rentry->res->start = res.start;
> -                               if (res.end > rentry->res->end)
> -                                       rentry->res->end = res.end;
> +                           resource_union(rentry->res, &res, rentry->res)) {
>                                 found = true;
>                                 break;
>                         }
> --
> 2.28.0
>
diff mbox series

Patch

diff --git a/drivers/acpi/acpi_watchdog.c b/drivers/acpi/acpi_watchdog.c
index 5c1e9ea43123..ca28183f4d13 100644
--- a/drivers/acpi/acpi_watchdog.c
+++ b/drivers/acpi/acpi_watchdog.c
@@ -151,11 +151,7 @@  void __init acpi_watchdog_init(void)
 		found = false;
 		resource_list_for_each_entry(rentry, &resource_list) {
 			if (rentry->res->flags == res.flags &&
-			    resource_overlaps(rentry->res, &res)) {
-				if (res.start < rentry->res->start)
-					rentry->res->start = res.start;
-				if (res.end > rentry->res->end)
-					rentry->res->end = res.end;
+			    resource_union(rentry->res, &res, rentry->res)) {
 				found = true;
 				break;
 			}