regulator: move rdev_print helpers to internal.h

The rdev print helpers are a nice way to print messages related to a
specific regulator device. Move them from core.c to internal.h

As the rdev print helpers use rdev_get_name() export it from core.c. Also
move the declaration from coupler.h to driver.h because the rdev name is
not just a coupled regulator property. I guess the main audience for
rdev_get_name() will be the regulator core and drivers.

Signed-off-by: Matti Vaittinen <matti.vaittinen@fi.rohmeurope.com>
Link: https://lore.kernel.org/r/dc7fd70dc31de4d0e820b7646bb78eeb04f80735.1622628333.git.matti.vaittinen@fi.rohmeurope.com
Signed-off-by: Mark Brown <broonie@kernel.org>
This commit is contained in:
Matti Vaittinen 2021-06-03 08:41:37 +03:00 коммит произвёл Mark Brown
Родитель e6c3092d43
Коммит 157d223019
Не найден ключ, соответствующий данной подписи
Идентификатор ключа GPG: 24D68B725D5487D0
4 изменённых файлов: 22 добавлений и 16 удалений

Просмотреть файл

@ -33,17 +33,6 @@
#include "dummy.h" #include "dummy.h"
#include "internal.h" #include "internal.h"
#define rdev_crit(rdev, fmt, ...) \
pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_err(rdev, fmt, ...) \
pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_warn(rdev, fmt, ...) \
pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_info(rdev, fmt, ...) \
pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_dbg(rdev, fmt, ...) \
pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
static DEFINE_WW_CLASS(regulator_ww_class); static DEFINE_WW_CLASS(regulator_ww_class);
static DEFINE_MUTEX(regulator_nesting_mutex); static DEFINE_MUTEX(regulator_nesting_mutex);
static DEFINE_MUTEX(regulator_list_mutex); static DEFINE_MUTEX(regulator_list_mutex);
@ -117,6 +106,7 @@ const char *rdev_get_name(struct regulator_dev *rdev)
else else
return ""; return "";
} }
EXPORT_SYMBOL_GPL(rdev_get_name);
static bool have_full_constraints(void) static bool have_full_constraints(void)
{ {

Просмотреть файл

@ -15,6 +15,17 @@
#define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1) #define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1)
#define rdev_crit(rdev, fmt, ...) \
pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_err(rdev, fmt, ...) \
pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_warn(rdev, fmt, ...) \
pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_info(rdev, fmt, ...) \
pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
#define rdev_dbg(rdev, fmt, ...) \
pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__)
struct regulator_voltage { struct regulator_voltage {
int min_uV; int min_uV;
int max_uV; int max_uV;

Просмотреть файл

@ -52,7 +52,6 @@ struct regulator_coupler {
#ifdef CONFIG_REGULATOR #ifdef CONFIG_REGULATOR
int regulator_coupler_register(struct regulator_coupler *coupler); int regulator_coupler_register(struct regulator_coupler *coupler);
const char *rdev_get_name(struct regulator_dev *rdev);
int regulator_check_consumers(struct regulator_dev *rdev, int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV, int *min_uV, int *max_uV,
suspend_state_t state); suspend_state_t state);
@ -69,10 +68,6 @@ static inline int regulator_coupler_register(struct regulator_coupler *coupler)
{ {
return 0; return 0;
} }
static inline const char *rdev_get_name(struct regulator_dev *rdev)
{
return NULL;
}
static inline int regulator_check_consumers(struct regulator_dev *rdev, static inline int regulator_check_consumers(struct regulator_dev *rdev,
int *min_uV, int *max_uV, int *min_uV, int *max_uV,
suspend_state_t state) suspend_state_t state)

Просмотреть файл

@ -550,4 +550,14 @@ int regulator_desc_list_voltage_linear_range(const struct regulator_desc *desc,
int regulator_desc_list_voltage_linear(const struct regulator_desc *desc, int regulator_desc_list_voltage_linear(const struct regulator_desc *desc,
unsigned int selector); unsigned int selector);
#ifdef CONFIG_REGULATOR
const char *rdev_get_name(struct regulator_dev *rdev);
#else
static inline const char *rdev_get_name(struct regulator_dev *rdev)
{
return NULL;
}
#endif
#endif #endif