Skip to content

Commit be1a50d

Browse files
Jean DelvareLiam Girdwood
authored andcommitted
regulator: Let drivers know when they use the stub API
Have the stub variant of regulator_get() return NULL, so that drivers can (but still don't have to) handle this case specifically. Signed-off-by: Jean Delvare <khali@linux-fr.org> Cc: Mark Brown <broonie@opensource.wolfsonmicro.com> Cc: Jerome Oufella <jerome.oufella@savoirfairelinux.com> Acked-by: Mark Brown <broonie@opensource.wolfsonmicro.com> Signed-off-by: Liam Girdwood <lrg@slimlogic.co.uk>
1 parent 13bd8e4 commit be1a50d

1 file changed

Lines changed: 6 additions & 2 deletions

File tree

‎include/linux/regulator/consumer.h‎

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
183183
{
184184
/* Nothing except the stubbed out regulator API should be
185185
* looking at the value except to check if it is an error
186-
* value so the actual return value doesn't matter.
186+
* value. Drivers are free to handle NULL specifically by
187+
* skipping all regulator API calls, but they don't have to.
188+
* Drivers which don't, should make sure they properly handle
189+
* corner cases of the API, such as regulator_get_voltage()
190+
* returning 0.
187191
*/
188-
return (struct regulator *)id;
192+
return NULL;
189193
}
190194
static inline void regulator_put(struct regulator *regulator)
191195
{

0 commit comments

Comments
 (0)