call to request_mem_region() fails

前端 未结 2 507
没有蜡笔的小新
没有蜡笔的小新 2020-12-20 06:53

The start address 0x4806E000 (UART4 base address) is already present in /proc/iomem with the name omap4-uart.

How to disable the memory regions already allocated ?.<

2条回答
  •  既然无缘
    2020-12-20 07:27

    I don't believe it's possible to reuse the memory region by other driver. This would make first driver misbehaving. This means that in order to use this memory region by your driver, you should first disable the other driver.

    Now it's possible that your ioremap() call won't return an error. It's also possible that it will appear to work perfectly fine. This is because AFAIK, the content of /proc/iomem does not come from ioremap() calls but from request_mem_region() calls. It's important to understand what both of them do:

    • You should first call request_mem_region to claim that your driver is going to use requested memory region (note that this won't do any memory mapping, it will only indicate your will in doing so). In case of your device, some driver already did this so it may use this region when needed. It's possible, however, that it didn't call ioremap() immediately after claiming the region but will do this on demand.

    • If above call succeeded, you may be sure that no other driver is going to use this region. This means you are free to call ioremap() and iounmap() on this region whenever you want.

    Technically it's possible to do only 2nd thing and skip using request_mem_region but this way your driver would have to keep memory mapped all times just to indicate that you may use it in future. So you should be nice and always reserve the region first.

提交回复
热议问题