diff --git a/drivers/regulator/core.c b/drivers/regulator/core.c index 046fb1bd861..10c12e40f75 100644 --- a/drivers/regulator/core.c +++ b/drivers/regulator/core.c @@ -51,6 +51,7 @@ static LIST_HEAD(regulator_list); static LIST_HEAD(regulator_map_list); static bool has_full_constraints; static bool board_wants_dummy_regulator; +static int suppress_info_printing; static struct dentry *debugfs_root; @@ -959,7 +960,8 @@ static int set_machine_constraints(struct regulator_dev *rdev, } } - print_constraints(rdev); + if (!suppress_info_printing) + print_constraints(rdev); return 0; out: kfree(rdev->constraints); @@ -981,7 +983,8 @@ static int set_supply(struct regulator_dev *rdev, { int err; - rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev)); + if (!suppress_info_printing) + rdev_info(rdev, "supplied by %s\n", rdev_get_name(supply_rdev)); rdev->supply = create_regulator(supply_rdev, &rdev->dev, "SUPPLY"); if (rdev->supply == NULL) { @@ -3117,6 +3120,22 @@ void regulator_use_dummy_regulator(void) } EXPORT_SYMBOL_GPL(regulator_use_dummy_regulator); +/** + * regulator_suppress_info_printing - disable printing of info messages + * + * The regulator framework calls print_constraints() when a regulator is + * registered. It also prints a disable message for each unused regulator in + * regulator_init_complete(). + * + * Calling this function ensures that such messages do not end up in the + * log. + */ +void regulator_suppress_info_printing(void) +{ + suppress_info_printing = 1; +} +EXPORT_SYMBOL_GPL(regulator_suppress_info_printing); + /** * rdev_get_drvdata - get rdev regulator driver data * @rdev: regulator @@ -3273,7 +3292,8 @@ static int __init regulator_init_complete(void) if (has_full_constraints) { /* We log since this may kill the system if it * goes wrong. */ - rdev_info(rdev, "disabling\n"); + if (!suppress_info_printing) + rdev_info(rdev, "disabling\n"); ret = ops->disable(rdev); if (ret != 0) { rdev_err(rdev, "couldn't disable: %d\n", ret); @@ -3284,7 +3304,9 @@ static int __init regulator_init_complete(void) * so warn even if we aren't going to do * anything here. */ - rdev_warn(rdev, "incomplete constraints, leaving on\n"); + if (!suppress_info_printing) + rdev_warn(rdev, "incomplete constraints, " + "leaving on\n"); } unlock: diff --git a/include/linux/regulator/machine.h b/include/linux/regulator/machine.h index b02108446be..837423fdcdf 100644 --- a/include/linux/regulator/machine.h +++ b/include/linux/regulator/machine.h @@ -188,6 +188,7 @@ int regulator_suspend_finish(void); #ifdef CONFIG_REGULATOR void regulator_has_full_constraints(void); void regulator_use_dummy_regulator(void); +void regulator_suppress_info_printing(void); #else static inline void regulator_has_full_constraints(void) { @@ -196,6 +197,10 @@ static inline void regulator_has_full_constraints(void) static inline void regulator_use_dummy_regulator(void) { } + +static inline void regulator_suppress_info_printing(void) +{ +} #endif #endif