[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <CAMRc=Mf0uBOHe=Ff6_1GcpEPX4d4wYJsnBBE=Mri-Um_sq2nog@mail.gmail.com>
Date: Mon, 7 Mar 2022 15:33:16 +0100
From: Bartosz Golaszewski <brgl@...ev.pl>
To: Alifer Moraes <alifer.m@...iscite.com>
Cc: Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
eran.m@...iscite.com, Linus Walleij <linus.walleij@...aro.org>,
"open list:GPIO SUBSYSTEM" <linux-gpio@...r.kernel.org>,
pierluigi.p@...iscite.com,
FrancescoFerraro <francesco.f@...iscite.com>
Subject: Re: [PATCH] driver: pca953x: avoid error message when resuming
On Mon, Mar 7, 2022 at 3:20 PM Alifer Moraes <alifer.m@...iscite.com> wrote:
>
> From: FrancescoFerraro <francesco.f@...iscite.com>
>
> Avoids the error messages "pca953x 1-0020: failed reading register"
> when resuming from suspend using gpio-key attached to pca9534.
>
The commit message should read: "gpio: pca953x: ..."
> Signed-off-by: Francesco Ferraro <francesco.f@...iscite.com>
> Signed-off-by: Alifer Moraes <alifer.m@...iscite.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;
Something like this is not needed because we already have
pm_runtime_status_suspended().
> };
>
> 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
>
Can you elaborate more on the circumstances in which you're seeing this?
Bart
Powered by blists - more mailing lists