[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAK=WgbbZB0hGRr84JV4a7c0KvW7VbVzsnCx1PGg=wjoB0OSrYw@mail.gmail.com>
Date: Fri, 27 Jan 2012 09:08:44 +0200
From: Ohad Ben-Cohen <ohad@...ery.com>
To: Joerg Roedel <joerg.roedel@....com>
Cc: iommu@...ts.linux-foundation.org, linux-kernel@...r.kernel.org,
David Woodhouse <dwmw2@...radead.org>,
David Brown <davidb@...eaurora.org>,
Tony Lindgren <tony@...mide.com>,
Laurent Pinchart <laurent.pinchart@...asonboard.com>,
Stuart Yoder <b08248@...il.com>,
Scott Wood <scottwood@...escale.com>,
Hiroshi Doyu <hdoyu@...dia.com>
Subject: Re: [PATCH 2/6] iommu/amd: Implement DOMAIN_ATTR_GEOMETRY attribute
Hi Joerg,
On Thu, Jan 26, 2012 at 8:40 PM, Joerg Roedel <joerg.roedel@....com> wrote:
> Implement the attribute itself and add the code for the
> AMD IOMMU driver.
It's somewhat non-intuitive to have the generic attribute code bundled
with the AMD implementation in the same patch (took me some time to
find it here :).
Maybe split this to two patches ?
> diff --git a/drivers/iommu/iommu.c b/drivers/iommu/iommu.c
> index ef54718..3d0b0bf 100644
> --- a/drivers/iommu/iommu.c
> +++ b/drivers/iommu/iommu.c
> @@ -345,10 +345,23 @@ EXPORT_SYMBOL_GPL(iommu_device_group);
> int iommu_domain_get_attr(struct iommu_domain *domain,
> enum iommu_attr attr, void *data)
> {
> - if (!domain->ops->domain_get_attr)
> - return -EINVAL;
> + struct iommu_domain_geometry *geometry;
> + int ret = 0;
> +
> + switch (attr) {
> + case DOMAIN_ATTR_GEOMETRY:
> + geometry = data;
> + *geometry = domain->geometry;
This is not type-safe and will surely bite someone some day.
Sure, we can't have type safety in a multi-purpose generic interface,
but I wonder whether this is the right interface for getting the
geometry ? I.e. why not have a dedicated API for this ?
Thanks,
Ohad.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@...r.kernel.org
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/
Powered by blists - more mailing lists