Jams.Liu
Jams.Liu

Reputation: 523

Does need devm_iounmap when rmmod, which module use devm* api?

The devm_ioremap() API use device resource management framework, no need to unmap when driver probe fail.

What about the module when the module is unloaded? Need to be released too?

Upvotes: 1

Views: 654

Answers (1)

Ezequiel Garcia
Ezequiel Garcia

Reputation: 1057

No, it's not needed.

The design goal of the managed resource API (the devm_ stuff) is to avoid calling unmap, free, etc. when a device is released, either because of failure or removal.

The devm_iounmap and similar is only there when you need to roll-back a previous call to devm_ioremap.

Official doc here: https://www.kernel.org/doc/Documentation/driver-model/devres.txt

I suggest that you take a look at how drivers do it in the kernel. Learning by reading the code is a great path in the Linux Kernel.

Upvotes: 3

Related Questions