power: supply: qpnp-qg: Fix some error logs

When battery_id is set to a value for which there exists no
battery profile, QG driver prints error logs frequently as
some properties doesn't exist.

[ 4305.969087] QG-K: qg_get_charge_counter: Failed to get FCC for charge-counter rc=-19
[ 4305.969123] QG-K: qg_iio_read_raw: Couldn't read IIO channel 73, rc = -19
[ 4305.976657] QG-K: qg_iio_read_raw: Couldn't read IIO channel 83, rc = -19
[ 4305.989355] QG-K: qg_iio_read_raw: Couldn't read IIO channel 84, rc = -19

Fix this by changing pr_err() to pr_err_ratelimited(). While at
it, change a pr_err() to pr_debug(). Also fix an error log to
correct that the error is for reading IIO channel and not for a
property.

Change-Id: I936409d4ffafd664c571976d17ec4baf1b8de218
Signed-off-by: Subbaraman Narayanamurthy <subbaram@codeaurora.org>
This commit is contained in:
Subbaraman Narayanamurthy 2021-01-28 19:10:39 -08:00
commit d37101dfc3

View file

@ -1,6 +1,6 @@
// SPDX-License-Identifier: GPL-2.0-only
/*
* Copyright (c) 2018-2020 The Linux Foundation. All rights reserved.
* Copyright (c) 2018-2021 The Linux Foundation. All rights reserved.
*/
#define pr_fmt(fmt) "QG-K: %s: " fmt, __func__
@ -2148,13 +2148,13 @@ static int qg_iio_write_raw(struct iio_dev *indio_dev,
rc = qg_setprop_batt_age_level(chip, val1);
break;
default:
pr_err("Unsupported QG IIO chan %d\n", chan->channel);
pr_debug("Unsupported QG IIO chan %d\n", chan->channel);
rc = -EINVAL;
break;
}
if (rc < 0)
pr_err("Couldn't write IIO channel %d, rc = %d\n",
pr_err_ratelimited("Couldn't write IIO channel %d, rc = %d\n",
chan->channel, rc);
return rc;
@ -2288,13 +2288,13 @@ static int qg_iio_read_raw(struct iio_dev *indio_dev,
*val1 = chip->qg_mode;
break;
default:
pr_debug("Unsupported property %d\n", chan->channel);
pr_debug("Unsupported QG IIO chan %d\n", chan->channel);
rc = -EINVAL;
break;
}
if (rc < 0) {
pr_err("Couldn't read IIO channel %d, rc = %d\n",
pr_err_ratelimited("Couldn't read IIO channel %d, rc = %d\n",
chan->channel, rc);
return rc;
}