Re: [PATCH 02/04] iommu/ipmmu-vmsa: Consistent ->of_xlate() handling

From: Geert Uytterhoeven
Date: Fri Jun 16 2017 - 03:17:08 EST


Hi Magnus,

On Thu, Jun 15, 2017 at 12:29 PM, Magnus Damm <magnus.damm@xxxxxxxxx> wrote:
> From: Magnus Damm <damm+renesas@xxxxxxxxxxxxx>
>
> The 32-bit ARM code gets updated to make use of ->of_xlate() and the
> code is shared between 64-bit and 32-bit ARM. The of_device_is_available()
> check gets dropped since it is included in of_iommu_xlate().
>
> Suggested-by: Robin Murphy <robin.murphy@xxxxxxx>
> Signed-off-by: Magnus Damm <damm+renesas@xxxxxxxxxxxxx>
> ---
>
> drivers/iommu/ipmmu-vmsa.c | 51 ++++++++++++++------------------------------
> 1 file changed, 17 insertions(+), 34 deletions(-)
>
> --- 0009/drivers/iommu/ipmmu-vmsa.c
> +++ work/drivers/iommu/ipmmu-vmsa.c 2017-06-15 17:22:27.460607110 +0900
> @@ -680,6 +680,10 @@ static int ipmmu_init_platform_device(st
> int num_utlbs;
> int ret = -ENODEV;
>
> + /* Initialize once - xlate() will call multiple times */
> + if (to_priv(dev))
> + return 0;

I think this is more clear if you move this check to ...

> +
> /* Find the master corresponding to the device. */
>
> num_utlbs = of_count_phandle_with_args(dev->of_node, "iommus",
> @@ -734,6 +738,12 @@ error:
> return ret;
> }
>
> +static int ipmmu_of_xlate(struct device *dev,
> + struct of_phandle_args *spec)
> +{

... here

> + return ipmmu_init_platform_device(dev);
> +}

Gr{oetje,eeting}s,

Geert

--
Geert Uytterhoeven -- There's lots of Linux beyond ia32 -- geert@xxxxxxxxxxxxxx

In personal conversations with technical people, I call myself a hacker. But
when I'm talking to journalists I just say "programmer" or something like that.
-- Linus Torvalds