From: Tzung-Bi Shih <tzungbi@kernel.org>
To: Bartosz Golaszewski <brgl@kernel.org>
Cc: Jonathan Corbet <corbet@lwn.net>, Shuah Khan <shuah@kernel.org>,
Laurent Pinchart <laurent.pinchart@ideasonboard.com>,
Wolfram Sang <wsa+renesas@sang-engineering.com>,
Jason Gunthorpe <jgg@nvidia.com>, Johan Hovold <johan@kernel.org>,
"Paul E . McKenney" <paulmck@kernel.org>,
Dan Williams <dan.j.williams@intel.com>,
Linus Walleij <linusw@kernel.org>,
chrome-platform@lists.linux.dev, driver-core@lists.linux.dev,
linux-doc@vger.kernel.org, linux-kernel@vger.kernel.org,
linux-kselftest@vger.kernel.org,
Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
"Rafael J. Wysocki" <rafael@kernel.org>,
Danilo Krummrich <dakr@kernel.org>
Subject: Re: [PATCH v8 1/3] revocable: Revocable resource management
Date: Mon, 23 Feb 2026 15:03:30 +0800 [thread overview]
Message-ID: <aZv7whUgUOyIFoYS@tzungbi-laptop> (raw)
In-Reply-To: <CAMRc=MehkJc-js=Wk9vBAcXOpazqjtYDLPUEhmbN8U7Wu2YpgA@mail.gmail.com>
On Mon, Feb 16, 2026 at 08:37:50AM -0800, Bartosz Golaszewski wrote:
> On Fri, 13 Feb 2026 10:23:05 +0100, Tzung-Bi Shih <tzungbi@kernel.org> said:
> > diff --git a/include/linux/revocable.h b/include/linux/revocable.h
> > +
>
> [snip]
>
> > +/**
> > + * struct revocable_consumer - A handle for resource consumer.
> > + * @rp: The pointer of resource provider.
> > + * @idx: The index for the SRCU critical section.
> > + */
> > +struct revocable_consumer {
> > + struct revocable *rp;
> > + int idx;
> > +};
> > +
> > +void revocable_get(struct revocable *rp);
> > +void revocable_put(struct revocable *rp);
> > +struct revocable *revocable_alloc(void *res);
>
> Is there any reason why we couldn't do:
>
> int revocable_init(struct revocable *rp, void *res);
>
> and then:
>
> struct gpio_device {
> struct revocable rp;
> ...
> };
>
> revocable_init(&gdev->rp, gc);
>
> ? It would be functionally equivalent to what we're doing now in GPIO.
In the case of struct gpio_device, it is possible to embed struct revocable
directly. Since the lifetime of gpio_device matches the revocable object,
the reference counting mechanism in struct revocable is redundant in this
specific instance.
However, the design allows for cases where there is no persistent parent
object. For example, a revocable handle may exist in the dev-managed
context of a kernel thread. In such cases, consumers are required to hold
a reference to the handle.
next prev parent reply other threads:[~2026-02-23 7:03 UTC|newest]
Thread overview: 6+ messages / expand[flat|nested] mbox.gz Atom feed top
2026-02-13 9:23 [PATCH v8 0/3] drivers/base: Introduce revocable Tzung-Bi Shih
2026-02-13 9:23 ` [PATCH v8 1/3] revocable: Revocable resource management Tzung-Bi Shih
2026-02-16 16:37 ` Bartosz Golaszewski
2026-02-23 7:03 ` Tzung-Bi Shih [this message]
2026-02-13 9:23 ` [PATCH v8 2/3] revocable: Add KUnit test cases Tzung-Bi Shih
2026-02-13 9:23 ` [PATCH v8 3/3] selftests: revocable: Add kselftest cases Tzung-Bi Shih
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=aZv7whUgUOyIFoYS@tzungbi-laptop \
--to=tzungbi@kernel.org \
--cc=brgl@kernel.org \
--cc=chrome-platform@lists.linux.dev \
--cc=corbet@lwn.net \
--cc=dakr@kernel.org \
--cc=dan.j.williams@intel.com \
--cc=driver-core@lists.linux.dev \
--cc=gregkh@linuxfoundation.org \
--cc=jgg@nvidia.com \
--cc=johan@kernel.org \
--cc=laurent.pinchart@ideasonboard.com \
--cc=linusw@kernel.org \
--cc=linux-doc@vger.kernel.org \
--cc=linux-kernel@vger.kernel.org \
--cc=linux-kselftest@vger.kernel.org \
--cc=paulmck@kernel.org \
--cc=rafael@kernel.org \
--cc=shuah@kernel.org \
--cc=wsa+renesas@sang-engineering.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®