]> git.proxmox.com Git - mirror_ubuntu-hirsute-kernel.git/commitdiff
misc/pvpanic: simplify the code using acpi_dev_resource_io
authorPeng Hao <peng.hao2@zte.com.cn>
Tue, 6 Nov 2018 14:57:13 +0000 (22:57 +0800)
committerGreg Kroah-Hartman <gregkh@linuxfoundation.org>
Wed, 7 Nov 2018 12:53:04 +0000 (13:53 +0100)
Use acpi_dev_resource_io API.

Suggested-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Reviewed-by: Andy Shevchenko <andy.shevchenko@gmail.com>
Acked-by: Mark Rutland <mark.rutland@arm.com>
Signed-off-by: Peng Hao <peng.hao2@zte.com.cn>
Signed-off-by: Greg Kroah-Hartman <gregkh@linuxfoundation.org>
drivers/misc/pvpanic.c

index fd86daba7ffd450e8c2767eddb180d27573c5c70..49c59e1d299db5cc7b0c8cbf6305805f7573ef5d 100644 (file)
@@ -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)