peripheralman: fix return values
peripheralman: fix return values

Be consistent with the return values from MRAA and propagate the
errors received from PIO in case of failure. PIO returns 0 on success
and negative errno on failure. Handle APIs that must return length of
read/written data if PIO returns success.

Signed-off-by: Sanrio Alvares <9291f26d690b1b38af7fb6e32b3eabba14676070@intel.com>
Signed-off-by: Brendan Le Foll <3e0e8c4069934e8b47d99704927a85c66c0ceb33@intel.com>

stefan-andritoiu/mraa,g-vidal/mraa,alext-mkrs/mraa,g-vidal/mraa,ncrastanaren/mraa,ncrastanaren/mraa,intel-iot-devkit/mraa,intel-iot-devkit/mraa,g-vidal/mraa,malikabhi05/mraa,intel-iot-devkit/mraa,yongli3/mraa,KurtE/mraa,alext-mkrs/mraa,malikabhi05/mraa,arfoll/mraa,stefan-andritoiu/mraa,yongli3/mraa,alext-mkrs/mraa,alext-mkrs/mraa,malikabhi05/mraa,intel-iot-devkit/mraa,stefan-andritoiu/mraa,ncrastanaren/mraa,g-vidal/mraa,malikabhi05/mraa,KurtE/mraa,arfoll/mraa,arfoll/mraa,arfoll/mraa,yongli3/mraa,sergev/mraa,malikabhi05/mraa,Propanu/mraa,sergev/mraa,stefan-andritoiu/mraa,Propanu/mraa,yongli3/mraa,KurtE/mraa,ncrastanaren/mraa,alext-mkrs/mraa,sergev/mraa,sergev/mraa,Propanu/mraa,KurtE/mraa,Propanu/mraa,Propanu/mraa,intel-iot-devkit/mraa,arfoll/mraa,KurtE/mraa,yongli3/mraa,stefan-andritoiu/mraa,g-vidal/mraa,ncrastanaren/mraa,sergev/mraa