Re: [PATCH 2/3] regulator: Only free GPIOs if the core requested them

From: Mark Brown
Date: Fri Nov 23 2018 - 09:25:57 EST


On Thu, Nov 22, 2018 at 05:30:14PM +0000, Charles Keepax wrote:
> Currently, the regulator core will take ownership of any GPIO passed
> into it. Makes end driver code fairly error prone as the normal devm_
> patterns of allocation don't work. Update the regulator core to only
> free the GPIO if it requested it, this allows the drivers to manage the
> GPIO lifetime as they normally would.

I think this is fine in conjunction with patch 3 in that adding that
patch sorts out the double free problems with shared regulators but
without that pushing the GPIO management into the individual regulator
drivers is going to create trouble as something needs to coordinate to
make sure that we only free when the last user is gone.

However even with patch 3 I think it'd be better to base this off the
rest of Linus' series for converting to descriptors (which is currently
sitting waiting for some more testing) since that will convert
everything to descriptors and so remove the code that's doing requests
in the core entirely.

Attachment: signature.asc
Description: PGP signature