lkml.org 
[lkml]   [2021]   [Jun]   [30]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
/
From
Date
SubjectRe: [PATCH v2] gpio: tegra186: Add ACPI support
On Mon, Jun 21, 2021 at 6:07 PM Akhil R <akhilrajeev@nvidia.com> wrote:

> >What about doing like
>
> > gpio->secure = devm_platform_ioremap_resource_byname(pdev, "security");
> > if (IS_ERR(gpio->secure))
> > gpio->secure = devm_platform_ioremap_resource(pdev, 0);
> > if (IS_ERR(gpio->secure))
> > return PTR_ERR(gpio->secure);
> >
> >and similar for gpio->base?
>
> Wouldn't this cause a redundant check if it had already succeeded in getting
> the resource by name? Also, could it happen that if the device tree is
> incorrect, then one of the resource is fetched by name and other by the index,
> which I guess, would mess things up. Just my random thoughts, not sure if it
> is valid enough.
>
> >Wouldn't the following be enough?
> >
> >- gpio->intc.name = pdev->dev.of_node->name;
> >+ gpio->intc.name = devm_kasprintf(&pdev->dev, "%pfw",
> >dev_fwnode(&pdev->dev));
> >+ if (!gpio->intc.name)
> >+
>
> How about this way? I feel it would be right to add the OF functions conditionally.

Looks okay, although I have a question here.

> + if (pdev->dev.of_node) {

Do we really need this check at all? If the OF-node is NULL then it
doesn't matter if other fields are filled or not, correct?

What you need is #ifdef CONFIG_OF_GPIO (IIRC the name correctly).

> + gpio->gpio.of_node = pdev->dev.of_node;
> + gpio->gpio.of_gpio_n_cells = 2;
> + gpio->gpio.of_xlate = tegra186_gpio_of_xlate;
> + }
>
> + gpio->intc.name = gpio->soc->name;

--
With Best Regards,
Andy Shevchenko

\
 
 \ /
  Last update: 2021-06-30 18:15    [W:0.076 / U:0.488 seconds]
©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site