Skip to content

Commit 7eb954e

Browse files
hcodinagregkh
authored andcommitted
of: address: Remove duplicated functions
[ Upstream commit 3eb030c60835668997d5763b1a0c7938faf169f6 ] The recently added of_bus_default_flags_translate() performs the exact same operation as of_bus_pci_translate() and of_bus_isa_translate(). Avoid duplicated code replacing both of_bus_pci_translate() and of_bus_isa_translate() with of_bus_default_flags_translate(). Signed-off-by: Herve Codina <[email protected]> Link: https://lore.kernel.org/r/[email protected] Signed-off-by: Rob Herring <[email protected]> Stable-dep-of: 7f05e20b989a ("of: address: Preserve the flags portion on 1:1 dma-ranges mapping") Signed-off-by: Sasha Levin <[email protected]>
1 parent 30eb112 commit 7eb954e

File tree

1 file changed

+2
-11
lines changed

1 file changed

+2
-11
lines changed

drivers/of/address.c

Lines changed: 2 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -221,10 +221,6 @@ static u64 of_bus_pci_map(__be32 *addr, const __be32 *range, int na, int ns,
221221
return da - cp;
222222
}
223223

224-
static int of_bus_pci_translate(__be32 *addr, u64 offset, int na)
225-
{
226-
return of_bus_default_translate(addr + 1, offset, na - 1);
227-
}
228224
#endif /* CONFIG_PCI */
229225

230226
int of_pci_address_to_resource(struct device_node *dev, int bar,
@@ -334,11 +330,6 @@ static u64 of_bus_isa_map(__be32 *addr, const __be32 *range, int na, int ns,
334330
return da - cp;
335331
}
336332

337-
static int of_bus_isa_translate(__be32 *addr, u64 offset, int na)
338-
{
339-
return of_bus_default_translate(addr + 1, offset, na - 1);
340-
}
341-
342333
static unsigned int of_bus_isa_get_flags(const __be32 *addr)
343334
{
344335
unsigned int flags = 0;
@@ -369,7 +360,7 @@ static struct of_bus of_busses[] = {
369360
.match = of_bus_pci_match,
370361
.count_cells = of_bus_pci_count_cells,
371362
.map = of_bus_pci_map,
372-
.translate = of_bus_pci_translate,
363+
.translate = of_bus_default_flags_translate,
373364
.has_flags = true,
374365
.get_flags = of_bus_pci_get_flags,
375366
},
@@ -381,7 +372,7 @@ static struct of_bus of_busses[] = {
381372
.match = of_bus_isa_match,
382373
.count_cells = of_bus_isa_count_cells,
383374
.map = of_bus_isa_map,
384-
.translate = of_bus_isa_translate,
375+
.translate = of_bus_default_flags_translate,
385376
.has_flags = true,
386377
.get_flags = of_bus_isa_get_flags,
387378
},

0 commit comments

Comments
 (0)