libqiprog: Store context pointer in each device struct

Some drivers may need to have access to the qiprog context. For example,
the USB host driver needs the libusb context pointer (stored in the qiprog
context) for asynchronous USB transactions. Store a pointer to the qiprog
context in each device struct.

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>
libqiprog: Add macros for MIN and MAX

Signed-off-by: Alexandru Gagniuc <mr.nuke.me@gmail.com>