misc: pci_endpoint_test: Refactor dma_set_mask_and_coherent() logic
authorFrank Li <Frank.Li@nxp.com>
Thu, 2 May 2024 19:59:03 +0000 (15:59 -0400)
committerBjorn Helgaas <bhelgaas@google.com>
Tue, 9 Jul 2024 22:57:59 +0000 (17:57 -0500)
commita50c7de0607c65af588900b1236d88faf561374e
treed5b61cd449706f3d39917febee5e95fc401c2464
parent2a35703a6a00e87bf65d61e70516ae2524f70ec7
misc: pci_endpoint_test: Refactor dma_set_mask_and_coherent() logic

dma_set_mask_and_coherent() should never fail when the mask is >= 32bit,
unless the architecture has no DMA support. So no need to check for the
error and also no need to set dma_set_mask_and_coherent(32) as a fallback.

Even if dma_set_mask_and_coherent(48) fails due to the lack of DMA support
(theoretically), then dma_set_mask_and_coherent(32) will also fail for the
same reason. So the fallback doesn't make sense.

Simplify the code by setting the streaming and coherent DMA mask to 48
bits.

Link: https://lore.kernel.org/linux-pci/20240502195903.3191049-1-Frank.Li@nxp.com
Signed-off-by: Frank Li <Frank.Li@nxp.com>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
Reviewed-by: Manivannan Sadhasivam <manivannan.sadhasivam@linaro.org>
Reviewed-by: Niklas Cassel <cassel@kernel.org>
drivers/misc/pci_endpoint_test.c