* [PATCH] iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo()
@ 2018-07-11 22:15 Lorenzo Bianconi
2018-07-15 9:11 ` Jonathan Cameron
0 siblings, 1 reply; 2+ messages in thread
From: Lorenzo Bianconi @ 2018-07-11 22:15 UTC (permalink / raw)
To: jic23; +Cc: linux-iio, jramirez
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>
---
drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 16 +++++++++++++---
1 file 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)
err = regmap_bulk_read(hw->regmap,
hw->settings->fifo_ops.fifo_diff.addr,
&fifo_status, sizeof(fifo_status));
- if (err < 0)
+ if (err < 0) {
+ dev_err(hw->dev, "failed to read fifo status (err=%d)\n",
+ err);
return err;
+ }
if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK))
return 0;
@@ -313,8 +316,12 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
for (read_len = 0; read_len < fifo_len; read_len += pattern_len) {
err = st_lsm6dsx_read_block(hw, hw->buff, pattern_len);
- if (err < 0)
+ if (err < 0) {
+ dev_err(hw->dev,
+ "failed to read pattern from fifo (err=%d)\n",
+ err);
return err;
+ }
/*
* 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)
if (unlikely(reset_ts)) {
err = st_lsm6dsx_reset_hw_ts(hw);
- if (err < 0)
+ if (err < 0) {
+ dev_err(hw->dev, "failed to reset hw ts (err=%d)\n",
+ err);
return err;
+ }
}
return read_len;
}
--
2.18.0
^ permalink raw reply related [flat|nested] 2+ messages in thread
* Re: [PATCH] iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo()
2018-07-11 22:15 [PATCH] iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo() Lorenzo Bianconi
@ 2018-07-15 9:11 ` Jonathan Cameron
0 siblings, 0 replies; 2+ messages in thread
From: Jonathan Cameron @ 2018-07-15 9:11 UTC (permalink / raw)
To: Lorenzo Bianconi; +Cc: linux-iio, jramirez
On Thu, 12 Jul 2018 00:15:12 +0200
Lorenzo Bianconi <lorenzo.bianconi@redhat.com> wrote:
> 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>
Applied to the togreg branch of iio.git and pushed out as testing for
the autobuilders to play with it.
Thanks,
Jonathan
> ---
> drivers/iio/imu/st_lsm6dsx/st_lsm6dsx_buffer.c | 16 +++++++++++++---
> 1 file 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)
> err = regmap_bulk_read(hw->regmap,
> hw->settings->fifo_ops.fifo_diff.addr,
> &fifo_status, sizeof(fifo_status));
> - if (err < 0)
> + if (err < 0) {
> + dev_err(hw->dev, "failed to read fifo status (err=%d)\n",
> + err);
> return err;
> + }
>
> if (fifo_status & cpu_to_le16(ST_LSM6DSX_FIFO_EMPTY_MASK))
> return 0;
> @@ -313,8 +316,12 @@ static int st_lsm6dsx_read_fifo(struct st_lsm6dsx_hw *hw)
>
> for (read_len = 0; read_len < fifo_len; read_len += pattern_len) {
> err = st_lsm6dsx_read_block(hw, hw->buff, pattern_len);
> - if (err < 0)
> + if (err < 0) {
> + dev_err(hw->dev,
> + "failed to read pattern from fifo (err=%d)\n",
> + err);
> return err;
> + }
>
> /*
> * 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)
>
> if (unlikely(reset_ts)) {
> err = st_lsm6dsx_reset_hw_ts(hw);
> - if (err < 0)
> + if (err < 0) {
> + dev_err(hw->dev, "failed to reset hw ts (err=%d)\n",
> + err);
> return err;
> + }
> }
> return read_len;
> }
^ permalink raw reply [flat|nested] 2+ messages in thread
end of thread, other threads:[~2018-07-15 9:34 UTC | newest]
Thread overview: 2+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2018-07-11 22:15 [PATCH] iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo() Lorenzo Bianconi
2018-07-15 9:11 ` Jonathan Cameron
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox