Fix coding style issues

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Move scope of count into first while loop

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fix possible endless loop when spi read fails

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>
Fix compile error with newer kernel

Signed-off-by: Stefan Wahren <stefan.wahren@i2se.com>