From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andriy.shevchenko@intel.com>
Cc: amiratefabdallah1122@gmail.com,
Lars-Peter Clausen <lars@metafoo.de>,
Michael Hennerich <Michael.Hennerich@analog.com>,
David Lechner <dlechner@baylibre.com>,
Nuno Sa <nuno.sa@analog.com>, Andy Shevchenko <andy@kernel.org>,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
linux-iio@vger.kernel.org, linux-staging@lists.linux.dev,
linux-kernel@vger.kernel.org
Subject: Re: [PATCH v3] staging: iio: frequency: ad9834: use guard(mutex)
Date: Sat, 24 Oct 2026 03:32:57 +0100 [thread overview]
Message-ID: <20261024033257.53192e12@jic23-hlaptop> (raw)
In-Reply-To: <atZpjGgTBcdVMtQJ@ashevche-desk.local>
On Mon, 19 Oct 2026 22:03:40 +0300
Andy Shevchenko <andriy.shevchenko@intel.com> wrote:
> On Mon, Oct 19, 2026 at 05:15:45PM +0300, Amir Atef via B4 Relay wrote:
>
> > Use guard(mutex) to manage the state lock in ad9834_write() and
> > ad9834_store_wavetype(). This simplifies error handling by allowing
> > early returns instead of setting the return code and breaking out of the
> > switch statement to manually unlock the mutex.
>
> If you want to continue improving the code, you can research the use of
> sysfs_match_string() and rather use it as an outer check.
>
> static const char * const wavetypes[] = { "sine", "triangle", "square" };
>
> int wavetype;
> ...
> wavetype = sysfs_match_string(wavetypes);
> if (wavetype < 0)
> return wavetype;
>
> but it might be actually worse than existing. Again, it needs a research to be
> conducted.
>
> As for this change, it's good enough.
> Reviewed-by: Andy Shevchenko <andriy.shevchenko@intel.com>
>
Applied
next prev parent reply other threads:[~2026-10-24 2:33 UTC|newest]
Thread overview: 4+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-10-19 14:15 Amir Atef via B4 Relay
2026-10-19 19:03 ` Andy Shevchenko
2026-10-24 2:32 ` Jonathan Cameron [this message]
-- strict thread matches above, loose matches on Subject: below --
2026-10-17 21:12 Amir Atef via B4 Relay
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=20261024033257.53192e12@jic23-hlaptop \
--to=jic23@kernel.org \
--cc=Michael.Hennerich@analog.com \
--cc=amiratefabdallah1122@gmail.com \
--cc=andriy.shevchenko@intel.com \
--cc=andy@kernel.org \
--cc=dlechner@baylibre.com \
--cc=gregkh@linuxfoundation.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-staging@lists.linux.dev \
--cc=nuno.sa@analog.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®