Re: [Patch Part3 V1 19/22] iommu/vt-d: simplify intel_unmap_sg() and kill duplicated code

From: Jiang Liu
Date: Tue Apr 22 2014 - 03:42:36 EST


On 2014/4/22 15:38, David Woodhouse wrote:
> 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().

Good suggestion, will change to follow that way in next version.
--
To unsubscribe from this list: send the line "unsubscribe linux-kernel" in
the body of a message to majordomo@xxxxxxxxxxxxxxx
More majordomo info at http://vger.kernel.org/majordomo-info.html
Please read the FAQ at http://www.tux.org/lkml/