Linux kernel mirror (for testing) git.kernel.org/pub/scm/linux/kernel/git/torvalds/linux.git
kernel os linux

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>

authored by

Matti Vaittinen and committed by
Mark Brown
157d2230 e6c3092d

+22 -16
+1 -11
drivers/regulator/core.c
··· 33 33 #include "dummy.h" 34 34 #include "internal.h" 35 35 36 - #define rdev_crit(rdev, fmt, ...) \ 37 - pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 38 - #define rdev_err(rdev, fmt, ...) \ 39 - pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 40 - #define rdev_warn(rdev, fmt, ...) \ 41 - pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 42 - #define rdev_info(rdev, fmt, ...) \ 43 - pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 44 - #define rdev_dbg(rdev, fmt, ...) \ 45 - pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 46 - 47 36 static DEFINE_WW_CLASS(regulator_ww_class); 48 37 static DEFINE_MUTEX(regulator_nesting_mutex); 49 38 static DEFINE_MUTEX(regulator_list_mutex); ··· 106 117 else 107 118 return ""; 108 119 } 120 + EXPORT_SYMBOL_GPL(rdev_get_name); 109 121 110 122 static bool have_full_constraints(void) 111 123 {
+11
drivers/regulator/internal.h
··· 15 15 16 16 #define REGULATOR_STATES_NUM (PM_SUSPEND_MAX + 1) 17 17 18 + #define rdev_crit(rdev, fmt, ...) \ 19 + pr_crit("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 20 + #define rdev_err(rdev, fmt, ...) \ 21 + pr_err("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 22 + #define rdev_warn(rdev, fmt, ...) \ 23 + pr_warn("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 24 + #define rdev_info(rdev, fmt, ...) \ 25 + pr_info("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 26 + #define rdev_dbg(rdev, fmt, ...) \ 27 + pr_debug("%s: " fmt, rdev_get_name(rdev), ##__VA_ARGS__) 28 + 18 29 struct regulator_voltage { 19 30 int min_uV; 20 31 int max_uV;
-5
include/linux/regulator/coupler.h
··· 52 52 53 53 #ifdef CONFIG_REGULATOR 54 54 int regulator_coupler_register(struct regulator_coupler *coupler); 55 - const char *rdev_get_name(struct regulator_dev *rdev); 56 55 int regulator_check_consumers(struct regulator_dev *rdev, 57 56 int *min_uV, int *max_uV, 58 57 suspend_state_t state); ··· 67 68 static inline int regulator_coupler_register(struct regulator_coupler *coupler) 68 69 { 69 70 return 0; 70 - } 71 - static inline const char *rdev_get_name(struct regulator_dev *rdev) 72 - { 73 - return NULL; 74 71 } 75 72 static inline int regulator_check_consumers(struct regulator_dev *rdev, 76 73 int *min_uV, int *max_uV,
+10
include/linux/regulator/driver.h
··· 550 550 551 551 int regulator_desc_list_voltage_linear(const struct regulator_desc *desc, 552 552 unsigned int selector); 553 + 554 + #ifdef CONFIG_REGULATOR 555 + const char *rdev_get_name(struct regulator_dev *rdev); 556 + #else 557 + static inline const char *rdev_get_name(struct regulator_dev *rdev) 558 + { 559 + return NULL; 560 + } 561 + #endif 562 + 553 563 #endif