@@ -55,7 +55,6 @@ static LIST_HEAD(regulator_map_list);
5555static LIST_HEAD (regulator_ena_gpio_list );
5656static LIST_HEAD (regulator_supply_alias_list );
5757static bool has_full_constraints ;
58- static bool board_wants_dummy_regulator ;
5958
6059static struct dentry * debugfs_root ;
6160
@@ -1303,12 +1302,12 @@ static struct regulator_dev *regulator_dev_lookup(struct device *dev,
13031302
13041303/* Internal regulator request function */
13051304static struct regulator * _regulator_get (struct device * dev , const char * id ,
1306- bool exclusive )
1305+ bool exclusive , bool allow_dummy )
13071306{
13081307 struct regulator_dev * rdev ;
13091308 struct regulator * regulator = ERR_PTR (- EPROBE_DEFER );
13101309 const char * devname = NULL ;
1311- int ret = 0 ;
1310+ int ret = - EPROBE_DEFER ;
13121311
13131312 if (id == NULL ) {
13141313 pr_err ("get() with no identifier\n" );
@@ -1324,34 +1323,32 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
13241323 if (rdev )
13251324 goto found ;
13261325
1326+ regulator = ERR_PTR (ret );
1327+
13271328 /*
13281329 * If we have return value from dev_lookup fail, we do not expect to
13291330 * succeed, so, quit with appropriate error value
13301331 */
1331- if (ret ) {
1332- regulator = ERR_PTR (ret );
1332+ if (ret && ret != - ENODEV ) {
13331333 goto out ;
13341334 }
13351335
1336- if (board_wants_dummy_regulator ) {
1337- rdev = dummy_regulator_rdev ;
1338- goto found ;
1339- }
1340-
1341- #ifdef CONFIG_REGULATOR_DUMMY
13421336 if (!devname )
13431337 devname = "deviceless" ;
13441338
1345- /* If the board didn't flag that it was fully constrained then
1346- * substitute in a dummy regulator so consumers can continue.
1339+ /*
1340+ * Assume that a regulator is physically present and enabled
1341+ * even if it isn't hooked up and just provide a dummy.
13471342 */
1348- if (! has_full_constraints ) {
1343+ if (has_full_constraints && allow_dummy ) {
13491344 pr_warn ("%s supply %s not found, using dummy regulator\n" ,
13501345 devname , id );
1346+
13511347 rdev = dummy_regulator_rdev ;
13521348 goto found ;
1349+ } else {
1350+ dev_err (dev , "dummy supplies not allowed\n" );
13531351 }
1354- #endif
13551352
13561353 mutex_unlock (& regulator_list_mutex );
13571354 return regulator ;
@@ -1409,7 +1406,7 @@ static struct regulator *_regulator_get(struct device *dev, const char *id,
14091406 */
14101407struct regulator * regulator_get (struct device * dev , const char * id )
14111408{
1412- return _regulator_get (dev , id , false);
1409+ return _regulator_get (dev , id , false, true );
14131410}
14141411EXPORT_SYMBOL_GPL (regulator_get );
14151412
@@ -1436,7 +1433,7 @@ EXPORT_SYMBOL_GPL(regulator_get);
14361433 */
14371434struct regulator * regulator_get_exclusive (struct device * dev , const char * id )
14381435{
1439- return _regulator_get (dev , id , true);
1436+ return _regulator_get (dev , id , true, false );
14401437}
14411438EXPORT_SYMBOL_GPL (regulator_get_exclusive );
14421439
@@ -1465,7 +1462,7 @@ EXPORT_SYMBOL_GPL(regulator_get_exclusive);
14651462 */
14661463struct regulator * regulator_get_optional (struct device * dev , const char * id )
14671464{
1468- return _regulator_get (dev , id , 0 );
1465+ return _regulator_get (dev , id , false, false );
14691466}
14701467EXPORT_SYMBOL_GPL (regulator_get_optional );
14711468
@@ -3663,22 +3660,6 @@ void regulator_has_full_constraints(void)
36633660}
36643661EXPORT_SYMBOL_GPL (regulator_has_full_constraints );
36653662
3666- /**
3667- * regulator_use_dummy_regulator - Provide a dummy regulator when none is found
3668- *
3669- * Calling this function will cause the regulator API to provide a
3670- * dummy regulator to consumers if no physical regulator is found,
3671- * allowing most consumers to proceed as though a regulator were
3672- * configured. This allows systems such as those with software
3673- * controllable regulators for the CPU core only to be brought up more
3674- * readily.
3675- */
3676- void regulator_use_dummy_regulator (void )
3677- {
3678- board_wants_dummy_regulator = true;
3679- }
3680- EXPORT_SYMBOL_GPL (regulator_use_dummy_regulator );
3681-
36823663/**
36833664 * rdev_get_drvdata - get rdev regulator driver data
36843665 * @rdev: regulator
0 commit comments