[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <ZiXu4Tk8lDroOKTA@surfacebook.localdomain>
Date: Mon, 22 Apr 2024 08:00:17 +0300
From: Andy Shevchenko <andy.shevchenko@...il.com>
To: Robin Murphy <robin.murphy@....com>
Cc: Will Deacon <will@...nel.org>, Joerg Roedel <joro@...tes.org>,
linux-acpi@...r.kernel.org, linux-arm-kernel@...ts.infradead.org,
linux-kernel@...r.kernel.org, iommu@...ts.linux.dev,
devicetree@...r.kernel.org, Rob Herring <robh@...nel.org>,
Saravana Kannan <saravanak@...gle.com>,
Lorenzo Pieralisi <lpieralisi@...nel.org>,
Hanjun Guo <guohanjun@...wei.com>,
Sudeep Holla <sudeep.holla@....com>,
"Rafael J. Wysocki" <rafael@...nel.org>,
Len Brown <lenb@...nel.org>,
Jean-Philippe Brucker <jean-philippe@...aro.org>
Subject: Re: [PATCH 1/4] iommu: Resolve fwspec ops automatically
Fri, Apr 19, 2024 at 05:55:59PM +0100, Robin Murphy kirjoitti:
> There's no real need for callers to resolve ops from a fwnode in order
> to then pass both to iommu_fwspec_init() - it's simpler and more sensible
> for that to resolve the ops itself. This in turn means we can centralise
> the notion of checking for a present driver, and enforce that fwspecs
> aren't allocated unless and until we know they will be usable.
>
> Also we've grown a generic fwnode_handle_get() since this code was first
> written, so may as well clear up that ugly mismatch while we're in here.
..
> +++ b/drivers/iommu/mtk_iommu_v1.c
> if (!fwspec) {
> - ret = iommu_fwspec_init(dev, &args->np->fwnode, &mtk_iommu_v1_ops);
> + ret = iommu_fwspec_init(dev, &args->np->fwnode);
I'm wondering, while at it, if can avoid direct dereference of fwnode by using of_fwnode_handle().
> if (ret)
> return ret;
..
> +++ b/drivers/iommu/of_iommu.c
> - ret = iommu_fwspec_init(dev, fwnode, ops);
> + ret = iommu_fwspec_init(dev, &iommu_spec->np->fwnode);
Ditto.
> + if (ret == -EPROBE_DEFER)
> + return driver_deferred_probe_check_state(dev);
> if (ret)
> return ret;
..
> --- a/drivers/iommu/tegra-smmu.c
> +++ b/drivers/iommu/tegra-smmu.c
> - err = iommu_fwspec_init(dev, &dev->of_node->fwnode, ops);
> + err = iommu_fwspec_init(dev, &dev->of_node->fwnode);
Ditto.
> if (err < 0) {
> dev_err(dev, "failed to initialize fwspec: %d\n", err);
> return err;
--
With Best Regards,
Andy Shevchenko
Powered by blists - more mailing lists