Re: [Patch Part3 V1 19/22] iommu/vt-d: simplify intel_unmap_sg() and kill duplicated code
From: David Woodhouse
Date: Tue Apr 22 2014 - 03:39:25 EST
On Tue, 2014-04-22 at 15:07 +0800, Jiang Liu wrote:
> + size_t size = 0;
> +#if 0
> + /* current the third argument of intel_unmap_page is unsued */
> + int i;
> + struct scatterlist *sg;
>
> - freelist = domain_unmap(domain, start_pfn, last_pfn);
> + for_each_sg(sglist, sg, nelems, i)
> + size += sg->length;
> +#endif
Please don't do that. If you want to rely on the fact that
intel_unmap_page() currently just uses the size from the IOVA it finds,
then split it out into a separate function which explicitly does
precisely that. And call that new function from both intel_unmap_sg()
and intel_unmap_page().
--
David Woodhouse Open Source Technology Centre
David.Woodhouse@xxxxxxxxx Intel Corporation
Attachment:
smime.p7s
Description: S/MIME cryptographic signature