Skip to content

Commit fb4ee2b

Browse files
aikmpe
authored andcommitted
powerpc/pseries/ddw: simplify enable_ddw()
This drops rather useless ddw_enabled flag as direct_mapping implies it anyway. While at this, fix indents in enable_ddw(). This should not cause any behavioral change. Signed-off-by: Alexey Kardashevskiy <[email protected]> Signed-off-by: Michael Ellerman <[email protected]> Link: https://lore.kernel.org/r/[email protected]
1 parent 2d33f55 commit fb4ee2b

File tree

1 file changed

+4
-7
lines changed
  • arch/powerpc/platforms/pseries

1 file changed

+4
-7
lines changed

arch/powerpc/platforms/pseries/iommu.c

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -1229,7 +1229,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
12291229
u32 ddw_avail[DDW_APPLICABLE_SIZE];
12301230
struct dma_win *window;
12311231
struct property *win64;
1232-
bool ddw_enabled = false;
12331232
struct failed_ddw_pdn *fpdn;
12341233
bool default_win_removed = false, direct_mapping = false;
12351234
bool pmem_present;
@@ -1244,7 +1243,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
12441243

12451244
if (find_existing_ddw(pdn, &dev->dev.archdata.dma_offset, &len)) {
12461245
direct_mapping = (len >= max_ram_len);
1247-
ddw_enabled = true;
12481246
goto out_unlock;
12491247
}
12501248

@@ -1397,8 +1395,8 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
13971395
dev_info(&dev->dev, "failed to map DMA window for %pOF: %d\n",
13981396
dn, ret);
13991397

1400-
/* Make sure to clean DDW if any TCE was set*/
1401-
clean_dma_window(pdn, win64->value);
1398+
/* Make sure to clean DDW if any TCE was set*/
1399+
clean_dma_window(pdn, win64->value);
14021400
goto out_del_list;
14031401
}
14041402
} else {
@@ -1445,7 +1443,6 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
14451443
spin_unlock(&dma_win_list_lock);
14461444

14471445
dev->dev.archdata.dma_offset = win_addr;
1448-
ddw_enabled = true;
14491446
goto out_unlock;
14501447

14511448
out_del_list:
@@ -1481,10 +1478,10 @@ static bool enable_ddw(struct pci_dev *dev, struct device_node *pdn)
14811478
* as RAM, then we failed to create a window to cover persistent
14821479
* memory and need to set the DMA limit.
14831480
*/
1484-
if (pmem_present && ddw_enabled && direct_mapping && len == max_ram_len)
1481+
if (pmem_present && direct_mapping && len == max_ram_len)
14851482
dev->dev.bus_dma_limit = dev->dev.archdata.dma_offset + (1ULL << len);
14861483

1487-
return ddw_enabled && direct_mapping;
1484+
return direct_mapping;
14881485
}
14891486

14901487
static void pci_dma_dev_setup_pSeriesLP(struct pci_dev *dev)

0 commit comments

Comments
 (0)