From patchwork Wed Jul 11 22:15:12 2018 Content-Type: text/plain; charset="utf-8" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit X-Patchwork-Submitter: Lorenzo Bianconi X-Patchwork-Id: 10520651 Return-Path: Received: from mail.wl.linuxfoundation.org (pdx-wl-mail.web.codeaurora.org [172.30.200.125]) by pdx-korg-patchwork.web.codeaurora.org (Postfix) with ESMTP id 958C76028E for ; Wed, 11 Jul 2018 22:15:21 +0000 (UTC) Received: from mail.wl.linuxfoundation.org (localhost [127.0.0.1]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id 7F85B26CFF for ; Wed, 11 Jul 2018 22:15:21 +0000 (UTC) Received: by mail.wl.linuxfoundation.org (Postfix, from userid 486) id 6EDED29877; Wed, 11 Jul 2018 22:15:21 +0000 (UTC) X-Spam-Checker-Version: SpamAssassin 3.3.1 (2010-03-16) on pdx-wl-mail.web.codeaurora.org X-Spam-Level: X-Spam-Status: No, score=-7.9 required=2.0 tests=BAYES_00, MAILING_LIST_MULTI, RCVD_IN_DNSWL_HI autolearn=ham version=3.3.1 Received: from vger.kernel.org (vger.kernel.org [209.132.180.67]) by mail.wl.linuxfoundation.org (Postfix) with ESMTP id DC37926CFF for ; Wed, 11 Jul 2018 22:15:20 +0000 (UTC) Received: (majordomo@vger.kernel.org) by vger.kernel.org via listexpand id S2387627AbeGKWVp (ORCPT ); Wed, 11 Jul 2018 18:21:45 -0400 Received: from mail-wr1-f68.google.com ([209.85.221.68]:43480 "EHLO mail-wr1-f68.google.com" rhost-flags-OK-OK-OK-OK) by vger.kernel.org with ESMTP id S1733146AbeGKWVp (ORCPT ); Wed, 11 Jul 2018 18:21:45 -0400 Received: by mail-wr1-f68.google.com with SMTP id b15-v6so19681286wrv.10 for ; Wed, 11 Jul 2018 15:15:19 -0700 (PDT) X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20161025; h=x-gm-message-state:from:to:cc:subject:date:message-id; bh=8I6rDEB2wpzpCv6l+aNTWItz+FnIF22N9f0eTfKQLtg=; b=DkFfWb7/3WO10McGfTDOFerh6w+ql3MgnMsgy81K8+pbr8lL98BgjH6yFQmuYxFe+/ 3ZkV6SSRyF+V9iwopGzPaduutqx+OpqynOu4Og6Hl1ibs1ABlbasUiafYLtamo7s9UpD WFF32U8sdgR/ma17RNeF7V2ylEBP7J6tPTh2QB+4+vxIzkVe6hth8MACXMAR9ltoEePB A7L8D5DBpwa6nJhxD1Nx1MU1kMBebexpiX78djR8b2j3d9c2BliuKyrfqbpfx/No1jSd 1FAz7uSNo33ROqCfd9XsiWVv8RZv8WGSUsBOdoDRmOOMRHCUXdxtzdqs+imCOYvzvB0Y of7w== X-Gm-Message-State: AOUpUlHwZL4HFyIc7WjWOgwF6g8nirSb0cXNHVxU6H2st0T/KeOd4hGs I3mnSHZWvka8Wh0e8Z0TT81AEw== X-Google-Smtp-Source: AAOMgpeDZRe/gKZJaqLCAKgFWQQq5Wp2XDHTbJxQu7ZzCBh6BRxD2+gZXbi6Syc4SArotvxFUamGrA== X-Received: by 2002:adf:d842:: with SMTP id k2-v6mr278517wrl.26.1531347318781; Wed, 11 Jul 2018 15:15:18 -0700 (PDT) Received: from localhost.localdomain ([151.66.54.250]) by smtp.gmail.com with ESMTPSA id p1-v6sm3936584wrp.63.2018.07.11.15.15.17 (version=TLS1_2 cipher=ECDHE-RSA-AES128-GCM-SHA256 bits=128/128); Wed, 11 Jul 2018 15:15:18 -0700 (PDT) From: Lorenzo Bianconi To: jic23@kernel.org Cc: linux-iio@vger.kernel.org, jramirez@baylibre.com Subject: [PATCH] iio: imu: st_lsm6dsx: add error logs to st_lsm6dsx_read_fifo() Date: Thu, 12 Jul 2018 00:15:12 +0200 Message-Id: <20180711221512.20366-1-lorenzo.bianconi@redhat.com> X-Mailer: git-send-email 2.18.0 Sender: linux-iio-owner@vger.kernel.org Precedence: bulk List-ID: X-Mailing-List: linux-iio@vger.kernel.org X-Virus-Scanned: ClamAV using ClamSMTP Add debug info to error conditions in st_lsm6dsx_read_fifo routine Suggested-by: Jorge Ramirez-Ortiz Signed-off-by: Lorenzo Bianconi --- 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; }