Skip to content

Commit bb6bfd7

Browse files
robherringjoergroedel
authored andcommitted
iommu: Remove unused of_get_dma_window()
of_get_dma_window() was added in 2012 and removed in 2014 in commit 8918465 ("memory: Add NVIDIA Tegra memory controller support"). Remove it and simplify the header to use forward declarations for structs rather than includes. Cc: Joerg Roedel <[email protected]> Cc: Will Deacon <[email protected]> Cc: Frank Rowand <[email protected]> Cc: [email protected] Signed-off-by: Rob Herring <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Joerg Roedel <[email protected]>
1 parent 7978724 commit bb6bfd7

File tree

2 files changed

+3
-82
lines changed

2 files changed

+3
-82
lines changed

drivers/iommu/of_iommu.c

Lines changed: 0 additions & 68 deletions
Original file line numberDiff line numberDiff line change
@@ -19,74 +19,6 @@
1919

2020
#define NO_IOMMU 1
2121

22-
/**
23-
* of_get_dma_window - Parse *dma-window property and returns 0 if found.
24-
*
25-
* @dn: device node
26-
* @prefix: prefix for property name if any
27-
* @index: index to start to parse
28-
* @busno: Returns busno if supported. Otherwise pass NULL
29-
* @addr: Returns address that DMA starts
30-
* @size: Returns the range that DMA can handle
31-
*
32-
* This supports different formats flexibly. "prefix" can be
33-
* configured if any. "busno" and "index" are optionally
34-
* specified. Set 0(or NULL) if not used.
35-
*/
36-
int of_get_dma_window(struct device_node *dn, const char *prefix, int index,
37-
unsigned long *busno, dma_addr_t *addr, size_t *size)
38-
{
39-
const __be32 *dma_window, *end;
40-
int bytes, cur_index = 0;
41-
char propname[NAME_MAX], addrname[NAME_MAX], sizename[NAME_MAX];
42-
43-
if (!dn || !addr || !size)
44-
return -EINVAL;
45-
46-
if (!prefix)
47-
prefix = "";
48-
49-
snprintf(propname, sizeof(propname), "%sdma-window", prefix);
50-
snprintf(addrname, sizeof(addrname), "%s#dma-address-cells", prefix);
51-
snprintf(sizename, sizeof(sizename), "%s#dma-size-cells", prefix);
52-
53-
dma_window = of_get_property(dn, propname, &bytes);
54-
if (!dma_window)
55-
return -ENODEV;
56-
end = dma_window + bytes / sizeof(*dma_window);
57-
58-
while (dma_window < end) {
59-
u32 cells;
60-
const void *prop;
61-
62-
/* busno is one cell if supported */
63-
if (busno)
64-
*busno = be32_to_cpup(dma_window++);
65-
66-
prop = of_get_property(dn, addrname, NULL);
67-
if (!prop)
68-
prop = of_get_property(dn, "#address-cells", NULL);
69-
70-
cells = prop ? be32_to_cpup(prop) : of_n_addr_cells(dn);
71-
if (!cells)
72-
return -EINVAL;
73-
*addr = of_read_number(dma_window, cells);
74-
dma_window += cells;
75-
76-
prop = of_get_property(dn, sizename, NULL);
77-
cells = prop ? be32_to_cpup(prop) : of_n_size_cells(dn);
78-
if (!cells)
79-
return -EINVAL;
80-
*size = of_read_number(dma_window, cells);
81-
dma_window += cells;
82-
83-
if (cur_index++ == index)
84-
break;
85-
}
86-
return 0;
87-
}
88-
EXPORT_SYMBOL_GPL(of_get_dma_window);
89-
9022
static int of_iommu_xlate(struct device *dev,
9123
struct of_phandle_args *iommu_spec)
9224
{

include/linux/of_iommu.h

Lines changed: 3 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -2,29 +2,18 @@
22
#ifndef __OF_IOMMU_H
33
#define __OF_IOMMU_H
44

5-
#include <linux/device.h>
6-
#include <linux/iommu.h>
7-
#include <linux/of.h>
5+
struct device;
6+
struct device_node;
7+
struct iommu_ops;
88

99
#ifdef CONFIG_OF_IOMMU
1010

11-
extern int of_get_dma_window(struct device_node *dn, const char *prefix,
12-
int index, unsigned long *busno, dma_addr_t *addr,
13-
size_t *size);
14-
1511
extern const struct iommu_ops *of_iommu_configure(struct device *dev,
1612
struct device_node *master_np,
1713
const u32 *id);
1814

1915
#else
2016

21-
static inline int of_get_dma_window(struct device_node *dn, const char *prefix,
22-
int index, unsigned long *busno, dma_addr_t *addr,
23-
size_t *size)
24-
{
25-
return -EINVAL;
26-
}
27-
2817
static inline const struct iommu_ops *of_iommu_configure(struct device *dev,
2918
struct device_node *master_np,
3019
const u32 *id)

0 commit comments

Comments
 (0)