Re: [PATCH v7 1/3] revocable: Revocable resource management

From: Laurent Pinchart

Date: Fri Jan 16 2026 - 11:04:47 EST


On Fri, Jan 16, 2026 at 04:27:27PM +0100, Bartosz Golaszewski wrote:
> On Fri, Jan 16, 2026 at 4:20 PM Danilo Krummrich wrote:
> > On Fri Jan 16, 2026 at 9:02 AM CET, Tzung-Bi Shih wrote:
> > > diff --git a/MAINTAINERS b/MAINTAINERS
> > > index a671e3d4e8be..fd683c62012a 100644
> > > --- a/MAINTAINERS
> > > +++ b/MAINTAINERS
> > > @@ -22517,6 +22517,13 @@ F: include/uapi/linux/rseq.h
> > > F: kernel/rseq.c
> > > F: tools/testing/selftests/rseq/
> > >
> > > +REVOCABLE RESOURCE MANAGEMENT
> > > +M: Tzung-Bi Shih <tzungbi@xxxxxxxxxx>
> > > +L: linux-kernel@xxxxxxxxxxxxxxx
> > > +S: Maintained
> > > +F: drivers/base/revocable.c
> > > +F: include/linux/revocable.h
> >
> > NIT: I think we should add this include to the DRIVER CORE entry as well.
>
> FWIW: I'm not even sure drivers/base/ is the right place for this.
> Except for a few devm_ helpers, nothing here is inherently tied into
> the driver model This could be useful outside of device drivers and I
> would suggest to put it under lib/ with devres factored out into a
> separate source file.

I agree. Based on the discussions we had at LPC, the revocable resource
management API is not the right solution to handle races between device
removal and userspace access. It is however a possibly useful tool for
races between producers and consumers *inside the kernel*. lib/ is a
better location.

--
Regards,

Laurent Pinchart