@@ -186,3 +186,37 @@ their hardware offsets within the chip.
186
186
187
187
Encourage users to switch to using them and eventually remove the existing
188
188
global export/unexport attribues.
189
+
190
+ -------------------------------------------------------------------------------
191
+
192
+ Remove GPIOD_FLAGS_BIT_NONEXCLUSIVE
193
+
194
+ GPIOs in the linux kernel are meant to be an exclusive resource. This means
195
+ that the GPIO descriptors (the software representation of the hardware concept)
196
+ are not reference counted and - in general - only one user at a time can
197
+ request a GPIO line and control its settings. The consumer API is designed
198
+ around full control of the line's state as evidenced by the fact that, for
199
+ instance, gpiod_set_value() does indeed drive the line as requested, instead
200
+ of bumping an enable counter of some sort.
201
+
202
+ A problematic use-case for GPIOs is when two consumers want to use the same
203
+ descriptor independently. An example of such a user is the regulator subsystem
204
+ which may instantiate several struct regulator_dev instances containing
205
+ a struct device but using the same enable GPIO line.
206
+
207
+ A workaround was introduced in the form of the GPIOD_FLAGS_BIT_NONEXCLUSIVE
208
+ flag but its implementation is problematic: it does not provide any
209
+ synchronization of usage nor did it introduce any enable count meaning the
210
+ non-exclusive users of the same descriptor will in fact "fight" for the
211
+ control over it. This flag should be removed and replaced with a better
212
+ solution, possibly based on the new power sequencing subsystem.
213
+
214
+ -------------------------------------------------------------------------------
215
+
216
+ Remove devm_gpiod_unhinge()
217
+
218
+ devm_gpiod_unhinge() is provided as a way to transfer the ownership of managed
219
+ enable GPIOs to the regulator core. Rather than doing that however, we should
220
+ make it possible for the regulator subsystem to deal with GPIO resources the
221
+ lifetime of which it doesn't control as logically, a GPIO obtained by a caller
222
+ should also be freed by it.
0 commit comments