PCI: rockchip-ep: Improve rockchip_pcie_ep_unmap_addr()
authorDamien Le Moal <damien.lemoal@opensource.wdc.com>
Thu, 17 Oct 2024 01:58:38 +0000 (10:58 +0900)
committerBjorn Helgaas <bhelgaas@google.com>
Mon, 25 Nov 2024 19:18:35 +0000 (13:18 -0600)
commit57ed93fe799b3564388fd61279fc274ae2716508
tree7724b9989df5c924e2fd409e500abae074ed75cc
parent739e25f51aedaebf20496fbc99c6ef43fc6d6ca1
PCI: rockchip-ep: Improve rockchip_pcie_ep_unmap_addr()

There is no need to loop over all regions to find the memory window used
to map an address. We can use rockchip_ob_region() to determine the
region index, together with a check that the address passed as argument
is the address used to create the mapping. Furthermore, the
ob_region_map bitmap should also be checked to ensure that we are not
attempting to unmap an address that is not mapped.

Link: https://lore.kernel.org/r/20241017015849.190271-4-dlemoal@kernel.org
Signed-off-by: Damien Le Moal <damien.lemoal@opensource.wdc.com>
Signed-off-by: Krzysztof WilczyƄski <kwilczynski@kernel.org>
Signed-off-by: Bjorn Helgaas <bhelgaas@google.com>
drivers/pci/controller/pcie-rockchip-ep.c