lists.openwall.net   lists  /  announce  owl-users  owl-dev  john-users  john-dev  passwdqc-users  yescrypt  popa3d-users  /  oss-security  kernel-hardening  musl  sabotage  tlsify  passwords  /  crypt-dev  xvendor  /  Bugtraq  Full-Disclosure  linux-kernel  linux-netdev  linux-ext4  linux-hardening  linux-cve-announce  PHC 
Open Source and information security mailing list archives
 
Hash Suite: Windows password security audit tool. GUI, reports in PDF.
[<prev] [next>] [<thread-prev] [day] [month] [year] [list]
Message-ID: <CAHp75VcLiCRy_m35Sd4AGpOKQ+5WTXMzHZA7hcwDR-t1v46t2Q@mail.gmail.com>
Date:   Tue, 6 Sep 2022 23:36:28 +0300
From:   Andy Shevchenko <andy.shevchenko@...il.com>
To:     Eddie James <eajames@...ux.ibm.com>
Cc:     Jonathan Cameron <jic23@...nel.org>,
        Lars-Peter Clausen <lars@...afoo.de>,
        linux-iio <linux-iio@...r.kernel.org>,
        Linux Kernel Mailing List <linux-kernel@...r.kernel.org>,
        Joel Stanley <joel@....id.au>
Subject: Re: [PATCH v6 2/2] iio: pressure: dps310: Reset chip after timeout

On Tue, Sep 6, 2022 at 11:05 PM Eddie James <eajames@...ux.ibm.com> wrote:
>
> The DPS310 chip has been observed to get "stuck" such that pressure
> and temperature measurements are never indicated as "ready" in the
> MEAS_CFG register. The only solution is to reset the device and try
> again. In order to avoid continual failures, use a boolean flag to
> only try the reset after timeout once if errors persist.

If the previous patch is a dependency to this one, you need to use its
Subject in a Cc: stable@ tag as it's pointed out in the documentation.
Otherwise, Fixes go first in the series.

...

> +static int dps310_reset_reinit(struct dps310_data *data)
> +{
> +       int rc;
> +
> +       rc = dps310_reset_wait(data);
> +       if (rc)
> +               return rc;

> +       rc = dps310_startup(data);
> +       if (rc)
> +               return rc;
> +
> +       return 0;

Can be simply return _startup(...);

> +}

...

Can it be a helper here?

int dps310_get_ready_status(data, ready_bit, timeout)
{
  sleep = ...
  int ready;

 return regmap_read_poll_timeout(...);

}

> +static int dps310_ready(struct dps310_data *data, int ready_bit, int timeout)
> +{
> +       int rc;
> +       int ready;
> +       int sleep = DPS310_POLL_SLEEP_US(timeout);

> +       rc = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG, ready, ready & ready_bit,
> +                                     sleep, timeout);

rc = dps310_get_ready_status(...);

> +       if (rc) {
> +               if (rc == -ETIMEDOUT && !data->timeout_recovery_failed) {
> +                       int rc2;
> +
> +                       /* Reset and reinitialize the chip. */
> +                       rc2 = dps310_reset_reinit(data);
> +                       if (rc2) {
> +                               data->timeout_recovery_failed = true;
> +                       } else {

> +                               /* Try again to get sensor ready status. */
> +                               rc2 = regmap_read_poll_timeout(data->regmap, DPS310_MEAS_CFG,
> +                                                              ready, ready & ready_bit, sleep,
> +                                                              timeout);

rc2 = dps310_get_ready_status(...);

> +                               if (rc2)
> +                                       data->timeout_recovery_failed = true;
> +                               else
> +                                       return 0;
> +                       }
> +               }
> +
> +               return rc;
> +       }
> +
> +       data->timeout_recovery_failed = false;
> +       return 0;
> +}

--
With Best Regards,
Andy Shevchenko

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ