Re: [PATCH V5 6/8] misc/pvpanic: add MMIO support

From: Andy Shevchenko
Date: Thu Nov 01 2018 - 13:04:17 EST


On Thu, Nov 1, 2018 at 9:00 AM Peng Hao <peng.hao2@xxxxxxxxxx> wrote:
>
> On some architectures (e.g. arm64), it's preferable to use MMIO, since
> this can be used standalone. Add MMIO support to the pvpanic driver.

> - if (acpi_dev_resource_io(res, &r) {
> - port = r.start;
> + if (acpi_dev_resource_io(res, &r) ||
> + acpi_dev_resource_memory(res, &r)) {


> + if (r.flags & IORESOURCE_IO)

You need spend some time to understand better how acpi_dev_resource_*() works.
Hint: this condition is redundant.

> + base = (void __iomem *) ioport_map(r.start,
> + r.end - r.start + 1);
> + else
> + base = ioremap(r.start, r.end - r.start + 1);
> +


--
With Best Regards,
Andy Shevchenko