Re: [PATCH] gpio: tegra186: Add ACPI support
From: Andy Shevchenko
Date: Thu Jun 17 2021 - 11:21:58 EST
On Thu, Jun 17, 2021 at 1:18 PM Akhil R <akhilrajeev@xxxxxxxxxx> wrote:
>
> From: Akhil Rajeev <akhilrajeev@xxxxxxxxxx>
>
> Add ACPI module ID to probe the driver from the ACPI based bootloader
> firmware.
...
> +#include <linux/acpi.h>
It probably should be property.h, see below.
...
> + if (has_acpi_companion(&pdev->dev)) {
> + gpio->secure = devm_platform_ioremap_resource(pdev, 0);
> + gpio->base = devm_platform_ioremap_resource(pdev, 1);
> + } else {
> + gpio->secure = devm_platform_ioremap_resource_byname(pdev, "security");
> + gpio->base = devm_platform_ioremap_resource_byname(pdev, "gpio");
> + }
General comment here.
Can't we rather try named resources first and fallback to indexed
ones? (Or other way around)
In this case you don't need to check for ACPI at all.
...
> + .acpi_match_table = ACPI_PTR(tegra186_gpio_acpi_match),
You can drop ACPI_PTR() along with ugly ifdeffery.
--
With Best Regards,
Andy Shevchenko