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] [thread-next>] [day] [month] [year] [list]
Message-ID: <CA+U=Dspxp4u5BoxwHCKMJBC5HWywX7ULSS=YBfOGzP1zLP=yVA@mail.gmail.com>
Date:   Wed, 26 Aug 2020 13:01:33 +0300
From:   Alexandru Ardelean <ardeleanalex@...il.com>
To:     Fabrice Gasnier <fabrice.gasnier@...com>
Cc:     Alexandru Ardelean <alexandru.ardelean@...log.com>,
        linux-iio <linux-iio@...r.kernel.org>,
        linux-stm32@...md-mailman.stormreply.com,
        LKML <linux-kernel@...r.kernel.org>,
        linux-arm-kernel@...ts.infradead.org,
        Jonathan Cameron <jic23@...nel.org>, alexandre.torgue@...com,
        Sergiu Cuciurean <sergiu.cuciurean@...log.com>
Subject: Re: [PATCH] iio: stm32-dac: Replace indio_dev->mlock with own device lock

On Wed, Aug 26, 2020 at 12:01 PM Fabrice Gasnier <fabrice.gasnier@...com> wrote:
>
> On 8/26/20 8:38 AM, Alexandru Ardelean wrote:
> > From: Sergiu Cuciurean <sergiu.cuciurean@...log.com>
> >
> > As part of the general cleanup of indio_dev->mlock, this change replaces
> > it with a local lock on the device's state structure.
> >
> > The patch also does a minor whitespace change to align the 'lock' with the
> > 'common' field via tabs.
> >
> > Signed-off-by: Sergiu Cuciurean <sergiu.cuciurean@...log.com>
> > Signed-off-by: Alexandru Ardelean <alexandru.ardelean@...log.com>
> > ---
> >  drivers/iio/dac/stm32-dac.c | 14 +++++++++-----
> >  1 file changed, 9 insertions(+), 5 deletions(-)
> >
> > diff --git a/drivers/iio/dac/stm32-dac.c b/drivers/iio/dac/stm32-dac.c
> > index 092c796fa3d9..fc636812c17e 100644
> > --- a/drivers/iio/dac/stm32-dac.c
> > +++ b/drivers/iio/dac/stm32-dac.c
> > @@ -26,9 +26,11 @@
> >  /**
> >   * struct stm32_dac - private data of DAC driver
> >   * @common:          reference to DAC common data
> > + * @lock:            lock to protect the data buffer during regmap ops
>
> Hi Alexandru,
>
> I think the same patch has been sent by Sergiu already [1].
> Jonathan and I had a minor comment at that time: E.g. could you please
> update the comment ?

Oh.
My bad. I didn't follow the discussion closely.
Will send a V2.

>
> [1] https://lkml.org/lkml/2020/5/18/254
>
> >   */
> >  struct stm32_dac {
> > -     struct stm32_dac_common *common;
> > +     struct stm32_dac_common *common;
>
> Is above change needed?

No.
I can remove it.

Thanks
Alex

>
> Best Regards,
> Fabrice
>
> > +     struct mutex            lock;
> >  };
> >
> >  static int stm32_dac_is_enabled(struct iio_dev *indio_dev, int channel)
> > @@ -58,10 +60,10 @@ static int stm32_dac_set_enable_state(struct iio_dev *indio_dev, int ch,
> >       int ret;
> >
> >       /* already enabled / disabled ? */
> > -     mutex_lock(&indio_dev->mlock);
> > +     mutex_lock(&dac->lock);
> >       ret = stm32_dac_is_enabled(indio_dev, ch);
> >       if (ret < 0 || enable == !!ret) {
> > -             mutex_unlock(&indio_dev->mlock);
> > +             mutex_unlock(&dac->lock);
> >               return ret < 0 ? ret : 0;
> >       }
> >
> > @@ -69,13 +71,13 @@ static int stm32_dac_set_enable_state(struct iio_dev *indio_dev, int ch,
> >               ret = pm_runtime_get_sync(dev);
> >               if (ret < 0) {
> >                       pm_runtime_put_noidle(dev);
> > -                     mutex_unlock(&indio_dev->mlock);
> > +                     mutex_unlock(&dac->lock);
> >                       return ret;
> >               }
> >       }
> >
> >       ret = regmap_update_bits(dac->common->regmap, STM32_DAC_CR, msk, en);
> > -     mutex_unlock(&indio_dev->mlock);
> > +     mutex_unlock(&dac->lock);
> >       if (ret < 0) {
> >               dev_err(&indio_dev->dev, "%s failed\n", en ?
> >                       "Enable" : "Disable");
> > @@ -327,6 +329,8 @@ static int stm32_dac_probe(struct platform_device *pdev)
> >       indio_dev->info = &stm32_dac_iio_info;
> >       indio_dev->modes = INDIO_DIRECT_MODE;
> >
> > +     mutex_init(&dac->lock);
> > +
> >       ret = stm32_dac_chan_of_init(indio_dev);
> >       if (ret < 0)
> >               return ret;
> >

Powered by blists - more mailing lists

Powered by Openwall GNU/*/Linux Powered by OpenVZ