diff options
author | Ahmad Fatoum <a.fatoum@pengutronix.de> | 2021-10-30 19:59:26 +0200 |
---|---|---|
committer | Sascha Hauer <s.hauer@pengutronix.de> | 2021-11-25 08:49:41 +0100 |
commit | 362ffd8492e4b8662ead765e8270f835ef90c778 (patch) | |
tree | 4dddcd58fc025bfe8e970c4bcf639d62d39580cd /include | |
parent | 3fad84f927d85f752afad1fe230982d6b347b9c7 (diff) | |
download | barebox-362ffd8492e4b8662ead765e8270f835ef90c778.tar.gz barebox-362ffd8492e4b8662ead765e8270f835ef90c778.tar.xz |
driver: implement dev_err_probe()
The function like it's Linux equivalent is meant to be used during
driver probe whenever an error occurs that would lead to aborting the
probe. This allows moving EPROBE_DEFER checks out of drivers and
in future could allow selectively compiling out only error probe
messages, as they are mainly interesting during bring up.
Signed-off-by: Ahmad Fatoum <a.fatoum@pengutronix.de>
Link: https://lore.barebox.org/20211030175926.2277259-1-a.fatoum@pengutronix.de
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
Diffstat (limited to 'include')
-rw-r--r-- | include/linux/printk.h | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/include/linux/printk.h b/include/linux/printk.h index 3f370adb90..2120419272 100644 --- a/include/linux/printk.h +++ b/include/linux/printk.h @@ -74,6 +74,18 @@ static inline int pr_print(int level, const char *format, ...) #define dev_vdbg(dev, format, arg...) \ __dev_printf(8, (dev) , format , ## arg) +#if LOGLEVEL >= MSG_ERR +int dev_err_probe(const struct device_d *dev, int err, const char *fmt, ...) + __attribute__ ((format(__printf__, 3, 4))); +#elif !defined(dev_err_probe) +static int dev_err_probe(const struct device_d *dev, int err, const char *fmt, ...) + __attribute__ ((format(__printf__, 3, 4))); +static inline int dev_err_probe(const struct device_d *dev, int err, const char *fmt, ...) +{ + return err; +} +#endif + #define __pr_printk(level, format, args...) \ ({ \ (level) <= LOGLEVEL ? pr_print((level), (format), ##args) : 0; \ |