[CORE] Introduce linux-like device resource managment APIs

The linux kernel developers are moving most of the device drivers
to use devm_xxxx() APIs for managing device resource.

We will soon require linux-like device resource managment APIs
for porting drivers from Linux.

This patch adds stripped down version of linux-like device resource
managment APIs so that we can implement devm_xxxx() APIs for drivers
ported from linux.

Signed-off-by: Anup Patel <anup@brainfault.org>