dev_err() and co. functions handle the dev_fmt() macro if it is defined. This helps to have a common prefix for all messages generated with this API. dev_err_probe() looks like dev_err() but, up to now, does not expand the dev_fmt() macro. Add it. Suggested-by: Robin Murphy <robin.murphy@xxxxxxx> Signed-off-by: Christophe JAILLET <christophe.jaillet@xxxxxxxxxx> --- Example of where it would be useful is discussed at: https://lore.kernel.org/all/aaeba9c12ccdb29f48fe19137cb5abeea85fbb24.1659732652.git.christophe.jaillet@xxxxxxxxxx/ I've left the kerneldoc in the .c file near _dev_err_probe(). I don't know if it should be moved in the .h file close to dev_err_probe(). --- drivers/base/core.c | 7 +++++-- include/linux/device.h | 4 +++- 2 files changed, 8 insertions(+), 3 deletions(-) diff --git a/drivers/base/core.c b/drivers/base/core.c index 753e7cca0f40..89cab273a7b5 100644 --- a/drivers/base/core.c +++ b/drivers/base/core.c @@ -4830,6 +4830,9 @@ define_dev_printk_level(_dev_info, KERN_INFO); * * return dev_err_probe(dev, err, ...); * + * Just as dev_err() does, dev_err_probe() also takes the dev_fmt() macro into + * consideration if it is defined. + * * Note that it is deemed acceptable to use this function for error * prints during probe even if the @err is known to never be -EPROBE_DEFER. * The benefit compared to a normal dev_err() is the standardized format @@ -4838,7 +4841,7 @@ define_dev_printk_level(_dev_info, KERN_INFO); * Returns @err. * */ -int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) +int _dev_err_probe(const struct device *dev, int err, const char *fmt, ...) { struct va_format vaf; va_list args; @@ -4858,7 +4861,7 @@ int dev_err_probe(const struct device *dev, int err, const char *fmt, ...) return err; } -EXPORT_SYMBOL_GPL(dev_err_probe); +EXPORT_SYMBOL_GPL(_dev_err_probe); static inline bool fwnode_is_primary(struct fwnode_handle *fwnode) { diff --git a/include/linux/device.h b/include/linux/device.h index 424b55df0272..412a0ee2d44e 100644 --- a/include/linux/device.h +++ b/include/linux/device.h @@ -1093,7 +1093,9 @@ void device_links_supplier_sync_state_pause(void); void device_links_supplier_sync_state_resume(void); extern __printf(3, 4) -int dev_err_probe(const struct device *dev, int err, const char *fmt, ...); +int _dev_err_probe(const struct device *dev, int err, const char *fmt, ...); +#define dev_err_probe(dev, err, fmt, ...) \ + _dev_err_probe(dev, err, dev_fmt(fmt), ##__VA_ARGS__) /* Create alias, so I can be autoloaded. */ #define MODULE_ALIAS_CHARDEV(major,minor) \ -- 2.34.1