Re: [PATCH 3/3] gpio: Add reference counting for non-exclusive GPIOs
From: Mark Brown
Date: Tue Nov 27 2018 - 08:30:43 EST
On Mon, Nov 26, 2018 at 10:53:40PM +0100, Linus Walleij wrote:
> The managed resources pretty much assume
> that you tie resources to the device model and let kref inside the
> kobject in struct device do all refcounting and that essentially
> collides with the refcounting inside the regulator core, they both
> want to control this now.
If a driver is handing ownership of an object over to something else
then devm is always unsuitable.
> I suspect maybe the lesser evil is to bite the bullet, invent
> gpiod_get_from_of_node() which is the missing API (we currently
> only have devm_gpiod_get_from_of_node()) and simply
> fix up the converted regulator drivers to avoid devm_*
> retrieveal in the same manner as wm8994 (the already
> queued patch). This will make the regulator core own the
> refcounting as it does today.
You're always going to need unmanaged versions of functions for use with
things like this I think.
Attachment:
signature.asc
Description: PGP signature