Introduce a regulator_is_dummy function to check whether the regulator is dummy. Signed-off-by: Kevin Liu <kliu5@xxxxxxxxxxx> --- drivers/regulator/core.c | 17 +++++++++++++++++ include/linux/regulator/consumer.h | 6 ++++++ 2 files changed, 23 insertions(+) diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index e872c8b..d2a8bdb 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -1826,6 +1826,23 @@ int regulator_disable_regmap(struct regulator_dev *rdev) } EXPORT_SYMBOL_GPL(regulator_disable_regmap); +/** + * regulator_is_dummy - check if regulator is dummy + * @regulator: regulator source + * + * Returns positive if the regulator is dummy, zero if it's not. + */ +int regulator_is_dummy(struct regulator *regulator) +{ + struct regulator_dev *rdev = regulator->rdev; + + if (!strcmp(rdev_get_name(rdev), "regulator-dummy")) + return 1; + else + return 0; +} +EXPORT_SYMBOL_GPL(regulator_is_dummy); + static int _regulator_is_enabled(struct regulator_dev *rdev) { /* A GPIO control always takes precedence */ diff --git a/include/linux/regulator/consumer.h b/include/linux/regulator/consumer.h index c43cd35..fe549d0 100644 --- a/include/linux/regulator/consumer.h +++ b/include/linux/regulator/consumer.h @@ -164,6 +164,7 @@ int regulator_count_voltages(struct regulator *regulator); int regulator_list_voltage(struct regulator *regulator, unsigned selector); int regulator_is_supported_voltage(struct regulator *regulator, int min_uV, int max_uV); +int regulator_is_dummy(struct regulator *regulator); int regulator_set_voltage(struct regulator *regulator, int min_uV, int max_uV); int regulator_set_voltage_time(struct regulator *regulator, int old_uV, int new_uV); @@ -249,6 +250,11 @@ static inline int regulator_is_enabled(struct regulator *regulator) return 1; } +static inline int regulator_is_dummy(struct regulator *regulator) +{ + return 0; +} + static inline int regulator_bulk_get(struct device *dev, int num_consumers, struct regulator_bulk_data *consumers) -- 1.7.9.5 -- To unsubscribe from this list: send the line "unsubscribe linux-mmc" in the body of a message to majordomo@xxxxxxxxxxxxxxx More majordomo info at http://vger.kernel.org/majordomo-info.html