From d2ae1717f3f6b1bd86cd05d0443169b645445d62 Mon Sep 17 00:00:00 2001 From: Peng Hao Date: Tue, 6 Nov 2018 22:57:13 +0800 Subject: [PATCH] misc/pvpanic: simplify the code using acpi_dev_resource_io Use acpi_dev_resource_io API. Suggested-by: Andy Shevchenko Reviewed-by: Andy Shevchenko Acked-by: Mark Rutland Signed-off-by: Peng Hao Signed-off-by: Greg Kroah-Hartman --- drivers/misc/pvpanic.c | 13 +++++-------- 1 file changed, 5 insertions(+), 8 deletions(-) diff --git a/drivers/misc/pvpanic.c b/drivers/misc/pvpanic.c index fd86daba7ffd..49c59e1d299d 100644 --- a/drivers/misc/pvpanic.c +++ b/drivers/misc/pvpanic.c @@ -77,17 +77,14 @@ static struct notifier_block pvpanic_panic_nb = { static acpi_status pvpanic_walk_resources(struct acpi_resource *res, void *context) { - switch (res->type) { - case ACPI_RESOURCE_TYPE_END_TAG: - return AE_OK; + struct resource r; - case ACPI_RESOURCE_TYPE_IO: - port = res->data.io.minimum; + if (acpi_dev_resource_io(res, &r)) { + port = r.start; return AE_OK; - - default: - return AE_ERROR; } + + return AE_ERROR; } static int pvpanic_add(struct acpi_device *device)