[PATCH V3 2/4] ACPI/scan: Clean up acpi_check_dma
Bjorn Helgaas
helgaas at kernel.org
Mon Oct 19 19:17:35 PDT 2015
On Tue, Oct 13, 2015 at 06:53:28PM -0500, Suravee Suthikulanit wrote:
> Bjorn / Rafael,
>
> On 10/13/2015 10:52 AM, Suravee Suthikulpanit wrote:
> >
> >On 09/14/2015 09:34 AM, Bjorn Helgaas wrote:
> >>[..]
> >>I think acpi_check_dma_coherency() is better, but only slightly. It
> >>still doesn't give a hint about the *sense* of the return value. I
> >>think it'd be easier to read if there were two functions, e.g.,
> >
> >I have been going back-and-forth between the current version, and the
> >two-function-approach in the past. I can definitely go with this route
> >if you would prefer. Although, if acpi_dma_is_coherent() == 0, it would
> >be ambiguous whether DMA is not supported or non-coherent DMA is
> >supported. Then, we would need to call acpi_dma_is_supported() to find
> >out. So, that's okay with you?
>
> Thinking about this again, I still think having one API (which can
> tell whether DMA is supported or not, and if so whether it is
> coherent or non-coherent) would be the least confusing and least
> error prone.
>
> What if we would just have:
>
> enum dev_dma_type acpi_get_dev_dma_type(struct acpi_device *adev);
>
> where:
> enum dev_dma_type {
> DEV_DMA_NOT_SUPPORTED,
> DEV_DMA_NON_COHERENT,
> DEV_DMA_COHERENT,
> };
>
> This would probably mean that we should modify
> drivers/base/property.c to replace:
> bool device_dma_is_coherent()
> to:
> enum dev_dma_type device_get_dma_type()
>
> We used to discuss the enum approach in the past
> (https://lkml.org/lkml/2015/8/25/868). But we only considered at the
> ACPI level at the time. Actually, this should also reflect in the
> property.c.
>
> At this point, only drivers/crypto/ccp/ccp-platform.c and
> drivers/net/ethernet/amd/xgbe/xgbe-main.c are calling the
> device_dma_is_coherent(). So, it should be easy to change this API.
OK, I'm fine with either the enum or Rafael's 0/1/-ENOTSUPP idea.
Bjorn
More information about the linux-arm-kernel
mailing list