Re: [PATCH v2 6/6] iommu: Delete iommu_dev_has_feature()

From: Christoph Hellwig
Date: Sat Jan 09 2021 - 04:12:36 EST


On Thu, Jan 07, 2021 at 09:18:06AM +0800, Lu Baolu wrote:
> The typical use case is
>
> if (iommu_dev_has_feature(dev, IOMMU_DEV_FEAT_AUX)) {
> rc = iommu_dev_enable_feature(dev, IOMMU_DEV_FEAT_AUX);
> if (rc < 0) {
> dev_warn(dev, "Failed to enable aux-domain: %d\n",
> rc);
> return rc;
> }
> }
>
> So please don't remove it.

This doesn't have an upstream user, and did not have for years! If
new users show up they can add it back. Note that the above API with
a separate has vs enable is horrible anyway - the right way is to just
enable and fail it with a specific error code if not supported.

We have a general rule that APIs should only be introduced with their
users, and this example just confirms the reasons of why that rule is in
place once again.