Skip to content

Commit d9c6866

Browse files
committed
of: kill off of_can_translate_address
of_can_translate_address only checks some conditions for address translation, but does not check other conditions like having range properties. The checks it does do are redundant with __of_address_translate. The only difference is printing a message or not. Since we only have a single caller that does the full translation anyway, just remove of_can_translate_address and quiet the error message. Cc: Grant Likely <[email protected]> Signed-off-by: Rob Herring <[email protected]> Tested-by: Frank Rowand <[email protected]> Reviewed-by: Frank Rowand <[email protected]>
1 parent b8acee3 commit d9c6866

File tree

3 files changed

+3
-25
lines changed

3 files changed

+3
-25
lines changed

drivers/of/address.c

Lines changed: 1 addition & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -498,8 +498,7 @@ static u64 __of_translate_address(struct device_node *dev,
498498
/* Count address cells & copy address locally */
499499
bus->count_cells(dev, &na, &ns);
500500
if (!OF_CHECK_COUNTS(na, ns)) {
501-
printk(KERN_ERR "prom_parse: Bad cell count for %s\n",
502-
of_node_full_name(dev));
501+
pr_debug("OF: Bad cell count for %s\n", of_node_full_name(dev));
503502
goto bail;
504503
}
505504
memcpy(addr, in_addr, na * 4);
@@ -564,25 +563,6 @@ u64 of_translate_dma_address(struct device_node *dev, const __be32 *in_addr)
564563
}
565564
EXPORT_SYMBOL(of_translate_dma_address);
566565

567-
bool of_can_translate_address(struct device_node *dev)
568-
{
569-
struct device_node *parent;
570-
struct of_bus *bus;
571-
int na, ns;
572-
573-
parent = of_get_parent(dev);
574-
if (parent == NULL)
575-
return false;
576-
577-
bus = of_match_bus(parent);
578-
bus->count_cells(dev, &na, &ns);
579-
580-
of_node_put(parent);
581-
582-
return OF_CHECK_COUNTS(na, ns);
583-
}
584-
EXPORT_SYMBOL(of_can_translate_address);
585-
586566
const __be32 *of_get_address(struct device_node *dev, int index, u64 *size,
587567
unsigned int *flags)
588568
{

drivers/of/platform.c

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -140,9 +140,8 @@ struct platform_device *of_device_alloc(struct device_node *np,
140140
return NULL;
141141

142142
/* count the io and irq resources */
143-
if (of_can_translate_address(np))
144-
while (of_address_to_resource(np, num_reg, &temp_res) == 0)
145-
num_reg++;
143+
while (of_address_to_resource(np, num_reg, &temp_res) == 0)
144+
num_reg++;
146145
num_irq = of_irq_count(np);
147146

148147
/* Populate the resource table */

include/linux/of_address.h

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,6 @@ extern u64 of_translate_dma_address(struct device_node *dev,
4040

4141
#ifdef CONFIG_OF_ADDRESS
4242
extern u64 of_translate_address(struct device_node *np, const __be32 *addr);
43-
extern bool of_can_translate_address(struct device_node *dev);
4443
extern int of_address_to_resource(struct device_node *dev, int index,
4544
struct resource *r);
4645
extern struct device_node *of_find_matching_node_by_address(

0 commit comments

Comments
 (0)