staging: iio: tsl2x7x: add common function for reading chip status
authorBrian Masney <masneyb@onstation.org>
Sun, 4 Mar 2018 01:49:33 +0000 (20:49 -0500)
committerJonathan Cameron <Jonathan.Cameron@huawei.com>
Sat, 10 Mar 2018 14:29:39 +0000 (14:29 +0000)
commit107eb59bc15ccd999b8cd297172691673396ec8f
tree3dda0081034ac08dc325a814ff85da82671e18f4
parenteac15d8ded8f23a7cda681e2b2c7b86cf8535688
staging: iio: tsl2x7x: add common function for reading chip status

There were three places where the same chunk of code was used to read
the chip status. This patch creates a common function
tsl2x7x_read_status() to reduce duplicate code. This patch also corrects
tsl2x7x_event_handler() to properly check for an error after reading the
chip status.

Signed-off-by: Brian Masney <masneyb@onstation.org>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
drivers/staging/iio/light/tsl2x7x.c