kernel/resource: refactor __request_region to allow external locking