summaryrefslogtreecommitdiff
path: root/include/linux/dev_printk.h
diff options
context:
space:
mode:
authorNuno Sa <nuno.sa@analog.com>2024-06-06 09:22:37 +0200
committerJonathan Cameron <Jonathan.Cameron@huawei.com>2024-06-30 12:27:16 +0100
commitdbbe7eaf0e4795bf003ac06872aaf52b6b6b1310 (patch)
treef040d6894c9fdb5f80cf79e7878ec5b3a6ce5f62 /include/linux/dev_printk.h
parentaa9e366bb0bf457c7cff3d72276f5dfa43d5a244 (diff)
downloadlwn-dbbe7eaf0e4795bf003ac06872aaf52b6b6b1310.tar.gz
lwn-dbbe7eaf0e4795bf003ac06872aaf52b6b6b1310.zip
dev_printk: add new dev_err_probe() helpers
This is similar to dev_err_probe() but for cases where an ERR_PTR() or ERR_CAST() is to be returned simplifying patterns like: dev_err_probe(dev, ret, ...); return ERR_PTR(ret) or dev_err_probe(dev, PTR_ERR(ptr), ...); return ERR_CAST(ptr) Signed-off-by: Nuno Sa <nuno.sa@analog.com> Link: https://patch.msgid.link/20240606-dev-add_dev_errp_probe-v3-1-51bb229edd79@analog.com Signed-off-by: Jonathan Cameron <Jonathan.Cameron@huawei.com>
Diffstat (limited to 'include/linux/dev_printk.h')
-rw-r--r--include/linux/dev_printk.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/include/linux/dev_printk.h b/include/linux/dev_printk.h
index ae80a303c216..ca32b5bb28eb 100644
--- a/include/linux/dev_printk.h
+++ b/include/linux/dev_printk.h
@@ -277,4 +277,12 @@ do { \
__printf(3, 4) int dev_err_probe(const struct device *dev, int err, const char *fmt, ...);
+/* Simple helper for dev_err_probe() when ERR_PTR() is to be returned. */
+#define dev_err_ptr_probe(dev, ___err, fmt, ...) \
+ ERR_PTR(dev_err_probe(dev, ___err, fmt, ##__VA_ARGS__))
+
+/* Simple helper for dev_err_probe() when ERR_CAST() is to be returned. */
+#define dev_err_cast_probe(dev, ___err_ptr, fmt, ...) \
+ ERR_PTR(dev_err_probe(dev, PTR_ERR(___err_ptr), fmt, ##__VA_ARGS__))
+
#endif /* _DEVICE_PRINTK_H_ */