diff options
author | Lorenzo Bianconi <lorenzo.bianconi@redhat.com> | 2018-07-11 18:15:12 -0400 |
---|---|---|
committer | Jonathan Cameron <Jonathan.Cameron@huawei.com> | 2018-07-15 05:11:22 -0400 |
commit | a42174983c7545055bd8375965e31b3c15b287dc (patch) | |
tree | b4247446736b4720e2c9f87e4b47c0c65b8e7c1c /drivers/iio | |
parent | d2b863baf1c7d92969c2a9dcada3c6b14e5dbbc4 (diff) |
iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo()
Add debug info to error conditions in st_lsm6dsx_read_fifo routine
Suggested-by: Jorge Ramirez-Ortiz <jramirez@baylibre.com>
Signed-off-by: Lorenzo Bianconi <lorenzo.bianconi@redhat.com>
Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'drivers/iio')
-rw-r--r-- | drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 16 |
1 files changed, 13 insertions, 3 deletions
diff --git a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c index 4994f920a836..7589f2ad1dae 100644 --- a/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c +++ b/drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | |||
@@ -298,8 +298,11 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) | |||
298 | err = regmap_bulk_read(hw->regmap, | 298 | err = regmap_bulk_read(hw->regmap, |
299 | hw->settings->fifo_ops.fifo_diff.addr, | 299 | hw->settings->fifo_ops.fifo_diff.addr, |
300 | &fifo_status, sizeof(fifo_status)); | 300 | &fifo_status, sizeof(fifo_status)); |
301 | if (err < 0) | 301 | if (err < 0) { |
302 | dev_err(hw->dev, "failed to read fifo status (err=%d)\n", | ||
303 | err); | ||
302 | return err; | 304 | return err; |
305 | } | ||
303 | 306 | ||
304 | if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK)) | 307 | if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK)) |
305 | return 0; | 308 | return 0; |
@@ -313,8 +316,12 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) | |||
313 | 316 | ||
314 | for (read_len = 0; read_len < fifo_len; read_len += pattern_len) { | 317 | for (read_len = 0; read_len < fifo_len; read_len += pattern_len) { |
315 | err = st_lsm6dsx_read_block(hw, hw->buff, pattern_len); | 318 | err = st_lsm6dsx_read_block(hw, hw->buff, pattern_len); |
316 | if (err < 0) | 319 | if (err < 0) { |
320 | dev_err(hw->dev, | ||
321 | "failed to read pattern from fifo (err=%d)\n", | ||
322 | err); | ||
317 | return err; | 323 | return err; |
324 | } | ||
318 | 325 | ||
319 | /* | 326 | /* |
320 | * Data are written to the FIFO with a specific pattern | 327 | * Data are written to the FIFO with a specific pattern |
@@ -385,8 +392,11 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw) | |||
385 | 392 | ||
386 | if (unlikely(reset_ts)) { | 393 | if (unlikely(reset_ts)) { |
387 | err = st_lsm6dsx_reset_hw_ts(hw); | 394 | err = st_lsm6dsx_reset_hw_ts(hw); |
388 | if (err < 0) | 395 | if (err < 0) { |
396 | dev_err(hw->dev, "failed to reset hw ts (err=%d)\n", | ||
397 | err); | ||
389 | return err; | 398 | return err; |
399 | } | ||
390 | } | 400 | } |
391 | return read_len; | 401 | return read_len; |
392 | } | 402 | } |