From: Alifer Moraes <alifer.m@variscite.com>
To: linux-kernel@vger.kernel.org
Cc: brgl@bgdev.pl, eran.m@variscite.com, linus.walleij@linaro.org,
linux-gpio@vger.kernel.org, pierluigi.p@variscite.com,
FrancescoFerraro <francesco.f@variscite.com>,
Alifer Moraes <alifer.m@variscite.com>
Subject: [PATCH] driver: pca953x: avoid error message when resuming
Date: Mon, 7 Mar 2022 11:19:55 -0300 [thread overview]
Message-ID: <20220307141955.28040-1-alifer.m@variscite.com> (raw)
From: FrancescoFerraro <francesco.f@variscite.com>
Avoids the error messages "pca953x 1-0020: failed reading register"
when resuming from suspend using gpio-key attached to pca9534.
Signed-off-by: Francesco Ferraro <francesco.f@variscite.com>
Signed-off-by: Alifer Moraes <alifer.m@variscite.com>
---
drivers/gpio/gpio-pca953x.c | 9 ++++++++-
1 file changed, 8 insertions(+), 1 deletion(-)
diff --git a/drivers/gpio/gpio-pca953x.c b/drivers/gpio/gpio-pca953x.c
index d2fe76f3f34f..4f35b75dcbb1 100644
--- a/drivers/gpio/gpio-pca953x.c
+++ b/drivers/gpio/gpio-pca953x.c
@@ -211,6 +211,7 @@ struct pca953x_chip {
struct regulator *regulator;
const struct pca953x_reg_config *regs;
+ int is_in_suspend;
};
static int pca953x_bank_shift(struct pca953x_chip *chip)
@@ -412,7 +413,8 @@ static int pca953x_read_regs(struct pca953x_chip *chip, int reg, unsigned long *
ret = regmap_bulk_read(chip->regmap, regaddr, value, NBANK(chip));
if (ret < 0) {
- dev_err(&chip->client->dev, "failed reading register\n");
+ if (!chip->is_in_suspend)
+ dev_err(&chip->client->dev, "failed reading register\n");
return ret;
}
@@ -954,6 +956,7 @@ static int pca953x_probe(struct i2c_client *client,
chip = devm_kzalloc(&client->dev, sizeof(*chip), GFP_KERNEL);
if (chip == NULL)
return -ENOMEM;
+ chip->is_in_suspend = 0;
pdata = dev_get_platdata(&client->dev);
if (pdata) {
@@ -1161,6 +1164,8 @@ static int pca953x_suspend(struct device *dev)
else
regulator_disable(chip->regulator);
+ chip->is_in_suspend = 1;
+
return 0;
}
@@ -1189,6 +1194,8 @@ static int pca953x_resume(struct device *dev)
return ret;
}
+ chip->is_in_suspend = 0;
+
return 0;
}
#endif
--
2.25.1
next reply other threads:[~2022-03-07 14:20 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2022-03-07 14:19 Alifer Moraes [this message]
2022-03-07 14:33 ` Bartosz Golaszewski
2022-03-07 16:22 ` Andy Shevchenko
2022-06-20 14:18 ` Pierluigi Passaro
2022-06-20 16:02 ` Andy Shevchenko
2022-06-28 12:35 ` Linus Walleij
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20220307141955.28040-1-alifer.m@variscite.com \
--to=alifer.m@variscite.com \
--cc=brgl@bgdev.pl \
--cc=eran.m@variscite.com \
--cc=francesco.f@variscite.com \
--cc=linus.walleij@linaro.org \
--cc=linux-gpio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=pierluigi.p@variscite.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox
all inboxes | Powered by JetHome®