public inbox for linux-iio@vger.kernel.org
 help / color / mirror / Atom feed
From: Jonathan Cameron <jic23@kernel.org>
To: Andy Shevchenko <andy.shevchenko@gmail.com>
Cc: Ethan Tidmore <ethantidmore06@gmail.com>,
	andy@kernel.org, linux-iio@vger.kernel.org
Subject: Re: [RFC] GSoC 2026: Transitioning IIO to guard() and scoped_guard()
Date: Sat, 14 Mar 2026 11:07:58 +0000	[thread overview]
Message-ID: <20260314110758.2fc20704@jic23-huawei> (raw)
In-Reply-To: <CAHp75VeZb0pSiAkHo9QUeS+2L-qP_83-dKKRSp7-1VfZrtr1bw@mail.gmail.com>

On Wed, 11 Mar 2026 22:18:07 +0200
Andy Shevchenko <andy.shevchenko@gmail.com> wrote:

> On Wed, Mar 11, 2026 at 9:46 PM Ethan Tidmore <ethantidmore06@gmail.com> wrote:
> >
> > Hi Jonathan, Andy,
> >
> > I'm proposing converting the entire IIO tree to use guard() and
> > scoped_guard() instead of manual locking. This would greatly reduce
> > boilerplate, the possibility of lock leaks and modernize the entire IIO
> > tree to current kernel API standards.
> >
> > $ grep -rn "mutex_lock" drivers/iio | wc -l
> > 874
> >
> > This would have to be a "Large" project according to GsoC due to the scale
> > of the IIO tree. If this is wanted, I would like to know how these changes
> > should be submitted to make this easier to review. I was thinking per
> > directory per vendor.
> >
> > Looking forward to hear your feedback.  
> 
> Most of the cases can be automated with coccinelle, so you can even
> create a script in one day and estimate the real number of corner
> cases (id est that require manual work). That said, it's not a big
> project from amount of drivers point of view. It might be still big
> depending on corner cases and if you wish to target them as well.

Hi Ethan

I'm not keen on a mass cleanup like this without taking a closer look at
the drivers. I would say (based on gut feeling rather than actually
having checked the stats) that perhaps 25% of these patches result in
feedback on the surrounding code or follow on improvements that are
enabled. I don't mind people doing this sort of stuff as a 'first few
patches' thing but not seeing the benefit from a mass conversion. In
particular it would absorb a huge amount of reviewer time. Improving
readability of old drivers that aren't touched that much isn't a big
priority for me at least.  This particular guard() pattern thing
isn't universal. Sometimes it's not the right tool to use or much
more comprehensive restructuring is needed to make it useful

As to the your question on how this 'might' be done, it would need to be
1 patch per driver because this will cause chaos for backports of later
fixes due to significant churn.

There are ABI changes that we want to push through the tree such
as iio_push_to_buffers_with_ts() but that's because the new ABI
is inherently safer and I want to get rid of the old one.
Some of those cases are easy, others much less so.

Jonathan



> 


  reply	other threads:[~2026-03-14 11:08 UTC|newest]

Thread overview: 9+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2026-03-11 19:46 [RFC] GSoC 2026: Transitioning IIO to guard() and scoped_guard() Ethan Tidmore
2026-03-11 20:18 ` Andy Shevchenko
2026-03-14 11:07   ` Jonathan Cameron [this message]
2026-03-14 18:08     ` Ethan Tidmore
2026-03-15 18:34       ` David Lechner
2026-03-15 19:01         ` Jonathan Cameron
2026-03-15 18:41       ` Jonathan Cameron
2026-03-16  1:11         ` Ethan Tidmore
2026-03-18  1:28           ` Ethan Tidmore

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=20260314110758.2fc20704@jic23-huawei \
    --to=jic23@kernel.org \
    --cc=andy.shevchenko@gmail.com \
    --cc=andy@kernel.org \
    --cc=ethantidmore06@gmail.com \
    --cc=linux-iio@vger.kernel.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