Skip to content

Commit

Permalink
regulator: Let drivers know when they use the stub API
Browse files Browse the repository at this point in the history
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>
  • Loading branch information
Jean Delvare authored and Liam Girdwood committed Apr 19, 2010
1 parent 13bd8e4 commit be1a50d
Showing 1 changed file with 6 additions and 2 deletions.
8 changes: 6 additions & 2 deletions include/linux/regulator/consumer.h
Original file line number Diff line number Diff line change
Expand Up @@ -183,9 +183,13 @@ static inline struct regulator *__must_check regulator_get(struct device *dev,
{
/* Nothing except the stubbed out regulator API should be
* looking at the value except to check if it is an error
* value so the actual return value doesn't matter.
* value. Drivers are free to handle NULL specifically by
* skipping all regulator API calls, but they don't have to.
* Drivers which don't, should make sure they properly handle
* corner cases of the API, such as regulator_get_voltage()
* returning 0.
*/
return (struct regulator *)id;
return NULL;
}
static inline void regulator_put(struct regulator *regulator)
{
Expand Down

0 comments on commit be1a50d

Please sign in to comment.