Skip to contentSkip to conversation

of_iomap() and devres questions

DISCUSSION Markus Mayer 2 participants 2 messages Apr 2, 2013 – Apr 3, 2013 1 message not in the archive

lore
Share & tools
lore
#0 lore raw

Hi all,

I have a few questions regarding the implementation of the of_iomap() function.

As it currently stands, the function parses the device tree for the device's address and then simply calls ioremap() with that address and the associated size.

The first question that has come up is why of_iomap() doesn't also call request_mem_region()? Is there a particular reason for it or has it just not yet been implemented?

The second question is regarding the use of devres in of_iomap(). Would it make sense for of_iomap() to use devm_ioremap() or, better yet, devm_request_and_ioremap() instead of simply calling ioremap()?

Thanks,
-Markus

#2 lore raw
In reply to a message not in the archive
Quoted 5 lines · Markus Mayer

Hi all,

I have a few questions regarding the implementation of the of_iomap() function.

Quoted 7 lines

As it currently stands, the function parses the device tree for the device's address and then simply calls ioremap() with that address and the associated size.

The first question that has come up is why of_iomap() doesn't also call request_mem_region()? Is there a particular reason for it or has it just not yet been implemented?

Don't know. It probably should not and make cause some breakage.

Quoted 3 lines

The second question is regarding the use of devres in of_iomap(). Would it make sense for of_iomap() to use devm_ioremap() or, better yet, devm_request_and_ioremap() instead of simply calling ioremap()?

You should not be using of_iomap in a driver, but rather the functions you mention. of_iomap is mainly used in cases where there is no driver or struct device. Which means devm_* functions would be pointless. Also there is no way to get from a struct device_node ptr to a struct device ptr.

Rob

Quoted 8 lines

Thanks,
-Markus

_______________________________________________
devicetree-discuss mailing list devicetree-discuss-uLR06cmDAlY/[email protected]
https://lists.ozlabs.org/listinfo/devicetree-discuss