public inbox for linux-kernel-mentees@lists.linux-foundation.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Gabriel Shahrouzi <gshahrouzi@gmail.com>
Cc: gregkh@linuxfoundation.org, lars@metafoo.de,
	linux-iio@vger.kernel.org, linux-kernel@vger.kernel.org,
	linux-staging@lists.linux.dev, Michael.Hennerich@analog.com,
	skhan@linuxfoundation.org, linux-kernel-mentees@lists.linux.dev
Subject: Re: [PATCH v3 2/3] staging: iio: ad9832: Refactor powerdown control
Date: Fri, 25 Apr 2025 09:16:59 +0100	[thread overview]
Message-ID: <20250425091659.71bf143f@jic23-huawei> (raw)
In-Reply-To: <CAKUZ0zKXg4KLpHPLtpkywPLp8+xxwAMSpNAgUmP34pfVZDv7Aw@mail.gmail.com>

On Thu, 24 Apr 2025 18:25:51 -0400
Gabriel Shahrouzi <gshahrouzi@gmail.com> wrote:

> On Mon, Apr 21, 2025 at 7:37 AM Jonathan Cameron <jic23@kernel.org> wrote:
> >
> > On Sun, 20 Apr 2025 13:54:18 -0400
> > Gabriel Shahrouzi <gshahrouzi@gmail.com> wrote:
> >  
> > > Replace custom implementation with out_altvoltage_powerdown ABI. The
> > > attribute's logic is inverted (1 now enables powerdown) to match the
> > > standard. Modernize driver by using the standard IIO interface.
> > >
> > > Signed-off-by: Gabriel Shahrouzi <gshahrouzi@gmail.com>
> > > ---
> > >  drivers/staging/iio/frequency/ad9832.c | 44 ++++++++++++++++++--------
> > >  1 file changed, 30 insertions(+), 14 deletions(-)
> > >
> > > diff --git a/drivers/staging/iio/frequency/ad9832.c b/drivers/staging/iio/frequency/ad9832.c
> > > index 0872ff4ec4896..a8fc20379efed 100644
> > > --- a/drivers/staging/iio/frequency/ad9832.c
> > > +++ b/drivers/staging/iio/frequency/ad9832.c
> > > @@ -167,6 +167,34 @@ static int ad9832_write_phase(struct ad9832_state *st,
> > >       return spi_sync(st->spi, &st->phase_msg);
> > >  }
> > >
> > > +static ssize_t ad9832_write_powerdown(struct device *dev, struct device_attribute *attr,
> > > +                                   const char *buf, size_t len)
> > > +{
> > > +     struct iio_dev *indio_dev = dev_to_iio_dev(dev);
> > > +     struct ad9832_state *st = iio_priv(indio_dev);
> > > +     int ret;
> > > +     unsigned long val;
> > > +
> > > +     ret = kstrtoul(buf, 10, &val);
> > > +     if (ret)
> > > +             goto error_ret;
> > > +
> > > +     mutex_lock(&st->lock);  
> >
> > Look at how guard(mutex)(&st->lock);
> > can be used in this driver to simplify things considerably.  
> Noted, added into new version.
> > May make sense to do that before introducing this new code.  
> Not sure whether to have made it its own patch or not. I grouped it
> together with the new code since it also uses locking.
For new code it is fine to do it at the same time.

If there are other places it makes sense in the driver, separate
patch covering all those.

Jonathan

  reply	other threads:[~2025-04-25  8:17 UTC|newest]

Thread overview: 14+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2025-04-20 17:54 [PATCH v3 0/3] Fix and refactor output disable logic Gabriel Shahrouzi
2025-04-20 17:54 ` [PATCH v3 1/3] iio: frequency: Use SLEEP bit instead of RESET to disable output Gabriel Shahrouzi
2025-04-20 17:54 ` [PATCH v3 2/3] staging: iio: ad9832: Refactor powerdown control Gabriel Shahrouzi
2025-04-21 11:37   ` Jonathan Cameron
2025-04-24 22:25     ` Gabriel Shahrouzi
2025-04-25  8:16       ` Jonathan Cameron [this message]
2025-04-20 17:54 ` [PATCH v3 3/3] staging: iio: ad9832: Add minor improvements to ad9832_write_powerdown Gabriel Shahrouzi
2025-04-21 11:40   ` Jonathan Cameron
2025-04-24 22:29     ` Gabriel Shahrouzi
2025-04-25  8:19       ` Jonathan Cameron
2025-04-21 11:33 ` [PATCH v3 0/3] Fix and refactor output disable logic Jonathan Cameron
2025-04-21 13:56   ` Gabriel Shahrouzi
2025-04-22 10:09 ` Dan Carpenter
2025-04-22 16:15   ` Gabriel Shahrouzi

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=20250425091659.71bf143f@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=Michael.Hennerich@analog.com \
    --cc=gregkh@linuxfoundation.org \
    --cc=gshahrouzi@gmail.com \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel-mentees@lists.linux.dev \
    --cc=linux-kernel@vger.kernel.org \
    --cc=linux-staging@lists.linux.dev \
    --cc=skhan@linuxfoundation.org \
    /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