gpio: Use proper logging instead of perror

Also do some style cleanup.