[PATCH v5 1/1] iommu-api: Add map_sg/unmap_sg functions
joro at 8bytes.org
Fri Oct 17 02:09:07 PDT 2014
On Thu, Oct 16, 2014 at 10:23:07AM -0700, Olav Haugan wrote:
> On 10/15/2014 2:16 AM, Thierry Reding wrote:
> >Perhaps make the return value ssize_t so that we can propagate errors?
> I am fine with that. Joerg?
I am not so sure this is a good idea. On error the function should
return the size that is already mapped, so that the caller can check
that against the expected size and just call iommu_unmap with the
returned size when return value does not match expected size.
The benefit of ssize_t is that we can return more detailed error
information when the function did not map anything yet. But this
complicates the error handling for the caller and implementers might get
it wrong and return an error-value even when some space was already
mapped, so that the caller can not unmap the addresses.
So taking this into mind, I prefer it to be size_t for now. We can
always change it later if it turns out to be wrong.
More information about the linux-arm-kernel