From: "Nuno Sá" <noname.nuno@gmail.com>
To: Jonathan Cameron <jic23@kernel.org>, Nuno Sa <nuno.sa@analog.com>
Cc: linux-iio@vger.kernel.org, Lars-Peter Clausen <lars@metafoo.de>
Subject: Re: [PATCH v2 1/5] iio: core: move to cleanup.h magic
Date: Mon, 26 Feb 2024 09:49:15 +0100 [thread overview]
Message-ID: <cc6131b2a2da98a0546ea503f52bb87a549a45e9.camel@gmail.com> (raw)
In-Reply-To: <20240225123600.301758b0@jic23-huawei>
On Sun, 2024-02-25 at 12:36 +0000, Jonathan Cameron wrote:
> On Fri, 23 Feb 2024 13:43:44 +0100
> Nuno Sa <nuno.sa@analog.com> wrote:
>
> > Use the new cleanup magic for handling mutexes in IIO. This allows us to
> > greatly simplify some code paths.
> >
> > Note that we keep the plain mutex calls in the
> > iio_device_release|acquire() APIs since in there the macros would likely
> > not help much (as we want to keep the lock acquired when he leave the
> > APIs).
> >
> > Signed-off-by: Nuno Sa <nuno.sa@analog.com>
> > ---
>
>
> > @@ -1808,29 +1805,22 @@ static long iio_ioctl(struct file *filp, unsigned int
> > cmd, unsigned long arg)
> > struct iio_ioctl_handler *h;
> > int ret = -ENODEV;
> >
> > - mutex_lock(&iio_dev_opaque->info_exist_lock);
> > -
> > + guard(mutex)(&iio_dev_opaque->info_exist_lock);
> > /*
> > * The NULL check here is required to prevent crashing when a device
> > * is being removed while userspace would still have open file handles
> > * to try to access this device.
> > */
> > if (!indio_dev->info)
> > - goto out_unlock;
> > + return ret;
>
> return -ENODEV; and drop initialisation above.
Ok, that was actually what I had. Ended up changing it because of the slightly
smaller diff on the patch.
- Nuno Sá
next prev parent reply other threads:[~2024-02-26 8:49 UTC|newest]
Thread overview: 16+ messages / expand[flat|nested] mbox.gz Atom feed top
2024-02-23 12:43 [PATCH v2 0/5] iio: move IIO to the cleanup.h magic Nuno Sa
2024-02-23 12:43 ` [PATCH v2 1/5] iio: core: move to " Nuno Sa
2024-02-25 12:36 ` Jonathan Cameron
2024-02-26 8:49 ` Nuno Sá [this message]
2024-02-23 12:43 ` [PATCH v2 2/5] iio: events: move to the " Nuno Sa
2024-02-25 12:35 ` Jonathan Cameron
2024-02-26 8:48 ` Nuno Sá
2024-02-23 12:43 ` [PATCH v2 3/5] iio: trigger: " Nuno Sa
2024-02-25 12:45 ` Jonathan Cameron
2024-02-26 8:51 ` Nuno Sá
2024-02-23 12:43 ` [PATCH v2 4/5] iio: buffer: iio: core: " Nuno Sa
2024-02-25 12:53 ` Jonathan Cameron
2024-02-26 8:53 ` Nuno Sá
2024-02-23 12:43 ` [PATCH v2 5/5] iio: inkern: " Nuno Sa
2024-02-25 13:12 ` Jonathan Cameron
2024-02-26 8:57 ` Nuno Sá
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=cc6131b2a2da98a0546ea503f52bb87a549a45e9.camel@gmail.com \
--to=noname.nuno@gmail.com \
--cc=jic23@kernel.org \
--cc=lars@metafoo.de \
--cc=linux-iio@vger.kernel.org \
--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